mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ bool ItemCanGoIntoBag(ItemPrototype const *proto, ItemPrototype const *pBagProto
|
|||
class MANGOS_DLL_SPEC Item : public Object
|
||||
{
|
||||
public:
|
||||
static Item* CreateItem(uint32 item, uint32 count, Player const* player = NULL);
|
||||
static Item* CreateItem(uint32 item, uint32 count, Player const* player = NULL, uint32 randomPropertyId = 0);
|
||||
Item* CloneItem( uint32 count, Player const* player = NULL ) const;
|
||||
|
||||
Item();
|
||||
|
|
|
|||
|
|
@ -2164,6 +2164,14 @@ void ObjectMgr::LoadItemPrototypes()
|
|||
const_cast<ItemPrototype*>(proto)->RandomSuffix = 0;
|
||||
}
|
||||
|
||||
// item can have not null only one from field values
|
||||
if (proto->RandomProperty && proto->RandomSuffix)
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) have RandomProperty==%u and RandomSuffix==%u, but must have one from field = 0",
|
||||
proto->ItemId, proto->RandomProperty, proto->RandomSuffix);
|
||||
const_cast<ItemPrototype*>(proto)->RandomSuffix = 0;
|
||||
}
|
||||
|
||||
if (proto->ItemSet && !sItemSetStore.LookupEntry(proto->ItemSet))
|
||||
{
|
||||
sLog.outErrorDb("Item (Entry: %u) have wrong ItemSet (%u)", i, proto->ItemSet);
|
||||
|
|
@ -2182,7 +2190,7 @@ void ObjectMgr::LoadItemPrototypes()
|
|||
for (uint32 j = 0; j < sizeof(proto->BagFamily) * 8; ++j)
|
||||
{
|
||||
uint32 mask = 1 << j;
|
||||
if((proto->BagFamily & mask)==0)
|
||||
if (!(proto->BagFamily & mask))
|
||||
continue;
|
||||
|
||||
ItemBagFamilyEntry const* bf = sItemBagFamilyStore.LookupEntry(j+1);
|
||||
|
|
@ -2229,13 +2237,15 @@ void ObjectMgr::LoadItemPrototypes()
|
|||
{
|
||||
if (proto->Quality > ITEM_QUALITY_EPIC || proto->Quality < ITEM_QUALITY_UNCOMMON)
|
||||
{
|
||||
ERROR_DB_STRICT_LOG("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable quality (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Quality);
|
||||
ERROR_DB_STRICT_LOG("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable quality (%u), reset it.",
|
||||
i, proto->RequiredDisenchantSkill, proto->Quality);
|
||||
const_cast<ItemPrototype*>(proto)->RequiredDisenchantSkill = -1;
|
||||
}
|
||||
else if (proto->Class != ITEM_CLASS_WEAPON && proto->Class != ITEM_CLASS_ARMOR)
|
||||
{
|
||||
// some wrong data in wdb for unused items
|
||||
ERROR_DB_STRICT_LOG("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable item class (%u), reset it.",i,proto->RequiredDisenchantSkill,proto->Class);
|
||||
ERROR_DB_STRICT_LOG("Item (Entry: %u) has unexpected RequiredDisenchantSkill (%u) for non-disenchantable item class (%u), reset it.",
|
||||
i, proto->RequiredDisenchantSkill, proto->Class);
|
||||
const_cast<ItemPrototype*>(proto)->RequiredDisenchantSkill = -1;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11114,13 +11114,11 @@ Item* Player::StoreNewItem( ItemPosCountVec const& dest, uint32 item, bool updat
|
|||
for(ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr)
|
||||
count += itr->count;
|
||||
|
||||
Item *pItem = Item::CreateItem( item, count, this );
|
||||
Item *pItem = Item::CreateItem(item, count, this, randomPropertyId);
|
||||
if (pItem)
|
||||
{
|
||||
ItemAddedQuestCheck( item, count );
|
||||
GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, count);
|
||||
if(randomPropertyId)
|
||||
pItem->SetItemRandomProperties(randomPropertyId);
|
||||
pItem = StoreItem( dest, pItem, update );
|
||||
}
|
||||
return pItem;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11701"
|
||||
#define REVISION_NR "11702"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue