Jeck - Consolidated card price functions from deckviewer/shop into PriceList. Also moved price discount hash variable. (As of around r1825, price discount has been based on (mtgid + static int randomKey) % 20. randomKey updates at the end of any won game, making prices for a given fixed between visits to the shop on the same "day")
This commit is contained in:
@@ -80,14 +80,9 @@ class GameStateShop: public GameState, public JGuiListener
|
||||
void purchaseBooster(int controlId);
|
||||
int purchasePrice(int offset);
|
||||
string descPurchase(int controlId, bool tiny = false);
|
||||
|
||||
|
||||
static int randomKey;
|
||||
public:
|
||||
GameStateShop(GameApp* parent);
|
||||
virtual ~GameStateShop();
|
||||
|
||||
static void passOneDay() {randomKey = rand();};
|
||||
virtual void Start();
|
||||
virtual void End();
|
||||
virtual void Create();
|
||||
|
||||
@@ -114,6 +114,10 @@ class Constants
|
||||
RARITY_L = 'L', //Lands
|
||||
RARITY_T = 'T', //Tokens
|
||||
|
||||
//Price flux
|
||||
PRICE_FLUX_RANGE = 20,
|
||||
PRICE_FLUX_MINUS = 10,
|
||||
|
||||
//Price for singles
|
||||
PRICE_1M = 3000,
|
||||
PRICE_1R = 500,
|
||||
|
||||
@@ -13,12 +13,16 @@ class PriceList{
|
||||
MTGAllCards * collection;
|
||||
string filename;
|
||||
map<int,int> prices;
|
||||
static int randomKey;
|
||||
public:
|
||||
PriceList(const char * file, MTGAllCards * _collection);
|
||||
~PriceList();
|
||||
int save();
|
||||
int getSellPrice(int cardid);
|
||||
int getPurchasePrice(int cardid);
|
||||
int getPrice(int cardId);
|
||||
int setPrice(int cardId, int price);
|
||||
static void updateKey() {randomKey = rand();};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user