|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
One inventory slot: an item index and an amount, with live pricing. More...
#include <item.h>
Public Member Functions | |
| Item (SaveFileIterator *it=nullptr) | |
| < Item index (into the items DB). | |
| Item (var8 ind, var8 amount) | |
| New Item from a given index and amount. | |
| Item (bool random) | |
| New Item either blank or random. | |
| Item (QString name, var8 amount) | |
| Given name and amount. | |
| void | makeConnect () |
| Wire up internal signal connections. | |
| virtual | ~Item () |
| void | save (SaveFileIterator *it) |
| Given an iterator, saves 2 bytes: index and amount. | |
| ItemDBEntry * | toItem () |
| Resolve ind to its DB entry. | |
| bool | canSell () |
| Whether the item may be sold. | |
| int | buyPriceOneMoney () |
| int | buyPriceOneCoins () |
| int | sellPriceOneMoney () |
| int | sellPriceOneCoins () |
| int | buyPriceAllMoney () |
| int | buyPriceAllCoins () |
| int | sellPriceAllMoney () |
| int | sellPriceAllCoins () |
| int | getAmount () |
| Current amount (backs property READ). | |
| void | setAmount (int val) |
| Set amount (backs property WRITE; clamped to the Gen 1 max). | |
| protected::void | indChanged () |
| void | amountChanged () |
| void | itemChanged () |
| void | load (int ind, int amount) |
| Set from an index + amount. | |
| void | load (bool random) |
| Set blank or random. | |
| void | load (QString name, int amount) |
| Set from an item name + amount. | |
| void | reset () |
| Blank this slot. | |
| void | randomize () |
| Randomize this slot. | |
Public Attributes | |
| int | ind |
| Item index (backs property). | |
| int | amount |
| Item amount (max 99 in Gen 1; backs property). | |
One inventory slot: an item index and an amount, with live pricing.
On disk an item is just two bytes (index + amount). On top of those, this object computes a set of QML pricing properties – buy/sell, single/all, money/coins – by resolving ind through the items DB. Lives inside an ItemStorageBox (bag or PC).
| Item::Item | ( | SaveFileIterator * | it = nullptr | ) |
< Item index (into the items DB).
Quantity (max 99 in Gen 1). < Is this item sellable? < Buy price (one) in money. Buy price (one) in coins. Sell price (one) in money. Sell price (one) in coins. < Buy price (whole stack) in money. Buy price (whole stack) in coins. Sell price (whole stack) in money. Sell price (whole stack) in coins. New Item from iterator or a blank item. If iterator provided it extracts 2 bytes for index and amount.
Definition at line 30 of file item.cpp.
References amount, SaveFileIterator::getByte(), ind, makeConnect(), and reset().
| Item::Item | ( | bool | random | ) |
New Item either blank or random.
Definition at line 48 of file item.cpp.
References load(), and makeConnect().
| Item::Item | ( | QString | name, |
| var8 | amount ) |
Given name and amount.
Definition at line 54 of file item.cpp.
References amount, load(), and makeConnect().
| void Item::amountChanged | ( | ) |
Referenced by makeConnect(), randomize(), and reset().
| int Item::buyPriceAllCoins | ( | ) |
Definition at line 159 of file item.cpp.
References amount, and buyPriceOneCoins().
| int Item::buyPriceAllMoney | ( | ) |
Definition at line 154 of file item.cpp.
References amount, and buyPriceOneMoney().
| int Item::buyPriceOneCoins | ( | ) |
Definition at line 124 of file item.cpp.
References toItem().
Referenced by buyPriceAllCoins().
| int Item::buyPriceOneMoney | ( | ) |
Definition at line 114 of file item.cpp.
References toItem().
Referenced by buyPriceAllMoney().
| bool Item::canSell | ( | ) |
| int Item::getAmount | ( | ) |
| protected::void Item::indChanged | ( | ) |
Referenced by makeConnect(), randomize(), and reset().
| void Item::itemChanged | ( | ) |
References amount, ind, load(), randomize(), and reset().
Referenced by ItemStorageBox::load(), and makeConnect().
| void Item::load | ( | bool | random | ) |
| void Item::load | ( | int | ind, |
| int | amount ) |
| void Item::load | ( | QString | name, |
| int | amount ) |
Set from an item name + amount.
Definition at line 204 of file item.cpp.
References amount, ItemsDB::getIndAt(), ind, and ItemsDB::inst().
| void Item::makeConnect | ( | ) |
Wire up internal signal connections.
Definition at line 60 of file item.cpp.
References amountChanged(), indChanged(), and itemChanged().
| void Item::randomize | ( | ) |
Randomize this slot.
Definition at line 83 of file item.cpp.
References amount, amountChanged(), ItemsDB::getStore(), ind, indChanged(), ItemsDB::inst(), Random::inst(), and Random::rangeInclusive().
Referenced by itemChanged(), and load().
| void Item::reset | ( | ) |
Blank this slot.
Definition at line 74 of file item.cpp.
References amount, amountChanged(), ind, and indChanged().
Referenced by Item(), itemChanged(), and load().
| void Item::save | ( | SaveFileIterator * | it | ) |
Given an iterator, saves 2 bytes: index and amount.
Definition at line 68 of file item.cpp.
References amount, ind, and SaveFileIterator::setByte().
| int Item::sellPriceAllCoins | ( | ) |
Definition at line 169 of file item.cpp.
References amount, and sellPriceOneCoins().
| int Item::sellPriceAllMoney | ( | ) |
Definition at line 164 of file item.cpp.
References amount, and sellPriceOneMoney().
| int Item::sellPriceOneCoins | ( | ) |
Definition at line 144 of file item.cpp.
References toItem().
Referenced by sellPriceAllCoins().
| int Item::sellPriceOneMoney | ( | ) |
Definition at line 134 of file item.cpp.
References toItem().
Referenced by sellPriceAllMoney().
| void Item::setAmount | ( | int | val | ) |
Set amount (backs property WRITE; clamped to the Gen 1 max).
Definition at line 179 of file item.cpp.
References amount.
Referenced by ItemStorageModel::dragTransfer().
| ItemDBEntry * Item::toItem | ( | ) |
Definition at line 98 of file item.cpp.
References ItemsDB::getIndAt(), ind, and ItemsDB::inst().
Referenced by buyPriceOneCoins(), buyPriceOneMoney(), canSell(), sellPriceOneCoins(), and sellPriceOneMoney().
| int Item::amount |
Item amount (max 99 in Gen 1; backs property).
Definition at line 109 of file item.h.
Referenced by buyPriceAllCoins(), buyPriceAllMoney(), ItemMarketEntryStoreItem::calculateStacks(), ItemStorageModel::dragTransfer(), getAmount(), Item(), Item(), Item(), itemChanged(), load(), load(), randomize(), reset(), save(), sellPriceAllCoins(), sellPriceAllMoney(), and setAmount().
| int Item::ind |