Horizon Official Technical Documentation
|
|
#include <Inventory.hpp>
Public Member Functions | |
Inventory (std::shared_ptr< Horizon::Zone::Units::Player > player, uint32_t max_storage) | |
virtual | ~Inventory () |
int16_t | get_free_index () |
std::shared_ptr< Horizon::Zone::Units::Player > | player () |
inventory_addition_result_type | add_item (std::shared_ptr< Horizon::Zone::Units::Item > floor_item) |
inventory_addition_result_type | add_item (uint32_t item_id, uint16_t amount, bool is_identified=false) |
inventory_addition_result_type | add_item (std::shared_ptr< item_entry_data > item, int amount) |
std::shared_ptr< item_entry_data > | get_item (uint32_t inventory_index) |
inventory_removal_result_type | remove_item (int16_t inventory_index, int amount, item_deletion_reason_type reason=ITEM_DEL_NORMAL) |
void | drop_item (uint32_t inventory_index, uint16_t amount) |
void | initialize () |
Inventory initialization for player, called after Status is computed and notified. More... | |
bool | use_item (uint32_t inventory_index, uint32_t guid) |
bool | can_equip (uint32_t inventory_index) |
item_equip_result_type | equip_item (uint32_t inventory_index, uint16_t equip_location_mask) |
item_unequip_result_type | unequip_item (uint32_t inventory_index) |
EquipmentListType & | equipments () |
void | add_to_equipment_list (std::shared_ptr< item_entry_data > item) |
void | remove_from_equipment_list (std::shared_ptr< item_entry_data > item) |
void | notify_all () |
void | notify_without_equipments () |
void | notify_only_equipments () |
void | notify_add (std::shared_ptr< item_entry_data > const &item, uint16_t amount, inventory_addition_result_type fail) |
void | notify_deletion (uint16_t idx, uint16_t amount, inventory_deletion_reason_type reason) |
void | notify_drop (uint16_t idx, uint16_t amount) |
void | notify_move_fail (uint16_t idx, bool silent) |
int32_t | save () |
int32_t | load () |
void | set_max_storage (uint32_t max_storage) |
uint32_t | max_storage () |
void | print_inventory () |
Protected Member Functions | |
uint32_t | calculate_current_equip_location_mask (std::shared_ptr< const item_config_data > item) |
Private Types | |
typedef std::vector< std::shared_ptr< item_entry_data > > | storage_type |
Private Attributes | |
int32_t | _max_storage |
std::weak_ptr< Horizon::Zone::Units::Player > | _player |
EquipmentListType | _equipments |
storage_type | _inventory_items |
storage_type | _saved_inventory_items |
|
private |
Inventory::Inventory | ( | std::shared_ptr< Horizon::Zone::Units::Player > | player, |
uint32_t | max_storage | ||
) |
References _equipments, IT_EQPI_ACC_L, IT_EQPI_ACC_R, IT_EQPI_AMMO, IT_EQPI_ARMOR, IT_EQPI_COSTUME_GARMENT, IT_EQPI_COSTUME_LOW, IT_EQPI_COSTUME_MID, IT_EQPI_COSTUME_TOP, IT_EQPI_GARMENT, IT_EQPI_HAND_L, IT_EQPI_HAND_R, IT_EQPI_HEAD_LOW, IT_EQPI_HEAD_MID, IT_EQPI_HEAD_TOP, IT_EQPI_SHADOW_ACC_L, IT_EQPI_SHADOW_ACC_R, IT_EQPI_SHADOW_ARMOR, IT_EQPI_SHADOW_SHIELD, IT_EQPI_SHADOW_SHOES, IT_EQPI_SHADOW_WEAPON, IT_EQPI_SHOES, IT_EQPM_ACC_L, IT_EQPM_ACC_R, IT_EQPM_AMMO, IT_EQPM_ARMOR, IT_EQPM_COSTUME_GARMENT, IT_EQPM_COSTUME_HEAD_LOW, IT_EQPM_COSTUME_HEAD_MID, IT_EQPM_COSTUME_HEAD_TOP, IT_EQPM_GARMENT, IT_EQPM_HAND_L, IT_EQPM_HAND_R, IT_EQPM_HEAD_LOW, IT_EQPM_HEAD_MID, IT_EQPM_HEAD_TOP, IT_EQPM_SHADOW_ACC_L, IT_EQPM_SHADOW_ACC_R, IT_EQPM_SHADOW_ARMOR, IT_EQPM_SHADOW_SHIELD, IT_EQPM_SHADOW_SHOES, IT_EQPM_SHADOW_WEAPON, and IT_EQPM_SHOES.
|
virtual |
inventory_addition_result_type Inventory::add_item | ( | std::shared_ptr< Horizon::Zone::Units::Item > | floor_item | ) |
References add_item().
Referenced by add_item(), and Horizon::Zone::PlayerComponent::sync_data_types().
inventory_addition_result_type Inventory::add_item | ( | std::shared_ptr< item_entry_data > | item, |
int | amount | ||
) |
References _inventory_items, add_item(), get_free_index(), Horizon::Zone::Assets::INVENTORY_ADD_INVALID, Horizon::Zone::Assets::INVENTORY_ADD_NO_INV_SPACE, Horizon::Zone::Assets::INVENTORY_ADD_OVER_QUANTITY, Horizon::Zone::Assets::INVENTORY_ADD_OVER_STACK_LIMIT, Horizon::Zone::Assets::INVENTORY_ADD_OVER_WEIGHT, Horizon::Zone::Assets::INVENTORY_ADD_SUCCESS, ITEM_STORE_INVENTORY, MAX_INVENTORY_STACK_LIMIT, max_storage(), notify_add(), and player().
inventory_addition_result_type Inventory::add_item | ( | uint32_t | item_id, |
uint16_t | amount, | ||
bool | is_identified = false |
||
) |
References item_entry_data::actual_equip_location_mask, add_item(), item_entry_data::bind_type, item_entry_data::config, item_entry_data::info, Horizon::Zone::Assets::INVENTORY_ADD_INVALID, item_entry_data::item_entry_info::is_favorite, item_entry_data::item_entry_info::is_identified, IT_BIND_NONE, item_entry_data::item_id, ItemDB, JobDB, player(), and item_entry_data::type.
void Inventory::add_to_equipment_list | ( | std::shared_ptr< item_entry_data > | item | ) |
References equipments(), IT_EQPI_MAX, IT_UNEQUIP_FAIL, and unequip_item().
Referenced by equip_item().
|
protected |
References equipments(), IT_EQPI_ACC_L, IT_EQPI_HAND_L, IT_EQPI_SHADOW_ACC_L, IT_EQPI_SHADOW_WEAPON, IT_EQPM_ACC, IT_EQPM_ACC_L, IT_EQPM_ACC_R, IT_EQPM_ARMS, IT_EQPM_HAND_L, IT_EQPM_HAND_R, IT_EQPM_SHADOW_ACC, IT_EQPM_SHADOW_ACC_L, IT_EQPM_SHADOW_ACC_R, IT_EQPM_SHADOW_ARMS, IT_EQPM_SHADOW_SHIELD, IT_EQPM_SHADOW_WEAPON, IT_EQPM_WEAPON, IT_TYPE_WEAPON, IT_WT_1HAXE, IT_WT_1HSWORD, IT_WT_DAGGER, JMASK_ASSASSIN, JMASK_KAGEROUOBORO, JobDB, and player().
Referenced by equip_item().
bool Horizon::Zone::Assets::Inventory::can_equip | ( | uint32_t | inventory_index | ) |
void Inventory::drop_item | ( | uint32_t | inventory_index, |
uint16_t | amount | ||
) |
References get_item(), notify_drop(), and player().
item_equip_result_type Inventory::equip_item | ( | uint32_t | inventory_index, |
uint16_t | equip_location_mask | ||
) |
References _inventory_items, add_to_equipment_list(), calculate_current_equip_location_mask(), HLog, IT_BIND_CHARACTER, IT_BIND_NONE, IT_EQUIP_FAIL, IT_EQUIP_SUCCESS, IT_TYPE_AMMO, player(), and print_inventory().
|
inline |
References _equipments.
Referenced by add_to_equipment_list(), calculate_current_equip_location_mask(), notify_only_equipments(), print_inventory(), and remove_from_equipment_list().
int16_t Inventory::get_free_index | ( | ) |
References _inventory_items.
Referenced by add_item().
std::shared_ptr< item_entry_data > Inventory::get_item | ( | uint32_t | inventory_index | ) |
References _inventory_items.
Referenced by drop_item(), and remove_item().
void Inventory::initialize | ( | ) |
Inventory initialization for player, called after Status is computed and notified.
References _inventory_items, and player().
int32_t Inventory::load | ( | ) |
References _character_id, _inventory_items, _saved_inventory_items, item_entry_data::actual_equip_location_mask, item_entry_data::amount, item_entry_data::bind_type, item_entry_data::config, item_entry_data::current_equip_location_mask, item_entry_data::ele_type, item_entry_data::hire_expire_date, HLog, item_entry_data::index, item_entry_data::info, item_entry_data::inventory, item_entry_data::item_entry_info::is_broken, item_entry_data::item_entry_info::is_favorite, item_entry_data::item_entry_info::is_identified, item_entry_data::item_id, ITEM_STORE_INVENTORY, ItemDB, item_entry_data::option_count, item_entry_data::option_data, player(), item_entry_data::refine_level, item_entry_data::options::set_index(), item_entry_data::options::set_value(), item_entry_data::slot_item_id, item_entry_data::sprite_id, item_entry_data::storage_type, sZone, item_entry_data::type, and item_entry_data::unique_id.
|
inline |
References _max_storage.
Referenced by add_item(), and set_max_storage().
void Inventory::notify_add | ( | std::shared_ptr< item_entry_data > const & | item, |
uint16_t | amount, | ||
inventory_addition_result_type | fail | ||
) |
References Horizon::Zone::Assets::INVENTORY_ADD_INVALID, Horizon::Zone::Assets::INVENTORY_ADD_NO_INV_SPACE, Horizon::Zone::Assets::INVENTORY_ADD_OVER_QUANTITY, Horizon::Zone::Assets::INVENTORY_ADD_OVER_STACK_LIMIT, Horizon::Zone::Assets::INVENTORY_ADD_OVER_WEIGHT, Horizon::Zone::Assets::INVENTORY_ADD_SUCCESS, ITEM_INV_ADD_INVALID, ITEM_INV_ADD_NO_INV_SPACE, ITEM_INV_ADD_OVER_QUANTITY, ITEM_INV_ADD_OVER_STACK_LIMIT, ITEM_INV_ADD_OVER_WEIGHT, ITEM_INV_ADD_SUCCESS, and player().
Referenced by add_item().
void Inventory::notify_all | ( | ) |
References INVTYPE_INVENTORY, notify_only_equipments(), notify_without_equipments(), and player().
void Inventory::notify_deletion | ( | uint16_t | idx, |
uint16_t | amount, | ||
inventory_deletion_reason_type | reason | ||
) |
void Inventory::notify_drop | ( | uint16_t | idx, |
uint16_t | amount | ||
) |
References player().
Referenced by drop_item().
void Inventory::notify_move_fail | ( | uint16_t | idx, |
bool | silent | ||
) |
void Inventory::notify_only_equipments | ( | ) |
References _inventory_items, equipments(), and player().
Referenced by notify_all().
void Inventory::notify_without_equipments | ( | ) |
References _inventory_items, and player().
Referenced by notify_all().
|
inline |
References _player.
Referenced by add_item(), calculate_current_equip_location_mask(), drop_item(), equip_item(), initialize(), load(), notify_add(), notify_all(), notify_drop(), notify_only_equipments(), notify_without_equipments(), remove_item(), save(), unequip_item(), and use_item().
void Inventory::print_inventory | ( | ) |
References _inventory_items, equipments(), HLog, and IT_EQPI_MAX.
Referenced by equip_item(), and unequip_item().
void Inventory::remove_from_equipment_list | ( | std::shared_ptr< item_entry_data > | item | ) |
References equipments(), and IT_EQPI_MAX.
Referenced by unequip_item().
inventory_removal_result_type Inventory::remove_item | ( | int16_t | inventory_index, |
int | amount, | ||
item_deletion_reason_type | reason = ITEM_DEL_NORMAL |
||
) |
References _inventory_items, get_item(), Horizon::Zone::Assets::INVENTORY_REMOVE_INVALID, Horizon::Zone::Assets::INVENTORY_REMOVE_SUCCESS, MAX_INVENTORY_STACK_LIMIT, and player().
int32_t Inventory::save | ( | ) |
References _character_id, _inventory_items, _saved_inventory_items, GridTypeListIterator::count(), HLog, player(), and sZone.
|
inline |
item_unequip_result_type Inventory::unequip_item | ( | uint32_t | inventory_index | ) |
References _inventory_items, IT_UNEQUIP_FAIL, IT_UNEQUIP_SUCCESS, player(), print_inventory(), and remove_from_equipment_list().
Referenced by add_to_equipment_list().
bool Inventory::use_item | ( | uint32_t | inventory_index, |
uint32_t | guid | ||
) |
References _inventory_items, and player().
|
private |
Referenced by equipments(), and Inventory().
|
private |
|
private |
Referenced by max_storage(), and set_max_storage().
|
private |
Referenced by player().
|
private |