[9509] Move custom data from item spell charges sign to new field NoConsumable.

Some items with negative by defaul charges not expected to be deletedt at no charges.
In past this fixed by using positive charges amount in like cases in different from
expected negative value. Adding new field for avoid this.
This commit is contained in:
VladimirMangos 2010-03-03 09:07:16 +03:00
parent 84e5f7520b
commit 52701a58f6
9 changed files with 130 additions and 94 deletions

View file

@ -2060,6 +2060,31 @@ void ObjectMgr::LoadItemPrototypes()
sLog.outErrorDb("Item (Entry: %u) has wrong HolidayId value (%u)", i, proto->HolidayId);
const_cast<ItemPrototype*>(proto)->HolidayId = 0;
}
if(proto->NonConsumable)
{
if (proto->NonConsumable > 1)
{
sLog.outErrorDb("Item (Entry: %u) has wrong NonConsumable (%u), must be 0..1",i,proto->NonConsumable);
const_cast<ItemPrototype*>(proto)->NonConsumable = 1;
}
bool can_be_need = false;
for (int j = 0; j < MAX_ITEM_PROTO_SPELLS; ++j)
{
if(proto->Spells[j].SpellCharges < 0)
{
can_be_need = true;
break;
}
}
if (!can_be_need)
{
sLog.outErrorDb("Item (Entry: %u) has redundant NonConsumable (%u), item not have negative charges",i,proto->NonConsumable);
const_cast<ItemPrototype*>(proto)->NonConsumable = 0;
}
}
}
// check some dbc referenced items (avoid duplicate reports)