ManaPlus
|
#include <shopitem.h>
Data Structures | |
struct | DuplicateItem |
Public Member Functions | |
ShopItem (const int inventoryIndex, const int id, const ItemTypeT type, const ItemColor color, const int quantity, const int price, const std::string ¤cy) | |
ShopItem (const int id, const ItemTypeT type, const ItemColor color, const int price, const std::string ¤cy) | |
~ShopItem () | |
void | addDuplicate (const int inventoryIndex, const int quantity) |
void | addDuplicate () |
void | update () |
int | getCurrentQuantity () const |
int | getCurrentInvIndex () const |
int | sellCurrentDuplicate (const int quantity) |
int | getPrice () const |
const std::string & | getDisplayName () const |
void | setVisible (const bool b) |
bool | isVisible () const |
void | increaseUsedQuantity (const int amount) |
int | getUsedQuantity () const |
void | setDisabled (const bool b) |
bool | getDisabled () const |
Public Member Functions inherited from Item | |
Item (const int id, const ItemTypeT type, const int quantity, const uint8_t refine, const ItemColor color, const Identified identified, const Damaged damaged, const Favorite favorite, const Equipm equipment, const Equipped equipped) | |
virtual | ~Item () |
void | setId (const int id, const ItemColor color) |
int | getId () const |
Image * | getImage () const |
void | setQuantity (const int quantity) |
void | increaseQuantity (const int amount) |
int | getQuantity () const |
void | setEquipment (const Equipm equipment) |
Equipm | isEquipment () const |
void | setEquipped (const Equipped equipped) |
Equipped | isEquipped () const |
void | setRefine (const uint8_t refine) |
uint8_t | getRefine () const |
void | setInEquipment (const bool inEquipment) |
bool | isInEquipment () const |
void | setInvIndex (const int index) |
int | getInvIndex () const |
const ItemInfo & | getInfo () const |
std::string | getName () const |
bool | isHaveTag (const int tagId) const |
ItemColor | getColor () const |
void | setColor (const ItemColor color) |
const std::string & | getDescription () const |
void | setIdentified (const Identified b) |
Identified | getIdentified () const |
void | setDamaged (const Damaged b) |
Damaged | getDamaged () const |
void | setFavorite (const Favorite b) |
Favorite | getFavorite () const |
void | setCard (const int index, const int id) |
int | getCard (const int index) const |
void | setCards (const int *const cards, const int size) |
const int * | getCards () const |
void | setOptions (const ItemOptionsList *const options) |
const ItemOptionsList * | getOptions () const |
void | setType (const ItemTypeT type) |
ItemTypeT | getType () const |
void | setTag (const int tag) |
int | getTag () const |
void | addCard (const int card) |
void | updateColor () |
Protected Member Functions | |
void | updateDisplayName (const int quantity) |
Protected Attributes | |
std::string | mDisplayName |
std::string | mCurrency |
std::stack< DuplicateItem * > | mDuplicates |
int | mPrice |
int | mUsedQuantity |
bool | mShowQuantity |
bool | mVisible |
bool | mDisabled |
Protected Attributes inherited from Item | |
Image * | mImage |
std::string | mDescription |
std::map< int, int > | mTags |
int | mCards [4] |
const ItemOptionsList * | mOptions |
uint8_t | mRefine |
int | mInvIndex |
ItemTypeT | mType |
Equipm | mEquipment |
Equipped | mEquipped |
bool | mInEquipment |
Identified | mIdentified |
Damaged | mDamaged |
Favorite | mFavorite |
Additional Inherited Members | |
Static Public Member Functions inherited from Item | |
static Image * | getImage (const int id, const ItemColor color) |
static bool | isItem (const int id) |
Data Fields inherited from Item | |
int | mId |
ItemColor | mColor |
int | mQuantity |
int | mTag |
Represents an item in a shop inventory. It can store quantity and inventory indices of duplicate entries in the shop as well.
Definition at line 37 of file shopitem.h.
ShopItem::ShopItem | ( | const int | inventoryIndex, |
const int | id, | ||
const ItemTypeT | type, | ||
const ItemColor | color, | ||
const int | quantity, | ||
const int | price, | ||
const std::string & | currency | ||
) |
Constructor. Creates a new ShopItem.
inventoryIndex | the inventory index of the item |
id | the id of the item |
quantity | number of available copies of the item |
price | price of the item |
Definition at line 38 of file shopitem.cpp.
References addDuplicate(), Item::setInvIndex(), and updateDisplayName().
ShopItem::ShopItem | ( | const int | id, |
const ItemTypeT | type, | ||
const ItemColor | color, | ||
const int | price, | ||
const std::string & | currency | ||
) |
Constructor. Creates a new ShopItem. Inventory index will be set to -1 and quantity to 0.
id | the id of the item |
price | price of the item |
Definition at line 65 of file shopitem.cpp.
References addDuplicate(), Item::setInvIndex(), and updateDisplayName().
ShopItem::~ShopItem | ( | ) |
Destructor.
Clear all remaining duplicates on Object destruction.
Definition at line 90 of file shopitem.cpp.
References mDuplicates.
void ShopItem::addDuplicate | ( | ) |
Add a duplicate. Id and price will be taken from this item. Needed for compatibility with ShopDuplicateItems (see) class documentation).
Definition at line 133 of file shopitem.cpp.
References ShopItem::DuplicateItem::inventoryIndex, mDuplicates, and ShopItem::DuplicateItem::quantity.
Referenced by ShopItem().
void ShopItem::addDuplicate | ( | const int | inventoryIndex, |
const int | quantity | ||
) |
Add a duplicate. Id and price will be taken from this item.
inventoryIndex | the inventory index of the item |
quantity | number of available copies of the item |
Definition at line 124 of file shopitem.cpp.
References ShopItem::DuplicateItem::inventoryIndex, mDuplicates, Item::mQuantity, and ShopItem::DuplicateItem::quantity.
Referenced by ShopItems::addItem2().
|
inline |
Gets the inventory index of the currently topmost duplicate.
Definition at line 108 of file shopitem.h.
References mDuplicates, and Item::mInvIndex.
Referenced by EAthena::BarterHandler::buyItems(), EAthena::NpcHandler::sellItems(), and NpcSellDialog::sellOneItem().
|
inline |
Gets the quantity of the currently topmost duplicate.
Definition at line 98 of file shopitem.h.
References mDuplicates.
|
inline |
|
inline |
Gets the display name for the item in the shop list.
Definition at line 140 of file shopitem.h.
References mDisplayName.
|
inline |
Gets the price of the item.
Definition at line 132 of file shopitem.h.
References mPrice.
Referenced by BuyDialog::action(), ShopWindow::announce(), EAthena::BuyingStoreHandler::create(), EAthena::VendingHandler::createShop(), ShopWindow::findShopItem(), ShopWindow::giveList(), ShopWindow::processRequest(), ShopWindow::saveList(), BuyingStoreSellDialog::sellAction(), NpcSellDialog::sellOneItem(), TmwAthena::BuySellHandler::sendBuyRequest(), TmwAthena::BuySellHandler::sendSellRequest(), SellDialog::updateButtonsAndLabels(), BuyDialog::updateButtonsAndLabels(), and BuyDialog::updateSlider().
|
inline |
Definition at line 151 of file shopitem.h.
References mUsedQuantity.
Referenced by EAthena::VendingHandler::buyItems(), EAthena::CashShopHandler::buyItems(), EAthena::BarterHandler::buyItems(), EAthena::MarketHandler::buyItems(), EAthena::NpcHandler::buyItems(), and EAthena::NpcHandler::sellItems().
void ShopItem::increaseUsedQuantity | ( | const int | amount | ) |
Definition at line 159 of file shopitem.cpp.
References Item::mQuantity, mShowQuantity, and mUsedQuantity.
Referenced by BuyDialog::action(), EAthena::VendingHandler::buyItems(), EAthena::CashShopHandler::buyItems(), EAthena::BarterHandler::buyItems(), EAthena::MarketHandler::buyItems(), EAthena::NpcHandler::buyItems(), EAthena::NpcHandler::sellItems(), and NpcSellDialog::sellManyItems().
|
inline |
Definition at line 146 of file shopitem.h.
References mVisible.
Referenced by ShopItems::updateList().
int ShopItem::sellCurrentDuplicate | ( | const int | quantity | ) |
Reduces the quantity of the topmost duplicate by the specified amount. Also reduces the total quantity of this DuplicateItem. Empty duplicates are automatically removed.
If the amount is bigger than the quantity of the current topmost, only sell as much as possible. Returns the amount actually sold (do not ignore the return value!)
Definition at line 141 of file shopitem.cpp.
References mDuplicates, Item::mQuantity, and ShopItem::DuplicateItem::quantity.
Referenced by NpcSellDialog::sellOneItem().
|
inline |
Definition at line 154 of file shopitem.h.
References mDisabled.
Referenced by ShopWindow::showList().
|
inline |
Definition at line 143 of file shopitem.h.
References mVisible.
Referenced by BuyDialog::applyNameFilter().
void ShopItem::update | ( | ) |
Definition at line 119 of file shopitem.cpp.
References Item::mQuantity, and updateDisplayName().
Referenced by BuyDialog::action(), EAthena::VendingHandler::buyItems(), EAthena::CashShopHandler::buyItems(), EAthena::BarterHandler::buyItems(), EAthena::MarketHandler::buyItems(), EAthena::NpcHandler::buyItems(), EAthena::NpcHandler::sellItems(), NpcSellDialog::sellManyItems(), and SellDialog::updateButtonsAndLabels().
|
protected |
Definition at line 100 of file shopitem.cpp.
References UnitsDb::formatCurrency(), Item::getInfo(), Item::getName(), Net::getNetworkType(), Item::mColor, mCurrency, mDisplayName, mPrice, mShowQuantity, mUsedQuantity, ServerType::TMWATHENA, and Catch::toString().
Referenced by ShopItem(), and update().
|
protected |
Definition at line 164 of file shopitem.h.
Referenced by updateDisplayName().
|
protected |
Definition at line 179 of file shopitem.h.
Referenced by getDisabled(), and setDisabled().
|
protected |
Definition at line 163 of file shopitem.h.
Referenced by getDisplayName(), and updateDisplayName().
|
protected |
Definition at line 174 of file shopitem.h.
Referenced by addDuplicate(), getCurrentInvIndex(), getCurrentQuantity(), sellCurrentDuplicate(), and ~ShopItem().
|
protected |
<– Stores duplicates
Definition at line 175 of file shopitem.h.
Referenced by getPrice(), and updateDisplayName().
|
protected |
Definition at line 177 of file shopitem.h.
Referenced by increaseUsedQuantity(), and updateDisplayName().
|
protected |
Definition at line 176 of file shopitem.h.
Referenced by getUsedQuantity(), increaseUsedQuantity(), and updateDisplayName().
|
protected |
Definition at line 178 of file shopitem.h.
Referenced by isVisible(), and setVisible().