Core/Items: Fix some cases where items could be created without random properties (#166)

This commit is contained in:
Roc13x authored and GitHub committed 2020-08-04 10:19:24 +02:00
1 parent 8669b5d22c
commit 5360da31a2
5 files changed
+11 -8

No files matched your search

+7 -4
View File
@@ -657,7 +657,7 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
if (msg != EQUIP_ERR_OK)
break;
EquipNewItem(eDest, titem_id, true);
EquipNewItem(eDest, titem_id, true, GenerateItemRandomPropertyId(titem_id));
AutoUnequipOffhandIfNeed();
--titem_amount;
}
@@ -11634,12 +11634,15 @@ Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool
}
}
Item* Player::EquipNewItem(uint16 pos, uint32 item, bool update)
Item* Player::EquipNewItem(uint16 pos, uint32 item, bool update, int32 randomPropertyId)
{
if (Item* pItem = Item::CreateItem(item, 1, this))
{
ItemAddedQuestCheck(item, 1);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, 1);
UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM, item, 1);
if (randomPropertyId)
pItem->SetItemRandomProperties(randomPropertyId);
return EquipItem(pos, pItem, update);
}
@@ -22035,8 +22038,8 @@ inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint32
}
Item* it = bStore ?
StoreNewItem(vDest, item, true) :
EquipNewItem(uiDest, item, true);
StoreNewItem(vDest, item, true, GenerateItemRandomPropertyId(item)) :
EquipNewItem(uiDest, item, true, GenerateItemRandomPropertyId(item));
if (it)
{
uint32 new_count = pVendor->UpdateVendorItemCurrentCount(crItem, count);
+1 -1
View File
@@ -1211,7 +1211,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
InventoryResult CanRollForItemInLFG(ItemTemplate const* item, WorldObject const* lootedObject) const;
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0, GuidSet const& allowedLooters = GuidSet());
Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update);
Item* EquipNewItem(uint16 pos, uint32 item, bool update);
Item* EquipNewItem(uint16 pos, uint32 item, bool update, int32 randomPropertyId = 0);
Item* EquipItem(uint16 pos, Item* pItem, bool update);
void AutoUnequipOffhandIfNeed(bool force = false);
bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count);
+1 -1
View File
@@ -738,7 +738,7 @@ void Map::ScriptsProcess()
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))
if (Item* item = pReceiver->StoreNewItem(dest, step.script->CreateItem.ItemEntry, true, GenerateItemRandomPropertyId(step.script->CreateItem.ItemEntry)))
pReceiver->SendNewItem(item, step.script->CreateItem.Amount, false, true);
}
else
+1 -1
View File
@@ -1363,7 +1363,7 @@ public:
InventoryResult msg = playerTarget->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, itr->second.GetId(), 1);
if (msg == EQUIP_ERR_OK)
{
Item* item = playerTarget->StoreNewItem(dest, itr->second.GetId(), true);
Item* item = playerTarget->StoreNewItem(dest, itr->second.GetId(), true, GenerateItemRandomPropertyId(itr->second.GetId()));
// remove binding (let GM give it to another player later)
if (player == playerTarget)
+1 -1
View File
@@ -208,7 +208,7 @@ public:
uint8 msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, id, count-curItemCount);
if (msg == EQUIP_ERR_OK)
{
Item* item = player->StoreNewItem(dest, id, true);
Item* item = player->StoreNewItem(dest, id, true, GenerateItemRandomPropertyId(id));
player->SendNewItem(item, count-curItemCount, true, false);
}
}