diff options
Diffstat (limited to 'src')
22 files changed, 165 insertions, 192 deletions
diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 2b6f960597c..caef8650d29 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -282,7 +282,7 @@ bool ChatHandler::HandleAddItemCommand(const char *args) // check space and find places ItemPosCountVec dest; - uint8 msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); + InventoryResult msg = plTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); if (msg != EQUIP_ERR_OK) // convert to possible store amount count -= noSpaceForCount; @@ -348,7 +348,7 @@ bool ChatHandler::HandleAddItemSetCommand(const char *args) { found = true; ItemPosCountVec dest; - uint8 msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1); + InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.ItemId, 1); if (msg == EQUIP_ERR_OK) { Item* item = playerTarget->StoreNewItem(dest, itr->second.ItemId, true); diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index e33e7cd9c9f..b35516ebfa4 100755 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -1085,8 +1085,8 @@ struct ItemDisplayInfoEntry //struct ItemCondExtCostsEntry //{ // uint32 ID; -// uint32 condExtendedCost; // ItemPrototype::CondExtendedCost -// uint32 itemextendedcostentry; // ItemPrototype::ExtendedCost +// uint32 condExtendedCost; // ItemTemplate::CondExtendedCost +// uint32 itemextendedcostentry; // ItemTemplate::ExtendedCost // uint32 arenaseason; // arena season number(1-4) //}; diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 024a423164c..f65d58b4101 100755 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -804,7 +804,7 @@ bool Item::IsBoundByEnchant() const return false; } -uint8 Item::CanBeMergedPartlyWith(ItemTemplate const* proto) const +InventoryResult Item::CanBeMergedPartlyWith(ItemTemplate const* proto) const { // not allow merge looting currently items if (m_lootGenerated) diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 93947e74428..39ac95c209f 100755 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -36,7 +36,7 @@ struct ItemSetEffect SpellEntry const *spells[8]; }; -enum InventoryChangeFailure +enum InventoryResult { EQUIP_ERR_OK = 0, EQUIP_ERR_CANT_EQUIP_LEVEL_I = 1, @@ -79,7 +79,7 @@ enum InventoryChangeFailure EQUIP_ERR_YOU_ARE_DEAD = 38, EQUIP_ERR_CANT_DO_RIGHT_NOW = 39, EQUIP_ERR_INT_BAG_ERROR = 40, - EQUIP_ERR_CAN_EQUIP_ONLY1_QUIVER2 = 41, + EQUIP_ERR_CAN_EQUIP_ONLY1_BOLT = 41, EQUIP_ERR_CAN_EQUIP_ONLY1_AMMOPOUCH = 42, EQUIP_ERR_STACKABLE_CANT_BE_WRAPPED = 43, EQUIP_ERR_EQUIPPED_CANT_BE_WRAPPED = 44, @@ -129,7 +129,7 @@ enum InventoryChangeFailure EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED = 89 }; -enum BuyFailure +enum BuyResult { BUY_ERR_CANT_FIND_ITEM = 0, BUY_ERR_ITEM_ALREADY_SOLD = 1, @@ -142,7 +142,7 @@ enum BuyFailure BUY_ERR_REPUTATION_REQUIRE = 12 }; -enum SellFailure +enum SellResult { SELL_ERR_CANT_FIND_ITEM = 1, SELL_ERR_CANT_SELL_ITEM = 2, // merchant doesn't like that item @@ -277,7 +277,7 @@ class Item : public Object uint32 GetMaxStackCount() const { return GetTemplate()->GetMaxStackSize(); } uint8 GetGemCountWithID(uint32 GemID) const; uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const; - uint8 CanBeMergedPartlyWith(ItemTemplate const* proto) const; + InventoryResult CanBeMergedPartlyWith(ItemTemplate const* proto) const; uint8 GetSlot() const {return m_slot;} Bag *GetContainer() { return m_container; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ec77668e829..15576b8226e 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -1107,7 +1107,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c uint32 item_id = oEntry->ItemId[j]; - // just skip, reported in ObjectMgr::LoadItemPrototypes + // just skip, reported in ObjectMgr::LoadItemTemplates ItemTemplate const* iProto = sObjectMgr->GetItemTemplate(item_id); if (!iProto) continue; @@ -1146,7 +1146,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c { uint16 eDest; // equip offhand weapon/shield if it attempt equipped before main-hand weapon - uint8 msg = CanEquipItem(NULL_SLOT, eDest, pItem, false); + InventoryResult msg = CanEquipItem(NULL_SLOT, eDest, pItem, false); if (msg == EQUIP_ERR_OK) { RemoveItem(INVENTORY_SLOT_BAG_0, i,true); @@ -1183,7 +1183,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) while (titem_amount > 0) { uint16 eDest; - uint8 msg = CanEquipNewItem(NULL_SLOT, eDest, titem_id, false); + InventoryResult msg = CanEquipNewItem(NULL_SLOT, eDest, titem_id, false); if (msg != EQUIP_ERR_OK) break; @@ -1198,7 +1198,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount) // attempt store ItemPosCountVec sDest; // store in main bag to simplify second pass (special bags can be not equipped yet at this moment) - uint8 msg = CanStoreNewItem(INVENTORY_SLOT_BAG_0, NULL_SLOT, sDest, titem_id, titem_amount); + InventoryResult msg = CanStoreNewItem(INVENTORY_SLOT_BAG_0, NULL_SLOT, sDest, titem_id, titem_amount); if (msg == EQUIP_ERR_OK) { StoreNewItem(sDest, titem_id, true, Item::GenerateItemRandomPropertyId(titem_id)); @@ -9859,17 +9859,17 @@ uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) c return NULL_SLOT; } -uint8 Player::CanUnequipItems(uint32 item, uint32 count) const +InventoryResult Player::CanUnequipItems(uint32 item, uint32 count) const { uint32 tempcount = 0; - uint8 res = EQUIP_ERR_OK; + InventoryResult res = EQUIP_ERR_OK; for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i) if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetEntry() == item) { - uint8 ires = CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i, false); + InventoryResult ires = CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i, false); if (ires == EQUIP_ERR_OK) { tempcount += pItem->GetCount(); @@ -10352,7 +10352,7 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 return false; } -uint8 Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count) const +InventoryResult Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count) const { ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(entry); if (!pProto) @@ -10436,7 +10436,7 @@ bool Player::HasItemTotemCategory(uint32 TotemCategory) const return false; } -uint8 Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32& count, bool swap, Item* pSrcItem) const +InventoryResult Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32& count, bool swap, Item* pSrcItem) const { Item* pItem2 = GetItemByPos(bag, slot); @@ -10490,7 +10490,7 @@ uint8 Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVe else { // can be merged at least partly - uint8 res = pItem2->CanBeMergedPartlyWith(pProto); + InventoryResult res = pItem2->CanBeMergedPartlyWith(pProto); if (res != EQUIP_ERR_OK) return res; @@ -10510,7 +10510,7 @@ uint8 Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVe return EQUIP_ERR_OK; } -uint8 Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const +InventoryResult Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const { // skip specific bag already processed in first called _CanStoreItem_InBag if (bag == skip_bag) @@ -10580,7 +10580,7 @@ uint8 Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemTemplate return EQUIP_ERR_OK; } -uint8 Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const +InventoryResult Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const { //this is never called for non-bag slots so we can do this if (pSrcItem && pSrcItem->IsNotEmptyBag()) @@ -10631,7 +10631,7 @@ uint8 Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, I return EQUIP_ERR_OK; } -uint8 Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 entry, uint32 count, Item *pItem, bool swap, uint32* no_space_count) const +InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 entry, uint32 count, Item *pItem, bool swap, uint32* no_space_count) const { sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count); @@ -10663,7 +10663,7 @@ uint8 Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 // check count of items (skip for auto move for same player from bank) uint32 no_similar_count = 0; // can't store this amount similar items - uint8 res = _CanTakeMoreSimilarItems(entry,count,pItem,&no_similar_count); + InventoryResult res = _CanTakeMoreSimilarItems(entry,count,pItem,&no_similar_count); if (res != EQUIP_ERR_OK) { if (count == no_similar_count) @@ -11064,75 +11064,60 @@ uint8 Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 } ////////////////////////////////////////////////////////////////////////// -uint8 Player::CanStoreItems(Item **pItems,int count) const +InventoryResult Player::CanStoreItems(Item** pItems, int count) const { - Item *pItem2; + Item* pItem2; // fill space table - int inv_slot_items[INVENTORY_SLOT_ITEM_END-INVENTORY_SLOT_ITEM_START]; - int inv_bags[INVENTORY_SLOT_BAG_END-INVENTORY_SLOT_BAG_START][MAX_BAG_SIZE]; - int inv_keys[KEYRING_SLOT_END-KEYRING_SLOT_START]; - int inv_tokens[CURRENCYTOKEN_SLOT_END-CURRENCYTOKEN_SLOT_START]; + int inv_slot_items[INVENTORY_SLOT_ITEM_END - INVENTORY_SLOT_ITEM_START]; + int inv_bags[INVENTORY_SLOT_BAG_END - INVENTORY_SLOT_BAG_START][MAX_BAG_SIZE]; + int inv_keys[KEYRING_SLOT_END - KEYRING_SLOT_START]; + int inv_tokens[CURRENCYTOKEN_SLOT_END - CURRENCYTOKEN_SLOT_START]; - memset(inv_slot_items,0,sizeof(int)*(INVENTORY_SLOT_ITEM_END-INVENTORY_SLOT_ITEM_START)); - memset(inv_bags,0,sizeof(int)*(INVENTORY_SLOT_BAG_END-INVENTORY_SLOT_BAG_START)*MAX_BAG_SIZE); - memset(inv_keys,0,sizeof(int)*(KEYRING_SLOT_END-KEYRING_SLOT_START)); - memset(inv_tokens,0,sizeof(int)*(CURRENCYTOKEN_SLOT_END-CURRENCYTOKEN_SLOT_START)); + memset(inv_slot_items, 0, sizeof(int) * (INVENTORY_SLOT_ITEM_END - INVENTORY_SLOT_ITEM_START)); + memset(inv_bags, 0, sizeof(int) * (INVENTORY_SLOT_BAG_END - INVENTORY_SLOT_BAG_START) * MAX_BAG_SIZE); + memset(inv_keys, 0, sizeof(int) * (KEYRING_SLOT_END - KEYRING_SLOT_START)); + memset(inv_tokens, 0, sizeof(int) * (CURRENCYTOKEN_SLOT_END - CURRENCYTOKEN_SLOT_START)); for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) { pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i); - if (pItem2 && !pItem2->IsInTrade()) - { - inv_slot_items[i-INVENTORY_SLOT_ITEM_START] = pItem2->GetCount(); - } + inv_slot_items[i - INVENTORY_SLOT_ITEM_START] = pItem2->GetCount(); } for (uint8 i = KEYRING_SLOT_START; i < KEYRING_SLOT_END; i++) { pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i); - if (pItem2 && !pItem2->IsInTrade()) - { - inv_keys[i-KEYRING_SLOT_START] = pItem2->GetCount(); - } + inv_keys[i - KEYRING_SLOT_START] = pItem2->GetCount(); } for (uint8 i = CURRENCYTOKEN_SLOT_START; i < CURRENCYTOKEN_SLOT_END; i++) { pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i); - if (pItem2 && !pItem2->IsInTrade()) - { - inv_tokens[i-CURRENCYTOKEN_SLOT_START] = pItem2->GetCount(); - } + inv_tokens[i - CURRENCYTOKEN_SLOT_START] = pItem2->GetCount(); } for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) - { if (Bag* pBag = GetBagByPos(i)) - { for (uint32 j = 0; j < pBag->GetBagSize(); j++) { pItem2 = GetItemByPos(i, j); if (pItem2 && !pItem2->IsInTrade()) - { - inv_bags[i-INVENTORY_SLOT_BAG_START][j] = pItem2->GetCount(); - } + inv_bags[i - INVENTORY_SLOT_BAG_START][j] = pItem2->GetCount(); } - } - } // check free space for all items for (int k = 0; k < count; ++k) { - Item *pItem = pItems[k]; + Item *pItem = pItems[k]; // no item if (!pItem) continue; - sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItems %i. item = %u, count = %u", k+1, pItem->GetEntry(), pItem->GetCount()); + sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, pItem->GetEntry(), pItem->GetCount()); ItemTemplate const *pProto = pItem->GetTemplate(); // strange item @@ -11151,7 +11136,7 @@ uint8 Player::CanStoreItems(Item **pItems,int count) const ItemTemplate const *pBagProto; // item is 'one item only' - uint8 res = CanTakeMoreSimilarItems(pItem); + InventoryResult res = CanTakeMoreSimilarItems(pItem); if (res != EQUIP_ERR_OK) return res; @@ -11323,13 +11308,13 @@ uint8 Player::CanStoreItems(Item **pItems,int count) const } ////////////////////////////////////////////////////////////////////////// -uint8 Player::CanEquipNewItem(uint8 slot, uint16 &dest, uint32 item, bool swap) const +InventoryResult Player::CanEquipNewItem(uint8 slot, uint16 &dest, uint32 item, bool swap) const { dest = 0; Item *pItem = Item::CreateItem(item, 1, this); if (pItem) { - uint8 result = CanEquipItem(slot, dest, pItem, swap); + InventoryResult result = CanEquipItem(slot, dest, pItem, swap); delete pItem; return result; } @@ -11337,7 +11322,7 @@ uint8 Player::CanEquipNewItem(uint8 slot, uint16 &dest, uint32 item, bool swap) return EQUIP_ERR_ITEM_NOT_FOUND; } -uint8 Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading) const +InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading) const { dest = 0; if (pItem) @@ -11354,7 +11339,7 @@ uint8 Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, boo return EQUIP_ERR_DONT_OWN_THAT_ITEM; // check count of items (skip for auto move for same player from bank) - uint8 res = CanTakeMoreSimilarItems(pItem); + InventoryResult res = CanTakeMoreSimilarItems(pItem); if (res != EQUIP_ERR_OK) return res; @@ -11403,34 +11388,20 @@ uint8 Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, boo return EQUIP_ERR_NO_EQUIPMENT_SLOT_AVAILABLE; // if swap ignore item (equipped also) - uint8 res2 = 0; - if (swap) - res2 = CanEquipUniqueItem(pItem, eslot); - else - res2 = CanEquipUniqueItem(pItem, NULL_SLOT); - if (res2) + InventoryResult res2 = CanEquipUniqueItem(pItem, swap ? eslot : NULL_SLOT); + if (res2 != EQUIP_ERR_OK) return res2; // check unique-equipped special item classes if (pProto->Class == ITEM_CLASS_QUIVER) - { for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) - { if (Item* pBag = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) - { if (pBag != pItem) - { if (ItemTemplate const* pBagProto = pBag->GetTemplate()) - { if (pBagProto->Class == pProto->Class && (!swap || pBag->GetSlot() != eslot)) return (pBagProto->SubClass == ITEM_SUBCLASS_AMMO_POUCH) ? EQUIP_ERR_CAN_EQUIP_ONLY1_AMMOPOUCH : EQUIP_ERR_CAN_EQUIP_ONLY1_QUIVER; - } - } - } - } - } uint32 type = pProto->InventoryType; @@ -11481,7 +11452,7 @@ uint8 Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, boo return !swap ? EQUIP_ERR_ITEM_NOT_FOUND : EQUIP_ERR_ITEMS_CANT_BE_SWAPPED; } -uint8 Player::CanUnequipItem(uint16 pos, bool swap) const +InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const { // Applied only to equipped items and bank bags if (!IsEquipmentPos(pos) && !IsBagPos(pos)) @@ -11522,7 +11493,7 @@ uint8 Player::CanUnequipItem(uint16 pos, bool swap) const return EQUIP_ERR_OK; } -uint8 Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading) const +InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading) const { if (!pItem) return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND; @@ -11551,7 +11522,7 @@ uint8 Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pI } // check count of items (skip for auto move for same player from bank) - uint8 res = CanTakeMoreSimilarItems(pItem); + InventoryResult res = CanTakeMoreSimilarItems(pItem); if (res != EQUIP_ERR_OK) return res; @@ -11709,7 +11680,7 @@ uint8 Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pI return EQUIP_ERR_BANK_FULL; } -uint8 Player::CanUseItem(Item *pItem, bool not_loading) const +InventoryResult Player::CanUseItem(Item *pItem, bool not_loading) const { if (pItem) { @@ -11727,7 +11698,7 @@ uint8 Player::CanUseItem(Item *pItem, bool not_loading) const if (pItem->IsBindedNotWith(this)) return EQUIP_ERR_DONT_OWN_THAT_ITEM; - uint8 res = CanUseItem(pProto); + InventoryResult res = CanUseItem(pProto); if (res != EQUIP_ERR_OK) return res; @@ -11768,7 +11739,7 @@ uint8 Player::CanUseItem(Item *pItem, bool not_loading) const return EQUIP_ERR_ITEM_NOT_FOUND; } -uint8 Player::CanUseItem(ItemTemplate const *pProto) const +InventoryResult Player::CanUseItem(ItemTemplate const *pProto) const { // Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player @@ -11799,7 +11770,7 @@ uint8 Player::CanUseItem(ItemTemplate const *pProto) const return EQUIP_ERR_ITEM_NOT_FOUND; } -uint8 Player::CanUseAmmo(uint32 item) const +InventoryResult Player::CanUseAmmo(uint32 item) const { sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUseAmmo item = %u", item); if (!isAlive()) @@ -11812,7 +11783,7 @@ uint8 Player::CanUseAmmo(uint32 item) const if (pProto->InventoryType!= INVTYPE_AMMO) return EQUIP_ERR_ONLY_AMMO_CAN_GO_HERE; - uint8 res = CanUseItem(pProto); + InventoryResult res = CanUseItem(pProto); if (res != EQUIP_ERR_OK) return res; @@ -11841,7 +11812,7 @@ void Player::SetAmmo(uint32 item) // check ammo if (item) { - uint8 msg = CanUseAmmo(item); + InventoryResult msg = CanUseAmmo(item); if (msg != EQUIP_ERR_OK) { SendEquipError(msg, NULL, NULL, item); @@ -12710,7 +12681,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) pSrcItem->SetCount(pSrcItem->GetCount() - count); ItemPosCountVec dest; - uint8 msg = CanStoreItem(dstbag, dstslot, dest, pNewItem, false); + InventoryResult msg = CanStoreItem(dstbag, dstslot, dest, pNewItem, false); if (msg != EQUIP_ERR_OK) { delete pNewItem; @@ -12730,7 +12701,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) pSrcItem->SetCount(pSrcItem->GetCount() - count); ItemPosCountVec dest; - uint8 msg = CanBankItem(dstbag, dstslot, dest, pNewItem, false); + InventoryResult msg = CanBankItem(dstbag, dstslot, dest, pNewItem, false); if (msg != EQUIP_ERR_OK) { delete pNewItem; @@ -12750,7 +12721,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) pSrcItem->SetCount(pSrcItem->GetCount() - count); uint16 dest; - uint8 msg = CanEquipItem(dstslot, dest, pNewItem, false); + InventoryResult msg = CanEquipItem(dstslot, dest, pNewItem, false); if (msg != EQUIP_ERR_OK) { delete pNewItem; @@ -12802,7 +12773,7 @@ void Player::SwapItem(uint16 src, uint16 dst) if (IsEquipmentPos(src) || IsBagPos(src)) { // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later) - uint8 msg = CanUnequipItem(src, !IsBagPos(src) || IsBagPos(dst) || (pDstItem && pDstItem->ToBag() && pDstItem->ToBag()->IsEmpty())); + InventoryResult msg = CanUnequipItem(src, !IsBagPos(src) || IsBagPos(dst) || (pDstItem && pDstItem->ToBag() && pDstItem->ToBag()->IsEmpty())); if (msg != EQUIP_ERR_OK) { SendEquipError(msg, pSrcItem, pDstItem); @@ -12839,7 +12810,7 @@ void Player::SwapItem(uint16 src, uint16 dst) if (IsEquipmentPos(dst) || IsBagPos(dst)) { // bags can be swapped with empty bag slots, or with empty bag (items move possibility checked later) - uint8 msg = CanUnequipItem(dst, !IsBagPos(dst) || IsBagPos(src) || (pSrcItem->ToBag() && pSrcItem->ToBag()->IsEmpty())); + InventoryResult msg = CanUnequipItem(dst, !IsBagPos(dst) || IsBagPos(src) || (pSrcItem->ToBag() && pSrcItem->ToBag()->IsEmpty())); if (msg != EQUIP_ERR_OK) { SendEquipError(msg, pSrcItem, pDstItem); @@ -12857,7 +12828,7 @@ void Player::SwapItem(uint16 src, uint16 dst) if (IsInventoryPos(dst)) { ItemPosCountVec dest; - uint8 msg = CanStoreItem(dstbag, dstslot, dest, pSrcItem, false); + InventoryResult msg = CanStoreItem(dstbag, dstslot, dest, pSrcItem, false); if (msg != EQUIP_ERR_OK) { SendEquipError(msg, pSrcItem, NULL); @@ -12870,7 +12841,7 @@ void Player::SwapItem(uint16 src, uint16 dst) else if (IsBankPos (dst)) { ItemPosCountVec dest; - uint8 msg = CanBankItem(dstbag, dstslot, dest, pSrcItem, false); + InventoryResult msg = CanBankItem(dstbag, dstslot, dest, pSrcItem, false); if (msg != EQUIP_ERR_OK) { SendEquipError(msg, pSrcItem, NULL); @@ -12883,7 +12854,7 @@ void Player::SwapItem(uint16 src, uint16 dst) else if (IsEquipmentPos (dst)) { uint16 dest; - uint8 msg = CanEquipItem(dstslot, dest, pSrcItem, false); + InventoryResult msg = CanEquipItem(dstslot, dest, pSrcItem, false); if (msg != EQUIP_ERR_OK) { SendEquipError(msg, pSrcItem, NULL); @@ -12901,7 +12872,7 @@ void Player::SwapItem(uint16 src, uint16 dst) // attempt merge to / fill target item if (!pSrcItem->IsBag() && !pDstItem->IsBag()) { - uint8 msg; + InventoryResult msg; ItemPosCountVec sDest; uint16 eDest = 0; if (IsInventoryPos(dst)) @@ -12948,7 +12919,7 @@ void Player::SwapItem(uint16 src, uint16 dst) } // impossible merge/fill, do real swap - uint8 msg = EQUIP_ERR_OK; + InventoryResult msg = EQUIP_ERR_OK; // check src->dest move possibility ItemPosCountVec sDest; @@ -13208,7 +13179,7 @@ void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) } } -void Player::SendEquipError(uint8 msg, Item* pItem, Item *pItem2, uint32 itemid) +void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint32 itemid) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_INVENTORY_CHANGE_FAILURE (%u)", msg); WorldPacket data(SMSG_INVENTORY_CHANGE_FAILURE, (msg == EQUIP_ERR_CANT_EQUIP_LEVEL_I ? 22 : 18)); @@ -13251,7 +13222,7 @@ void Player::SendEquipError(uint8 msg, Item* pItem, Item *pItem2, uint32 itemid) GetSession()->SendPacket(&data); } -void Player::SendBuyError(uint8 msg, Creature* pCreature, uint32 item, uint32 param) +void Player::SendBuyError(BuyResult msg, Creature* pCreature, uint32 item, uint32 param) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_BUY_FAILED"); WorldPacket data(SMSG_BUY_FAILED, (8+4+4+1)); @@ -13263,7 +13234,7 @@ void Player::SendBuyError(uint8 msg, Creature* pCreature, uint32 item, uint32 pa GetSession()->SendPacket(&data); } -void Player::SendSellError(uint8 msg, Creature* pCreature, uint64 guid, uint32 param) +void Player::SendSellError(SellResult msg, Creature* pCreature, uint64 guid, uint32 param) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_SELL_ITEM"); WorldPacket data(SMSG_SELL_ITEM,(8+8+(param?4:0)+1)); // last check 2.0.10 @@ -14534,7 +14505,7 @@ bool Player::CanAddQuest(Quest const *pQuest, bool msg) { uint32 count = pQuest->GetSrcItemCount(); ItemPosCountVec dest; - uint8 msg2 = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, srcitem, count); + InventoryResult msg2 = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, srcitem, count); // player already have max number (in most case 1) source item, no additional item needed and quest can be added. if (msg2 == EQUIP_ERR_CANT_CARRY_MORE_OF_THIS) @@ -14686,7 +14657,7 @@ bool Player::CanRewardQuest(Quest const *pQuest, uint32 reward, bool msg) if (pQuest->RewChoiceItemId[reward]) { ItemPosCountVec dest; - uint8 res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, pQuest->RewChoiceItemId[reward], pQuest->RewChoiceItemCount[reward]); + InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, pQuest->RewChoiceItemId[reward], pQuest->RewChoiceItemCount[reward]); if (res != EQUIP_ERR_OK) { SendEquipError(res, NULL, NULL, pQuest->RewChoiceItemId[reward]); @@ -14702,7 +14673,7 @@ bool Player::CanRewardQuest(Quest const *pQuest, uint32 reward, bool msg) if (pQuest->RewItemId[i]) { ItemPosCountVec dest; - uint8 res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, pQuest->RewItemId[i], pQuest->RewItemCount[i]); + InventoryResult res = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, pQuest->RewItemId[i], pQuest->RewItemCount[i]); if (res != EQUIP_ERR_OK) { SendEquipError(res, NULL, NULL, pQuest->RewItemId[i]); @@ -15419,7 +15390,7 @@ bool Player::GiveQuestSourceItem(Quest const *pQuest) count = 1; ItemPosCountVec dest; - uint8 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, srcitem, count); + InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, srcitem, count); if (msg == EQUIP_ERR_OK) { Item * item = StoreNewItem(dest, srcitem, true); @@ -15451,7 +15422,7 @@ bool Player::TakeQuestSourceItem(uint32 quest_id, bool msg) // exist one case when destroy source quest item not possible: // non un-equippable item (equipped non-empty bag, for example) - uint8 res = CanUnequipItems(srcitem, count); + InventoryResult res = CanUnequipItems(srcitem, count); if (res != EQUIP_ERR_OK) { if (msg) @@ -16095,13 +16066,13 @@ void Player::SendQuestReward(Quest const *pQuest, uint32 XP, Object * questGiver GetMap()->ScriptsStart(sQuestEndScripts, pQuest->GetQuestCompleteScript(), questGiver, this); } -void Player::SendQuestFailed(uint32 quest_id) +void Player::SendQuestFailed(uint32 questId, InventoryResult reason) { - if (quest_id) + if (questId) { - WorldPacket data(SMSG_QUESTGIVER_QUEST_FAILED, 4+4); - data << uint32(quest_id); - data << uint32(0); // failed reason (4 for inventory is full) + WorldPacket data(SMSG_QUESTGIVER_QUEST_FAILED, 4 + 4); + data << uint32(questId); + data << uint32(reason); // failed reason (valid reasons: 4, 16, 50, 17, 74, other values show default message) GetSession()->SendPacket(&data); sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_FAILED"); } @@ -19129,7 +19100,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) if (spellInfo->Reagent[i] > 0) { ItemPosCountVec dest; //for succubus, voidwalker, felhunter and felguard credit soulshard when despawn reason other than death (out of range, logout) - uint8 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, spellInfo->Reagent[i], spellInfo->ReagentCount[i]); + InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, spellInfo->Reagent[i], spellInfo->ReagentCount[i]); if (msg == EQUIP_ERR_OK) { Item* item = StoreNewItem(dest, spellInfo->Reagent[i], true); @@ -20158,7 +20129,7 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 c { ItemPosCountVec vDest; uint16 uiDest = 0; - uint8 msg = bStore ? + InventoryResult msg = bStore ? CanStoreNewItem(bag, slot, vDest, item, pProto->BuyCount * count) : CanEquipNewItem(slot, uiDest, item, false); if (msg != EQUIP_ERR_OK) @@ -23031,7 +23002,7 @@ void Player::AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore cons LootItem* lootItem = loot.LootItemInSlot(i,this); ItemPosCountVec dest; - uint8 msg = CanStoreNewItem(bag, slot, dest,lootItem->itemid, lootItem->count); + InventoryResult msg = CanStoreNewItem(bag, slot, dest,lootItem->itemid, lootItem->count); if (msg != EQUIP_ERR_OK && slot != NULL_SLOT) msg = CanStoreNewItem(bag, NULL_SLOT, dest, lootItem->itemid, lootItem->count); if (msg != EQUIP_ERR_OK && bag != NULL_BAG) @@ -23069,7 +23040,7 @@ void Player::StoreLootItem(uint8 lootSlot, Loot* loot) } ItemPosCountVec dest; - uint8 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count); + InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item->itemid, item->count); if (msg == EQUIP_ERR_OK) { AllowedLooterSet* looters = item->GetAllowedLooters(); @@ -23267,12 +23238,12 @@ uint32 Player::GetPhaseMaskForSpawn() const return PHASEMASK_NORMAL; } -uint8 Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limit_count) const +InventoryResult Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limit_count) const { ItemTemplate const* pProto = pItem->GetTemplate(); // proto based limitations - if (uint8 res = CanEquipUniqueItem(pProto,eslot,limit_count)) + if (InventoryResult res = CanEquipUniqueItem(pProto,eslot,limit_count)) return res; // check unique-equipped on gems @@ -23293,14 +23264,14 @@ uint8 Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limit_count) c uint32 gem_limit_count = !pItem->IsEquipped() && pGem->ItemLimitCategory ? pItem->GetGemCountWithLimitCategory(pGem->ItemLimitCategory) : 1; - if (uint8 res = CanEquipUniqueItem(pGem, eslot, gem_limit_count)) + if (InventoryResult res = CanEquipUniqueItem(pGem, eslot, gem_limit_count)) return res; } return EQUIP_ERR_OK; } -uint8 Player::CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot, uint32 limit_count) const +InventoryResult Player::CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot, uint32 limit_count) const { // check unique-equipped on item if (itemProto->Flags & ITEM_PROTO_FLAG_UNIQUE_EQUIPPED) @@ -24427,7 +24398,7 @@ bool Player::AddItem(uint32 itemId, uint32 count) { uint32 noSpaceForCount = 0; ItemPosCountVec dest; - uint8 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); + InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, count, &noSpaceForCount); if (msg != EQUIP_ERR_OK) count = noSpaceForCount; @@ -24487,7 +24458,7 @@ void Player::RefundItem(Item *item) if (count && itemid) { ItemPosCountVec dest; - uint8 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count); + InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count); if (msg != EQUIP_ERR_OK) { store_error = true; @@ -24534,7 +24505,7 @@ void Player::RefundItem(Item *item) if (count && itemid) { ItemPosCountVec dest; - uint8 msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count); + InventoryResult msg = CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemid, count); ASSERT(msg == EQUIP_ERR_OK) /// Already checked before Item* it = StoreNewItem(dest, itemid, true); SendNewItem(it, count, true, false, true); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 9b97bfbf9c5..3a74ba3d494 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1205,13 +1205,13 @@ class Player : public Unit, public GridObject<Player> bool CanNoReagentCast(SpellEntry const* spellInfo) const; bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const; bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const; - uint8 CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(),pItem->GetCount(),pItem); } - uint8 CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return _CanTakeMoreSimilarItems(entry,count,NULL); } - uint8 CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = NULL) const + InventoryResult CanTakeMoreSimilarItems(Item* pItem) const { return _CanTakeMoreSimilarItems(pItem->GetEntry(),pItem->GetCount(),pItem); } + InventoryResult CanTakeMoreSimilarItems(uint32 entry, uint32 count) const { return _CanTakeMoreSimilarItems(entry,count,NULL); } + InventoryResult CanStoreNewItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 item, uint32 count, uint32* no_space_count = NULL) const { return _CanStoreItem(bag, slot, dest, item, count, NULL, false, no_space_count); } - uint8 CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item *pItem, bool swap = false) const + InventoryResult CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item* pItem, bool swap = false) const { if (!pItem) return EQUIP_ERR_ITEM_NOT_FOUND; @@ -1219,19 +1219,20 @@ class Player : public Unit, public GridObject<Player> return _CanStoreItem(bag, slot, dest, pItem->GetEntry(), count, pItem, swap, NULL); } - uint8 CanStoreItems(Item **pItem,int count) const; - uint8 CanEquipNewItem(uint8 slot, uint16 &dest, uint32 item, bool swap) const; - uint8 CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading = true) const; - - uint8 CanEquipUniqueItem(Item * pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const; - uint8 CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const; - uint8 CanUnequipItems(uint32 item, uint32 count) const; - uint8 CanUnequipItem(uint16 src, bool swap) const; - uint8 CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item *pItem, bool swap, bool not_loading = true) const; - uint8 CanUseItem(Item *pItem, bool not_loading = true) const; + InventoryResult CanStoreItems(Item** pItem,int count) const; + InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const; + InventoryResult CanEquipItem(uint8 slot, uint16& dest, Item *pItem, bool swap, bool not_loading = true) const; + + InventoryResult CanEquipUniqueItem(Item* pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const; + 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) const; + InventoryResult CanUseItem(Item* pItem, bool not_loading = true) const; bool HasItemTotemCategory(uint32 TotemCategory) const; - uint8 CanUseItem(ItemTemplate const *pItem) const; - uint8 CanUseAmmo(uint32 item) const; + InventoryResult CanUseItem(ItemTemplate const* pItem) const; + InventoryResult CanUseAmmo(uint32 item) const; + Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0, AllowedLooterSet* allowedLooters = NULL); Item* StoreItem(ItemPosCountVec const& pos, Item *pItem, bool update); Item* EquipNewItem(uint16 pos, uint32 item, bool update); @@ -1242,8 +1243,8 @@ class Player : public Unit, public GridObject<Player> void AutoStoreLoot(uint32 loot_id, LootStore const& store, bool broadcast = false) { AutoStoreLoot(NULL_BAG,NULL_SLOT,loot_id,store,broadcast); } void StoreLootItem(uint8 lootSlot, Loot* loot); - uint8 _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const; - uint8 _CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item *pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const; + InventoryResult _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const; + InventoryResult _CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item *pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const; void AddRefundReference(uint32 it); void DeleteRefundReference(uint32 it); @@ -1278,9 +1279,9 @@ class Player : public Unit, public GridObject<Player> Item* GetItemFromBuyBackSlot(uint32 slot); void RemoveItemFromBuyBackSlot(uint32 slot, bool del); uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END-KEYRING_SLOT_START; } - void SendEquipError(uint8 msg, Item* pItem, Item *pItem2 = NULL, uint32 itemid = 0); - void SendBuyError(uint8 msg, Creature* pCreature, uint32 item, uint32 param); - void SendSellError(uint8 msg, Creature* pCreature, uint64 guid, uint32 param); + void SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2 = NULL, uint32 itemid = 0); + void SendBuyError(BuyResult msg, Creature* pCreature, uint32 item, uint32 param); + void SendSellError(SellResult msg, Creature* pCreature, uint64 guid, uint32 param); void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; } void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; } uint32 GetWeaponProficiency() const { return m_WeaponProficiency; } @@ -1442,7 +1443,7 @@ class Player : public Unit, public GridObject<Player> void SendQuestComplete(uint32 quest_id); void SendQuestReward(Quest const *pQuest, uint32 XP, Object* questGiver); - void SendQuestFailed(uint32 quest_id); + void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK); void SendQuestTimerFailed(uint32 quest_id); void SendCanTakeQuestResponse(uint32 msg); void SendQuestConfirmAccept(Quest const* pQuest, Player* pReceiver); @@ -2687,9 +2688,9 @@ class Player : public Unit, public GridObject<Player> bool isAlwaysDetectableFor(WorldObject const* seer) const; private: // internal common parts for CanStore/StoreItem functions - uint8 _CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const *pProto, uint32& count, bool swap, Item *pSrcItem) const; - uint8 _CanStoreItem_InBag(uint8 bag, ItemPosCountVec& dest, ItemTemplate const *pProto, uint32& count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const; - uint8 _CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemTemplate const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const; + InventoryResult _CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const *pProto, uint32& count, bool swap, Item *pSrcItem) const; + InventoryResult _CanStoreItem_InBag(uint8 bag, ItemPosCountVec& dest, ItemTemplate const *pProto, uint32& count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const; + InventoryResult _CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemTemplate const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const; Item* _StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool update); Item* _LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields); diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index a1c8c9b619e..098f2c19c17 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -1047,7 +1047,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) ItemPosCountVec dest; LootItem *item = &(roll->getLoot()->items[roll->itemSlot]); - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count); + InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count); if (msg == EQUIP_ERR_OK) { item->is_looted = true; @@ -1100,7 +1100,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) if (rollvote == GREED) { ItemPosCountVec dest; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count); + InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count); if (msg == EQUIP_ERR_OK) { item->is_looted = true; diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 8b0e8350844..f26a3328474 100755 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -757,10 +757,10 @@ bool Guild::MoveItemData::CheckItem(uint32& splitedAmount) return true; } -uint8 Guild::MoveItemData::CanStore(Item* pItem, bool swap, bool sendError) +bool Guild::MoveItemData::CanStore(Item* pItem, bool swap, bool sendError) { m_vec.clear(); - uint8 msg = _CanStore(pItem, swap); + InventoryResult msg = _CanStore(pItem, swap); if (sendError && msg != EQUIP_ERR_OK) m_pPlayer->SendEquipError(msg, pItem); return (msg == EQUIP_ERR_OK); @@ -848,7 +848,7 @@ void Guild::PlayerMoveItemData::LogBankEvent(SQLTransaction& trans, MoveItemData pFrom->GetItem()->GetEntry(), count); } -inline uint8 Guild::PlayerMoveItemData::_CanStore(Item* pItem, bool swap) +inline InventoryResult Guild::PlayerMoveItemData::_CanStore(Item* pItem, bool swap) { return m_pPlayer->CanStoreItem(m_container, m_slotId, m_vec, pItem, swap); } @@ -1020,7 +1020,7 @@ void Guild::BankMoveItemData::_CanStoreItemInTab(Item* pItem, uint8 skipSlotId, } } -uint8 Guild::BankMoveItemData::_CanStore(Item* pItem, bool swap) +InventoryResult Guild::BankMoveItemData::_CanStore(Item* pItem, bool swap) { sLog->outDebug(LOG_FILTER_GUILD, "GUILD STORAGE: CanStore() tab = %u, slot = %u, item = %u, count = %u", m_container, m_slotId, pItem->GetEntry(), pItem->GetCount()); diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index 6865ab09b83..97e484bb5ce 100755 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -506,7 +506,7 @@ private: // Defines if player has rights to withdraw item from container virtual bool HasWithdrawRights(MoveItemData* /*pOther*/) const { return true; } // Checks if container can store specified item - uint8 CanStore(Item* pItem, bool swap, bool sendError); + bool CanStore(Item* pItem, bool swap, bool sendError); // Clones stored item bool CloneItem(uint32 count); // Remove item from container (if splited update items fields) @@ -524,7 +524,7 @@ private: uint8 GetContainer() const { return m_container; } uint8 GetSlotId() const { return m_slotId; } protected: - virtual uint8 _CanStore(Item* pItem, bool swap) = 0; + virtual InventoryResult _CanStore(Item* pItem, bool swap) = 0; Guild* m_pGuild; Player *m_pPlayer; @@ -547,7 +547,7 @@ private: Item* StoreItem(SQLTransaction& trans, Item* pItem); void LogBankEvent(SQLTransaction& trans, MoveItemData* pFrom, uint32 count) const; protected: - uint8 _CanStore(Item* pItem, bool swap); + InventoryResult _CanStore(Item* pItem, bool swap); }; class BankMoveItemData : public MoveItemData @@ -566,7 +566,7 @@ private: void LogAction(MoveItemData* pFrom) const; protected: - uint8 _CanStore(Item* pItem, bool swap); + InventoryResult _CanStore(Item* pItem, bool swap); private: Item* _StoreItem(SQLTransaction& trans, BankTab* pTab, Item *pItem, ItemPosCount& pos, bool clone) const; diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 7a54ec5df21..8df9e0998ad 100755 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -776,7 +776,7 @@ void Map::ScriptsProcess() if (Player* pReceiver = _GetScriptPlayerSourceOrTarget(source, target, step.script)) { ItemPosCountVec dest; - uint8 msg = pReceiver->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, step.script->CreateItem.ItemEntry, step.script->CreateItem.Amount); + InventoryResult msg = pReceiver->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, step.script->CreateItem.ItemEntry, step.script->CreateItem.Amount); if (msg == EQUIP_ERR_OK) { if (Item* item = pReceiver->StoreNewItem(dest, step.script->CreateItem.ItemEntry, true)) diff --git a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp index 37df0a63409..f117d3306fe 100755 --- a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp @@ -270,6 +270,11 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) recv_data >> race_; recv_data >> class_; + // extract other data required for player creating + uint8 gender, skin, face, hairStyle, hairColor, facialHair, outfitId; + recv_data >> gender >> skin >> face; + recv_data >> hairStyle >> hairColor >> facialHair >> outfitId; + WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases if (GetSecurity() == SEC_PLAYER) @@ -279,10 +284,10 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) bool disabled = false; uint32 team = Player::TeamForRace(race_); - switch(team) + switch (team) { - case ALLIANCE: disabled = mask & (1<<0); break; - case HORDE: disabled = mask & (1<<1); break; + case ALLIANCE: disabled = mask & (1 << 0); break; + case HORDE: disabled = mask & (1 << 1); break; } if (disabled) @@ -534,11 +539,6 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) return; } - // extract other data required for player creating - uint8 gender, skin, face, hairStyle, hairColor, facialHair, outfitId; - recv_data >> gender >> skin >> face; - recv_data >> hairStyle >> hairColor >> facialHair >> outfitId; - if (recv_data.rpos() < recv_data.wpos()) { uint8 unk; @@ -1423,7 +1423,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data) continue; ItemPosCountVec sDest; - uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, sDest, uItem, false); + InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, sDest, uItem, false); if (msg == EQUIP_ERR_OK) { _player->RemoveItem(INVENTORY_SLOT_BAG_0, i, true); diff --git a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp index 8acb73c3e94..52177bd0c24 100755 --- a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp @@ -152,7 +152,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recv_data) return; // only at cheat uint16 dest; - uint8 msg = _player->CanEquipItem(NULL_SLOT, dest, pSrcItem, !pSrcItem->IsBag()); + InventoryResult msg = _player->CanEquipItem(NULL_SLOT, dest, pSrcItem, !pSrcItem->IsBag()); if (msg != EQUIP_ERR_OK) { _player->SendEquipError(msg, pSrcItem, NULL); @@ -246,7 +246,7 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recv_data) // prevent drop unequipable items (in combat, for example) and non-empty bags if (_player->IsEquipmentPos(pos) || _player->IsBagPos(pos)) { - uint8 msg = _player->CanUnequipItem(pos, false); + InventoryResult msg = _player->CanUnequipItem(pos, false); if (msg != EQUIP_ERR_OK) { _player->SendEquipError(msg, _player->GetItemByPos(pos), NULL); @@ -450,7 +450,7 @@ void WorldSession::HandleReadItem(WorldPacket & recv_data) { WorldPacket data; - uint8 msg = _player->CanUseItem(pItem); + InventoryResult msg = _player->CanUseItem(pItem); if (msg == EQUIP_ERR_OK) { data.Initialize (SMSG_READ_ITEM_OK, 8); @@ -627,7 +627,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) } ItemPosCountVec dest; - uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false); + InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false); if (msg == EQUIP_ERR_OK) { _player->ModifyMoney(-(int32)price); @@ -823,7 +823,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data) // check unequip potability for equipped items and bank bags if (_player->IsEquipmentPos (src) || _player->IsBagPos (src)) { - uint8 msg = _player->CanUnequipItem(src, !_player->IsBagPos (src)); + InventoryResult msg = _player->CanUnequipItem(src, !_player->IsBagPos (src)); if (msg != EQUIP_ERR_OK) { _player->SendEquipError(msg, pItem, NULL); @@ -832,7 +832,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data) } ItemPosCountVec dest; - uint8 msg = _player->CanStoreItem(dstbag, NULL_SLOT, dest, pItem, false); + InventoryResult msg = _player->CanStoreItem(dstbag, NULL_SLOT, dest, pItem, false); if (msg != EQUIP_ERR_OK) { _player->SendEquipError(msg, pItem, NULL); @@ -917,7 +917,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) return; ItemPosCountVec dest; - uint8 msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false); + InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false); if (msg != EQUIP_ERR_OK) { _player->SendEquipError(msg, pItem, NULL); @@ -949,7 +949,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) if (_player->IsBankPos(srcbag, srcslot)) // moving from bank to inventory { ItemPosCountVec dest; - uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false); + InventoryResult msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, pItem, false); if (msg != EQUIP_ERR_OK) { _player->SendEquipError(msg, pItem, NULL); @@ -962,7 +962,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) else // moving from inventory to bank { ItemPosCountVec dest; - uint8 msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false); + InventoryResult msg = _player->CanBankItem(NULL_BAG, NULL_SLOT, dest, pItem, false); if (msg != EQUIP_ERR_OK) { _player->SendEquipError(msg, pItem, NULL); @@ -1294,7 +1294,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) // for equipped item check all equipment for duplicate equipped gems if (itemTarget->IsEquipped()) { - if (uint8 res = _player->CanEquipUniqueItem(Gems[i],slot,limit_newcount >= 0 ? limit_newcount : 0)) + if (InventoryResult res = _player->CanEquipUniqueItem(Gems[i], slot, std::max(limit_newcount, 0))) { _player->SendEquipError(res, itemTarget, NULL); return; @@ -1308,8 +1308,8 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) //if a meta gem is being equipped, all information has to be written to the item before testing if the conditions for the gem are met //remove ALL enchants - for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot) - _player->ApplyEnchantment(itemTarget,EnchantmentSlot(enchant_slot),false); + for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot) + _player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), false); for (int i = 0; i < MAX_GEM_SOCKETS; ++i) { diff --git a/src/server/game/Server/Protocol/Handlers/LootHandler.cpp b/src/server/game/Server/Protocol/Handlers/LootHandler.cpp index 073bc3366ce..748b9a08589 100755 --- a/src/server/game/Server/Protocol/Handlers/LootHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/LootHandler.cpp @@ -462,7 +462,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) LootItem& item = pLoot->items[slotid]; ItemPosCountVec dest; - uint8 msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count); + InventoryResult msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count); if (msg != EQUIP_ERR_OK) { target->SendEquipError(msg, NULL, NULL, item.itemid); diff --git a/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp b/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp index d28d86a0ab9..eb301660c0a 100755 --- a/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp @@ -193,10 +193,10 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) } ItemPosCountVec dest; - uint8 msg = _player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, charterid, pProto->BuyCount); + InventoryResult msg = _player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, charterid, pProto->BuyCount); if (msg != EQUIP_ERR_OK) { - _player->SendBuyError(msg, pCreature, charterid, 0); + _player->SendEquipError(msg, NULL, NULL, charterid); return; } diff --git a/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp b/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp index cddb571ebe6..3b5e6871632 100755 --- a/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp @@ -109,7 +109,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) return; } - uint8 msg = pUser->CanUseItem(pItem); + InventoryResult msg = pUser->CanUseItem(pItem); if (msg != EQUIP_ERR_OK) { pUser->SendEquipError(msg, pItem, NULL); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index b2342c98c77..5a9977ff2b6 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -6315,7 +6315,7 @@ void AuraEffect::HandleChannelDeathItem(AuraApplication const * aurApp, uint8 mo uint32 count = m_amount; ItemPosCountVec dest; - uint8 msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellProto()->EffectItemType[m_effIndex], count, &noSpaceForCount); + InventoryResult msg = plCaster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, GetSpellProto()->EffectItemType[m_effIndex], count, &noSpaceForCount); if (msg != EQUIP_ERR_OK) { count-=noSpaceForCount; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 15d61322db3..0b4de8fab74 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -6092,7 +6092,7 @@ SpellCastResult Spell::CheckItems() if (!m_IsTriggeredSpell && m_spellInfo->EffectItemType[i]) { ItemPosCountVec dest; - uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1); + InventoryResult msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1); if (msg != EQUIP_ERR_OK) { ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(m_spellInfo->EffectItemType[i]); @@ -6127,7 +6127,7 @@ SpellCastResult Spell::CheckItems() if (m_CastItem && m_CastItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST) return SPELL_FAILED_TOTEM_CATEGORY; ItemPosCountVec dest; - uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1); + InventoryResult msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1); if (msg != EQUIP_ERR_OK) { p_caster->SendEquipError(msg, NULL, NULL, m_spellInfo->EffectItemType[i]); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 1fb33c8bb36..3aa7709749c 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2431,7 +2431,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype) // can the player store the new item? ItemPosCountVec dest; uint32 no_space = 0; - uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, newitemid, num_to_add, &no_space); + InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, newitemid, num_to_add, &no_space); if (msg != EQUIP_ERR_OK) { // convert to possible store amount @@ -2897,7 +2897,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) if (player->IsInventoryPos(pos)) { ItemPosCountVec dest; - uint8 msg = player->CanStoreItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true); + InventoryResult msg = player->CanStoreItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true); if (msg == EQUIP_ERR_OK) { player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index a0a01ea2875..237fa210933 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -249,7 +249,7 @@ public: if (!*args) return false; - uint8 msg = atoi(args); + InventoryResult msg = InventoryResult(atoi(args)); handler->GetSession()->GetPlayer()->SendEquipError(msg, NULL, NULL); return true; } @@ -259,7 +259,7 @@ public: if (!*args) return false; - uint8 msg = atoi(args); + SellResult msg = SellResult(atoi(args)); handler->GetSession()->GetPlayer()->SendSellError(msg, 0, 0, 0); return true; } @@ -269,7 +269,7 @@ public: if (!*args) return false; - uint8 msg = atoi(args); + BuyResult msg = BuyResult(atoi(args)); handler->GetSession()->GetPlayer()->SendBuyError(msg, 0, 0, 0); return true; } diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index b5431b823f8..7bb661cd792 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -1299,7 +1299,7 @@ public: uint32 ItemID = atoi(pItemID); uint32 SlotID = atoi(pSlotID); - ItemPrototype* tmpItem = sObjectMgr->GetItemTemplate(ItemID); + ItemTemplate* tmpItem = sObjectMgr->GetItemTemplate(ItemID); bool added = false; if (tmpItem) diff --git a/src/server/scripts/Outland/zangarmarsh.cpp b/src/server/scripts/Outland/zangarmarsh.cpp index c102d11e161..3face5ee606 100644 --- a/src/server/scripts/Outland/zangarmarsh.cpp +++ b/src/server/scripts/Outland/zangarmarsh.cpp @@ -250,7 +250,7 @@ public: { ItemPosCountVec dest; uint32 itemId = 24573; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1, false); + InventoryResult msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1, false); if (msg == EQUIP_ERR_OK) { pPlayer->StoreNewItem(dest, itemId, true); diff --git a/src/server/scripts/World/item_scripts.cpp b/src/server/scripts/World/item_scripts.cpp index c248738a6d6..4129fe0e3fa 100644 --- a/src/server/scripts/World/item_scripts.cpp +++ b/src/server/scripts/World/item_scripts.cpp @@ -105,12 +105,13 @@ public: { ItemPosCountVec dest; uint32 itemId = 23614; - uint8 msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1); + InventoryResult msg = pPlayer->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itemId, 1); if (msg == EQUIP_ERR_OK) { if (Item* item = pPlayer->StoreNewItem(dest, itemId, true)) pPlayer->SendNewItem(item, 1, false, true); - } else + } + else pPlayer->SendEquipError(msg, NULL, NULL, itemId); } } |