Jeck - More deck editor fixes, linked in prior coded subtype filter.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<PACK name="TSP" type="Booster" pool="unlocked set:TSP;" price="700">
|
||||
<PACK name="TSP" type="Booster" pool="all set:TSP;" price="700">
|
||||
<slot copies="1">
|
||||
<random_card>rarity:mythic;</random_card>
|
||||
<random_card>rarity:rare;</random_card>
|
||||
|
||||
@@ -132,6 +132,7 @@ public:
|
||||
void rotateCards(int direction);
|
||||
void loadIndexes();
|
||||
void updateFilters();
|
||||
void rebuildFilters();
|
||||
void switchDisplay();
|
||||
void Start();
|
||||
virtual void End();
|
||||
|
||||
@@ -19,6 +19,7 @@ public:
|
||||
TYPE_LAND = 5,
|
||||
TYPE_ARTIFACT = 6,
|
||||
TYPE_LEGENDARY = 7,
|
||||
LAST_TYPE = TYPE_LEGENDARY,
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -462,6 +462,7 @@ public:
|
||||
FILTER_COLOR,
|
||||
FILTER_PRODUCE,
|
||||
FILTER_TYPE,
|
||||
FILTER_SUBTYPE,
|
||||
FILTER_BASIC,
|
||||
FILTER_CMC,
|
||||
FILTER_POWER,
|
||||
|
||||
@@ -67,6 +67,14 @@ void GameStateDeckViewer::rotateCards(int direction){
|
||||
displayed_deck->prev();
|
||||
loadIndexes();
|
||||
}
|
||||
void GameStateDeckViewer::rebuildFilters(){
|
||||
SAFE_DELETE(filterDeck);
|
||||
SAFE_DELETE(filterCollection);
|
||||
filterCollection = NEW WGuiFilters("Filter by...",myCollection);
|
||||
filterDeck = NEW WGuiFilters("Filter by...",myDeck);
|
||||
filterDeck->Finish(true);
|
||||
filterCollection->Finish(true);
|
||||
}
|
||||
void GameStateDeckViewer::updateFilters(){
|
||||
if(!displayed_deck) return;
|
||||
// displayed_deck->clearFilters();
|
||||
@@ -130,8 +138,6 @@ void GameStateDeckViewer::Start()
|
||||
myCollection = NEW DeckDataWrapper(playerdata->collection);
|
||||
myCollection->Sort(WSrcCards::SORT_ALPHA);
|
||||
displayed_deck = myCollection;
|
||||
filterCollection = NEW WGuiFilters("Filter by...",myCollection);
|
||||
filterCollection->Finish(true);
|
||||
//Build menu.
|
||||
menu = NEW SimpleMenu(11,this,Constants::MENU_FONT,SCREEN_WIDTH/2-150,20);
|
||||
menu->Add(22,"Filter by...");
|
||||
@@ -141,7 +147,6 @@ void GameStateDeckViewer::Start()
|
||||
menu->Add(0,"Save & Back to Main Menu");
|
||||
menu->Add(4,"Cancel");
|
||||
|
||||
|
||||
//Icons
|
||||
mIcons[Constants::MTG_COLOR_ARTIFACT] = resources.GetQuad("c_artifact");
|
||||
mIcons[Constants::MTG_COLOR_LAND] = resources.GetQuad("c_land");
|
||||
@@ -327,12 +332,10 @@ void GameStateDeckViewer::Update(float dt)
|
||||
case JGE_BTN_CTRL :
|
||||
mStage = STAGE_FILTERS;
|
||||
if (displayed_deck == myDeck) {
|
||||
if (!filterDeck)
|
||||
filterDeck = NEW WGuiFilters("Filter by...",myDeck);
|
||||
if (!filterDeck) rebuildFilters();
|
||||
filterDeck->Entering(JGE_BTN_NONE);
|
||||
} else if(displayed_deck == myCollection) {
|
||||
if (!filterCollection)
|
||||
filterCollection = NEW WGuiFilters("Filter by...",myCollection);
|
||||
if (!filterCollection) rebuildFilters();
|
||||
filterCollection->Entering(JGE_BTN_NONE);
|
||||
}
|
||||
break;
|
||||
@@ -1401,10 +1404,7 @@ int GameStateDeckViewer::loadDeck(int deckid){
|
||||
SAFE_DELETE(myDeck);
|
||||
}
|
||||
myDeck = NEW DeckDataWrapper(NEW MTGDeck(options.profileFile(deckname,"",false,false).c_str(), mParent->collection));
|
||||
if(filterDeck) SAFE_DELETE(filterDeck);
|
||||
filterDeck = NEW WGuiFilters("Filter by...",myDeck);
|
||||
filterDeck->Finish(true);
|
||||
|
||||
|
||||
// Check whether the cards in the deck are actually available in the player's collection:
|
||||
int cheatmode = options[Options::CHEATMODE].number;
|
||||
for(int i=0;i<myDeck->Size();i++){
|
||||
@@ -1470,6 +1470,7 @@ int GameStateDeckViewer::loadDeck(int deckid){
|
||||
}
|
||||
|
||||
myDeck->Sort(WSrcCards::SORT_ALPHA);
|
||||
rebuildFilters();
|
||||
loadIndexes();
|
||||
return 1;
|
||||
}
|
||||
@@ -1538,12 +1539,10 @@ void GameStateDeckViewer::ButtonPressed(int controllerId, int controlId)
|
||||
case 22:
|
||||
mStage = STAGE_FILTERS;
|
||||
if(displayed_deck == myDeck){
|
||||
if(!filterDeck)
|
||||
filterDeck = NEW WGuiFilters("Filter by...",myDeck);
|
||||
if(!filterDeck) rebuildFilters();
|
||||
filterDeck->Entering(JGE_BTN_NONE);
|
||||
}else if(displayed_deck == myCollection){
|
||||
if(!filterCollection)
|
||||
filterCollection = NEW WGuiFilters("Filter by...",myCollection);
|
||||
if(!filterCollection) rebuildFilters();
|
||||
filterCollection->Entering(JGE_BTN_NONE);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -700,16 +700,12 @@ string ShopBooster::getSort() {
|
||||
};
|
||||
string ShopBooster::getName(){
|
||||
char buffer[512];
|
||||
if(!pack){
|
||||
if(altSet == mainSet)
|
||||
altSet = NULL;
|
||||
if(altSet)
|
||||
sprintf(buffer,_("%s & %s (15 Cards)").c_str(),mainSet->id.c_str(),altSet->id.c_str());
|
||||
else if(mainSet)
|
||||
sprintf(buffer,_("%s Booster (15 Cards)").c_str(),mainSet->id.c_str());
|
||||
}else{
|
||||
return pack->getName();
|
||||
}
|
||||
if(!mainSet && pack) return pack->getName();
|
||||
if(altSet == mainSet) altSet = NULL;
|
||||
if(altSet)
|
||||
sprintf(buffer,_("%s & %s (15 Cards)").c_str(),mainSet->id.c_str(),altSet->id.c_str());
|
||||
else if(mainSet)
|
||||
sprintf(buffer,_("%s Booster (15 Cards)").c_str(),mainSet->id.c_str());
|
||||
return buffer;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,8 +40,7 @@ int MTGPackSlot::add(WSrcCards * ocean, MTGDeck *to, int carryover){
|
||||
int fails = 0;
|
||||
int amt = copies + carryover;
|
||||
WSrcCards * myPool = NULL;
|
||||
if(pool.size())
|
||||
myPool = MTGPack::getPool(pool);
|
||||
if(pool.size()) myPool = MTGPack::getPool(pool);
|
||||
if(!myPool) myPool = ocean;
|
||||
for(int i=0;i<amt;i++){
|
||||
size_t pos = rand() % entries.size();
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#include "../include/OptionItem.h"
|
||||
#include "../include/PlayerData.h"
|
||||
#include "../include/Translate.h"
|
||||
#include "../include/Subtypes.h"
|
||||
#include <algorithm>
|
||||
#include <hge/hgedistort.h>
|
||||
|
||||
@@ -1501,8 +1502,9 @@ bool WGuiFilters::isAvailable(int type){
|
||||
WGuiFilterItem * wgfi = dynamic_cast<WGuiFilterItem*>(*it);
|
||||
if(!wgfi || wgfi->mState != WGuiFilterItem::STATE_FINISHED) continue;
|
||||
switch(type){
|
||||
case WGuiFilterItem::FILTER_SUBTYPE:
|
||||
case WGuiFilterItem::FILTER_BASIC:
|
||||
return true;
|
||||
return true;
|
||||
case WGuiFilterItem::FILTER_PRODUCE:
|
||||
if(wgfi->filterType == type)
|
||||
ma++;
|
||||
@@ -1566,6 +1568,10 @@ void WGuiFilterItem::updateValue(){
|
||||
mParent->subMenu->Add(FILTER_TYPE,"Type");
|
||||
delMenu = false;
|
||||
}
|
||||
if(mParent->isAvailable(FILTER_SUBTYPE)){
|
||||
mParent->subMenu->Add(FILTER_SUBTYPE,"Subtype");
|
||||
delMenu = false;
|
||||
}
|
||||
if(mParent->isAvailable(FILTER_RARITY)){
|
||||
mParent->subMenu->Add(FILTER_RARITY,"Rarity");
|
||||
delMenu = false;
|
||||
@@ -1616,6 +1622,13 @@ void WGuiFilterItem::updateValue(){
|
||||
mParent->addArg("Land","t:Land;");
|
||||
mParent->addArg("Legendary","t:Legendary;");
|
||||
mParent->addArg("Sorcery","t:Sorcery;");
|
||||
}else if(filterType == FILTER_SUBTYPE){
|
||||
for(int i=Subtypes::LAST_TYPE+1;;i++){
|
||||
string s = Subtypes::subtypesList->find(i);
|
||||
if(s == "") break;
|
||||
char buf[1024]; sprintf(buf,"t:%s;",s.c_str());
|
||||
mParent->addArg(s,buf);
|
||||
}
|
||||
}else if(filterType == FILTER_RARITY){
|
||||
mParent->addArg("Mythic","r:m;");
|
||||
mParent->addArg("Rare","r:r;");
|
||||
|
||||
Reference in New Issue
Block a user