mirror of
https://github.com/mangosfour/server.git
synced 2025-12-27 19:37:04 +00:00
[11702] Alsways attempt generate randomProperty for item in at create if value not pre-selected.
This resolve all existed cases when we miss assign random property id. Also move random property/suffix check from item creating to server load time.
This commit is contained in:
parent
67f9c26d51
commit
cc11366d6b
6 changed files with 64 additions and 61 deletions
|
|
@ -661,13 +661,6 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
|
|||
if ((!itemProto->RandomProperty) && (!itemProto->RandomSuffix))
|
||||
return 0;
|
||||
|
||||
// item can have not null only one from field values
|
||||
if ((itemProto->RandomProperty) && (itemProto->RandomSuffix))
|
||||
{
|
||||
sLog.outErrorDb("Item template %u have RandomProperty==%u and RandomSuffix==%u, but must have one from field =0", itemProto->ItemId, itemProto->RandomProperty, itemProto->RandomSuffix);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Random Property case
|
||||
if (itemProto->RandomProperty)
|
||||
{
|
||||
|
|
@ -1081,7 +1074,7 @@ void Item::SendTimeUpdate(Player* owner)
|
|||
owner->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
Item* Item::CreateItem( uint32 item, uint32 count, Player const* player )
|
||||
Item* Item::CreateItem( uint32 item, uint32 count, Player const* player, uint32 randomPropertyId)
|
||||
{
|
||||
if (count < 1)
|
||||
return NULL; //don't create item at zero count
|
||||
|
|
@ -1097,6 +1090,9 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player )
|
|||
if (pItem->Create(sObjectMgr.GenerateItemLowGuid(), item, player))
|
||||
{
|
||||
pItem->SetCount(count);
|
||||
if (uint32 randId = randomPropertyId ? randomPropertyId : Item::GenerateItemRandomPropertyId(item))
|
||||
pItem->SetItemRandomProperties(randId);
|
||||
|
||||
return pItem;
|
||||
}
|
||||
else
|
||||
|
|
@ -1107,7 +1103,7 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player )
|
|||
|
||||
Item* Item::CloneItem(uint32 count, Player const* player) const
|
||||
{
|
||||
Item* newItem = CreateItem(GetEntry(), count, player);
|
||||
Item* newItem = CreateItem(GetEntry(), count, player, GetItemRandomPropertyId());
|
||||
if (!newItem)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -1115,7 +1111,6 @@ Item* Item::CloneItem(uint32 count, Player const* player) const
|
|||
newItem->SetGuidValue(ITEM_FIELD_GIFTCREATOR, GetGuidValue(ITEM_FIELD_GIFTCREATOR));
|
||||
newItem->SetUInt32Value(ITEM_FIELD_FLAGS, GetUInt32Value(ITEM_FIELD_FLAGS));
|
||||
newItem->SetUInt32Value(ITEM_FIELD_DURATION, GetUInt32Value(ITEM_FIELD_DURATION));
|
||||
newItem->SetItemRandomProperties(GetItemRandomPropertyId());
|
||||
return newItem;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue