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