aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOvahlord <dreadkiller@gmx.de>2023-11-15 22:41:58 +0100
committerOvahlord <dreadkiller@gmx.de>2023-11-15 22:42:08 +0100
commit6cc08c7668f1312a66539ee01be22b2b317b5fd2 (patch)
treefc9419eca7eeb345bddd6c6d40062d5742aae397
parent015a50aacc217af7384d6229be0747200d5ca1ac (diff)
Core/Player: updated inventory slots
-rw-r--r--src/server/game/Entities/Player/Player.cpp341
-rw-r--r--src/server/game/Entities/Player/Player.h58
-rw-r--r--src/server/game/Handlers/BankHandler.cpp20
-rw-r--r--src/server/game/Miscellaneous/SharedDefines.h8
-rw-r--r--src/server/scripts/Commands/cs_list.cpp2
5 files changed, 86 insertions, 343 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 3c07703a70f..b0ec0e6dfd2 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -3665,7 +3665,7 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
{
if (target == this)
{
- for (uint8 i = EQUIPMENT_SLOT_START; i < BANK_SLOT_BAG_END; ++i)
+ for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
if (m_items[i] == nullptr)
continue;
@@ -3673,7 +3673,15 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
}
- for (uint8 i = REAGENT_SLOT_START; i < CHILD_EQUIPMENT_SLOT_END; ++i)
+ for (uint8 i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
+ {
+ if (m_items[i] == nullptr)
+ continue;
+
+ m_items[i]->BuildCreateUpdateBlockForPlayer(data, target);
+ }
+
+ for (uint8 i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i)
{
if (m_items[i] == nullptr)
continue;
@@ -3814,7 +3822,7 @@ void Player::DestroyForPlayer(Player* target) const
if (target == this)
{
- for (uint8 i = EQUIPMENT_SLOT_START; i < BANK_SLOT_BAG_END; ++i)
+ for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
if (m_items[i] == nullptr)
continue;
@@ -3822,7 +3830,15 @@ void Player::DestroyForPlayer(Player* target) const
m_items[i]->DestroyForPlayer(target);
}
- for (uint8 i = REAGENT_SLOT_START; i < CHILD_EQUIPMENT_SLOT_END; ++i)
+ for (uint8 i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i)
+ {
+ if (m_items[i] == nullptr)
+ continue;
+
+ m_items[i]->DestroyForPlayer(target);
+ }
+
+ for (uint8 i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i)
{
if (m_items[i] == nullptr)
continue;
@@ -9059,19 +9075,6 @@ uint32 Player::GetFreeInventorySlotCount(EnumFlag<ItemSearchLocation> location /
++freeSlotCount;
}
- if (location.HasFlag(ItemSearchLocation::ReagentBank))
- {
- for (uint8 i = REAGENT_BAG_SLOT_START; i < REAGENT_BAG_SLOT_END; ++i)
- if (Bag* bag = GetBagByPos(i))
- for (uint32 j = 0; j < GetBagSize(bag); ++j)
- if (!GetItemInBag(bag, j))
- ++freeSlotCount;
-
- for (uint8 i = REAGENT_SLOT_START; i < REAGENT_SLOT_END; ++i)
- if (!GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- ++freeSlotCount;
- }
-
return freeSlotCount;
}
@@ -9106,7 +9109,7 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const
{
bool countGems = skipItem && skipItem->GetTemplate()->GetGemProperties();
- ItemSearchLocation location = ItemSearchLocation::Equipment | ItemSearchLocation::Inventory | ItemSearchLocation::ReagentBank;
+ ItemSearchLocation location = ItemSearchLocation::Equipment | ItemSearchLocation::Inventory | ItemSearchLocation::KeyRing;
if (inBankAlso)
location |= ItemSearchLocation::Bank;
@@ -9205,8 +9208,7 @@ Item* Player::GetUseableItemByPos(uint8 bag, uint8 slot) const
Bag* Player::GetBagByPos(uint8 bag) const
{
if ((bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)
- || (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END)
- || (bag >= REAGENT_BAG_SLOT_START && bag < REAGENT_BAG_SLOT_END))
+ || (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END))
if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, bag))
return item->ToBag();
return nullptr;
@@ -9319,8 +9321,6 @@ bool Player::IsInventoryPos(uint8 bag, uint8 slot)
return true;
if (bag >= INVENTORY_SLOT_BAG_START && bag < INVENTORY_SLOT_BAG_END)
return true;
- if (bag == INVENTORY_SLOT_BAG_0 && (slot >= CHILD_EQUIPMENT_SLOT_START && slot < CHILD_EQUIPMENT_SLOT_END))
- return true;
return false;
}
@@ -9332,8 +9332,6 @@ bool Player::IsEquipmentPos(uint8 bag, uint8 slot)
return true;
if (bag == INVENTORY_SLOT_BAG_0 && (slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END))
return true;
- if (bag == INVENTORY_SLOT_BAG_0 && (slot >= REAGENT_BAG_SLOT_START && slot < REAGENT_BAG_SLOT_END))
- return true;
return false;
}
@@ -9345,15 +9343,6 @@ bool Player::IsBankPos(uint8 bag, uint8 slot)
return true;
if (bag >= BANK_SLOT_BAG_START && bag < BANK_SLOT_BAG_END)
return true;
- if (bag == INVENTORY_SLOT_BAG_0 && (slot >= REAGENT_SLOT_START && slot < REAGENT_SLOT_END))
- return true;
- return false;
-}
-
-bool Player::IsReagentBankPos(uint8 bag, uint8 slot)
-{
- if (bag == INVENTORY_SLOT_BAG_0 && (slot >= REAGENT_SLOT_START && slot < REAGENT_SLOT_END))
- return true;
return false;
}
@@ -9365,16 +9354,9 @@ bool Player::IsBagPos(uint16 pos)
return true;
if (bag == INVENTORY_SLOT_BAG_0 && (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END))
return true;
- if (bag == INVENTORY_SLOT_BAG_0 && (slot >= REAGENT_BAG_SLOT_START && slot < REAGENT_BAG_SLOT_END))
- return true;
return false;
}
-bool Player::IsChildEquipmentPos(uint8 bag, uint8 slot)
-{
- return bag == INVENTORY_SLOT_BAG_0 && (slot >= CHILD_EQUIPMENT_SLOT_START && slot < CHILD_EQUIPMENT_SLOT_END);
-}
-
bool Player::IsValidPos(uint8 bag, uint8 slot, bool explicit_pos) const
{
// post selected
@@ -9399,10 +9381,6 @@ bool Player::IsValidPos(uint8 bag, uint8 slot, bool explicit_pos) const
if (slot >= INVENTORY_SLOT_BAG_START && slot < INVENTORY_SLOT_BAG_END)
return true;
- // reagent bag equip slots
- if (slot >= REAGENT_BAG_SLOT_START && slot < REAGENT_BAG_SLOT_END)
- return true;
-
// backpack slots
if (slot >= INVENTORY_SLOT_ITEM_START && slot < INVENTORY_SLOT_ITEM_START + GetInventorySlotCount())
return true;
@@ -9415,10 +9393,6 @@ bool Player::IsValidPos(uint8 bag, uint8 slot, bool explicit_pos) const
if (slot >= BANK_SLOT_BAG_START && slot < BANK_SLOT_BAG_END)
return true;
- // reagent bank bag slots
- if (slot >= REAGENT_SLOT_START && slot < REAGENT_SLOT_END)
- return true;
-
return false;
}
@@ -9481,7 +9455,7 @@ void Player::SetInventorySlotCount(uint8 slots)
bool Player::HasItemCount(uint32 item, uint32 count, bool inBankAlso) const
{
- ItemSearchLocation location = ItemSearchLocation::Equipment | ItemSearchLocation::Inventory | ItemSearchLocation::ReagentBank;
+ ItemSearchLocation location = ItemSearchLocation::Equipment | ItemSearchLocation::Inventory | ItemSearchLocation::KeyRing;
if (inBankAlso)
location |= ItemSearchLocation::Bank;
@@ -9666,7 +9640,7 @@ bool Player::HasItemTotemCategory(uint32 TotemCategory) const
}
}
- for (uint8 i = CHILD_EQUIPMENT_SLOT_START; i < CHILD_EQUIPMENT_SLOT_END; ++i)
+ for (uint8 i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i)
{
item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i);
if (item && DB2Manager::IsTotemCategoryCompatibleWith(item->GetTemplate()->GetTotemCategory(), TotemCategory))
@@ -9690,12 +9664,6 @@ InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemP
{
if (pSrcItem->IsNotEmptyBag() && !IsBagPos(uint16(bag) << 8 | slot))
return EQUIP_ERR_DESTROY_NONEMPTY_BAG;
-
- if (pSrcItem->HasItemFlag(ITEM_FIELD_FLAG_CHILD) && !IsEquipmentPos(bag, slot) && !IsChildEquipmentPos(bag, slot))
- return EQUIP_ERR_WRONG_BAG_TYPE_3;
-
- if (!pSrcItem->HasItemFlag(ITEM_FIELD_FLAG_CHILD) && IsChildEquipmentPos(bag, slot))
- return EQUIP_ERR_WRONG_BAG_TYPE_3;
}
// empty specific slot - check item fit to slot
@@ -9703,12 +9671,12 @@ InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemP
{
if (bag == INVENTORY_SLOT_BAG_0)
{
- // prevent cheating
- if ((slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) || slot >= PLAYER_SLOT_END)
+ // keyring case
+ if (slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_END && !(pProto->GetBagFamily() & BAG_FAMILY_MASK_KEYS))
return EQUIP_ERR_WRONG_BAG_TYPE;
- // can't store anything else than crafting reagents in Reagent Bank
- if (IsReagentBankPos(bag, slot) && (!IsReagentBankUnlocked() || !pProto->IsCraftingReagent()))
+ // prevent cheating
+ if ((slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) || slot >= PLAYER_SLOT_END)
return EQUIP_ERR_WRONG_BAG_TYPE;
}
else
@@ -9957,24 +9925,6 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des
{
if (bag == INVENTORY_SLOT_BAG_0) // inventory
{
- res = CanStoreItem_InInventorySlots(CHILD_EQUIPMENT_SLOT_START, CHILD_EQUIPMENT_SLOT_END, dest, pProto, count, true, pItem, bag, slot);
- if (res != EQUIP_ERR_OK)
- {
- if (no_space_count)
- *no_space_count = count + no_similar_count;
- return res;
- }
-
- if (count == 0)
- {
- if (no_similar_count == 0)
- return EQUIP_ERR_OK;
-
- if (no_space_count)
- *no_space_count = count + no_similar_count;
- return EQUIP_ERR_ITEM_MAX_COUNT;
- }
-
res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, inventoryEnd, dest, pProto, count, true, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
{
@@ -10022,27 +9972,6 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des
// search free slot in bag for place to
if (bag == INVENTORY_SLOT_BAG_0) // inventory
{
- if (pItem && pItem->HasItemFlag(ITEM_FIELD_FLAG_CHILD))
- {
- res = CanStoreItem_InInventorySlots(CHILD_EQUIPMENT_SLOT_START, CHILD_EQUIPMENT_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
- if (res != EQUIP_ERR_OK)
- {
- if (no_space_count)
- *no_space_count = count + no_similar_count;
- return res;
- }
-
- if (count == 0)
- {
- if (no_similar_count == 0)
- return EQUIP_ERR_OK;
-
- if (no_space_count)
- *no_space_count = count + no_similar_count;
- return EQUIP_ERR_ITEM_MAX_COUNT;
- }
- }
-
res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, inventoryEnd, dest, pProto, count, false, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
{
@@ -10091,24 +10020,6 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des
// search stack for merge to
if (pProto->GetMaxStackSize() != 1)
{
- res = CanStoreItem_InInventorySlots(CHILD_EQUIPMENT_SLOT_START, CHILD_EQUIPMENT_SLOT_END, dest, pProto, count, true, pItem, bag, slot);
- if (res != EQUIP_ERR_OK)
- {
- if (no_space_count)
- *no_space_count = count + no_similar_count;
- return res;
- }
-
- if (count == 0)
- {
- if (no_similar_count == 0)
- return EQUIP_ERR_OK;
-
- if (no_space_count)
- *no_space_count = count + no_similar_count;
- return EQUIP_ERR_ITEM_MAX_COUNT;
- }
-
res = CanStoreItem_InInventorySlots(INVENTORY_SLOT_ITEM_START, inventoryEnd, dest, pProto, count, true, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
{
@@ -10189,27 +10100,6 @@ InventoryResult Player::CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &des
if (pItem && pItem->IsNotEmptyBag())
return EQUIP_ERR_BAG_IN_BAG;
- if (pItem && pItem->HasItemFlag(ITEM_FIELD_FLAG_CHILD))
- {
- res = CanStoreItem_InInventorySlots(CHILD_EQUIPMENT_SLOT_START, CHILD_EQUIPMENT_SLOT_END, dest, pProto, count, false, pItem, bag, slot);
- if (res != EQUIP_ERR_OK)
- {
- if (no_space_count)
- *no_space_count = count + no_similar_count;
- return res;
- }
-
- if (count == 0)
- {
- if (no_similar_count == 0)
- return EQUIP_ERR_OK;
-
- if (no_space_count)
- *no_space_count = count + no_similar_count;
- return EQUIP_ERR_ITEM_MAX_COUNT;
- }
- }
-
// search free slot
uint8 searchSlotStart = INVENTORY_SLOT_ITEM_START;
// new bags can be directly equipped
@@ -10763,23 +10653,11 @@ InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const
return EQUIP_ERR_OK;
}
-InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap, bool not_loading /*= true*/, bool reagentBankOnly /*= false*/) const
+InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap, bool not_loading /*= true*/) const
{
if (!pItem)
return swap ? EQUIP_ERR_CANT_SWAP : EQUIP_ERR_ITEM_NOT_FOUND;
- // different slots range if we're trying to store item in Reagent Bank
- if (reagentBankOnly)
- {
- ASSERT(bag == NULL_BAG && slot == NULL_SLOT); // when reagentBankOnly is true then bag & slot must be hardcoded constants, not client input
- }
-
- if ((IsReagentBankPos(bag, slot) || reagentBankOnly) && !IsReagentBankUnlocked())
- return EQUIP_ERR_REAGENT_BANK_LOCKED;
-
- uint8 slotStart = reagentBankOnly ? uint8(REAGENT_SLOT_START) : uint8(BANK_SLOT_ITEM_START);
- uint8 slotEnd = reagentBankOnly ? uint8(REAGENT_SLOT_END) : uint8(BANK_SLOT_ITEM_END);
-
uint32 count = pItem->GetCount();
TC_LOG_DEBUG("entities.player.items", "Player::CanBankItem: Player '{}' ({}), Bag: {}, Slot: {}, Item: {}, Count: {}",
@@ -10845,7 +10723,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest
{
if (bag == INVENTORY_SLOT_BAG_0)
{
- res = CanStoreItem_InInventorySlots(slotStart, slotEnd, dest, pProto, count, true, pItem, bag, slot);
+ res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
return res;
@@ -10869,7 +10747,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest
// search free slot in bag
if (bag == INVENTORY_SLOT_BAG_0)
{
- res = CanStoreItem_InInventorySlots(slotStart, slotEnd, dest, pProto, count, false, pItem, bag, slot);
+ res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
return res;
@@ -10896,34 +10774,19 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest
if (pProto->GetMaxStackSize() != 1)
{
// in slots
- res = CanStoreItem_InInventorySlots(slotStart, slotEnd, dest, pProto, count, true, pItem, bag, slot);
+ res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, true, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
return res;
if (count == 0)
return EQUIP_ERR_OK;
- // don't try to store reagents anywhere else than in Reagent Bank if we're on it
- if (!reagentBankOnly)
+ // in special bags
+ if (pProto->GetBagFamily())
{
- // in special bags
- if (pProto->GetBagFamily())
- {
- for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
- {
- res = CanStoreItem_InBag(i, dest, pProto, count, true, false, pItem, bag, slot);
- if (res != EQUIP_ERR_OK)
- continue;
-
- if (count == 0)
- return EQUIP_ERR_OK;
- }
- }
-
- // in regular bags
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
{
- res = CanStoreItem_InBag(i, dest, pProto, count, true, true, pItem, bag, slot);
+ res = CanStoreItem_InBag(i, dest, pProto, count, true, false, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
continue;
@@ -10931,10 +10794,21 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest
return EQUIP_ERR_OK;
}
}
+
+ // in regular bags
+ for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
+ {
+ res = CanStoreItem_InBag(i, dest, pProto, count, true, true, pItem, bag, slot);
+ if (res != EQUIP_ERR_OK)
+ continue;
+
+ if (count == 0)
+ return EQUIP_ERR_OK;
+ }
}
// search free space in special bags (don't try to store reagents anywhere else than in Reagent Bank if we're on it)
- if (!reagentBankOnly && pProto->GetBagFamily())
+ if (pProto->GetBagFamily())
{
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
{
@@ -10948,7 +10822,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest
}
// search free space
- res = CanStoreItem_InInventorySlots(slotStart, slotEnd, dest, pProto, count, false, pItem, bag, slot);
+ res = CanStoreItem_InInventorySlots(BANK_SLOT_ITEM_START, BANK_SLOT_ITEM_END, dest, pProto, count, false, pItem, bag, slot);
if (res != EQUIP_ERR_OK)
return res;
@@ -10956,20 +10830,17 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest
return EQUIP_ERR_OK;
// search free space in regular bags (don't try to store reagents anywhere else than in Reagent Bank if we're on it)
- if (!reagentBankOnly)
+ for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
{
- for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
- {
- res = CanStoreItem_InBag(i, dest, pProto, count, false, true, pItem, bag, slot);
- if (res != EQUIP_ERR_OK)
- continue;
+ res = CanStoreItem_InBag(i, dest, pProto, count, false, true, pItem, bag, slot);
+ if (res != EQUIP_ERR_OK)
+ continue;
- if (count == 0)
- return EQUIP_ERR_OK;
- }
+ if (count == 0)
+ return EQUIP_ERR_OK;
}
- return reagentBankOnly ? EQUIP_ERR_REAGENT_BANK_FULL : EQUIP_ERR_BANK_FULL;
+ return EQUIP_ERR_BANK_FULL;
}
InventoryResult Player::CanUseItem(Item* pItem, bool not_loading) const
@@ -11175,21 +11046,6 @@ Item* Player::StoreNewItem(ItemPosCountVec const& pos, uint32 itemId, bool updat
if (addToCollection)
GetSession()->GetCollectionMgr()->OnItemAdded(item);
- if (ItemChildEquipmentEntry const* childItemEntry = sDB2Manager.GetItemChildEquipment(itemId))
- {
- if (ItemTemplate const* childTemplate = sObjectMgr->GetItemTemplate(childItemEntry->ChildItemID))
- {
- ItemPosCountVec childDest;
- CanStoreItem_InInventorySlots(CHILD_EQUIPMENT_SLOT_START, CHILD_EQUIPMENT_SLOT_END, childDest, childTemplate, count, false, nullptr, NULL_BAG, NULL_SLOT);
- if (Item* childItem = StoreNewItem(childDest, childTemplate->GetId(), update, {}, {}, context, {}, addToCollection))
- {
- childItem->SetCreator(item->GetGUID());
- childItem->SetItemFlag(ITEM_FIELD_FLAG_CHILD);
- item->SetChildItem(childItem->GetGUID());
- }
- }
- }
-
if (item->GetTemplate()->GetInventoryType() != INVTYPE_NON_EQUIP)
UpdateAverageItemLevelTotal();
}
@@ -11535,23 +11391,6 @@ void Player::EquipChildItem(uint8 parentBag, uint8 parentSlot, Item* parentItem)
void Player::AutoUnequipChildItem(Item* parentItem)
{
- if (sDB2Manager.GetItemChildEquipment(parentItem->GetEntry()))
- {
- if (Item* childItem = GetChildItemByGuid(parentItem->GetChildItem()))
- {
- if (IsChildEquipmentPos(childItem->GetPos()))
- return;
-
- ItemPosCountVec dest;
- uint32 count = childItem->GetCount();
- InventoryResult result = CanStoreItem_InInventorySlots(CHILD_EQUIPMENT_SLOT_START, CHILD_EQUIPMENT_SLOT_END, dest, childItem->GetTemplate(), count, false, childItem, NULL_BAG, NULL_SLOT);
- if (result != EQUIP_ERR_OK)
- return;
-
- RemoveItem(childItem->GetBagSlot(), childItem->GetSlot(), true);
- StoreItem(dest, childItem, true);
- }
- }
}
void Player::QuickEquipItem(uint16 pos, Item* pItem)
@@ -12058,61 +11897,6 @@ uint32 Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, boo
}
}
- for (uint8 i = REAGENT_SLOT_START; i < REAGENT_SLOT_END; ++i)
- {
- if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- {
- if (item->GetEntry() == itemEntry && !item->IsInTrade())
- {
- if (item->GetCount() + remcount <= count)
- {
- // all keys can be unequipped
- remcount += item->GetCount();
- DestroyItem(INVENTORY_SLOT_BAG_0, i, update);
-
- if (remcount >= count)
- return remcount;
- }
- else
- {
- item->SetCount(item->GetCount() - count + remcount);
- ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
- if (IsInWorld() && update)
- item->SendUpdateToPlayer(this);
- item->SetState(ITEM_CHANGED, this);
- return count;
- }
- }
- }
- }
-
- for (uint8 i = CHILD_EQUIPMENT_SLOT_START; i < CHILD_EQUIPMENT_SLOT_END; ++i)
- {
- if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- {
- if (item->GetEntry() == itemEntry && !item->IsInTrade())
- {
- if (item->GetCount() + remcount <= count)
- {
- // all keys can be unequipped
- remcount += item->GetCount();
- DestroyItem(INVENTORY_SLOT_BAG_0, i, update);
-
- if (remcount >= count)
- return remcount;
- }
- else
- {
- item->SetCount(item->GetCount() - count + remcount);
- ItemRemovedQuestCheck(item->GetEntry(), count - remcount);
- if (IsInWorld() && update)
- item->SendUpdateToPlayer(this);
- item->SetState(ITEM_CHANGED, this);
- return count;
- }
- }
- }
- }
return remcount;
}
@@ -12190,7 +11974,7 @@ Item* Player::GetItemByEntry(uint32 entry, ItemSearchLocation where /*= ItemSear
std::vector<Item*> Player::GetItemListByEntry(uint32 entry, bool inBankAlso) const
{
- ItemSearchLocation location = ItemSearchLocation::Equipment | ItemSearchLocation::Inventory | ItemSearchLocation::ReagentBank;
+ ItemSearchLocation location = ItemSearchLocation::Equipment | ItemSearchLocation::Inventory | ItemSearchLocation::KeyRing;
if (inBankAlso)
location |= ItemSearchLocation::Bank;
@@ -12440,12 +12224,6 @@ void Player::SwapItem(uint16 src, uint16 dst)
}
}
- if (IsReagentBankPos(dst) && !IsReagentBankUnlocked())
- {
- SendEquipError(EQUIP_ERR_REAGENT_BANK_LOCKED, pSrcItem, pDstItem);
- return;
- }
-
// NOW this is or item move (swap with empty), or swap with another item (including bags in bag possitions)
// or swap empty bag with another empty or not empty bag (with items exchange)
@@ -12479,8 +12257,7 @@ void Player::SwapItem(uint16 src, uint16 dst)
RemoveItem(srcbag, srcslot, true);
BankItem(dest, pSrcItem, true);
- if (!IsReagentBankPos(dst))
- ItemRemovedQuestCheck(pSrcItem->GetEntry(), pSrcItem->GetCount());
+ ItemRemovedQuestCheck(pSrcItem->GetEntry(), pSrcItem->GetCount());
}
else if (IsEquipmentPos(dst))
{
@@ -19435,7 +19212,7 @@ void Player::SaveToDB(LoginDatabaseTransaction loginTransaction, CharacterDataba
ss.str("");
// cache equipment...
- for (uint32 i = 0; i < REAGENT_BAG_SLOT_END; ++i)
+ for (uint32 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
{
if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
{
@@ -19572,7 +19349,7 @@ void Player::SaveToDB(LoginDatabaseTransaction loginTransaction, CharacterDataba
ss.str("");
// cache equipment...
- for (uint32 i = 0; i < REAGENT_BAG_SLOT_END; ++i)
+ for (uint32 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
{
if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
{
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index fd9a61196b7..39e3562ade2 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -669,47 +669,35 @@ enum InventorySlots : uint8 // 4 slots
INVENTORY_SLOT_BAG_END = 34
};
-enum ReagentBagSlots : uint8 // 1 slot
-{
- REAGENT_BAG_SLOT_START = 34,
- REAGENT_BAG_SLOT_END = 35
-};
-
enum InventoryPackSlots : uint8 // 28 slots
{
- INVENTORY_SLOT_ITEM_START = 35,
- INVENTORY_SLOT_ITEM_END = 63
+ INVENTORY_SLOT_ITEM_START = 34,
+ INVENTORY_SLOT_ITEM_END = 62
};
enum BankItemSlots // 28 slots
{
- BANK_SLOT_ITEM_START = 63,
- BANK_SLOT_ITEM_END = 91
+ BANK_SLOT_ITEM_START = 62,
+ BANK_SLOT_ITEM_END = 90
};
enum BankBagSlots // 7 slots
{
- BANK_SLOT_BAG_START = 91,
- BANK_SLOT_BAG_END = 98
+ BANK_SLOT_BAG_START = 90,
+ BANK_SLOT_BAG_END = 97
};
enum BuyBackSlots // 12 slots
{
// stored in m_buybackitems
- BUYBACK_SLOT_START = 98,
- BUYBACK_SLOT_END = 110
+ BUYBACK_SLOT_START = 97,
+ BUYBACK_SLOT_END = 109
};
-enum ReagentSlots // 98 slots
+enum KeyRingSlots : uint8 // 32 slots
{
- REAGENT_SLOT_START = 110,
- REAGENT_SLOT_END = 208,
-};
-
-enum ChildEquipmentSlots
-{
- CHILD_EQUIPMENT_SLOT_START = 208,
- CHILD_EQUIPMENT_SLOT_END = 211,
+ KEYRING_SLOT_START = 109,
+ KEYRING_SLOT_END = 141
};
// slots past 214 are guessed (unused in client)
@@ -747,10 +735,10 @@ enum class ItemSearchLocation
Equipment = 0x01,
Inventory = 0x02,
Bank = 0x04,
- ReagentBank = 0x08,
+ KeyRing = 0x08,
Default = Equipment | Inventory,
- Everywhere = Equipment | Inventory | Bank | ReagentBank
+ Everywhere = Equipment | Inventory | Bank | KeyRing
};
DEFINE_ENUM_FLAG(ItemSearchLocation);
@@ -1285,11 +1273,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
if (callback(pItem) == ItemSearchCallbackResult::Stop)
return false;
- for (uint8 i = CHILD_EQUIPMENT_SLOT_START; i < CHILD_EQUIPMENT_SLOT_END; ++i)
- if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- if (callback(pItem) == ItemSearchCallbackResult::Stop)
- return false;
-
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
if (Bag* pBag = GetBagByPos(i))
for (uint32 j = 0; j < GetBagSize(pBag); ++j)
@@ -1313,19 +1296,14 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
return false;
}
- if (flag.HasFlag(ItemSearchLocation::ReagentBank))
+ if (flag.HasFlag(ItemSearchLocation::KeyRing))
{
- for (uint8 i = REAGENT_BAG_SLOT_START; i < REAGENT_BAG_SLOT_END; ++i)
+ for (uint8 i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i)
if (Bag* bag = GetBagByPos(i))
for (uint32 j = 0; j < GetBagSize(bag); ++j)
if (Item* pItem = GetItemInBag(bag, j))
if (callback(pItem) == ItemSearchCallbackResult::Stop)
return false;
-
- for (uint8 i = REAGENT_SLOT_START; i < REAGENT_SLOT_END; ++i)
- if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
- if (callback(pItem) == ItemSearchCallbackResult::Stop)
- return false;
}
return true;
@@ -1360,10 +1338,6 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
static bool IsBagPos(uint16 pos);
static bool IsBankPos(uint16 pos) { return IsBankPos(pos >> 8, pos & 255); }
static bool IsBankPos(uint8 bag, uint8 slot);
- static bool IsReagentBankPos(uint16 pos) { return IsReagentBankPos(pos >> 8, pos & 255); }
- static bool IsReagentBankPos(uint8 bag, uint8 slot);
- static bool IsChildEquipmentPos(uint16 pos) { return IsChildEquipmentPos(pos >> 8, pos & 255); }
- static bool IsChildEquipmentPos(uint8 bag, uint8 slot);
bool IsValidPos(uint16 pos, bool explicit_pos) const { return IsValidPos(pos >> 8, pos & 255, explicit_pos); }
bool IsValidPos(uint8 bag, uint8 slot, bool explicit_pos) const;
uint8 GetInventorySlotCount() const { return m_activePlayerData->NumBackpackSlots; }
@@ -1396,7 +1370,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
InventoryResult CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
InventoryResult CanUnequipItems(uint32 item, uint32 count) const;
InventoryResult CanUnequipItem(uint16 src, bool swap) const;
- InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap, bool not_loading = true, bool reagentBankOnly = false) const;
+ InventoryResult CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap, bool not_loading = true) const;
InventoryResult CanUseItem(Item* pItem, bool not_loading = true) const;
bool HasItemTotemCategory(uint32 TotemCategory) const;
InventoryResult CanUseItem(ItemTemplate const* pItem, bool skipRequiredLevelCheck = false) const;
diff --git a/src/server/game/Handlers/BankHandler.cpp b/src/server/game/Handlers/BankHandler.cpp
index 5e515cf623a..b403c4bbfc1 100644
--- a/src/server/game/Handlers/BankHandler.cpp
+++ b/src/server/game/Handlers/BankHandler.cpp
@@ -194,7 +194,7 @@ void WorldSession::HandleReagentBankDepositOpcode(WorldPackets::Bank::ReagentBan
for (Item* item : _player->GetCraftingReagentItemsToDeposit())
{
ItemPosCountVec dest;
- InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, item, false, true, true);
+ InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, item, false, true);
if (msg != EQUIP_ERR_OK)
{
if (msg != EQUIP_ERR_REAGENT_BANK_FULL || !anyDeposited)
@@ -234,7 +234,7 @@ void WorldSession::HandleAutoBankReagentOpcode(WorldPackets::Bank::AutoBankReage
return;
ItemPosCountVec dest;
- InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, item, false, true, true);
+ InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, item, false, true);
if (msg != EQUIP_ERR_OK)
{
_player->SendEquipError(msg, item, nullptr);
@@ -269,23 +269,9 @@ void WorldSession::HandleAutoStoreBankReagentOpcode(WorldPackets::Bank::AutoStor
if (!pItem)
return;
- if (_player->IsReagentBankPos(autoStoreBankReagent.Slot, autoStoreBankReagent.PackSlot))
{
ItemPosCountVec dest;
- InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false);
- if (msg != EQUIP_ERR_OK)
- {
- _player->SendEquipError(msg, pItem, nullptr);
- return;
- }
-
- _player->RemoveItem(autoStoreBankReagent.Slot, autoStoreBankReagent.PackSlot, true);
- _player->StoreItem(dest, pItem, true);
- }
- else
- {
- ItemPosCountVec dest;
- InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false, true, true);
+ InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false, true);
if (msg != EQUIP_ERR_OK)
{
_player->SendEquipError(msg, pItem, nullptr);
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index 71dd99198c4..ce4f2ef2abe 100644
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -384,6 +384,14 @@ enum ItemQualities
MAX_ITEM_QUALITY
};
+constexpr uint8 MIN_TALENT_GROUP = 0;
+constexpr uint8 MAX_TALENT_GROUP = 1;
+constexpr uint8 MIN_TALENT_GROUPS = 1;
+constexpr uint8 MAX_TALENT_GROUPS = 2;
+constexpr uint8 MAX_GLYPH_SLOT_INDEX = 6;
+constexpr uint8 MIN_SPECIALIZATION_LEVEL = 10;
+constexpr uint8 MAX_SPECIALIZATIONS = 4;
+
enum SpellCategory
{
SPELL_CATEGORY_FOOD = 11,
diff --git a/src/server/scripts/Commands/cs_list.cpp b/src/server/scripts/Commands/cs_list.cpp
index 1121ae323ea..c214c53214c 100644
--- a/src/server/scripts/Commands/cs_list.cpp
+++ b/src/server/scripts/Commands/cs_list.cpp
@@ -192,8 +192,6 @@ public:
itemPos = "[equipped]";
else if (Player::IsInventoryPos(itemBag, itemSlot))
itemPos = "[in inventory]";
- else if (Player::IsReagentBankPos(itemBag, itemSlot))
- itemPos = "[in reagent bank]";
else if (Player::IsBankPos(itemBag, itemSlot))
itemPos = "[in bank]";
else