mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 19:37:02 +00:00
[11612] Code style in Item.*
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
52134f1852
commit
2686963d6d
3 changed files with 198 additions and 198 deletions
|
|
@ -23,45 +23,45 @@
|
||||||
#include "Database/DatabaseEnv.h"
|
#include "Database/DatabaseEnv.h"
|
||||||
#include "ItemEnchantmentMgr.h"
|
#include "ItemEnchantmentMgr.h"
|
||||||
|
|
||||||
void AddItemsSetItem(Player*player,Item *item)
|
void AddItemsSetItem(Player* player, Item* item)
|
||||||
{
|
{
|
||||||
ItemPrototype const *proto = item->GetProto();
|
ItemPrototype const* proto = item->GetProto();
|
||||||
uint32 setid = proto->ItemSet;
|
uint32 setid = proto->ItemSet;
|
||||||
|
|
||||||
ItemSetEntry const *set = sItemSetStore.LookupEntry(setid);
|
ItemSetEntry const* set = sItemSetStore.LookupEntry(setid);
|
||||||
|
|
||||||
if(!set)
|
if (!set)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Item set %u for item (id %u) not found, mods not applied.",setid,proto->ItemId);
|
sLog.outErrorDb("Item set %u for item (id %u) not found, mods not applied.", setid,proto->ItemId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( set->required_skill_id && player->GetSkillValue(set->required_skill_id) < set->required_skill_value )
|
if (set->required_skill_id && player->GetSkillValue(set->required_skill_id) < set->required_skill_value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ItemSetEffect *eff = NULL;
|
ItemSetEffect* eff = NULL;
|
||||||
|
|
||||||
for(size_t x = 0; x < player->ItemSetEff.size(); ++x)
|
for (size_t x = 0; x < player->ItemSetEff.size(); ++x)
|
||||||
{
|
{
|
||||||
if(player->ItemSetEff[x] && player->ItemSetEff[x]->setid == setid)
|
if (player->ItemSetEff[x] && player->ItemSetEff[x]->setid == setid)
|
||||||
{
|
{
|
||||||
eff = player->ItemSetEff[x];
|
eff = player->ItemSetEff[x];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!eff)
|
if (!eff)
|
||||||
{
|
{
|
||||||
eff = new ItemSetEffect;
|
eff = new ItemSetEffect;
|
||||||
memset(eff,0,sizeof(ItemSetEffect));
|
memset(eff, 0, sizeof(ItemSetEffect));
|
||||||
eff->setid = setid;
|
eff->setid = setid;
|
||||||
|
|
||||||
size_t x = 0;
|
size_t x = 0;
|
||||||
for(; x < player->ItemSetEff.size(); x++)
|
for (; x < player->ItemSetEff.size(); x++)
|
||||||
if(!player->ItemSetEff[x])
|
if (!player->ItemSetEff[x])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(x < player->ItemSetEff.size())
|
if (x < player->ItemSetEff.size())
|
||||||
player->ItemSetEff[x]=eff;
|
player->ItemSetEff[x]=eff;
|
||||||
else
|
else
|
||||||
player->ItemSetEff.push_back(eff);
|
player->ItemSetEff.push_back(eff);
|
||||||
|
|
@ -69,36 +69,36 @@ void AddItemsSetItem(Player*player,Item *item)
|
||||||
|
|
||||||
++eff->item_count;
|
++eff->item_count;
|
||||||
|
|
||||||
for(uint32 x=0;x<8;x++)
|
for (uint32 x = 0; x < 8; x++)
|
||||||
{
|
{
|
||||||
if(!set->spells [x])
|
if (!set->spells[x])
|
||||||
continue;
|
continue;
|
||||||
//not enough for spell
|
// not enough for spell
|
||||||
if(set->items_to_triggerspell[x] > eff->item_count)
|
if (set->items_to_triggerspell[x] > eff->item_count)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
uint32 z=0;
|
uint32 z = 0;
|
||||||
for(;z<8;z++)
|
for (; z < 8; z++)
|
||||||
if(eff->spells[z] && eff->spells[z]->Id==set->spells[x])
|
if (eff->spells[z] && eff->spells[z]->Id == set->spells[x])
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if(z < 8)
|
if (z < 8)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//new spell
|
// new spell
|
||||||
for(uint32 y=0;y<8;y++)
|
for (uint32 y = 0; y < 8; y++)
|
||||||
{
|
{
|
||||||
if(!eff->spells[y]) // free slot
|
if (!eff->spells[y]) // free slot
|
||||||
{
|
{
|
||||||
SpellEntry const *spellInfo = sSpellStore.LookupEntry(set->spells[x]);
|
SpellEntry const* spellInfo = sSpellStore.LookupEntry(set->spells[x]);
|
||||||
if(!spellInfo)
|
if (!spellInfo)
|
||||||
{
|
{
|
||||||
sLog.outError("WORLD: unknown spell id %u in items set %u effects", set->spells[x],setid);
|
sLog.outError("WORLD: unknown spell id %u in items set %u effects", set->spells[x],setid);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// spell casted only if fit form requirement, in other case will casted at form change
|
// spell casted only if fit form requirement, in other case will casted at form change
|
||||||
player->ApplyEquipSpell(spellInfo,NULL,true);
|
player->ApplyEquipSpell(spellInfo, NULL, true);
|
||||||
eff->spells[y] = spellInfo;
|
eff->spells[y] = spellInfo;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -106,23 +106,23 @@ void AddItemsSetItem(Player*player,Item *item)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveItemsSetItem(Player*player,ItemPrototype const *proto)
|
void RemoveItemsSetItem(Player* player, ItemPrototype const* proto)
|
||||||
{
|
{
|
||||||
uint32 setid = proto->ItemSet;
|
uint32 setid = proto->ItemSet;
|
||||||
|
|
||||||
ItemSetEntry const *set = sItemSetStore.LookupEntry(setid);
|
ItemSetEntry const* set = sItemSetStore.LookupEntry(setid);
|
||||||
|
|
||||||
if(!set)
|
if (!set)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Item set #%u for item #%u not found, mods not removed.",setid,proto->ItemId);
|
sLog.outErrorDb("Item set #%u for item #%u not found, mods not removed.", setid,proto->ItemId);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemSetEffect *eff = NULL;
|
ItemSetEffect* eff = NULL;
|
||||||
size_t setindex = 0;
|
size_t setindex = 0;
|
||||||
for(;setindex < player->ItemSetEff.size(); setindex++)
|
for (; setindex < player->ItemSetEff.size(); setindex++)
|
||||||
{
|
{
|
||||||
if(player->ItemSetEff[setindex] && player->ItemSetEff[setindex]->setid == setid)
|
if (player->ItemSetEff[setindex] && player->ItemSetEff[setindex]->setid == setid)
|
||||||
{
|
{
|
||||||
eff = player->ItemSetEff[setindex];
|
eff = player->ItemSetEff[setindex];
|
||||||
break;
|
break;
|
||||||
|
|
@ -130,33 +130,33 @@ void RemoveItemsSetItem(Player*player,ItemPrototype const *proto)
|
||||||
}
|
}
|
||||||
|
|
||||||
// can be in case now enough skill requirement for set appling but set has been appliend when skill requirement not enough
|
// can be in case now enough skill requirement for set appling but set has been appliend when skill requirement not enough
|
||||||
if(!eff)
|
if (!eff)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
--eff->item_count;
|
--eff->item_count;
|
||||||
|
|
||||||
for(uint32 x=0;x<8;x++)
|
for (uint32 x = 0; x < 8; x++)
|
||||||
{
|
{
|
||||||
if(!set->spells[x])
|
if (!set->spells[x])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// enough for spell
|
// enough for spell
|
||||||
if(set->items_to_triggerspell[x] <= eff->item_count)
|
if (set->items_to_triggerspell[x] <= eff->item_count)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for(uint32 z=0;z<8;z++)
|
for (uint32 z = 0; z < 8; z++)
|
||||||
{
|
{
|
||||||
if(eff->spells[z] && eff->spells[z]->Id==set->spells[x])
|
if (eff->spells[z] && eff->spells[z]->Id == set->spells[x])
|
||||||
{
|
{
|
||||||
// spell can be not active if not fit form requirement
|
// spell can be not active if not fit form requirement
|
||||||
player->ApplyEquipSpell(eff->spells[z],NULL,false);
|
player->ApplyEquipSpell(eff->spells[z], NULL, false);
|
||||||
eff->spells[z]=NULL;
|
eff->spells[z] = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!eff->item_count) //all items of a set were removed
|
if (!eff->item_count) // all items of a set were removed
|
||||||
{
|
{
|
||||||
MANGOS_ASSERT(eff == player->ItemSetEff[setindex]);
|
MANGOS_ASSERT(eff == player->ItemSetEff[setindex]);
|
||||||
delete eff;
|
delete eff;
|
||||||
|
|
@ -164,62 +164,62 @@ void RemoveItemsSetItem(Player*player,ItemPrototype const *proto)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ItemCanGoIntoBag(ItemPrototype const *pProto, ItemPrototype const *pBagProto)
|
bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProto)
|
||||||
{
|
{
|
||||||
if(!pProto || !pBagProto)
|
if (!pProto || !pBagProto)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch(pBagProto->Class)
|
switch (pBagProto->Class)
|
||||||
{
|
{
|
||||||
case ITEM_CLASS_CONTAINER:
|
case ITEM_CLASS_CONTAINER:
|
||||||
switch(pBagProto->SubClass)
|
switch (pBagProto->SubClass)
|
||||||
{
|
{
|
||||||
case ITEM_SUBCLASS_CONTAINER:
|
case ITEM_SUBCLASS_CONTAINER:
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_SOUL_CONTAINER:
|
case ITEM_SUBCLASS_SOUL_CONTAINER:
|
||||||
if(!(pProto->BagFamily & BAG_FAMILY_MASK_SOUL_SHARDS))
|
if (!(pProto->BagFamily & BAG_FAMILY_MASK_SOUL_SHARDS))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_HERB_CONTAINER:
|
case ITEM_SUBCLASS_HERB_CONTAINER:
|
||||||
if(!(pProto->BagFamily & BAG_FAMILY_MASK_HERBS))
|
if (!(pProto->BagFamily & BAG_FAMILY_MASK_HERBS))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_ENCHANTING_CONTAINER:
|
case ITEM_SUBCLASS_ENCHANTING_CONTAINER:
|
||||||
if(!(pProto->BagFamily & BAG_FAMILY_MASK_ENCHANTING_SUPP))
|
if (!(pProto->BagFamily & BAG_FAMILY_MASK_ENCHANTING_SUPP))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_MINING_CONTAINER:
|
case ITEM_SUBCLASS_MINING_CONTAINER:
|
||||||
if(!(pProto->BagFamily & BAG_FAMILY_MASK_MINING_SUPP))
|
if (!(pProto->BagFamily & BAG_FAMILY_MASK_MINING_SUPP))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_ENGINEERING_CONTAINER:
|
case ITEM_SUBCLASS_ENGINEERING_CONTAINER:
|
||||||
if(!(pProto->BagFamily & BAG_FAMILY_MASK_ENGINEERING_SUPP))
|
if (!(pProto->BagFamily & BAG_FAMILY_MASK_ENGINEERING_SUPP))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_GEM_CONTAINER:
|
case ITEM_SUBCLASS_GEM_CONTAINER:
|
||||||
if(!(pProto->BagFamily & BAG_FAMILY_MASK_GEMS))
|
if (!(pProto->BagFamily & BAG_FAMILY_MASK_GEMS))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_LEATHERWORKING_CONTAINER:
|
case ITEM_SUBCLASS_LEATHERWORKING_CONTAINER:
|
||||||
if(!(pProto->BagFamily & BAG_FAMILY_MASK_LEATHERWORKING_SUPP))
|
if (!(pProto->BagFamily & BAG_FAMILY_MASK_LEATHERWORKING_SUPP))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_INSCRIPTION_CONTAINER:
|
case ITEM_SUBCLASS_INSCRIPTION_CONTAINER:
|
||||||
if(!(pProto->BagFamily & BAG_FAMILY_MASK_INSCRIPTION_SUPP))
|
if (!(pProto->BagFamily & BAG_FAMILY_MASK_INSCRIPTION_SUPP))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case ITEM_CLASS_QUIVER:
|
case ITEM_CLASS_QUIVER:
|
||||||
switch(pBagProto->SubClass)
|
switch (pBagProto->SubClass)
|
||||||
{
|
{
|
||||||
case ITEM_SUBCLASS_QUIVER:
|
case ITEM_SUBCLASS_QUIVER:
|
||||||
if(!(pProto->BagFamily & BAG_FAMILY_MASK_ARROWS))
|
if (!(pProto->BagFamily & BAG_FAMILY_MASK_ARROWS))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
case ITEM_SUBCLASS_AMMO_POUCH:
|
case ITEM_SUBCLASS_AMMO_POUCH:
|
||||||
if(!(pProto->BagFamily & BAG_FAMILY_MASK_BULLETS))
|
if (!(pProto->BagFamily & BAG_FAMILY_MASK_BULLETS))
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
|
|
@ -229,7 +229,7 @@ bool ItemCanGoIntoBag(ItemPrototype const *pProto, ItemPrototype const *pBagProt
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item::Item( )
|
Item::Item()
|
||||||
{
|
{
|
||||||
m_objectType |= TYPEMASK_ITEM;
|
m_objectType |= TYPEMASK_ITEM;
|
||||||
m_objectTypeId = TYPEID_ITEM;
|
m_objectTypeId = TYPEID_ITEM;
|
||||||
|
|
@ -245,7 +245,7 @@ Item::Item( )
|
||||||
m_lootState = ITEM_LOOT_NONE;
|
m_lootState = ITEM_LOOT_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item::Create( uint32 guidlow, uint32 itemid, Player const* owner)
|
bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
|
||||||
{
|
{
|
||||||
Object::_Create(guidlow, 0, HIGHGUID_ITEM);
|
Object::_Create(guidlow, 0, HIGHGUID_ITEM);
|
||||||
|
|
||||||
|
|
@ -255,15 +255,15 @@ bool Item::Create( uint32 guidlow, uint32 itemid, Player const* owner)
|
||||||
SetGuidValue(ITEM_FIELD_OWNER, owner ? owner->GetObjectGuid() : ObjectGuid());
|
SetGuidValue(ITEM_FIELD_OWNER, owner ? owner->GetObjectGuid() : ObjectGuid());
|
||||||
SetGuidValue(ITEM_FIELD_CONTAINED, ObjectGuid());
|
SetGuidValue(ITEM_FIELD_CONTAINED, ObjectGuid());
|
||||||
|
|
||||||
ItemPrototype const *itemProto = ObjectMgr::GetItemPrototype(itemid);
|
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(itemid);
|
||||||
if(!itemProto)
|
if (!itemProto)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SetUInt32Value(ITEM_FIELD_STACK_COUNT, 1);
|
SetUInt32Value(ITEM_FIELD_STACK_COUNT, 1);
|
||||||
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability);
|
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, itemProto->MaxDurability);
|
||||||
SetUInt32Value(ITEM_FIELD_DURABILITY, itemProto->MaxDurability);
|
SetUInt32Value(ITEM_FIELD_DURABILITY, itemProto->MaxDurability);
|
||||||
|
|
||||||
for(int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||||
SetSpellCharges(i,itemProto->Spells[i].SpellCharges);
|
SetSpellCharges(i,itemProto->Spells[i].SpellCharges);
|
||||||
|
|
||||||
SetUInt32Value(ITEM_FIELD_DURATION, itemProto->Duration);
|
SetUInt32Value(ITEM_FIELD_DURATION, itemProto->Duration);
|
||||||
|
|
@ -276,9 +276,9 @@ void Item::UpdateDuration(Player* owner, uint32 diff)
|
||||||
if (!GetUInt32Value(ITEM_FIELD_DURATION))
|
if (!GetUInt32Value(ITEM_FIELD_DURATION))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//DEBUG_LOG("Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)",GetEntry(),GetUInt32Value(ITEM_FIELD_DURATION),diff);
|
//DEBUG_LOG("Item::UpdateDuration Item (Entry: %u Duration %u Diff %u)", GetEntry(), GetUInt32Value(ITEM_FIELD_DURATION), diff);
|
||||||
|
|
||||||
if (GetUInt32Value(ITEM_FIELD_DURATION)<=diff)
|
if (GetUInt32Value(ITEM_FIELD_DURATION) <= diff)
|
||||||
{
|
{
|
||||||
owner->DestroyItem(GetBagSlot(), GetSlot(), true);
|
owner->DestroyItem(GetBagSlot(), GetSlot(), true);
|
||||||
return;
|
return;
|
||||||
|
|
@ -302,7 +302,7 @@ void Item::SaveToDB()
|
||||||
stmt.PExecute(guid);
|
stmt.PExecute(guid);
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
for(uint16 i = 0; i < m_valuesCount; ++i )
|
for (uint16 i = 0; i < m_valuesCount; ++i)
|
||||||
ss << GetUInt32Value(i) << " ";
|
ss << GetUInt32Value(i) << " ";
|
||||||
|
|
||||||
stmt = CharacterDatabase.CreateStatement(insItem, "INSERT INTO item_instance (guid,owner_guid,data,text) VALUES (?, ?, ?, ?)");
|
stmt = CharacterDatabase.CreateStatement(insItem, "INSERT INTO item_instance (guid,owner_guid,data,text) VALUES (?, ?, ?, ?)");
|
||||||
|
|
@ -316,7 +316,7 @@ void Item::SaveToDB()
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updInstance, "UPDATE item_instance SET data = ?, owner_guid = ?, text = ? WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(updInstance, "UPDATE item_instance SET data = ?, owner_guid = ?, text = ? WHERE guid = ?");
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
for(uint16 i = 0; i < m_valuesCount; ++i )
|
for (uint16 i = 0; i < m_valuesCount; ++i)
|
||||||
ss << GetUInt32Value(i) << " ";
|
ss << GetUInt32Value(i) << " ";
|
||||||
|
|
||||||
stmt.PExecute(ss.str().c_str(), GetOwnerGuid().GetCounter(), m_text.c_str(), guid);
|
stmt.PExecute(ss.str().c_str(), GetOwnerGuid().GetCounter(), m_text.c_str(), guid);
|
||||||
|
|
@ -365,7 +365,7 @@ void Item::SaveToDB()
|
||||||
|
|
||||||
if (m_lootState == ITEM_LOOT_NEW || m_lootState == ITEM_LOOT_CHANGED)
|
if (m_lootState == ITEM_LOOT_NEW || m_lootState == ITEM_LOOT_CHANGED)
|
||||||
{
|
{
|
||||||
if(Player* owner = GetOwner())
|
if (Player* owner = GetOwner())
|
||||||
{
|
{
|
||||||
static SqlStatementID saveGold ;
|
static SqlStatementID saveGold ;
|
||||||
static SqlStatementID saveLoot ;
|
static SqlStatementID saveLoot ;
|
||||||
|
|
@ -382,10 +382,10 @@ void Item::SaveToDB()
|
||||||
// save items and quest items (at load its all will added as normal, but this not important for item loot case)
|
// save items and quest items (at load its all will added as normal, but this not important for item loot case)
|
||||||
for (size_t i = 0; i < loot.GetMaxSlotInLootFor(owner); ++i)
|
for (size_t i = 0; i < loot.GetMaxSlotInLootFor(owner); ++i)
|
||||||
{
|
{
|
||||||
QuestItem *qitem = NULL;
|
QuestItem* qitem = NULL;
|
||||||
|
|
||||||
LootItem *item = loot.LootItemInSlot(i,owner,&qitem);
|
LootItem* item = loot.LootItemInSlot(i, owner, &qitem);
|
||||||
if(!item)
|
if (!item)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// questitems use the blocked field for other purposes
|
// questitems use the blocked field for other purposes
|
||||||
|
|
@ -411,7 +411,7 @@ void Item::SaveToDB()
|
||||||
SetState(ITEM_UNCHANGED);
|
SetState(ITEM_UNCHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid)
|
bool Item::LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid)
|
||||||
{
|
{
|
||||||
// create item before any checks for store correct guid
|
// create item before any checks for store correct guid
|
||||||
// and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
|
// and allow use "FSetState(ITEM_REMOVED); SaveToDB();" for deleting item from DB
|
||||||
|
|
@ -436,23 +436,23 @@ bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemPrototype const* proto = GetProto();
|
ItemPrototype const* proto = GetProto();
|
||||||
if(!proto)
|
if (!proto)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// update max durability (and durability) if need
|
// update max durability (and durability) if need
|
||||||
if(proto->MaxDurability!= GetUInt32Value(ITEM_FIELD_MAXDURABILITY))
|
if (proto->MaxDurability!= GetUInt32Value(ITEM_FIELD_MAXDURABILITY))
|
||||||
{
|
{
|
||||||
SetUInt32Value(ITEM_FIELD_MAXDURABILITY,proto->MaxDurability);
|
SetUInt32Value(ITEM_FIELD_MAXDURABILITY, proto->MaxDurability);
|
||||||
if(GetUInt32Value(ITEM_FIELD_DURABILITY) > proto->MaxDurability)
|
if (GetUInt32Value(ITEM_FIELD_DURABILITY) > proto->MaxDurability)
|
||||||
SetUInt32Value(ITEM_FIELD_DURABILITY,proto->MaxDurability);
|
SetUInt32Value(ITEM_FIELD_DURABILITY, proto->MaxDurability);
|
||||||
|
|
||||||
need_save = true;
|
need_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// recalculate suffix factor
|
// recalculate suffix factor
|
||||||
if(GetItemRandomPropertyId() < 0)
|
if (GetItemRandomPropertyId() < 0)
|
||||||
{
|
{
|
||||||
if(UpdateItemSuffixFactor())
|
if (UpdateItemSuffixFactor())
|
||||||
need_save = true;
|
need_save = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -501,8 +501,8 @@ bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid)
|
||||||
SqlStatement stmt = CharacterDatabase.CreateStatement(updItem, "UPDATE item_instance SET data = ?, owner_guid = ? WHERE guid = ?");
|
SqlStatement stmt = CharacterDatabase.CreateStatement(updItem, "UPDATE item_instance SET data = ?, owner_guid = ? WHERE guid = ?");
|
||||||
|
|
||||||
std::ostringstream ss;
|
std::ostringstream ss;
|
||||||
for(uint16 i = 0; i < m_valuesCount; ++i )
|
for (uint16 i = 0; i < m_valuesCount; ++i)
|
||||||
ss << GetUInt32Value(i) << " ";
|
ss << GetUInt32Value(i) << "";
|
||||||
|
|
||||||
stmt.addString(ss);
|
stmt.addString(ss);
|
||||||
stmt.addUInt32(GetOwnerGuid().GetCounter());
|
stmt.addUInt32(GetOwnerGuid().GetCounter());
|
||||||
|
|
@ -513,7 +513,7 @@ bool Item::LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item::LoadLootFromDB(Field *fields)
|
void Item::LoadLootFromDB(Field* fields)
|
||||||
{
|
{
|
||||||
uint32 item_id = fields[1].GetUInt32();
|
uint32 item_id = fields[1].GetUInt32();
|
||||||
uint32 item_amount = fields[2].GetUInt32();
|
uint32 item_amount = fields[2].GetUInt32();
|
||||||
|
|
@ -531,7 +531,7 @@ void Item::LoadLootFromDB(Field *fields)
|
||||||
// normal item case
|
// normal item case
|
||||||
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(item_id);
|
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(item_id);
|
||||||
|
|
||||||
if(!proto)
|
if (!proto)
|
||||||
{
|
{
|
||||||
CharacterDatabase.PExecute("DELETE FROM item_loot WHERE guid = '%u' AND itemid = '%u'", GetGUIDLow(), item_id);
|
CharacterDatabase.PExecute("DELETE FROM item_loot WHERE guid = '%u' AND itemid = '%u'", GetGUIDLow(), item_id);
|
||||||
sLog.outError("Item::LoadLootFromDB: %s has an unknown item (id: #%u) in item_loot, deleted.", GetOwnerGuid().GetString().c_str(), item_id);
|
sLog.outError("Item::LoadLootFromDB: %s has an unknown item (id: #%u) in item_loot, deleted.", GetOwnerGuid().GetString().c_str(), item_id);
|
||||||
|
|
@ -560,7 +560,7 @@ void Item::DeleteFromInventoryDB()
|
||||||
stmt.PExecute(GetGUIDLow());
|
stmt.PExecute(GetGUIDLow());
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemPrototype const *Item::GetProto() const
|
ItemPrototype const* Item::GetProto() const
|
||||||
{
|
{
|
||||||
return ObjectMgr::GetItemPrototype(GetEntry());
|
return ObjectMgr::GetItemPrototype(GetEntry());
|
||||||
}
|
}
|
||||||
|
|
@ -583,7 +583,7 @@ uint32 Item::GetSkill()
|
||||||
|
|
||||||
const static uint32 item_armor_skills[MAX_ITEM_SUBCLASS_ARMOR] =
|
const static uint32 item_armor_skills[MAX_ITEM_SUBCLASS_ARMOR] =
|
||||||
{
|
{
|
||||||
0,SKILL_CLOTH,SKILL_LEATHER,SKILL_MAIL,SKILL_PLATE_MAIL,0,SKILL_SHIELD,0,0,0,0
|
0, SKILL_CLOTH, SKILL_LEATHER, SKILL_MAIL, SKILL_PLATE_MAIL, 0, SKILL_SHIELD, 0, 0, 0, 0
|
||||||
};
|
};
|
||||||
|
|
||||||
ItemPrototype const* proto = GetProto();
|
ItemPrototype const* proto = GetProto();
|
||||||
|
|
@ -591,13 +591,13 @@ uint32 Item::GetSkill()
|
||||||
switch (proto->Class)
|
switch (proto->Class)
|
||||||
{
|
{
|
||||||
case ITEM_CLASS_WEAPON:
|
case ITEM_CLASS_WEAPON:
|
||||||
if( proto->SubClass >= MAX_ITEM_SUBCLASS_WEAPON )
|
if (proto->SubClass >= MAX_ITEM_SUBCLASS_WEAPON)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return item_weapon_skills[proto->SubClass];
|
return item_weapon_skills[proto->SubClass];
|
||||||
|
|
||||||
case ITEM_CLASS_ARMOR:
|
case ITEM_CLASS_ARMOR:
|
||||||
if( proto->SubClass >= MAX_ITEM_SUBCLASS_ARMOR )
|
if (proto->SubClass >= MAX_ITEM_SUBCLASS_ARMOR)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
else
|
||||||
return item_armor_skills[proto->SubClass];
|
return item_armor_skills[proto->SubClass];
|
||||||
|
|
@ -634,7 +634,7 @@ uint32 Item::GetSpell()
|
||||||
default: return 0;
|
default: return 0;
|
||||||
}
|
}
|
||||||
case ITEM_CLASS_ARMOR:
|
case ITEM_CLASS_ARMOR:
|
||||||
switch(proto->SubClass)
|
switch (proto->SubClass)
|
||||||
{
|
{
|
||||||
case ITEM_SUBCLASS_ARMOR_CLOTH: return 9078;
|
case ITEM_SUBCLASS_ARMOR_CLOTH: return 9078;
|
||||||
case ITEM_SUBCLASS_ARMOR_LEATHER: return 9077;
|
case ITEM_SUBCLASS_ARMOR_LEATHER: return 9077;
|
||||||
|
|
@ -649,43 +649,43 @@ uint32 Item::GetSpell()
|
||||||
|
|
||||||
int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
|
int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
|
||||||
{
|
{
|
||||||
ItemPrototype const *itemProto = sItemStorage.LookupEntry<ItemPrototype>(item_id);
|
ItemPrototype const* itemProto = sItemStorage.LookupEntry<ItemPrototype>(item_id);
|
||||||
|
|
||||||
if(!itemProto)
|
if (!itemProto)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// item must have one from this field values not null if it can have random enchantments
|
// item must have one from this field values not null if it can have random enchantments
|
||||||
if((!itemProto->RandomProperty) && (!itemProto->RandomSuffix))
|
if ((!itemProto->RandomProperty) && (!itemProto->RandomSuffix))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// item can have not null only one from field values
|
// item can have not null only one from field values
|
||||||
if((itemProto->RandomProperty) && (itemProto->RandomSuffix))
|
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);
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// RandomProperty case
|
// Random Property case
|
||||||
if(itemProto->RandomProperty)
|
if (itemProto->RandomProperty)
|
||||||
{
|
{
|
||||||
uint32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty);
|
uint32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty);
|
||||||
ItemRandomPropertiesEntry const *random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId);
|
ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId);
|
||||||
if(!random_id)
|
if (!random_id)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'",randomPropId);
|
sLog.outErrorDb("Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return random_id->ID;
|
return random_id->ID;
|
||||||
}
|
}
|
||||||
// RandomSuffix case
|
// Random Suffix case
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
uint32 randomPropId = GetItemEnchantMod(itemProto->RandomSuffix);
|
uint32 randomPropId = GetItemEnchantMod(itemProto->RandomSuffix);
|
||||||
ItemRandomSuffixEntry const *random_id = sItemRandomSuffixStore.LookupEntry(randomPropId);
|
ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId);
|
||||||
if(!random_id)
|
if (!random_id)
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.",randomPropId);
|
sLog.outErrorDb("Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -695,38 +695,38 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
|
||||||
|
|
||||||
void Item::SetItemRandomProperties(int32 randomPropId)
|
void Item::SetItemRandomProperties(int32 randomPropId)
|
||||||
{
|
{
|
||||||
if(!randomPropId)
|
if (!randomPropId)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(randomPropId > 0)
|
if (randomPropId > 0)
|
||||||
{
|
{
|
||||||
ItemRandomPropertiesEntry const *item_rand = sItemRandomPropertiesStore.LookupEntry(randomPropId);
|
ItemRandomPropertiesEntry const* item_rand = sItemRandomPropertiesStore.LookupEntry(randomPropId);
|
||||||
if(item_rand)
|
if (item_rand)
|
||||||
{
|
{
|
||||||
if(GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != int32(item_rand->ID))
|
if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != int32(item_rand->ID))
|
||||||
{
|
{
|
||||||
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID,item_rand->ID);
|
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID,item_rand->ID);
|
||||||
SetState(ITEM_CHANGED);
|
SetState(ITEM_CHANGED);
|
||||||
}
|
}
|
||||||
for(uint32 i = PROP_ENCHANTMENT_SLOT_2; i < PROP_ENCHANTMENT_SLOT_2 + 3; ++i)
|
for (uint32 i = PROP_ENCHANTMENT_SLOT_2; i < PROP_ENCHANTMENT_SLOT_2 + 3; ++i)
|
||||||
SetEnchantment(EnchantmentSlot(i),item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_2],0,0);
|
SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_2], 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ItemRandomSuffixEntry const *item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId);
|
ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId);
|
||||||
if(item_rand)
|
if (item_rand)
|
||||||
{
|
{
|
||||||
if( GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != -int32(item_rand->ID) ||
|
if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != -int32(item_rand->ID) ||
|
||||||
!GetItemSuffixFactor())
|
!GetItemSuffixFactor())
|
||||||
{
|
{
|
||||||
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID,-int32(item_rand->ID));
|
SetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID, -int32(item_rand->ID));
|
||||||
UpdateItemSuffixFactor();
|
UpdateItemSuffixFactor();
|
||||||
SetState(ITEM_CHANGED);
|
SetState(ITEM_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint32 i = PROP_ENCHANTMENT_SLOT_0; i < PROP_ENCHANTMENT_SLOT_0 + 3; ++i)
|
for (uint32 i = PROP_ENCHANTMENT_SLOT_0; i < PROP_ENCHANTMENT_SLOT_0 + 3; ++i)
|
||||||
SetEnchantment(EnchantmentSlot(i),item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_0],0,0);
|
SetEnchantment(EnchantmentSlot(i), item_rand->enchant_id[i - PROP_ENCHANTMENT_SLOT_0], 0, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -734,13 +734,13 @@ void Item::SetItemRandomProperties(int32 randomPropId)
|
||||||
bool Item::UpdateItemSuffixFactor()
|
bool Item::UpdateItemSuffixFactor()
|
||||||
{
|
{
|
||||||
uint32 suffixFactor = GenerateEnchSuffixFactor(GetEntry());
|
uint32 suffixFactor = GenerateEnchSuffixFactor(GetEntry());
|
||||||
if(GetItemSuffixFactor()==suffixFactor)
|
if (GetItemSuffixFactor() == suffixFactor)
|
||||||
return false;
|
return false;
|
||||||
SetUInt32Value(ITEM_FIELD_PROPERTY_SEED,suffixFactor);
|
SetUInt32Value(ITEM_FIELD_PROPERTY_SEED,suffixFactor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item::SetState(ItemUpdateState state, Player *forplayer)
|
void Item::SetState(ItemUpdateState state, Player* forplayer)
|
||||||
{
|
{
|
||||||
if (uState == ITEM_NEW && state == ITEM_REMOVED)
|
if (uState == ITEM_NEW && state == ITEM_REMOVED)
|
||||||
{
|
{
|
||||||
|
|
@ -765,7 +765,7 @@ void Item::SetState(ItemUpdateState state, Player *forplayer)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item::AddToUpdateQueueOf(Player *player)
|
void Item::AddToUpdateQueueOf(Player* player)
|
||||||
{
|
{
|
||||||
if (IsInUpdateQueue())
|
if (IsInUpdateQueue())
|
||||||
return;
|
return;
|
||||||
|
|
@ -792,10 +792,10 @@ void Item::AddToUpdateQueueOf(Player *player)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
player->m_itemUpdateQueue.push_back(this);
|
player->m_itemUpdateQueue.push_back(this);
|
||||||
uQueuePos = player->m_itemUpdateQueue.size()-1;
|
uQueuePos = player->m_itemUpdateQueue.size() -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item::RemoveFromUpdateQueueOf(Player *player)
|
void Item::RemoveFromUpdateQueueOf(Player* player)
|
||||||
{
|
{
|
||||||
if (!IsInUpdateQueue())
|
if (!IsInUpdateQueue())
|
||||||
return;
|
return;
|
||||||
|
|
@ -845,7 +845,7 @@ bool Item::CanBeTraded(bool mail) const
|
||||||
|
|
||||||
if (Player* owner = GetOwner())
|
if (Player* owner = GetOwner())
|
||||||
{
|
{
|
||||||
if (owner->CanUnequipItem(GetPos(),false) != EQUIP_ERR_OK )
|
if (owner->CanUnequipItem(GetPos(), false) != EQUIP_ERR_OK )
|
||||||
return false;
|
return false;
|
||||||
if (owner->GetLootGuid() == GetObjectGuid())
|
if (owner->GetLootGuid() == GetObjectGuid())
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -863,17 +863,17 @@ bool Item::CanBeTraded(bool mail) const
|
||||||
bool Item::IsBoundByEnchant() const
|
bool Item::IsBoundByEnchant() const
|
||||||
{
|
{
|
||||||
// Check all enchants for soulbound
|
// Check all enchants for soulbound
|
||||||
for(uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
|
for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
|
||||||
{
|
{
|
||||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||||
if(!enchant_id)
|
if (!enchant_id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||||
if(!enchantEntry)
|
if (!enchantEntry)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(enchantEntry->slot & ENCHANTMENT_CAN_SOULBOUND)
|
if (enchantEntry->slot & ENCHANTMENT_CAN_SOULBOUND)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -896,12 +896,12 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
|
||||||
|
|
||||||
if (spellInfo->EquippedItemClass != -1) // -1 == any item class
|
if (spellInfo->EquippedItemClass != -1) // -1 == any item class
|
||||||
{
|
{
|
||||||
if(spellInfo->EquippedItemClass != int32(proto->Class))
|
if (spellInfo->EquippedItemClass != int32(proto->Class))
|
||||||
return false; // wrong item class
|
return false; // wrong item class
|
||||||
|
|
||||||
if(spellInfo->EquippedItemSubClassMask != 0) // 0 == any subclass
|
if (spellInfo->EquippedItemSubClassMask != 0) // 0 == any subclass
|
||||||
{
|
{
|
||||||
if((spellInfo->EquippedItemSubClassMask & (1 << proto->SubClass)) == 0)
|
if ((spellInfo->EquippedItemSubClassMask & (1 << proto->SubClass)) == 0)
|
||||||
return false; // subclass not present in mask
|
return false; // subclass not present in mask
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -909,9 +909,9 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
|
||||||
// Only check for item enchantments (TARGET_FLAG_ITEM), all other spells are either NPC spells
|
// Only check for item enchantments (TARGET_FLAG_ITEM), all other spells are either NPC spells
|
||||||
// or spells where slot requirements are already handled with AttributesEx3 fields
|
// or spells where slot requirements are already handled with AttributesEx3 fields
|
||||||
// and special code (Titan's Grip, Windfury Attack). Check clearly not applicable for Lava Lash.
|
// and special code (Titan's Grip, Windfury Attack). Check clearly not applicable for Lava Lash.
|
||||||
if(spellInfo->EquippedItemInventoryTypeMask != 0 && (spellInfo->Targets & TARGET_FLAG_ITEM)) // 0 == any inventory type
|
if (spellInfo->EquippedItemInventoryTypeMask != 0 && (spellInfo->Targets & TARGET_FLAG_ITEM)) // 0 == any inventory type
|
||||||
{
|
{
|
||||||
if((spellInfo->EquippedItemInventoryTypeMask & (1 << proto->InventoryType)) == 0)
|
if ((spellInfo->EquippedItemInventoryTypeMask & (1 << proto->InventoryType)) == 0)
|
||||||
return false; // inventory type not present in mask
|
return false; // inventory type not present in mask
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -928,8 +928,8 @@ bool Item::IsTargetValidForItemUse(Unit* pUnitTarget)
|
||||||
if (!pUnitTarget)
|
if (!pUnitTarget)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for(ItemRequiredTargetMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
for (ItemRequiredTargetMap::const_iterator itr = bounds.first; itr != bounds.second; ++itr)
|
||||||
if(itr->second.IsFitToRequirements(pUnitTarget))
|
if (itr->second.IsFitToRequirements(pUnitTarget))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -938,74 +938,74 @@ bool Item::IsTargetValidForItemUse(Unit* pUnitTarget)
|
||||||
void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges)
|
void Item::SetEnchantment(EnchantmentSlot slot, uint32 id, uint32 duration, uint32 charges)
|
||||||
{
|
{
|
||||||
// Better lost small time at check in comparison lost time at item save to DB.
|
// Better lost small time at check in comparison lost time at item save to DB.
|
||||||
if((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
|
if ((GetEnchantmentId(slot) == id) && (GetEnchantmentDuration(slot) == duration) && (GetEnchantmentCharges(slot) == charges))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET,id);
|
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET, id);
|
||||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET,duration);
|
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET, duration);
|
||||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET,charges);
|
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET, charges);
|
||||||
SetState(ITEM_CHANGED);
|
SetState(ITEM_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration)
|
void Item::SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration)
|
||||||
{
|
{
|
||||||
if(GetEnchantmentDuration(slot) == duration)
|
if (GetEnchantmentDuration(slot) == duration)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET,duration);
|
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET, duration);
|
||||||
SetState(ITEM_CHANGED);
|
SetState(ITEM_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item::SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges)
|
void Item::SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges)
|
||||||
{
|
{
|
||||||
if(GetEnchantmentCharges(slot) == charges)
|
if (GetEnchantmentCharges(slot) == charges)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET,charges);
|
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET, charges);
|
||||||
SetState(ITEM_CHANGED);
|
SetState(ITEM_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item::ClearEnchantment(EnchantmentSlot slot)
|
void Item::ClearEnchantment(EnchantmentSlot slot)
|
||||||
{
|
{
|
||||||
if(!GetEnchantmentId(slot))
|
if (!GetEnchantmentId(slot))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(uint8 x = 0; x < 3; ++x)
|
for (uint8 x = 0; x < 3; ++x)
|
||||||
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + x, 0);
|
SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + x, 0);
|
||||||
SetState(ITEM_CHANGED);
|
SetState(ITEM_CHANGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item::GemsFitSockets() const
|
bool Item::GemsFitSockets() const
|
||||||
{
|
{
|
||||||
bool fits = true;
|
bool fits = true;
|
||||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||||
{
|
{
|
||||||
uint8 SocketColor = GetProto()->Socket[enchant_slot-SOCK_ENCHANTMENT_SLOT].Color;
|
uint8 SocketColor = GetProto()->Socket[enchant_slot-SOCK_ENCHANTMENT_SLOT].Color;
|
||||||
|
|
||||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||||
if(!enchant_id)
|
if (!enchant_id)
|
||||||
{
|
{
|
||||||
if(SocketColor) fits &= false;
|
if (SocketColor) fits &= false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||||
if(!enchantEntry)
|
if (!enchantEntry)
|
||||||
{
|
{
|
||||||
if(SocketColor) fits &= false;
|
if (SocketColor) fits &= false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 GemColor = 0;
|
uint8 GemColor = 0;
|
||||||
|
|
||||||
uint32 gemid = enchantEntry->GemID;
|
uint32 gemid = enchantEntry->GemID;
|
||||||
if(gemid)
|
if (gemid)
|
||||||
{
|
{
|
||||||
ItemPrototype const* gemProto = sItemStorage.LookupEntry<ItemPrototype>(gemid);
|
ItemPrototype const* gemProto = sItemStorage.LookupEntry<ItemPrototype>(gemid);
|
||||||
if(gemProto)
|
if (gemProto)
|
||||||
{
|
{
|
||||||
GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties);
|
GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties);
|
||||||
if(gemProperty)
|
if (gemProperty)
|
||||||
GemColor = gemProperty->color;
|
GemColor = gemProperty->color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1018,17 +1018,17 @@ bool Item::GemsFitSockets() const
|
||||||
uint8 Item::GetGemCountWithID(uint32 GemID) const
|
uint8 Item::GetGemCountWithID(uint32 GemID) const
|
||||||
{
|
{
|
||||||
uint8 count = 0;
|
uint8 count = 0;
|
||||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||||
{
|
{
|
||||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||||
if(!enchant_id)
|
if (!enchant_id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||||
if(!enchantEntry)
|
if (!enchantEntry)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(GemID == enchantEntry->GemID)
|
if (GemID == enchantEntry->GemID)
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
|
|
@ -1037,27 +1037,27 @@ uint8 Item::GetGemCountWithID(uint32 GemID) const
|
||||||
uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const
|
uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const
|
||||||
{
|
{
|
||||||
uint8 count = 0;
|
uint8 count = 0;
|
||||||
for(uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
|
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||||
{
|
{
|
||||||
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
|
||||||
if(!enchant_id)
|
if (!enchant_id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
|
||||||
if(!enchantEntry)
|
if (!enchantEntry)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ItemPrototype const* gemProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID);
|
ItemPrototype const* gemProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID);
|
||||||
if(!gemProto)
|
if (!gemProto)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(gemProto->ItemLimitCategory==limitCategory)
|
if (gemProto->ItemLimitCategory == limitCategory)
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item::IsLimitedToAnotherMapOrZone( uint32 cur_mapId, uint32 cur_zoneId) const
|
bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const
|
||||||
{
|
{
|
||||||
ItemPrototype const* proto = GetProto();
|
ItemPrototype const* proto = GetProto();
|
||||||
return proto && ((proto->Map && proto->Map != cur_mapId) || (proto->Area && proto->Area != cur_zoneId));
|
return proto && ((proto->Map && proto->Map != cur_mapId) || (proto->Area && proto->Area != cur_zoneId));
|
||||||
|
|
@ -1072,7 +1072,7 @@ void Item::SendTimeUpdate(Player* owner)
|
||||||
if (!duration)
|
if (!duration)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8+4));
|
WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8 + 4));
|
||||||
data << ObjectGuid(GetObjectGuid());
|
data << ObjectGuid(GetObjectGuid());
|
||||||
data << uint32(duration);
|
data << uint32(duration);
|
||||||
owner->GetSession()->SendPacket(&data);
|
owner->GetSession()->SendPacket(&data);
|
||||||
|
|
@ -1083,17 +1083,17 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player )
|
||||||
if (count < 1)
|
if (count < 1)
|
||||||
return NULL; //don't create item at zero count
|
return NULL; //don't create item at zero count
|
||||||
|
|
||||||
if (ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item))
|
if (ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(item))
|
||||||
{
|
{
|
||||||
if (count > pProto->GetMaxStackSize())
|
if (count > pProto->GetMaxStackSize())
|
||||||
count = pProto->GetMaxStackSize();
|
count = pProto->GetMaxStackSize();
|
||||||
|
|
||||||
MANGOS_ASSERT(count !=0 && "pProto->Stackable==0 but checked at loading already");
|
MANGOS_ASSERT(count != 0 && "pProto->Stackable == 0 but checked at loading already");
|
||||||
|
|
||||||
Item *pItem = NewItemOrBag( pProto );
|
Item* pItem = NewItemOrBag(pProto);
|
||||||
if (pItem->Create(sObjectMgr.GenerateItemLowGuid(), item, player) )
|
if (pItem->Create(sObjectMgr.GenerateItemLowGuid(), item, player))
|
||||||
{
|
{
|
||||||
pItem->SetCount( count );
|
pItem->SetCount(count);
|
||||||
return pItem;
|
return pItem;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -1102,10 +1102,10 @@ Item* Item::CreateItem( uint32 item, uint32 count, Player const* player )
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item* Item::CloneItem( uint32 count, Player const* player ) const
|
Item* Item::CloneItem(uint32 count, Player const* player) const
|
||||||
{
|
{
|
||||||
Item* newItem = CreateItem( GetEntry(), count, player );
|
Item* newItem = CreateItem(GetEntry(), count, player);
|
||||||
if(!newItem)
|
if (!newItem)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
newItem->SetGuidValue(ITEM_FIELD_CREATOR, GetGuidValue(ITEM_FIELD_CREATOR));
|
newItem->SetGuidValue(ITEM_FIELD_CREATOR, GetGuidValue(ITEM_FIELD_CREATOR));
|
||||||
|
|
@ -1116,7 +1116,7 @@ Item* Item::CloneItem( uint32 count, Player const* player ) const
|
||||||
return newItem;
|
return newItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item::IsBindedNotWith( Player const* player ) const
|
bool Item::IsBindedNotWith(Player const* player) const
|
||||||
{
|
{
|
||||||
// own item
|
// own item
|
||||||
if (GetOwnerGuid() == player->GetObjectGuid())
|
if (GetOwnerGuid() == player->GetObjectGuid())
|
||||||
|
|
@ -1166,7 +1166,7 @@ void Item::BuildUpdateData(UpdateDataMapType& update_players)
|
||||||
ClearUpdateMask(false);
|
ClearUpdateMask(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryResult Item::CanBeMergedPartlyWith( ItemPrototype const* proto ) const
|
InventoryResult Item::CanBeMergedPartlyWith(ItemPrototype const* proto) const
|
||||||
{
|
{
|
||||||
// check item type
|
// check item type
|
||||||
if (GetEntry() != proto->ItemId)
|
if (GetEntry() != proto->ItemId)
|
||||||
|
|
@ -1183,15 +1183,15 @@ InventoryResult Item::CanBeMergedPartlyWith( ItemPrototype const* proto ) const
|
||||||
return EQUIP_ERR_OK;
|
return EQUIP_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ItemRequiredTarget::IsFitToRequirements( Unit* pUnitTarget ) const
|
bool ItemRequiredTarget::IsFitToRequirements(Unit* pUnitTarget) const
|
||||||
{
|
{
|
||||||
if(pUnitTarget->GetTypeId() != TYPEID_UNIT)
|
if (pUnitTarget->GetTypeId() != TYPEID_UNIT)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if(pUnitTarget->GetEntry() != m_uiTargetEntry)
|
if (pUnitTarget->GetEntry() != m_uiTargetEntry)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
switch(m_uiType)
|
switch (m_uiType)
|
||||||
{
|
{
|
||||||
case ITEM_TARGET_TYPE_CREATURE:
|
case ITEM_TARGET_TYPE_CREATURE:
|
||||||
return pUnitTarget->isAlive();
|
return pUnitTarget->isAlive();
|
||||||
|
|
@ -1206,7 +1206,7 @@ bool Item::HasMaxCharges() const
|
||||||
{
|
{
|
||||||
ItemPrototype const* itemProto = GetProto();
|
ItemPrototype const* itemProto = GetProto();
|
||||||
|
|
||||||
for(int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||||
if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges)
|
if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -1217,7 +1217,7 @@ void Item::RestoreCharges()
|
||||||
{
|
{
|
||||||
ItemPrototype const* itemProto = GetProto();
|
ItemPrototype const* itemProto = GetProto();
|
||||||
|
|
||||||
for(int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
|
||||||
{
|
{
|
||||||
if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges)
|
if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges)
|
||||||
{
|
{
|
||||||
|
|
@ -1227,12 +1227,12 @@ void Item::RestoreCharges()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Item::SetLootState( ItemLootUpdateState state )
|
void Item::SetLootState(ItemLootUpdateState state)
|
||||||
{
|
{
|
||||||
// ITEM_LOOT_NONE -> ITEM_LOOT_TEMPORARY -> ITEM_LOOT_NONE
|
// ITEM_LOOT_NONE -> ITEM_LOOT_TEMPORARY -> ITEM_LOOT_NONE
|
||||||
// ITEM_LOOT_NONE -> ITEM_LOOT_NEW -> ITEM_LOOT_NONE
|
// ITEM_LOOT_NONE -> ITEM_LOOT_NEW -> ITEM_LOOT_NONE
|
||||||
// ITEM_LOOT_NONE -> ITEM_LOOT_NEW -> ITEM_LOOT_UNCHANGED [<-> ITEM_LOOT_CHANGED] -> ITEM_LOOT_REMOVED -> ITEM_LOOT_NONE
|
// ITEM_LOOT_NONE -> ITEM_LOOT_NEW -> ITEM_LOOT_UNCHANGED [<-> ITEM_LOOT_CHANGED] -> ITEM_LOOT_REMOVED -> ITEM_LOOT_NONE
|
||||||
switch(state)
|
switch (state)
|
||||||
{
|
{
|
||||||
case ITEM_LOOT_NONE:
|
case ITEM_LOOT_NONE:
|
||||||
case ITEM_LOOT_NEW:
|
case ITEM_LOOT_NEW:
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ struct ItemSetEffect
|
||||||
{
|
{
|
||||||
uint32 setid;
|
uint32 setid;
|
||||||
uint32 item_count;
|
uint32 item_count;
|
||||||
SpellEntry const *spells[8];
|
SpellEntry const* spells[8];
|
||||||
};
|
};
|
||||||
|
|
||||||
enum InventoryResult
|
enum InventoryResult
|
||||||
|
|
@ -273,16 +273,16 @@ bool ItemCanGoIntoBag(ItemPrototype const *proto, ItemPrototype const *pBagProto
|
||||||
class MANGOS_DLL_SPEC Item : public Object
|
class MANGOS_DLL_SPEC Item : public Object
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Item* CreateItem( uint32 item, uint32 count, Player const* player = NULL );
|
static Item* CreateItem(uint32 item, uint32 count, Player const* player = NULL);
|
||||||
Item* CloneItem( uint32 count, Player const* player = NULL ) const;
|
Item* CloneItem( uint32 count, Player const* player = NULL ) const;
|
||||||
|
|
||||||
Item ( );
|
Item();
|
||||||
|
|
||||||
virtual bool Create( uint32 guidlow, uint32 itemid, Player const* owner);
|
virtual bool Create( uint32 guidlow, uint32 itemid, Player const* owner);
|
||||||
|
|
||||||
ItemPrototype const* GetProto() const;
|
ItemPrototype const* GetProto() const;
|
||||||
|
|
||||||
ObjectGuid const& GetOwnerGuid() const { return GetGuidValue(ITEM_FIELD_OWNER); }
|
ObjectGuid const& GetOwnerGuid() const { return GetGuidValue(ITEM_FIELD_OWNER); }
|
||||||
void SetOwnerGuid(ObjectGuid guid) { SetGuidValue(ITEM_FIELD_OWNER, guid); }
|
void SetOwnerGuid(ObjectGuid guid) { SetGuidValue(ITEM_FIELD_OWNER, guid); }
|
||||||
Player* GetOwner()const;
|
Player* GetOwner()const;
|
||||||
|
|
||||||
|
|
@ -292,10 +292,10 @@ class MANGOS_DLL_SPEC Item : public Object
|
||||||
bool IsBindedNotWith(Player const* player) const;
|
bool IsBindedNotWith(Player const* player) const;
|
||||||
bool IsBoundByEnchant() const;
|
bool IsBoundByEnchant() const;
|
||||||
virtual void SaveToDB();
|
virtual void SaveToDB();
|
||||||
virtual bool LoadFromDB(uint32 guidLow, Field *fields, ObjectGuid ownerGuid = ObjectGuid());
|
virtual bool LoadFromDB(uint32 guidLow, Field* fields, ObjectGuid ownerGuid = ObjectGuid());
|
||||||
virtual void DeleteFromDB();
|
virtual void DeleteFromDB();
|
||||||
void DeleteFromInventoryDB();
|
void DeleteFromInventoryDB();
|
||||||
void LoadLootFromDB(Field *fields);
|
void LoadLootFromDB(Field* fields);
|
||||||
|
|
||||||
bool IsBag() const { return GetProto()->InventoryType == INVTYPE_BAG; }
|
bool IsBag() const { return GetProto()->InventoryType == INVTYPE_BAG; }
|
||||||
bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
|
bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
|
||||||
|
|
@ -305,7 +305,7 @@ class MANGOS_DLL_SPEC Item : public Object
|
||||||
|
|
||||||
bool IsFitToSpellRequirements(SpellEntry const* spellInfo) const;
|
bool IsFitToSpellRequirements(SpellEntry const* spellInfo) const;
|
||||||
bool IsTargetValidForItemUse(Unit* pUnitTarget);
|
bool IsTargetValidForItemUse(Unit* pUnitTarget);
|
||||||
bool IsLimitedToAnotherMapOrZone( uint32 cur_mapId, uint32 cur_zoneId) const;
|
bool IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const;
|
||||||
bool GemsFitSockets() const;
|
bool GemsFitSockets() const;
|
||||||
|
|
||||||
uint32 GetCount() const { return GetUInt32Value (ITEM_FIELD_STACK_COUNT); }
|
uint32 GetCount() const { return GetUInt32Value (ITEM_FIELD_STACK_COUNT); }
|
||||||
|
|
@ -316,7 +316,7 @@ class MANGOS_DLL_SPEC Item : public Object
|
||||||
InventoryResult CanBeMergedPartlyWith(ItemPrototype const* proto) const;
|
InventoryResult CanBeMergedPartlyWith(ItemPrototype const* proto) const;
|
||||||
|
|
||||||
uint8 GetSlot() const {return m_slot;}
|
uint8 GetSlot() const {return m_slot;}
|
||||||
Bag *GetContainer() { return m_container; }
|
Bag* GetContainer() { return m_container; }
|
||||||
uint8 GetBagSlot() const;
|
uint8 GetBagSlot() const;
|
||||||
void SetSlot(uint8 slot) {m_slot = slot;}
|
void SetSlot(uint8 slot) {m_slot = slot;}
|
||||||
uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); }
|
uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); }
|
||||||
|
|
@ -338,9 +338,9 @@ class MANGOS_DLL_SPEC Item : public Object
|
||||||
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration);
|
void SetEnchantmentDuration(EnchantmentSlot slot, uint32 duration);
|
||||||
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges);
|
void SetEnchantmentCharges(EnchantmentSlot slot, uint32 charges);
|
||||||
void ClearEnchantment(EnchantmentSlot slot);
|
void ClearEnchantment(EnchantmentSlot slot);
|
||||||
uint32 GetEnchantmentId(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET);}
|
uint32 GetEnchantmentId(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_ID_OFFSET);}
|
||||||
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET);}
|
uint32 GetEnchantmentDuration(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_DURATION_OFFSET);}
|
||||||
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot*MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET);}
|
uint32 GetEnchantmentCharges(EnchantmentSlot slot) const { return GetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1 + slot * MAX_ENCHANTMENT_OFFSET + ENCHANTMENT_CHARGES_OFFSET);}
|
||||||
|
|
||||||
std::string const& GetText() const { return m_text; }
|
std::string const& GetText() const { return m_text; }
|
||||||
void SetText(std::string const& text) { m_text = text; }
|
void SetText(std::string const& text) { m_text = text; }
|
||||||
|
|
@ -350,7 +350,7 @@ class MANGOS_DLL_SPEC Item : public Object
|
||||||
|
|
||||||
// spell charges (signed but stored as unsigned)
|
// spell charges (signed but stored as unsigned)
|
||||||
int32 GetSpellCharges(uint8 index/*0..5*/ = 0) const { return GetInt32Value(ITEM_FIELD_SPELL_CHARGES + index); }
|
int32 GetSpellCharges(uint8 index/*0..5*/ = 0) const { return GetInt32Value(ITEM_FIELD_SPELL_CHARGES + index); }
|
||||||
void SetSpellCharges(uint8 index/*0..5*/, int32 value) { SetInt32Value(ITEM_FIELD_SPELL_CHARGES + index,value); }
|
void SetSpellCharges(uint8 index/*0..5*/, int32 value) { SetInt32Value(ITEM_FIELD_SPELL_CHARGES + index,value); }
|
||||||
bool HasMaxCharges() const;
|
bool HasMaxCharges() const;
|
||||||
void RestoreCharges();
|
void RestoreCharges();
|
||||||
|
|
||||||
|
|
@ -364,9 +364,9 @@ class MANGOS_DLL_SPEC Item : public Object
|
||||||
|
|
||||||
// Update States
|
// Update States
|
||||||
ItemUpdateState GetState() const { return uState; }
|
ItemUpdateState GetState() const { return uState; }
|
||||||
void SetState(ItemUpdateState state, Player *forplayer = NULL);
|
void SetState(ItemUpdateState state, Player* forplayer = NULL);
|
||||||
void AddToUpdateQueueOf(Player *player);
|
void AddToUpdateQueueOf(Player* player);
|
||||||
void RemoveFromUpdateQueueOf(Player *player);
|
void RemoveFromUpdateQueueOf(Player* player);
|
||||||
bool IsInUpdateQueue() const { return uQueuePos != -1; }
|
bool IsInUpdateQueue() const { return uQueuePos != -1; }
|
||||||
uint16 GetQueuePos() const { return uQueuePos; }
|
uint16 GetQueuePos() const { return uQueuePos; }
|
||||||
void FSetState(ItemUpdateState state) // forced
|
void FSetState(ItemUpdateState state) // forced
|
||||||
|
|
@ -385,7 +385,7 @@ class MANGOS_DLL_SPEC Item : public Object
|
||||||
private:
|
private:
|
||||||
std::string m_text;
|
std::string m_text;
|
||||||
uint8 m_slot;
|
uint8 m_slot;
|
||||||
Bag *m_container;
|
Bag* m_container;
|
||||||
ItemUpdateState uState;
|
ItemUpdateState uState;
|
||||||
int16 uQueuePos;
|
int16 uQueuePos;
|
||||||
bool mb_in_trade; // true if item is currently in trade-window
|
bool mb_in_trade; // true if item is currently in trade-window
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11611"
|
#define REVISION_NR "11612"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue