|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
Abstract base for one row of the item market – the row-type hierarchy root. More...
#include <itemmarketentry.h>
Public Types | |
| enum | { CompatNo = 0 , CompatYes , CompatEither } |
| Three-state compatibility for the mode filters. More... | |
| enum | { HashKeyName , HashKeyInStockCount , HashKeyCanSell , HashKeyItemWorth , HashKeyWhichType } |
| Cache keys for the memoised mode-stable values. More... | |
Public Member Functions | |
| ItemMarketEntry (int compatMoneyCurrency=CompatEither, int compatBuyMode=CompatEither) | |
| virtual | ~ItemMarketEntry () |
| virtual void | initOnce () |
| One-time setup for the first instance of a type. | |
| void | finishConstruction () |
| Finalise construction (register the instance). | |
| QString | name () |
| Cached display name. | |
| virtual QString | _name ()=0 |
| Subtype: compute the display name. | |
| int | inStockCount () |
| Cached owned/sellable count. | |
| virtual int | _inStockCount ()=0 |
| Subtype: compute the owned/sellable count. | |
| bool | canSell () |
| Cached sellable flag. | |
| virtual bool | _canSell ()=0 |
| Subtype: compute sellability. | |
| int | itemWorth () |
| Cached unit value. | |
| virtual int | _itemWorth ()=0 |
| Subtype: compute the unit value. | |
| QString | whichType () |
| Cached type label. | |
| virtual QString | _whichType ()=0 |
| Subtype: report the type label. | |
| virtual QString | infoText () |
| Detailed-tooltip body (default none). | |
| virtual int | stackCount ()=0 |
| Subtype: new stack slots needed (see note above). | |
| virtual int | onCartLeft ()=0 |
| Subtype: how many more may be added. | |
| bool | requestFilter () |
| Helper: does this row pass the current mode filter? | |
| int | getCartCount () |
Current cart quantity (backs onCart). | |
| int | cartWorth () |
| Value of the cart quantity. | |
| int | totalStackCount () |
| Stacks across all rows of this type. | |
| int | totalWorth () |
| Signed worth across ALL rows (sell +, buy -). | |
| int | moneyLeftover () |
| Money remaining if this checks out. | |
| virtual bool | canCheckout () |
| Can this row alone check out? | |
| bool | canAnyCheckout () |
| Can any row check out? | |
| virtual void | checkout ()=0 |
| Subtype: apply this row's transaction. | |
| void | setCartCount (int val) |
Set the cart quantity (backs onCart). | |
| void | reUpdateConstants () |
| Clear the cached mode-stable values. | |
Public Attributes | |
| int | compatMoneyCurrency = CompatEither |
| Money/coins compatibility. | |
| int | compatBuyMode = CompatEither |
| Buy/sell compatibility. | |
| int | onCart = 0 |
| Backing cart quantity. | |
| bool | exclude = false |
| Exclude from aggregate totals (see note). | |
| int | viewTag = -1 |
| Left-list view filter tag. | |
| int | cartSignVal = 1 |
| Net contribution sign (-1 buy / +1 sell). | |
| QHash< int, QVariant > | cache |
| Memoised mode-stable values (see HashKey* enum). | |
Static Public Attributes | |
| static bool * | isMoneyCurrency = nullptr |
| Shared: current currency mode. | |
| static bool * | isBuyMode = nullptr |
| Shared: current buy/sell mode. | |
| static PlayerBasics * | player = nullptr |
| Shared: player money/coins. | |
| static QHash< QString, QVector< ItemMarketEntry * > * > | instances |
| All rows, grouped by type. | |
| static QVector< ItemMarketEntry * > | instancesCombined |
| All rows, flat. | |
| static QVector< ItemMarketEntry * > * | activeList = nullptr |
| Current model's live rows. | |
Protected Member Functions | |
| void | doReUpdateConstants () |
| Force a refresh of the "mode-stable" values. | |
Protected Attributes | |
| : void onCartChanged() | |
| < Quantity on the cart. | |
Abstract base for one row of the item market – the row-type hierarchy root.
Each market row is an ItemMarketEntry subtype: a player item, a store item, money/coins, a message, or a Game Corner Pokemon. This base defines the shared cart mechanics (onCart, worth, stack/space limits, checkout gating) and a virtual table of _name(), _inStockCount(), _canSell(), _itemWorth(), _whichType(), stackCount(), onCartLeft(), checkout() that subtypes implement. The compatMoneyCurrency / compatBuyMode flags filter which rows appear in which of the model's four modes.
Definition at line 41 of file itemmarketentry.h.
| anonymous enum |
Cache keys for the memoised mode-stable values.
| Enumerator | |
|---|---|
| HashKeyName | |
| HashKeyInStockCount | |
| HashKeyCanSell | |
| HashKeyItemWorth | |
| HashKeyWhichType | |
Definition at line 80 of file itemmarketentry.h.
| anonymous enum |
Three-state compatibility for the mode filters.
| Enumerator | |
|---|---|
| CompatNo | |
| CompatYes | |
| CompatEither | |
Definition at line 72 of file itemmarketentry.h.
| ItemMarketEntry::ItemMarketEntry | ( | int | compatMoneyCurrency = CompatEither, |
| int | compatBuyMode = CompatEither ) |
| compatMoneyCurrency | / |
| compatBuyMode | which modes this row shows in. |
Definition at line 28 of file itemmarketentry.cpp.
References compatBuyMode, and compatMoneyCurrency.
Referenced by ItemMarketEntryGCPokemon::ItemMarketEntryGCPokemon(), ItemMarketEntryMoney::ItemMarketEntryMoney(), ItemMarketEntryPlayerItem::ItemMarketEntryPlayerItem(), and ItemMarketEntryStoreItem::ItemMarketEntryStoreItem().
|
virtual |
Definition at line 35 of file itemmarketentry.cpp.
References instances, instancesCombined, and whichType().
|
pure virtual |
Subtype: compute sellability.
Implemented in ItemMarketEntryGCPokemon, ItemMarketEntryMessage, ItemMarketEntryMoney, ItemMarketEntryPlayerItem, and ItemMarketEntryStoreItem.
Referenced by canSell(), and reUpdateConstants().
|
pure virtual |
Subtype: compute the owned/sellable count.
Implemented in ItemMarketEntryGCPokemon, ItemMarketEntryMessage, ItemMarketEntryMoney, ItemMarketEntryPlayerItem, and ItemMarketEntryStoreItem.
Referenced by inStockCount(), and reUpdateConstants().
|
pure virtual |
Subtype: compute the unit value.
Implemented in ItemMarketEntryGCPokemon, ItemMarketEntryMessage, ItemMarketEntryMoney, ItemMarketEntryPlayerItem, and ItemMarketEntryStoreItem.
Referenced by itemWorth(), and reUpdateConstants().
|
pure virtual |
Subtype: compute the display name.
Implemented in ItemMarketEntryGCPokemon, ItemMarketEntryMessage, ItemMarketEntryMoney, ItemMarketEntryPlayerItem, and ItemMarketEntryStoreItem.
Referenced by name(), and reUpdateConstants().
|
pure virtual |
Subtype: report the type label.
Implemented in ItemMarketEntryGCPokemon, ItemMarketEntryMessage, ItemMarketEntryMoney, ItemMarketEntryPlayerItem, and ItemMarketEntryStoreItem.
Referenced by reUpdateConstants(), and whichType().
| bool ItemMarketEntry::canAnyCheckout | ( | ) |
|
virtual |
Can this row alone check out?
Reimplemented in ItemMarketEntryMoney.
Definition at line 208 of file itemmarketentry.cpp.
References moneyLeftover(), onCart, onCartLeft(), and requestFilter().
Referenced by ItemMarketEntryGCPokemon::checkout(), ItemMarketEntryPlayerItem::checkout(), and ItemMarketEntryStoreItem::checkout().
| bool ItemMarketEntry::canSell | ( | ) |
Cached sellable flag.
Definition at line 87 of file itemmarketentry.cpp.
References _canSell(), cache, and HashKeyCanSell.
| int ItemMarketEntry::cartWorth | ( | ) |
Value of the cart quantity.
Definition at line 154 of file itemmarketentry.cpp.
References itemWorth(), onCart, and requestFilter().
Referenced by ItemMarketEntryPlayerItem::checkout(), and ItemMarketEntryStoreItem::checkout().
|
pure virtual |
Subtype: apply this row's transaction.
Implemented in ItemMarketEntryGCPokemon, ItemMarketEntryMessage, ItemMarketEntryMoney, ItemMarketEntryPlayerItem, and ItemMarketEntryStoreItem.
|
protected |
Force a refresh of the "mode-stable" values.
Referenced by reUpdateConstants().
| void ItemMarketEntry::finishConstruction | ( | ) |
Finalise construction (register the instance).
Definition at line 58 of file itemmarketentry.cpp.
References initOnce(), instances, instancesCombined, and whichType().
Referenced by ItemMarketEntryGCPokemon::ItemMarketEntryGCPokemon(), ItemMarketEntryMessage::ItemMarketEntryMessage(), ItemMarketEntryMoney::ItemMarketEntryMoney(), ItemMarketEntryPlayerItem::ItemMarketEntryPlayerItem(), and ItemMarketEntryStoreItem::ItemMarketEntryStoreItem().
| int ItemMarketEntry::getCartCount | ( | ) |
Current cart quantity (backs onCart).
Definition at line 149 of file itemmarketentry.cpp.
References onCart.
|
inlinevirtual |
Detailed-tooltip body (default none).
Reimplemented in ItemMarketEntryPlayerItem, and ItemMarketEntryStoreItem.
Definition at line 125 of file itemmarketentry.h.
|
virtual |
One-time setup for the first instance of a type.
Definition at line 53 of file itemmarketentry.cpp.
Referenced by finishConstruction().
| int ItemMarketEntry::inStockCount | ( | ) |
Cached owned/sellable count.
Definition at line 79 of file itemmarketentry.cpp.
References _inStockCount(), cache, and HashKeyInStockCount.
| int ItemMarketEntry::itemWorth | ( | ) |
Cached unit value.
Definition at line 95 of file itemmarketentry.cpp.
References _itemWorth(), cache, and HashKeyItemWorth.
Referenced by cartWorth(), ItemMarketEntryGCPokemon::onCartLeft(), ItemMarketEntryPlayerItem::onCartLeft(), and ItemMarketEntryStoreItem::onCartLeft().
| int ItemMarketEntry::moneyLeftover | ( | ) |
Money remaining if this checks out.
Definition at line 202 of file itemmarketentry.cpp.
References player, and totalWorth().
Referenced by canCheckout(), ItemMarketEntryGCPokemon::onCartLeft(), ItemMarketEntryPlayerItem::onCartLeft(), and ItemMarketEntryStoreItem::onCartLeft().
| QString ItemMarketEntry::name | ( | ) |
Cached display name.
Definition at line 71 of file itemmarketentry.cpp.
References _name(), cache, and HashKeyName.
|
pure virtual |
Subtype: how many more may be added.
Implemented in ItemMarketEntryGCPokemon, ItemMarketEntryMessage, ItemMarketEntryMoney, ItemMarketEntryPlayerItem, and ItemMarketEntryStoreItem.
Referenced by canCheckout().
| bool ItemMarketEntry::requestFilter | ( | ) |
Helper: does this row pass the current mode filter?
Definition at line 124 of file itemmarketentry.cpp.
References compatBuyMode, CompatEither, compatMoneyCurrency, isBuyMode, and isMoneyCurrency.
Referenced by ItemMarketEntryPlayerItem::_canSell(), ItemMarketEntryPlayerItem::_inStockCount(), ItemMarketEntryGCPokemon::_itemWorth(), ItemMarketEntryPlayerItem::_itemWorth(), ItemMarketEntryStoreItem::_itemWorth(), ItemMarketEntryGCPokemon::_name(), ItemMarketEntryPlayerItem::_name(), ItemMarketEntryStoreItem::_name(), ItemMarketEntryStoreItem::calculateStacks(), canCheckout(), cartWorth(), ItemMarketEntryGCPokemon::checkout(), ItemMarketEntryPlayerItem::checkout(), ItemMarketEntryStoreItem::checkout(), ItemMarketEntryGCPokemon::onCartLeft(), ItemMarketEntryPlayerItem::onCartLeft(), ItemMarketEntryStoreItem::onCartLeft(), and ItemMarketEntryStoreItem::stackCount().
| void ItemMarketEntry::reUpdateConstants | ( | ) |
Clear the cached mode-stable values.
Definition at line 241 of file itemmarketentry.cpp.
References _canSell(), _inStockCount(), _itemWorth(), _name(), _whichType(), cache, doReUpdateConstants(), HashKeyCanSell, HashKeyInStockCount, HashKeyItemWorth, HashKeyName, and HashKeyWhichType.
| void ItemMarketEntry::setCartCount | ( | int | val | ) |
Set the cart quantity (backs onCart).
Definition at line 231 of file itemmarketentry.cpp.
References onCart.
|
pure virtual |
Subtype: new stack slots needed (see note above).
Implemented in ItemMarketEntryGCPokemon, ItemMarketEntryMessage, ItemMarketEntryMoney, ItemMarketEntryPlayerItem, and ItemMarketEntryStoreItem.
| int ItemMarketEntry::totalStackCount | ( | ) |
Stacks across all rows of this type.
Definition at line 162 of file itemmarketentry.cpp.
References activeList, and whichType().
Referenced by ItemMarketEntryGCPokemon::onCartLeft(), and ItemMarketEntryStoreItem::onCartLeft().
| int ItemMarketEntry::totalWorth | ( | ) |
Signed worth across ALL rows (sell +, buy -).
Definition at line 183 of file itemmarketentry.cpp.
References activeList.
Referenced by moneyLeftover().
| QString ItemMarketEntry::whichType | ( | ) |
Cached type label.
Definition at line 103 of file itemmarketentry.cpp.
References _whichType(), cache, and HashKeyWhichType.
Referenced by finishConstruction(), totalStackCount(), and ~ItemMarketEntry().
|
protected |
< Quantity on the cart.
Can this row check out? Value of this row's cart qty. New stack slots this row needs. How many more can be added. Total stacks across this type. < Display name (mode-stable). Owned/sellable count (mode-stable). Sellable (mode-stable). Unit value (mode-stable). Row type label (mode-stable). This row's cart quantity changed.
Definition at line 1 of file itemmarketentry.h.
|
static |
Current model's live rows.
Definition at line 206 of file itemmarketentry.h.
Referenced by ItemMarketModel::buildList(), canAnyCheckout(), totalStackCount(), and totalWorth().
| QHash<int, QVariant> ItemMarketEntry::cache |
Memoised mode-stable values (see HashKey* enum).
Definition at line 211 of file itemmarketentry.h.
Referenced by canSell(), inStockCount(), itemWorth(), name(), reUpdateConstants(), and whichType().
| int ItemMarketEntry::cartSignVal = 1 |
Net contribution sign (-1 buy / +1 sell).
Definition at line 187 of file itemmarketentry.h.
Referenced by ItemMarketEntryStoreItem::ItemMarketEntryStoreItem().
| int ItemMarketEntry::compatBuyMode = CompatEither |
Buy/sell compatibility.
Definition at line 166 of file itemmarketentry.h.
Referenced by ItemMarketEntry(), and requestFilter().
| int ItemMarketEntry::compatMoneyCurrency = CompatEither |
Money/coins compatibility.
Definition at line 165 of file itemmarketentry.h.
Referenced by ItemMarketEntry(), and requestFilter().
| bool ItemMarketEntry::exclude = false |
Exclude from aggregate totals (see note).
Definition at line 174 of file itemmarketentry.h.
Referenced by ItemMarketEntryMessage::ItemMarketEntryMessage(), and ItemMarketEntryMoney::ItemMarketEntryMoney().
|
static |
All rows, grouped by type.
Definition at line 196 of file itemmarketentry.h.
Referenced by finishConstruction(), and ~ItemMarketEntry().
|
static |
All rows, flat.
Definition at line 199 of file itemmarketentry.h.
Referenced by finishConstruction(), and ~ItemMarketEntry().
|
static |
Shared: current buy/sell mode.
Definition at line 192 of file itemmarketentry.h.
Referenced by ItemMarketEntryMoney::buying(), ItemMarketModel::ItemMarketModel(), and requestFilter().
|
static |
Shared: current currency mode.
Definition at line 191 of file itemmarketentry.h.
Referenced by ItemMarketEntryPlayerItem::_itemWorth(), ItemMarketEntryStoreItem::_itemWorth(), ItemMarketEntryPlayerItem::checkout(), ItemMarketEntryStoreItem::checkout(), ItemMarketModel::ItemMarketModel(), and requestFilter().
| int ItemMarketEntry::onCart = 0 |
Backing cart quantity.
Definition at line 169 of file itemmarketentry.h.
Referenced by ItemMarketEntryStoreItem::calculateStacks(), canCheckout(), ItemMarketEntryMoney::canCheckout(), cartWorth(), ItemMarketEntryGCPokemon::checkout(), ItemMarketEntryMoney::checkout(), ItemMarketEntryPlayerItem::checkout(), ItemMarketEntryStoreItem::checkout(), ItemMarketEntryMoney::coinsDelta(), ItemMarketModel::exchangeAdjust(), getCartCount(), ItemMarketEntryMoney::moneyDelta(), ItemMarketEntryMoney::onCartLeft(), ItemMarketEntryPlayerItem::onCartLeft(), setCartCount(), and ItemMarketEntryGCPokemon::stackCount().
|
static |
Shared: player money/coins.
Definition at line 193 of file itemmarketentry.h.
Referenced by ItemMarketEntryMoney::_inStockCount(), ItemMarketEntryMoney::canCheckout(), ItemMarketEntryGCPokemon::checkout(), ItemMarketEntryMoney::checkout(), ItemMarketEntryPlayerItem::checkout(), ItemMarketEntryStoreItem::checkout(), ItemMarketModel::ItemMarketModel(), moneyLeftover(), and ItemMarketEntryMoney::onCartLeft().
| int ItemMarketEntry::viewTag = -1 |
Left-list view filter tag.
Definition at line 179 of file itemmarketentry.h.