ManaPlus
|
#include <itemshortcut.h>
Public Member Functions | |
ItemShortcut (const size_t number) | |
~ItemShortcut () | |
void | load () |
void | save () const |
int | getItem (const size_t index) const |
ItemColor | getItemColor (const size_t index) const |
void | setItemData (const size_t index, const std::string &data) |
std::string | getItemData (const size_t index) const |
int | getItemSelected () const |
void | setItem (const size_t index) |
void | setItem (const size_t index, const int item, const ItemColor color) |
void | setItemFast (const size_t index, const int item, const ItemColor color) |
void | setItems (const size_t index, const int itemId, const ItemColor color) |
void | setItemSelected (const int itemId) |
void | setItemSelected (const Item *const item) |
int | getSelectedItem () const |
bool | isItemSelected () const |
void | removeItem (const size_t index) |
void | useItem (const size_t index) const |
void | equipItem (const size_t index) const |
void | unequipItem (const size_t index) const |
void | swap (const size_t index1, const size_t index2) |
void | clear () |
size_t | getFreeIndex () const |
Static Public Member Functions | |
static int | getItemCount () |
Private Attributes | |
int | mItems [SHORTCUT_ITEMS] |
ItemColor | mItemColors [SHORTCUT_ITEMS] |
std::string | mItemData [SHORTCUT_ITEMS] |
size_t | mNumber |
int | mItemSelected |
ItemColor | mItemColorSelected |
The class which keeps track of the item shortcuts.
Definition at line 40 of file itemshortcut.h.
|
explicit |
ItemShortcut::~ItemShortcut | ( | ) |
void ItemShortcut::clear | ( | ) |
Definition at line 141 of file itemshortcut.cpp.
References ItemColor_zero, mItemColors, mItemData, mItems, and SHORTCUT_ITEMS.
Referenced by SkillDialog::update().
void ItemShortcut::equipItem | ( | const size_t | index | ) | const |
Equip a item from the shortcut.
Definition at line 181 of file itemshortcut.cpp.
References PlayerInfo::equipItem(), Equipm_true, Equipped_false, Inventory::findItem(), PlayerInfo::getInventory(), Item::getQuantity(), Item::isEquipment(), Item::isEquipped(), mItemColors, mItems, and Sfx_true.
size_t ItemShortcut::getFreeIndex | ( | ) | const |
|
inline |
Returns the shortcut item ID specified by the index.
index | Index of the shortcut item. |
Definition at line 70 of file itemshortcut.h.
References mItems.
Referenced by ItemShortcutContainer::draw(), ItemShortcutContainer::mouseDragged(), ItemShortcutContainer::mouseMoved(), ItemShortcutContainer::mousePressed(), ItemShortcutContainer::mouseReleased(), and ItemShortcutContainer::safeDraw().
|
inline |
Definition at line 73 of file itemshortcut.h.
References mItemColors.
Referenced by ItemShortcutContainer::draw(), ItemShortcutContainer::mouseDragged(), ItemShortcutContainer::mouseMoved(), ItemShortcutContainer::mousePressed(), and ItemShortcutContainer::safeDraw().
|
inlinestatic |
Returns the amount of shortcut items.
Definition at line 86 of file itemshortcut.h.
References SHORTCUT_ITEMS.
Referenced by ItemShortcutContainer::ItemShortcutContainer().
|
inline |
Definition at line 80 of file itemshortcut.h.
References mItemData.
Referenced by ItemShortcutContainer::mouseDragged(), and ItemShortcutContainer::mouseMoved().
|
inline |
Returns the item ID that is currently selected.
Definition at line 92 of file itemshortcut.h.
References mItemSelected.
|
inline |
Returns selected shortcut item ID.
Definition at line 134 of file itemshortcut.h.
References mItemSelected.
Referenced by ItemShortcutContainer::mousePressed().
|
inline |
A flag to check if the item is selected.
Definition at line 140 of file itemshortcut.h.
References mItemSelected.
Referenced by ItemShortcutContainer::mousePressed(), and ItemShortcutContainer::mouseReleased().
void ItemShortcut::load | ( | ) |
Load the configuration information.
Definition at line 61 of file itemshortcut.cpp.
References CAST_S32, CAST_U32, data, fromInt, ConfigurationObject::getValue(), mItemColors, mItemData, mItems, mNumber, serverConfig, SHORTCUT_AUTO_TAB, SHORTCUT_ITEMS, and Catch::toString().
Referenced by ItemShortcut().
|
inline |
Remove a item from the shortcut.
Definition at line 146 of file itemshortcut.h.
References mItems, and save().
Referenced by ItemShortcutContainer::mouseDragged().
void ItemShortcut::save | ( | ) | const |
Save the configuration information.
Definition at line 98 of file itemshortcut.cpp.
References CAST_S32, CAST_U32, data, ConfigurationObject::deleteKey(), mItemColors, mItemData, mItems, mNumber, serverConfig, Configuration::setValue(), SHORTCUT_AUTO_TAB, SHORTCUT_ITEMS, toInt, and Catch::toString().
Referenced by removeItem(), setItem(), setItems(), and swap().
void ItemShortcut::setItem | ( | const size_t | index | ) |
Adds the selected item ID to the items specified by the index.
index | Index of the items. |
Definition at line 236 of file itemshortcut.cpp.
References mItemColors, mItemColorSelected, mItems, mItemSelected, and save().
Referenced by ItemShortcutContainer::mousePressed(), and ItemShortcutContainer::mouseReleased().
void ItemShortcut::setItem | ( | const size_t | index, |
const int | item, | ||
const ItemColor | color | ||
) |
Definition at line 243 of file itemshortcut.cpp.
References mItemColors, mItems, and save().
|
inline |
Definition at line 76 of file itemshortcut.h.
References data, and mItemData.
Referenced by ItemShortcutContainer::mouseReleased(), and SkillDialog::update().
void ItemShortcut::setItemFast | ( | const size_t | index, |
const int | item, | ||
const ItemColor | color | ||
) |
Definition at line 252 of file itemshortcut.cpp.
References mItemColors, and mItems.
Referenced by SkillDialog::update().
|
inline |
Adds an item to the items store specified by the index.
index | Index of the item. |
itemId | ID of the item. |
Definition at line 116 of file itemshortcut.h.
References mItemColors, mItems, and save().
|
inline |
Set the item that is selected.
itemId | The ID of the item that is to be assigned. |
Definition at line 126 of file itemshortcut.h.
References mItemSelected.
Referenced by SkillDialog::action(), ItemContainer::mousePressed(), ItemShortcutContainer::mousePressed(), ItemShortcutContainer::mouseReleased(), and SpellShortcutContainer::mouseReleased().
void ItemShortcut::setItemSelected | ( | const Item *const | item | ) |
Definition at line 222 of file itemshortcut.cpp.
References Item::getColor(), Item::getId(), ItemColor_one, mItemColorSelected, and mItemSelected.
void ItemShortcut::swap | ( | const size_t | index1, |
const size_t | index2 | ||
) |
Definition at line 260 of file itemshortcut.cpp.
References CAST_U32, mItemColors, mItemData, mItems, save(), and SHORTCUT_ITEMS.
Referenced by ItemShortcutContainer::mouseReleased().
void ItemShortcut::unequipItem | ( | const size_t | index | ) | const |
UnEquip a item from the shortcut.
Definition at line 201 of file itemshortcut.cpp.
References Equipm_true, Equipped_true, Inventory::findItem(), PlayerInfo::getInventory(), Item::getQuantity(), Item::isEquipment(), Item::isEquipped(), mItemColors, mItems, Sfx_true, and PlayerInfo::unequipItem().
void ItemShortcut::useItem | ( | const size_t | index | ) | const |
Try to use the item specified by the index.
index | Index of the item shortcut. |
Definition at line 151 of file itemshortcut.cpp.
References config, Inventory::findItem(), fromBool, Configuration::getBoolValue(), PlayerInfo::getInventory(), Item::getQuantity(), mItemColors, mItemData, mItems, Sfx_true, SKILL_MIN_ID, skillDialog, SPELL_MIN_ID, spellManager, toInt, PlayerInfo::useEquipItem(), SpellManager::useItem(), and SkillDialog::useItem().
Referenced by ItemShortcutContainer::mouseReleased().
|
private |
The item colors.
Definition at line 175 of file itemshortcut.h.
Referenced by clear(), equipItem(), getItemColor(), load(), save(), setItem(), setItemFast(), setItems(), swap(), unequipItem(), and useItem().
|
private |
Definition at line 179 of file itemshortcut.h.
Referenced by setItem(), and setItemSelected().
|
private |
Definition at line 176 of file itemshortcut.h.
Referenced by clear(), getItemData(), load(), save(), setItemData(), swap(), and useItem().
|
private |
The items.
Definition at line 174 of file itemshortcut.h.
Referenced by clear(), equipItem(), getFreeIndex(), getItem(), load(), removeItem(), save(), setItem(), setItemFast(), setItems(), swap(), unequipItem(), and useItem().
|
private |
Definition at line 178 of file itemshortcut.h.
Referenced by getItemSelected(), getSelectedItem(), isItemSelected(), setItem(), and setItemSelected().
|
private |
Definition at line 177 of file itemshortcut.h.