aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Entities/Player/Player.cpp106
-rw-r--r--src/server/game/Entities/Player/Player.h43
-rw-r--r--src/server/game/Handlers/BankHandler.cpp140
-rw-r--r--src/server/scripts/Commands/cs_list.cpp2
4 files changed, 53 insertions, 238 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index b6d803c966e..da1ee6e78fe 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -3623,7 +3623,7 @@ 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 = KEYRING_SLOT_START; i < CHILD_EQUIPMENT_SLOT_END; ++i)
{
if (m_items[i] == nullptr)
continue;
@@ -3772,7 +3772,7 @@ 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 = KEYRING_SLOT_START; i < CHILD_EQUIPMENT_SLOT_END; ++i)
{
if (m_items[i] == nullptr)
continue;
@@ -9375,10 +9375,6 @@ uint32 Player::GetFreeInventorySlotCount(EnumFlag<ItemSearchLocation> location /
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;
@@ -9654,15 +9650,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;
}
@@ -9724,8 +9711,8 @@ 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)
+ // key ring bag slots
+ if (slot >= KEYRING_SLOT_START && slot < KEYRING_SLOT_END)
return true;
return false;
@@ -10015,10 +10002,6 @@ InventoryResult Player::CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemP
// prevent cheating
if ((slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) || slot >= PLAYER_SLOT_END)
return EQUIP_ERR_WRONG_BAG_TYPE;
-
- // can't store anything else than crafting reagents in Reagent Bank
- if (IsReagentBankPos(bag, slot) && (!IsReagentBankUnlocked() || !pProto->IsCraftingReagent()))
- return EQUIP_ERR_WRONG_BAG_TYPE;
}
else
{
@@ -11072,22 +11055,13 @@ 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);
+ uint8 slotStart = uint8(BANK_SLOT_ITEM_START);
+ uint8 slotEnd = uint8(BANK_SLOT_ITEM_END);
uint32 count = pItem->GetCount();
@@ -11212,27 +11186,12 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest
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;
@@ -11240,10 +11199,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())
+ // search free space in special bags
+ if (pProto->GetBagFamily())
{
for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++)
{
@@ -11264,21 +11234,18 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest
if (count == 0)
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)
+ // search free space in regular bags
+ 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
@@ -12375,7 +12342,7 @@ uint32 Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, boo
}
}
- for (uint8 i = REAGENT_SLOT_START; i < REAGENT_SLOT_END; ++i)
+ for (uint8 i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; ++i)
{
if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
{
@@ -12757,12 +12724,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)
@@ -12796,8 +12757,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))
{
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index e5a39a319fc..afb504466eb 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -678,45 +678,45 @@ enum InventorySlots : uint8 // 4 slots
enum ReagentBagSlots : uint8 // 1 slot
{
- REAGENT_BAG_SLOT_START = 34,
- REAGENT_BAG_SLOT_END = 35
+ REAGENT_BAG_SLOT_START = 34,
+ REAGENT_BAG_SLOT_END = 35
};
-enum InventoryPackSlots : uint8 // 28 slots
+enum InventoryPackSlots : uint8 // 24 slots
{
INVENTORY_SLOT_ITEM_START = 35,
- INVENTORY_SLOT_ITEM_END = 63
+ INVENTORY_SLOT_ITEM_END = 59
};
enum BankItemSlots // 28 slots
{
- BANK_SLOT_ITEM_START = 63,
- BANK_SLOT_ITEM_END = 91
+ BANK_SLOT_ITEM_START = 59,
+ BANK_SLOT_ITEM_END = 87
};
enum BankBagSlots // 7 slots
{
- BANK_SLOT_BAG_START = 91,
- BANK_SLOT_BAG_END = 98
+ BANK_SLOT_BAG_START = 87,
+ BANK_SLOT_BAG_END = 94
};
enum BuyBackSlots // 12 slots
{
// stored in m_buybackitems
- BUYBACK_SLOT_START = 98,
- BUYBACK_SLOT_END = 110
+ BUYBACK_SLOT_START = 94,
+ BUYBACK_SLOT_END = 106
};
-enum ReagentSlots // 98 slots
+enum KeyRingSlots // 32 slots
{
- REAGENT_SLOT_START = 110,
- REAGENT_SLOT_END = 208,
+ KEYRING_SLOT_START = 106,
+ KEYRING_SLOT_END = 138,
};
enum ChildEquipmentSlots
{
- CHILD_EQUIPMENT_SLOT_START = 208,
- CHILD_EQUIPMENT_SLOT_END = 211,
+ CHILD_EQUIPMENT_SLOT_START = 138,
+ CHILD_EQUIPMENT_SLOT_END = 141,
};
// slots past 214 are guessed (unused in client)
@@ -1328,11 +1328,6 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
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;
@@ -1367,8 +1362,6 @@ class TC_GAME_API Player final : 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); }
@@ -1403,7 +1396,7 @@ class TC_GAME_API Player final : 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;
@@ -2701,10 +2694,6 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
VoidStorageItem* GetVoidStorageItem(uint8 slot) const;
VoidStorageItem* GetVoidStorageItem(uint64 id, uint8& slot) const;
- // Reagent Bank
- bool IsReagentBankUnlocked() const { return HasPlayerFlagEx(PLAYER_FLAGS_EX_REAGENT_BANK_UNLOCKED); }
- void UnlockReagentBank() { SetPlayerFlagEx(PLAYER_FLAGS_EX_REAGENT_BANK_UNLOCKED); }
-
void CreateGarrison(uint32 garrSiteId);
void DeleteGarrison();
Garrison* GetGarrison() const { return _garrison.get(); }
diff --git a/src/server/game/Handlers/BankHandler.cpp b/src/server/game/Handlers/BankHandler.cpp
index 5e515cf623a..3fa44da49e4 100644
--- a/src/server/game/Handlers/BankHandler.cpp
+++ b/src/server/game/Handlers/BankHandler.cpp
@@ -149,152 +149,20 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPackets::Bank::BuyBankSlot& pack
_player->UpdateCriteria(CriteriaType::BankSlotsPurchased);
}
-void WorldSession::HandleBuyReagentBankOpcode(WorldPackets::Bank::ReagentBank& reagentBank)
+void WorldSession::HandleBuyReagentBankOpcode(WorldPackets::Bank::ReagentBank& /*reagentBank*/)
{
- if (!CanUseBank(reagentBank.Banker))
- {
- TC_LOG_DEBUG("network", "WORLD: HandleBuyReagentBankOpcode - {} not found or you can't interact with him.", reagentBank.Banker.ToString());
- return;
- }
-
- if (_player->IsReagentBankUnlocked())
- {
- TC_LOG_DEBUG("network", "WORLD: HandleBuyReagentBankOpcode - Player ({}, name: {}) tried to unlock reagent bank a 2nd time.", _player->GetGUID().ToString(), _player->GetName());
- return;
- }
-
- constexpr int64 price = 100 * GOLD;
-
- if (!_player->HasEnoughMoney(price))
- {
- TC_LOG_DEBUG("network", "WORLD: HandleBuyReagentBankOpcode - Player ({}, name: {}) without enough gold.", _player->GetGUID().ToString(), _player->GetName());
- return;
- }
-
- _player->ModifyMoney(-price);
- _player->UnlockReagentBank();
}
-void WorldSession::HandleReagentBankDepositOpcode(WorldPackets::Bank::ReagentBank& reagentBank)
+void WorldSession::HandleReagentBankDepositOpcode(WorldPackets::Bank::ReagentBank& /*reagentBank*/)
{
- if (!CanUseBank(reagentBank.Banker))
- {
- TC_LOG_DEBUG("network", "WORLD: HandleReagentBankDepositOpcode - {} not found or you can't interact with him.", reagentBank.Banker.ToString());
- return;
- }
-
- if (!_player->IsReagentBankUnlocked())
- {
- _player->SendEquipError(EQUIP_ERR_REAGENT_BANK_LOCKED);
- return;
- }
-
- // query all reagents from player's inventory
- bool anyDeposited = false;
- for (Item* item : _player->GetCraftingReagentItemsToDeposit())
- {
- ItemPosCountVec dest;
- InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, item, false, true, true);
- if (msg != EQUIP_ERR_OK)
- {
- if (msg != EQUIP_ERR_REAGENT_BANK_FULL || !anyDeposited)
- _player->SendEquipError(msg, item, nullptr);
- break;
- }
-
- if (dest.size() == 1 && dest[0].pos == item->GetPos())
- {
- _player->SendEquipError(EQUIP_ERR_CANT_SWAP, item, nullptr);
- continue;
- }
-
- // store reagent
- _player->RemoveItem(item->GetBagSlot(), item->GetSlot(), true);
- _player->BankItem(dest, item, true);
- anyDeposited = true;
- }
}
-void WorldSession::HandleAutoBankReagentOpcode(WorldPackets::Bank::AutoBankReagent& autoBankReagent)
+void WorldSession::HandleAutoBankReagentOpcode(WorldPackets::Bank::AutoBankReagent& /*autoBankReagent*/)
{
- if (!CanUseBank())
- {
- TC_LOG_DEBUG("network", "WORLD: HandleAutoBankReagentOpcode - {} not found or you can't interact with him.", _player->PlayerTalkClass->GetInteractionData().SourceGuid.ToString());
- return;
- }
-
- if (!_player->IsReagentBankUnlocked())
- {
- _player->SendEquipError(EQUIP_ERR_REAGENT_BANK_LOCKED);
- return;
- }
-
- Item* item = _player->GetItemByPos(autoBankReagent.PackSlot, autoBankReagent.Slot);
- if (!item)
- return;
-
- ItemPosCountVec dest;
- InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, item, false, true, true);
- if (msg != EQUIP_ERR_OK)
- {
- _player->SendEquipError(msg, item, nullptr);
- return;
- }
-
- if (dest.size() == 1 && dest[0].pos == item->GetPos())
- {
- _player->SendEquipError(EQUIP_ERR_CANT_SWAP, item, nullptr);
- return;
- }
-
- _player->RemoveItem(autoBankReagent.PackSlot, autoBankReagent.Slot, true);
- _player->BankItem(dest, item, true);
}
-void WorldSession::HandleAutoStoreBankReagentOpcode(WorldPackets::Bank::AutoStoreBankReagent& autoStoreBankReagent)
+void WorldSession::HandleAutoStoreBankReagentOpcode(WorldPackets::Bank::AutoStoreBankReagent& /*autoStoreBankReagent*/)
{
- if (!CanUseBank())
- {
- TC_LOG_DEBUG("network", "WORLD: HandleAutoBankReagentOpcode - {} not found or you can't interact with him.", _player->PlayerTalkClass->GetInteractionData().SourceGuid.ToString());
- return;
- }
-
- if (!_player->IsReagentBankUnlocked())
- {
- _player->SendEquipError(EQUIP_ERR_REAGENT_BANK_LOCKED);
- return;
- }
-
- Item* pItem = _player->GetItemByPos(autoStoreBankReagent.Slot, autoStoreBankReagent.PackSlot);
- 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);
- if (msg != EQUIP_ERR_OK)
- {
- _player->SendEquipError(msg, pItem, nullptr);
- return;
- }
-
- _player->RemoveItem(autoStoreBankReagent.Slot, autoStoreBankReagent.PackSlot, true);
- _player->BankItem(dest, pItem, true);
- }
}
void WorldSession::SendShowBank(ObjectGuid guid)
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