mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-17 03:08:26 +00:00
Inventory possessions beta testing
This commit is contained in:
+199
-32
@@ -177,7 +177,7 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id) const
|
||||
result = _GetItem(m_inv, slot_id);
|
||||
}
|
||||
else if ((slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) ||
|
||||
(slot_id >= invslot::TRIBUTE_BEGIN && slot_id <= invslot::TRIBUTE_END) || (slot_id == invslot::SLOT_POWER_SOURCE)) {
|
||||
(slot_id >= invslot::TRIBUTE_BEGIN && slot_id <= invslot::TRIBUTE_END)) {
|
||||
// Equippable slots (on body)
|
||||
result = _GetItem(m_worn, slot_id);
|
||||
}
|
||||
@@ -231,6 +231,25 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::GetItem(int16 slot_id, uint8 bagid
|
||||
// Put an item snto specified slot
|
||||
int16 EQEmu::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
|
||||
{
|
||||
if (slot_id <= EQEmu::invslot::POSSESSIONS_END && slot_id >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) == 0)
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
else if (slot_id <= EQEmu::invbag::GENERAL_BAGS_END && slot_id >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_id - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if ((slot_id - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
else if (slot_id <= EQEmu::invbag::BANK_BAGS_END && slot_id >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
auto temp_slot = (slot_id - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
|
||||
if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
// Clean up item already in slot (if exists)
|
||||
DeleteItem(slot_id);
|
||||
|
||||
@@ -260,6 +279,60 @@ bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b, SwapItemFailS
|
||||
{
|
||||
fail_state = swapInvalid;
|
||||
|
||||
if (slot_a <= EQEmu::invslot::POSSESSIONS_END && slot_a >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << slot_a) & m_lookup->PossessionsBitmask) == 0) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (slot_a <= EQEmu::invbag::GENERAL_BAGS_END && slot_a >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_a - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (slot_a <= EQEmu::invslot::BANK_END && slot_a >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if ((slot_a - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (slot_a <= EQEmu::invbag::BANK_BAGS_END && slot_a >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
auto temp_slot = (slot_a - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
|
||||
if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (slot_b <= EQEmu::invslot::POSSESSIONS_END && slot_b >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << slot_b) & m_lookup->PossessionsBitmask) == 0) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (slot_b <= EQEmu::invbag::GENERAL_BAGS_END && slot_b >= EQEmu::invbag::GENERAL_BAGS_BEGIN) {
|
||||
auto temp_slot = EQEmu::invslot::GENERAL_BEGIN + ((slot_b - EQEmu::invbag::GENERAL_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT);
|
||||
if ((((uint64)1 << temp_slot) & m_lookup->PossessionsBitmask) == 0) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (slot_b <= EQEmu::invslot::BANK_END && slot_b >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if ((slot_b - EQEmu::invslot::BANK_BEGIN) >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (slot_b <= EQEmu::invbag::BANK_BAGS_END && slot_b >= EQEmu::invbag::BANK_BAGS_BEGIN) {
|
||||
auto temp_slot = (slot_b - EQEmu::invbag::BANK_BAGS_BEGIN) / EQEmu::invbag::SLOT_COUNT;
|
||||
if (temp_slot >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Temp holding areas for a and b
|
||||
ItemInstance* inst_a = GetItem(slot_a);
|
||||
ItemInstance* inst_b = GetItem(slot_b);
|
||||
@@ -269,7 +342,7 @@ bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b, SwapItemFailS
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
if ((slot_b >= invslot::EQUIPMENT_BEGIN && slot_b <= invslot::EQUIPMENT_END) || slot_b == invslot::SLOT_POWER_SOURCE) {
|
||||
if ((slot_b >= invslot::EQUIPMENT_BEGIN && slot_b <= invslot::EQUIPMENT_END)) {
|
||||
auto item_a = inst_a->GetItem();
|
||||
if (!item_a) {
|
||||
fail_state = swapNullData;
|
||||
@@ -295,7 +368,7 @@ bool EQEmu::InventoryProfile::SwapItem(int16 slot_a, int16 slot_b, SwapItemFailS
|
||||
fail_state = swapNotAllowed;
|
||||
return false;
|
||||
}
|
||||
if ((slot_a >= invslot::EQUIPMENT_BEGIN && slot_a <= invslot::EQUIPMENT_END) || slot_a == invslot::SLOT_POWER_SOURCE) {
|
||||
if ((slot_a >= invslot::EQUIPMENT_BEGIN && slot_a <= invslot::EQUIPMENT_END)) {
|
||||
auto item_b = inst_b->GetItem();
|
||||
if (!item_b) {
|
||||
fail_state = swapNullData;
|
||||
@@ -379,11 +452,11 @@ EQEmu::ItemInstance* EQEmu::InventoryProfile::PopItem(int16 slot_id)
|
||||
if (slot_id == invslot::slotCursor) {
|
||||
p = m_cursor.pop();
|
||||
}
|
||||
else if ((slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) || (slot_id == invslot::SLOT_POWER_SOURCE)) {
|
||||
else if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||
p = m_worn[slot_id];
|
||||
m_worn.erase(slot_id);
|
||||
}
|
||||
else if ((slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END)) {
|
||||
else if (slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) {
|
||||
p = m_inv[slot_id];
|
||||
m_inv.erase(slot_id);
|
||||
}
|
||||
@@ -420,6 +493,8 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q
|
||||
if (ItemToTry->Stackable) {
|
||||
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
ItemInstance* InvItem = GetItem(i);
|
||||
|
||||
@@ -457,6 +532,8 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q
|
||||
}
|
||||
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
ItemInstance* InvItem = GetItem(i);
|
||||
|
||||
@@ -483,7 +560,7 @@ bool EQEmu::InventoryProfile::HasSpaceForItem(const ItemData *ItemToTry, int16 Q
|
||||
|
||||
uint8 BagSize = InvItem->GetItem()->BagSlots;
|
||||
|
||||
for (uint8 BagSlot = invbag::SLOT_BEGIN; BagSlot<BagSize; BagSlot++) {
|
||||
for (uint8 BagSlot = invbag::SLOT_BEGIN; BagSlot < BagSize; BagSlot++) {
|
||||
|
||||
InvItem = GetItem(BaseSlotID + BagSlot);
|
||||
|
||||
@@ -663,6 +740,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8
|
||||
{
|
||||
// Check basic inventory
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
if (!GetItem(i))
|
||||
// Found available slot in personal inventory
|
||||
return i;
|
||||
@@ -670,6 +750,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8
|
||||
|
||||
if (!for_bag) {
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* inst = GetItem(i);
|
||||
if (inst && inst->IsClassBag() && inst->GetItem()->BagSize >= min_size)
|
||||
{
|
||||
@@ -720,6 +803,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
// step 1: find room for bags (caller should really ask for slots for bags first to avoid sending them to cursor..and bag item loss)
|
||||
if (inst->IsClassBag()) {
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
if (!m_inv[free_slot])
|
||||
return free_slot;
|
||||
}
|
||||
@@ -730,6 +816,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
// step 2: find partial room for stackables
|
||||
if (inst->IsStackable()) {
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst)
|
||||
@@ -740,6 +829,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
}
|
||||
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst)
|
||||
@@ -763,6 +855,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
// step 3a: find room for container-specific items (ItemClassArrow)
|
||||
if (inst->GetItem()->ItemType == item::ItemTypeArrow) {
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst || (main_inst->GetItem()->BagType != item::BagTypeQuiver) || !main_inst->IsClassBag())
|
||||
@@ -779,6 +874,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
// step 3b: find room for container-specific items (ItemClassSmallThrowing)
|
||||
if (inst->GetItem()->ItemType == item::ItemTypeSmallThrowing) {
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst || (main_inst->GetItem()->BagType != item::BagTypeBandolier) || !main_inst->IsClassBag())
|
||||
@@ -794,6 +892,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
|
||||
// step 4: just find an empty slot
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (!main_inst)
|
||||
@@ -801,6 +902,9 @@ int16 EQEmu::InventoryProfile::FindFreeSlotForTradeItem(const ItemInstance* inst
|
||||
}
|
||||
|
||||
for (int16 free_slot = general_start; free_slot <= invslot::GENERAL_END; ++free_slot) {
|
||||
if ((((uint64)1 << free_slot) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
|
||||
const ItemInstance* main_inst = m_inv[free_slot];
|
||||
|
||||
if (main_inst && main_inst->IsClassBag()) {
|
||||
@@ -977,12 +1081,13 @@ bool EQEmu::InventoryProfile::CanItemFitInContainer(const ItemData *ItemToTry, c
|
||||
bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id)
|
||||
{
|
||||
// there are a few non-potion items that identify as ItemTypePotion..so, we still need to ubiquitously include the equipment range
|
||||
if ((uint16)slot_id <= invslot::GENERAL_END || slot_id == invslot::SLOT_POWER_SOURCE)
|
||||
{
|
||||
if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END)
|
||||
{
|
||||
else if (slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) {
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END) {
|
||||
if (inventory::Lookup(m_mob_version)->AllowClickCastFromBag)
|
||||
return true;
|
||||
}
|
||||
@@ -992,8 +1097,16 @@ bool EQEmu::InventoryProfile::SupportsClickCasting(int16 slot_id)
|
||||
|
||||
bool EQEmu::InventoryProfile::SupportsPotionBeltCasting(int16 slot_id)
|
||||
{
|
||||
if ((uint16)slot_id <= invslot::GENERAL_END || slot_id == invslot::SLOT_POWER_SOURCE || (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END))
|
||||
// does this have the same criteria as 'SupportsClickCasting' above? (bag clicking per client)
|
||||
if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END) {
|
||||
return true;
|
||||
}
|
||||
else if (slot_id >= invbag::GENERAL_BAGS_BEGIN && slot_id <= invbag::GENERAL_BAGS_END) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1006,7 +1119,7 @@ bool EQEmu::InventoryProfile::SupportsContainers(int16 slot_id)
|
||||
(slot_id >= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) ||
|
||||
(slot_id >= invslot::SHARED_BANK_BEGIN && slot_id <= invslot::SHARED_BANK_END) ||
|
||||
(slot_id >= invslot::TRADE_BEGIN && slot_id <= invslot::TRADE_END)
|
||||
) {
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1054,13 +1167,19 @@ uint8 EQEmu::InventoryProfile::FindBrightestLightType()
|
||||
uint8 brightest_light_type = 0;
|
||||
|
||||
for (auto iter = m_worn.begin(); iter != m_worn.end(); ++iter) {
|
||||
if ((iter->first < invslot::EQUIPMENT_BEGIN || iter->first > invslot::EQUIPMENT_END) && iter->first != invslot::SLOT_POWER_SOURCE) { continue; }
|
||||
if (iter->first == invslot::slotAmmo) { continue; }
|
||||
if ((iter->first < invslot::EQUIPMENT_BEGIN || iter->first > invslot::EQUIPMENT_END))
|
||||
continue;
|
||||
|
||||
if (iter->first == invslot::slotAmmo)
|
||||
continue;
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
if (inst == nullptr)
|
||||
continue;
|
||||
|
||||
auto item = inst->GetItem();
|
||||
if (item == nullptr) { continue; }
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
|
||||
if (lightsource::IsLevelGreater(item->Light, brightest_light_type))
|
||||
brightest_light_type = item->Light;
|
||||
@@ -1068,15 +1187,21 @@ uint8 EQEmu::InventoryProfile::FindBrightestLightType()
|
||||
|
||||
uint8 general_light_type = 0;
|
||||
for (auto iter = m_inv.begin(); iter != m_inv.end(); ++iter) {
|
||||
if (iter->first < invslot::GENERAL_BEGIN || iter->first > invslot::GENERAL_END) { continue; }
|
||||
if (iter->first < invslot::GENERAL_BEGIN || iter->first > invslot::GENERAL_END)
|
||||
continue;
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
auto item = inst->GetItem();
|
||||
if (item == nullptr) { continue; }
|
||||
if (inst == nullptr)
|
||||
continue;
|
||||
|
||||
if (!item->IsClassCommon()) { continue; }
|
||||
if (item->Light < 9 || item->Light > 13) { continue; }
|
||||
auto item = inst->GetItem();
|
||||
if (item == nullptr)
|
||||
continue;
|
||||
|
||||
if (!item->IsClassCommon())
|
||||
continue;
|
||||
if (item->Light < 9 || item->Light > 13)
|
||||
continue;
|
||||
|
||||
if (lightsource::TypeToLevel(item->Light))
|
||||
general_light_type = item->Light;
|
||||
@@ -1136,7 +1261,7 @@ int EQEmu::InventoryProfile::GetSlotByItemInstCollection(const std::map<int16, I
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
void EQEmu::InventoryProfile::dumpItemCollection(const std::map<int16, ItemInstance*> &collection)
|
||||
@@ -1174,6 +1299,15 @@ void EQEmu::InventoryProfile::dumpBagContents(ItemInstance *inst, std::map<int16
|
||||
// Internal Method: Retrieves item within an inventory bucket
|
||||
EQEmu::ItemInstance* EQEmu::InventoryProfile::_GetItem(const std::map<int16, ItemInstance*>& bucket, int16 slot_id) const
|
||||
{
|
||||
if (slot_id <= EQEmu::invslot::POSSESSIONS_END && slot_id >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) == 0)
|
||||
return nullptr;
|
||||
}
|
||||
else if (slot_id <= EQEmu::invslot::BANK_END && slot_id >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if (slot_id - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto it = bucket.find(slot_id);
|
||||
if (it != bucket.end()) {
|
||||
return it->second;
|
||||
@@ -1205,21 +1339,27 @@ int16 EQEmu::InventoryProfile::_PutItem(int16 slot_id, ItemInstance* inst)
|
||||
m_cursor.push_front(inst);
|
||||
result = slot_id;
|
||||
}
|
||||
else if ((slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) || (slot_id == invslot::SLOT_POWER_SOURCE)) {
|
||||
m_worn[slot_id] = inst;
|
||||
result = slot_id;
|
||||
else if (slot_id >= invslot::EQUIPMENT_BEGIN && slot_id <= invslot::EQUIPMENT_END) {
|
||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) != 0) {
|
||||
m_worn[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
}
|
||||
else if ((slot_id >= invslot::GENERAL_BEGIN && slot_id <= invslot::GENERAL_END)) {
|
||||
m_inv[slot_id] = inst;
|
||||
result = slot_id;
|
||||
if ((((uint64)1 << slot_id) & m_lookup->PossessionsBitmask) != 0) {
|
||||
m_inv[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
}
|
||||
else if (slot_id >= invslot::TRIBUTE_BEGIN && slot_id <= invslot::TRIBUTE_END) {
|
||||
m_worn[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
else if (slot_id >= invslot::BANK_BEGIN && slot_id <= invslot::BANK_END) {
|
||||
m_bank[slot_id] = inst;
|
||||
result = slot_id;
|
||||
if (slot_id - EQEmu::invslot::BANK_BEGIN < m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank]) {
|
||||
m_bank[slot_id] = inst;
|
||||
result = slot_id;
|
||||
}
|
||||
}
|
||||
else if (slot_id >= invslot::SHARED_BANK_BEGIN && slot_id <= invslot::SHARED_BANK_END) {
|
||||
m_shbank[slot_id] = inst;
|
||||
@@ -1254,6 +1394,15 @@ int16 EQEmu::InventoryProfile::_HasItem(std::map<int16, ItemInstance*>& bucket,
|
||||
uint32 quantity_found = 0;
|
||||
|
||||
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
|
||||
if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
}
|
||||
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
continue;
|
||||
}
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
|
||||
@@ -1347,6 +1496,15 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(std::map<int16, ItemInstance*>& buc
|
||||
uint32 quantity_found = 0;
|
||||
|
||||
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
|
||||
if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
}
|
||||
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
continue;
|
||||
}
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
|
||||
@@ -1411,6 +1569,15 @@ int16 EQEmu::InventoryProfile::_HasItemByUse(ItemInstQueue& iqueue, uint8 use, u
|
||||
int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::map<int16, ItemInstance*>& bucket, uint32 loregroup)
|
||||
{
|
||||
for (auto iter = bucket.begin(); iter != bucket.end(); ++iter) {
|
||||
if (iter->first <= EQEmu::invslot::POSSESSIONS_END && iter->first >= EQEmu::invslot::POSSESSIONS_BEGIN) {
|
||||
if ((((uint64)1 << iter->first) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
}
|
||||
else if (iter->first <= EQEmu::invslot::BANK_END && iter->first >= EQEmu::invslot::BANK_BEGIN) {
|
||||
if (iter->first - EQEmu::invslot::BANK_BEGIN >= m_lookup->InventoryTypeSize[EQEmu::invtype::typeBank])
|
||||
continue;
|
||||
}
|
||||
|
||||
auto inst = iter->second;
|
||||
if (inst == nullptr) { continue; }
|
||||
|
||||
@@ -1444,7 +1611,7 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(std::map<int16, ItemInstance*
|
||||
}
|
||||
}
|
||||
|
||||
return INVALID_INDEX;
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
// Internal Method: Checks an inventory queue type bucket for a particular item
|
||||
@@ -1487,5 +1654,5 @@ int16 EQEmu::InventoryProfile::_HasItemByLoreGroup(ItemInstQueue& iqueue, uint32
|
||||
break;
|
||||
}
|
||||
|
||||
return INVALID_INDEX;
|
||||
return EQEmu::invslot::SLOT_INVALID;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user