Core/ObjectMgr: Refactor sItemStorage

This commit is contained in:
leak
2011-04-28 22:42:33 +02:00
parent 03365e9a57
commit a82654debd
49 changed files with 785 additions and 639 deletions
@@ -2322,7 +2322,7 @@ uint32 Creature::GetVendorItemCurrentCount(VendorItem const* vItem)
if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
{
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(vItem->item);
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item);
uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
if ((vCount->count + diff * pProto->BuyCount) >= vItem->maxcount)
@@ -2361,7 +2361,7 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
if (time_t(vCount->lastIncrementTime + vItem->incrtime) <= ptime)
{
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(vItem->item);
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(vItem->item);
uint32 diff = uint32((ptime - vCount->lastIncrementTime)/vItem->incrtime);
if ((vCount->count + diff * pProto->BuyCount) < vItem->maxcount)
+1 -1
View File
@@ -332,7 +332,7 @@ struct VendorItem
uint32 ExtendedCost;
//helpers
bool IsGoldRequired(ItemPrototype const* pProto) const { return pProto->Flags2 & ITEM_FLAGS_EXTRA_EXT_COST_REQUIRES_GOLD || !ExtendedCost; }
bool IsGoldRequired(ItemTemplate const* pProto) const { return pProto->Flags2 & ITEM_FLAGS_EXTRA_EXT_COST_REQUIRES_GOLD || !ExtendedCost; }
};
typedef std::vector<VendorItem*> VendorItemList;
@@ -365,7 +365,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID,
}
else
{
ItemPrototype const* IProto;
ItemTemplate const* IProto;
data << uint32(pQuest->GetRewChoiceItemsCount());
for (uint32 i=0; i < QUEST_REWARD_CHOICES_COUNT; ++i)
@@ -376,7 +376,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID,
data << uint32(pQuest->RewChoiceItemId[i]);
data << uint32(pQuest->RewChoiceItemCount[i]);
IProto = ObjectMgr::GetItemPrototype(pQuest->RewChoiceItemId[i]);
IProto = sObjectMgr->GetItemTemplate(pQuest->RewChoiceItemId[i]);
if (IProto)
data << uint32(IProto->DisplayInfoID);
@@ -394,7 +394,7 @@ void PlayerMenu::SendQuestGiverQuestDetails(Quest const *pQuest, uint64 npcGUID,
data << uint32(pQuest->RewItemId[i]);
data << uint32(pQuest->RewItemCount[i]);
IProto = ObjectMgr::GetItemPrototype(pQuest->RewItemId[i]);
IProto = sObjectMgr->GetItemTemplate(pQuest->RewItemId[i]);
if (IProto)
data << uint32(IProto->DisplayInfoID);
@@ -617,12 +617,12 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, uint64 npcGUID,
data << uint32(pQuest->OfferRewardEmote[i]);
}
ItemPrototype const *pItem;
ItemTemplate const *pItem;
data << uint32(pQuest->GetRewChoiceItemsCount());
for (uint32 i=0; i < pQuest->GetRewChoiceItemsCount(); ++i)
{
pItem = ObjectMgr::GetItemPrototype(pQuest->RewChoiceItemId[i]);
pItem = sObjectMgr->GetItemTemplate(pQuest->RewChoiceItemId[i]);
data << uint32(pQuest->RewChoiceItemId[i]);
data << uint32(pQuest->RewChoiceItemCount[i]);
@@ -636,7 +636,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* pQuest, uint64 npcGUID,
data << uint32(pQuest->GetRewItemsCount());
for (uint32 i = 0; i < pQuest->GetRewItemsCount(); ++i)
{
pItem = ObjectMgr::GetItemPrototype(pQuest->RewItemId[i]);
pItem = sObjectMgr->GetItemTemplate(pQuest->RewItemId[i]);
data << uint32(pQuest->RewItemId[i]);
data << uint32(pQuest->RewItemCount[i]);
@@ -723,13 +723,13 @@ void PlayerMenu::SendQuestGiverRequestItems(Quest const *pQuest, uint64 npcGUID,
data << uint32(pQuest->GetRewOrReqMoney() < 0 ? -pQuest->GetRewOrReqMoney() : 0);
data << uint32(pQuest->GetReqItemsCount());
ItemPrototype const *pItem;
ItemTemplate const *pItem;
for (int i = 0; i < QUEST_ITEM_OBJECTIVES_COUNT; ++i)
{
if (!pQuest->ReqItemId[i])
continue;
pItem = ObjectMgr::GetItemPrototype(pQuest->ReqItemId[i]);
pItem = sObjectMgr->GetItemTemplate(pQuest->ReqItemId[i]);
data << uint32(pQuest->ReqItemId[i]);
data << uint32(pQuest->ReqItemCount[i]);
@@ -70,7 +70,7 @@ void Bag::RemoveFromWorld()
bool Bag::Create(uint32 guidlow, uint32 itemid, Player const* owner)
{
ItemPrototype const * itemProto = ObjectMgr::GetItemPrototype(itemid);
ItemTemplate const * itemProto = sObjectMgr->GetItemTemplate(itemid);
if (!itemProto || itemProto->ContainerSlots > MAX_BAG_SIZE)
return false;
@@ -110,7 +110,7 @@ bool Bag::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entry
if (!Item::LoadFromDB(guid, owner_guid, fields, entry))
return false;
ItemPrototype const* itemProto = GetProto(); // checked in Item::LoadFromDB
ItemTemplate const* itemProto = GetTemplate(); // checked in Item::LoadFromDB
SetUInt32Value(CONTAINER_FIELD_NUM_SLOTS, itemProto->ContainerSlots);
// cleanup bag content related item value fields (its will be filled correctly from `character_inventory`)
for (uint8 i = 0; i < MAX_BAG_SIZE; ++i)
@@ -198,12 +198,12 @@ uint32 Bag::GetItemCount(uint32 item, Item* eItem) const
count += pItem->GetCount();
}
if (eItem && eItem->GetProto()->GemProperties)
if (eItem && eItem->GetTemplate()->GemProperties)
{
for (uint32 i=0; i < GetBagSize(); ++i)
{
pItem = m_bagslot[i];
if (pItem && pItem != eItem && pItem->GetProto()->Socket[0].Color)
if (pItem && pItem != eItem && pItem->GetTemplate()->Socket[0].Color)
count += pItem->GetGemCountWithID(item);
}
}
@@ -217,7 +217,7 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem)
for (uint32 i = 0; i < GetBagSize(); ++i)
if (Item *pItem = m_bagslot[i])
if (pItem != skipItem)
if (ItemPrototype const *pProto = pItem->GetProto())
if (ItemTemplate const *pProto = pItem->GetTemplate())
if (pProto->ItemLimitCategory == limitCategory)
count += m_bagslot[i]->GetCount();
@@ -66,7 +66,7 @@ class Bag : public Item
Item* m_bagslot[MAX_BAG_SIZE];
};
inline Item* NewItemOrBag(ItemPrototype const * proto)
inline Item* NewItemOrBag(ItemTemplate const * proto)
{
return (proto->InventoryType == INVTYPE_BAG) ? new Bag : new Item;
}
+19 -19
View File
@@ -28,7 +28,7 @@
void AddItemsSetItem(Player* player,Item* item)
{
ItemPrototype const* proto = item->GetProto();
ItemTemplate const* proto = item->GetTemplate();
uint32 setid = proto->ItemSet;
ItemSetEntry const* set = sItemSetStore.LookupEntry(setid);
@@ -109,7 +109,7 @@ void AddItemsSetItem(Player* player,Item* item)
}
}
void RemoveItemsSetItem(Player*player,ItemPrototype const *proto)
void RemoveItemsSetItem(Player*player,ItemTemplate const *proto)
{
uint32 setid = proto->ItemSet;
@@ -167,7 +167,7 @@ void RemoveItemsSetItem(Player*player,ItemPrototype const *proto)
}
}
bool ItemCanGoIntoBag(ItemPrototype const *pProto, ItemPrototype const *pBagProto)
bool ItemCanGoIntoBag(ItemTemplate const *pProto, ItemTemplate const *pBagProto)
{
if (!pProto || !pBagProto)
return false;
@@ -263,7 +263,7 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0);
SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0);
ItemPrototype const *itemProto = ObjectMgr::GetItemPrototype(itemid);
ItemTemplate const *itemProto = sObjectMgr->GetItemTemplate(itemid);
if (!itemProto)
return false;
@@ -297,7 +297,7 @@ void Item::UpdateDuration(Player* owner, uint32 diff)
if (GetUInt32Value(ITEM_FIELD_DURATION) <= diff)
{
sScriptMgr->OnItemExpire(owner, GetProto());
sScriptMgr->OnItemExpire(owner, GetTemplate());
owner->DestroyItem(GetBagSlot(), GetSlot(), true);
return;
}
@@ -390,7 +390,7 @@ bool Item::LoadFromDB(uint32 guid, uint64 owner_guid, Field* fields, uint32 entr
SetEntry(entry);
SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f);
ItemPrototype const* proto = GetProto();
ItemTemplate const* proto = GetTemplate();
if (!proto)
return false;
@@ -484,9 +484,9 @@ void Item::DeleteFromInventoryDB(SQLTransaction& trans)
DeleteFromInventoryDB(trans, GetGUIDLow());
}
ItemPrototype const *Item::GetProto() const
ItemTemplate const *Item::GetTemplate() const
{
return ObjectMgr::GetItemPrototype(GetEntry());
return sObjectMgr->GetItemTemplate(GetEntry());
}
Player* Item::GetOwner()const
@@ -510,7 +510,7 @@ uint32 Item::GetSkill()
0,SKILL_CLOTH,SKILL_LEATHER,SKILL_MAIL,SKILL_PLATE_MAIL,0,SKILL_SHIELD,0,0,0,0
};
ItemPrototype const* proto = GetProto();
ItemTemplate const* proto = GetTemplate();
switch (proto->Class)
{
@@ -533,7 +533,7 @@ uint32 Item::GetSkill()
uint32 Item::GetSpell()
{
ItemPrototype const* proto = GetProto();
ItemTemplate const* proto = GetTemplate();
switch (proto->Class)
{
@@ -573,7 +573,7 @@ uint32 Item::GetSpell()
int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
{
ItemPrototype const *itemProto = sItemStorage.LookupEntry<ItemPrototype>(item_id);
ItemTemplate const *itemProto = sObjectMgr->GetItemTemplate(item_id);
if (!itemProto)
return 0;
@@ -804,7 +804,7 @@ bool Item::IsBoundByEnchant() const
return false;
}
uint8 Item::CanBeMergedPartlyWith(ItemPrototype const* proto) const
uint8 Item::CanBeMergedPartlyWith(ItemTemplate const* proto) const
{
// not allow merge looting currently items
if (m_lootGenerated)
@@ -823,7 +823,7 @@ uint8 Item::CanBeMergedPartlyWith(ItemPrototype const* proto) const
bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
{
ItemPrototype const* proto = GetProto();
ItemTemplate const* proto = GetTemplate();
if (spellInfo->EquippedItemClass != -1) // -1 == any item class
{
@@ -859,7 +859,7 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
bool Item::IsTargetValidForItemUse(Unit* pUnitTarget)
{
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET, GetProto()->ItemId);
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_ITEM_REQUIRED_TARGET, GetTemplate()->ItemId);
if (conditions.empty())
return true;
@@ -921,7 +921,7 @@ bool Item::GemsFitSockets() const
bool fits = true;
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 = GetTemplate()->Socket[enchant_slot-SOCK_ENCHANTMENT_SLOT].Color;
uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot));
if (!enchant_id)
@@ -942,7 +942,7 @@ bool Item::GemsFitSockets() const
uint32 gemid = enchantEntry->GemID;
if (gemid)
{
ItemPrototype const* gemProto = sItemStorage.LookupEntry<ItemPrototype>(gemid);
ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(gemid);
if (gemProto)
{
GemPropertiesEntry const* gemProperty = sGemPropertiesStore.LookupEntry(gemProto->GemProperties);
@@ -988,7 +988,7 @@ uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const
if (!enchantEntry)
continue;
ItemPrototype const* gemProto = ObjectMgr::GetItemPrototype(enchantEntry->GemID);
ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(enchantEntry->GemID);
if (!gemProto)
continue;
@@ -1000,7 +1000,7 @@ uint8 Item::GetGemCountWithLimitCategory(uint32 limitCategory) const
bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) const
{
ItemPrototype const* proto = GetProto();
ItemTemplate const* proto = GetTemplate();
return proto && ((proto->Map && proto->Map != cur_mapId) || (proto->Area && proto->Area != cur_zoneId));
}
@@ -1023,7 +1023,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player)
if (count < 1)
return NULL; //don't create item at zero count
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item);
ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item);
if (pProto)
{
if (count > pProto->GetMaxStackSize())
+12 -12
View File
@@ -221,7 +221,7 @@ struct ItemRequiredTarget
bool IsFitToRequirements(Unit* pUnitTarget) const;
};
bool ItemCanGoIntoBag(ItemPrototype const *proto, ItemPrototype const *pBagProto);
bool ItemCanGoIntoBag(ItemTemplate const *proto, ItemTemplate const *pBagProto);
class Item : public Object
{
@@ -233,7 +233,7 @@ class Item : public Object
virtual bool Create(uint32 guidlow, uint32 itemid, Player const* owner);
ItemPrototype const* GetProto() const;
ItemTemplate const* GetTemplate() const;
uint64 const& GetOwnerGUID() const { return GetUInt64Value(ITEM_FIELD_OWNER); }
void SetOwnerGUID(uint64 guid) { SetUInt64Value(ITEM_FIELD_OWNER, guid); }
@@ -241,7 +241,7 @@ class Item : public Object
void SetBinding(bool val) { ApplyModFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND, val); }
bool IsSoulBound() const { return HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_SOULBOUND); }
bool IsBoundAccountWide() const { return (GetProto()->Flags & ITEM_PROTO_FLAG_BIND_TO_ACCOUNT) != 0; }
bool IsBoundAccountWide() const { return (GetTemplate()->Flags & ITEM_PROTO_FLAG_BIND_TO_ACCOUNT) != 0; }
bool IsBindedNotWith(Player const* player) const;
bool IsBoundByEnchant() const;
virtual void SaveToDB(SQLTransaction& trans);
@@ -257,7 +257,7 @@ class Item : public Object
const Bag* ToBag() const { if (IsBag()) return reinterpret_cast<const Bag*>(this); else return NULL; }
bool IsLocked() const { return !HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED); }
bool IsBag() const { return GetProto()->InventoryType == INVTYPE_BAG; }
bool IsBag() const { return GetTemplate()->InventoryType == INVTYPE_BAG; }
bool IsNotEmptyBag() const;
bool IsBroken() const { return GetUInt32Value(ITEM_FIELD_MAXDURABILITY) > 0 && GetUInt32Value(ITEM_FIELD_DURABILITY) == 0; }
bool CanBeTraded(bool mail = false, bool trade = false) const;
@@ -274,10 +274,10 @@ class Item : public Object
uint32 GetCount() const { return GetUInt32Value(ITEM_FIELD_STACK_COUNT); }
void SetCount(uint32 value) { SetUInt32Value(ITEM_FIELD_STACK_COUNT, value); }
uint32 GetMaxStackCount() const { return GetProto()->GetMaxStackSize(); }
uint32 GetMaxStackCount() const { return GetTemplate()->GetMaxStackSize(); }
uint8 GetGemCountWithID(uint32 GemID) const;
uint8 GetGemCountWithLimitCategory(uint32 limitCategory) const;
uint8 CanBeMergedPartlyWith(ItemPrototype const* proto) const;
uint8 CanBeMergedPartlyWith(ItemTemplate const* proto) const;
uint8 GetSlot() const {return m_slot;}
Bag *GetContainer() { return m_container; }
@@ -331,12 +331,12 @@ class Item : public Object
uState = state;
}
bool hasQuest(uint32 quest_id) const { return GetProto()->StartQuest == quest_id; }
bool hasQuest(uint32 quest_id) const { return GetTemplate()->StartQuest == quest_id; }
bool hasInvolvedQuest(uint32 /*quest_id*/) const { return false; }
bool IsPotion() const { return GetProto()->IsPotion(); }
bool IsWeaponVellum() const { return GetProto()->IsWeaponVellum(); }
bool IsArmorVellum() const { return GetProto()->IsArmorVellum(); }
bool IsConjuredConsumable() const { return GetProto()->IsConjuredConsumable(); }
bool IsPotion() const { return GetTemplate()->IsPotion(); }
bool IsWeaponVellum() const { return GetTemplate()->IsWeaponVellum(); }
bool IsArmorVellum() const { return GetTemplate()->IsArmorVellum(); }
bool IsConjuredConsumable() const { return GetTemplate()->IsConjuredConsumable(); }
// Item Refund system
void SetNotRefundable(Player *owner, bool changestate = true);
@@ -357,7 +357,7 @@ class Item : public Object
void BuildUpdate(UpdateDataMapType&);
uint32 GetScriptId() const { return GetProto()->ScriptId; }
uint32 GetScriptId() const { return GetTemplate()->ScriptId; }
private:
std::string m_text;
uint8 m_slot;
@@ -120,7 +120,7 @@ uint32 GetItemEnchantMod(int32 entry)
uint32 GenerateEnchSuffixFactor(uint32 item_id)
{
ItemPrototype const *itemProto = ObjectMgr::GetItemPrototype(item_id);
ItemTemplate const *itemProto = sObjectMgr->GetItemTemplate(item_id);
if (!itemProto)
return 0;
@@ -576,13 +576,13 @@ struct _Socket
#define MAX_ITEM_PROTO_SPELLS 5
#define MAX_ITEM_PROTO_STATS 10
struct ItemPrototype
struct ItemTemplate
{
uint32 ItemId;
uint32 Class; // id from ItemClass.dbc
uint32 SubClass; // id from ItemSubClass.dbc
int32 Unk0;
char* Name1;
const char* Name1;
uint32 DisplayInfoID; // id from ItemDisplayInfo.dbc
uint32 Quality;
uint32 Flags;
@@ -622,7 +622,7 @@ struct ItemPrototype
float RangedModRange;
_Spell Spells[MAX_ITEM_PROTO_SPELLS];
uint32 Bonding;
char* Description;
const char* Description;
uint32 PageText;
uint32 LanguageID;
uint32 PageMaterial;
@@ -729,8 +729,12 @@ struct ItemPrototype
bool IsWeaponVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_WEAPON_ENCHANTMENT; }
bool IsArmorVellum() const { return Class == ITEM_CLASS_TRADE_GOODS && SubClass == ITEM_SUBCLASS_ARMOR_ENCHANTMENT; }
bool IsConjuredConsumable() const { return Class == ITEM_CLASS_CONSUMABLE && (Flags & ITEM_PROTO_FLAG_CONJURED); }
};
// Benchmarked: Faster than std::map (insert/find)
typedef UNORDERED_MAP<uint32, ItemTemplate> ItemTemplateContainer;
struct ItemLocale
{
StringVector Name;
+1 -1
View File
@@ -1051,7 +1051,7 @@ bool Guardian::InitStatsForLevel(uint8 petlevel)
return true;
}
bool Pet::HaveInDiet(ItemPrototype const* item) const
bool Pet::HaveInDiet(ItemTemplate const* item) const
{
if (!item->FoodType)
return false;
+1 -1
View File
@@ -163,7 +163,7 @@ class Pet : public Guardian
void GivePetXP(uint32 xp);
void GivePetLevel(uint8 level);
void SynchronizeLevelWithOwner();
bool HaveInDiet(ItemPrototype const* item) const;
bool HaveInDiet(ItemTemplate const* item) const;
uint32 GetCurrentFoodBenefitLevel(uint32 itemlevel);
void SetDuration(int32 dur) { m_duration = dur; }
+108 -108
View File
@@ -1108,7 +1108,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
uint32 item_id = oEntry->ItemId[j];
// just skip, reported in ObjectMgr::LoadItemPrototypes
ItemPrototype const* iProto = ObjectMgr::GetItemPrototype(item_id);
ItemTemplate const* iProto = sObjectMgr->GetItemTemplate(item_id);
if (!iProto)
continue;
@@ -1960,7 +1960,7 @@ bool Player::BuildEnumData(QueryResult result, WorldPacket* data)
{
uint32 visualBase = slot * 2;
uint32 itemId = GetUInt32ValueFromArray(equipment, visualBase);
ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemId);
ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId);
if (!proto)
{
*data << uint32(0);
@@ -4793,7 +4793,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
uint32 item_guidlow = fields[11].GetUInt32();
uint32 item_template = fields[12].GetUInt32();
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_template);
ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_template);
if (!itemProto)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ITEM_INSTANCE);
@@ -5209,8 +5209,8 @@ void Player::CreateCorpse()
{
if (m_items[i])
{
iDisplayID = m_items[i]->GetProto()->DisplayInfoID;
iIventoryType = m_items[i]->GetProto()->InventoryType;
iDisplayID = m_items[i]->GetTemplate()->DisplayInfoID;
iIventoryType = m_items[i]->GetTemplate()->InventoryType;
_cfi = iDisplayID | (iIventoryType << 24);
corpse->SetUInt32Value(CORPSE_FIELD_ITEM + i, _cfi);
@@ -5375,7 +5375,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g
uint32 LostDurability = maxDurability - curDurability;
if (LostDurability>0)
{
ItemPrototype const *ditemProto = item->GetProto();
ItemTemplate const *ditemProto = item->GetTemplate();
DurabilityCostsEntry const *dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel);
if (!dcost)
@@ -5987,7 +5987,7 @@ void Player::SetRegularAttackTime()
Item *tmpitem = GetWeaponForAttack(WeaponAttackType(i), true);
if (tmpitem && !tmpitem->IsBroken())
{
ItemPrototype const *proto = tmpitem->GetProto();
ItemTemplate const *proto = tmpitem->GetTemplate();
if (proto->Delay)
SetAttackTime(WeaponAttackType(i), proto->Delay);
}
@@ -6203,7 +6203,7 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType)
if (!tmpitem)
UpdateSkill(SKILL_UNARMED,weapon_skill_gain);
else if (tmpitem->GetProto()->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
else if (tmpitem->GetTemplate()->SubClass != ITEM_SUBCLASS_WEAPON_FISHING_POLE)
UpdateSkill(tmpitem->GetSkill(),weapon_skill_gain);
break;
}
@@ -6625,7 +6625,7 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type)
}
break;
case ACTION_BUTTON_ITEM:
if (!ObjectMgr::GetItemPrototype(action))
if (!sObjectMgr->GetItemTemplate(action))
{
sLog->outError( "Item action %u not added into button %u for player %s: item not exist", action, button, GetName() );
return false;
@@ -7607,7 +7607,7 @@ void Player::_ApplyItemMods(Item *item, uint8 slot,bool apply)
if (slot >= INVENTORY_SLOT_BAG_END || !item)
return;
ItemPrototype const *proto = item->GetProto();
ItemTemplate const *proto = item->GetTemplate();
if (!proto)
return;
@@ -7637,7 +7637,7 @@ void Player::_ApplyItemMods(Item *item, uint8 slot,bool apply)
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "_ApplyItemMods complete.");
}
void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool apply, bool only_level_scale /*= false*/)
void Player::_ApplyItemBonuses(ItemTemplate const *proto, uint8 slot, bool apply, bool only_level_scale /*= false*/)
{
if (slot >= INVENTORY_SLOT_BAG_END || !proto)
return;
@@ -7918,7 +7918,7 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
}
void Player::_ApplyWeaponDamage(uint8 slot, ItemPrototype const *proto, ScalingStatValuesEntry const *ssv, bool apply)
void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply)
{
WeaponAttackType attType = BASE_ATTACK;
float damage = 0.0f;
@@ -8060,7 +8060,7 @@ void Player::ApplyItemEquipSpell(Item *item, bool apply, bool form_change)
if (!item)
return;
ItemPrototype const *proto = item->GetProto();
ItemTemplate const *proto = item->GetTemplate();
if (!proto)
return;
@@ -8160,7 +8160,7 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
// If usable, try to cast item spell
if (Item * item = GetItemByPos(INVENTORY_SLOT_BAG_0,i))
if (!item->IsBroken() && CanUseAttackType(attType))
if (ItemPrototype const *proto = item->GetProto())
if (ItemTemplate const *proto = item->GetTemplate())
{
// Additional check for weapons
if (proto->Class == ITEM_CLASS_WEAPON)
@@ -8186,7 +8186,7 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
}
}
void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item *item, ItemPrototype const * proto)
void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item *item, ItemTemplate const * proto)
{
// Can do effect if any damage done to target
if (procVictim & PROC_FLAG_TAKEN_DAMAGE)
@@ -8309,7 +8309,7 @@ void Player::CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32
void Player::CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 cast_count, uint32 glyphIndex)
{
ItemPrototype const* proto = item->GetProto();
ItemTemplate const* proto = item->GetTemplate();
// special learning case
if (proto->Spells[0].SpellId == 483 || proto->Spells[0].SpellId == 55884)
{
@@ -8402,7 +8402,7 @@ void Player::_RemoveAllItemMods()
{
if (m_items[i])
{
ItemPrototype const *proto = m_items[i]->GetProto();
ItemTemplate const *proto = m_items[i]->GetTemplate();
if (!proto)
continue;
@@ -8424,7 +8424,7 @@ void Player::_RemoveAllItemMods()
{
if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
continue;
ItemPrototype const *proto = m_items[i]->GetProto();
ItemTemplate const *proto = m_items[i]->GetTemplate();
if (!proto)
continue;
@@ -8453,7 +8453,7 @@ void Player::_ApplyAllItemMods()
if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
continue;
ItemPrototype const *proto = m_items[i]->GetProto();
ItemTemplate const *proto = m_items[i]->GetTemplate();
if (!proto)
continue;
@@ -8472,7 +8472,7 @@ void Player::_ApplyAllItemMods()
{
if (m_items[i])
{
ItemPrototype const *proto = m_items[i]->GetProto();
ItemTemplate const *proto = m_items[i]->GetTemplate();
if (!proto)
continue;
@@ -8500,7 +8500,7 @@ void Player::_ApplyAllLevelScaleItemMods(bool apply)
if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i)))
continue;
ItemPrototype const *proto = m_items[i]->GetProto();
ItemTemplate const *proto = m_items[i]->GetTemplate();
if (!proto)
continue;
@@ -8518,7 +8518,7 @@ void Player::_ApplyAmmoBonuses()
float currentAmmoDPS;
ItemPrototype const *ammo_proto = ObjectMgr::GetItemPrototype(ammo_id);
ItemTemplate const *ammo_proto = sObjectMgr->GetItemTemplate(ammo_id);
if (!ammo_proto || ammo_proto->Class != ITEM_CLASS_PROJECTILE || !CheckAmmoCompatibility(ammo_proto))
currentAmmoDPS = 0.0f;
else
@@ -8533,7 +8533,7 @@ void Player::_ApplyAmmoBonuses()
UpdateDamagePhysical(RANGED_ATTACK);
}
bool Player::CheckAmmoCompatibility(const ItemPrototype *ammo_proto) const
bool Player::CheckAmmoCompatibility(const ItemTemplate *ammo_proto) const
{
if (!ammo_proto)
return false;
@@ -8543,7 +8543,7 @@ bool Player::CheckAmmoCompatibility(const ItemPrototype *ammo_proto) const
if (!weapon || weapon->IsBroken())
return false;
ItemPrototype const* weapon_proto = weapon->GetProto();
ItemTemplate const* weapon_proto = weapon->GetTemplate();
if (!weapon_proto || weapon_proto->Class != ITEM_CLASS_WEAPON)
return false;
@@ -8738,7 +8738,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
switch (loot_type)
{
case LOOT_DISENCHANTING:
loot->FillLoot(item->GetProto()->DisenchantID, LootTemplates_Disenchant, this,true);
loot->FillLoot(item->GetTemplate()->DisenchantID, LootTemplates_Disenchant, this,true);
break;
case LOOT_PROSPECTING:
loot->FillLoot(item->GetEntry(), LootTemplates_Prospecting, this,true);
@@ -8747,7 +8747,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
loot->FillLoot(item->GetEntry(), LootTemplates_Milling, this,true);
break;
default:
loot->generateMoneyLoot(item->GetProto()->MinMoneyLoot,item->GetProto()->MaxMoneyLoot);
loot->generateMoneyLoot(item->GetTemplate()->MinMoneyLoot,item->GetTemplate()->MaxMoneyLoot);
loot->FillLoot(item->GetEntry(), LootTemplates_Item, this, true, loot->gold != 0);
break;
}
@@ -9682,7 +9682,7 @@ void Player::SetSheath(SheathState sheathed)
Unit::SetSheath(sheathed); // this must visualize Sheath changing for other players...
}
uint8 Player::FindEquipSlot(ItemPrototype const* proto, uint32 slot, bool swap) const
uint8 Player::FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const
{
uint8 playerClass = getClass();
@@ -9757,7 +9757,7 @@ uint8 Player::FindEquipSlot(ItemPrototype const* proto, uint32 slot, bool swap)
slots[0] = EQUIPMENT_SLOT_MAINHAND;
if (Item* mhWeapon = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
{
if (ItemPrototype const* mhWeaponProto = mhWeapon->GetProto())
if (ItemTemplate const* mhWeaponProto = mhWeapon->GetTemplate())
{
if (mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_POLEARM || mhWeaponProto->SubClass == ITEM_SUBCLASS_WEAPON_STAFF)
{
@@ -9930,10 +9930,10 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const
if (Bag* pBag = GetBagByPos(i))
count += pBag->GetItemCount(item, skipItem);
if (skipItem && skipItem->GetProto()->GemProperties)
if (skipItem && skipItem->GetTemplate()->GemProperties)
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem && pItem->GetProto()->Socket[0].Color)
if (pItem != skipItem && pItem->GetTemplate()->Socket[0].Color)
count += pItem->GetGemCountWithID(item);
if (inBankAlso)
@@ -9947,10 +9947,10 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const
if (Bag* pBag = GetBagByPos(i))
count += pBag->GetItemCount(item, skipItem);
if (skipItem && skipItem->GetProto()->GemProperties)
if (skipItem && skipItem->GetTemplate()->GemProperties)
for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i)
if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem && pItem->GetProto()->Socket[0].Color)
if (pItem != skipItem && pItem->GetTemplate()->Socket[0].Color)
count += pItem->GetGemCountWithID(item);
}
@@ -9963,14 +9963,14 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte
for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem)
if (ItemPrototype const *pProto = pItem->GetProto())
if (ItemTemplate const *pProto = pItem->GetTemplate())
if (pProto->ItemLimitCategory == limitCategory)
count += pItem->GetCount();
for (int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem)
if (ItemPrototype const *pProto = pItem->GetProto())
if (ItemTemplate const *pProto = pItem->GetTemplate())
if (pProto->ItemLimitCategory == limitCategory)
count += pItem->GetCount();
@@ -9981,7 +9981,7 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte
for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i)
if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i))
if (pItem != skipItem)
if (ItemPrototype const *pProto = pItem->GetProto())
if (ItemTemplate const *pProto = pItem->GetTemplate())
if (pProto->ItemLimitCategory == limitCategory)
count += pItem->GetCount();
@@ -10067,7 +10067,7 @@ Item* Player::GetWeaponForAttack(WeaponAttackType attackType, bool useable /*= f
item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, slot);
else
item = GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
if (!item || item->GetProto()->Class != ITEM_CLASS_WEAPON)
if (!item || item->GetTemplate()->Class != ITEM_CLASS_WEAPON)
return NULL;
if (!useable)
@@ -10086,7 +10086,7 @@ Item* Player::GetShield(bool useable) const
item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
else
item = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
if (!item || item->GetProto()->Class != ITEM_CLASS_ARMOR)
if (!item || item->GetTemplate()->Class != ITEM_CLASS_ARMOR)
return NULL;
if (!useable)
@@ -10297,7 +10297,7 @@ bool Player::HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_
}
}
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item);
ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item);
if (pProto && pProto->GemProperties)
{
for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
@@ -10306,7 +10306,7 @@ bool Player::HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_
continue;
Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (pItem && pItem->GetProto()->Socket[0].Color)
if (pItem && pItem->GetTemplate()->Socket[0].Color)
{
tempcount += pItem->GetGemCountWithID(item);
if (tempcount >= count)
@@ -10330,7 +10330,7 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32
if (!pItem)
continue;
ItemPrototype const *pProto = pItem->GetProto();
ItemTemplate const *pProto = pItem->GetTemplate();
if (!pProto)
continue;
@@ -10354,7 +10354,7 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32
uint8 Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count) const
{
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(entry);
ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(entry);
if (!pProto)
{
if (no_space_count)
@@ -10412,13 +10412,13 @@ bool Player::HasItemTotemCategory(uint32 TotemCategory) const
for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i)
{
pItem = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i);
if (pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory))
if (pItem && IsTotemCategoryCompatiableWith(pItem->GetTemplate()->TotemCategory,TotemCategory))
return true;
}
for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i)
{
pItem = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i);
if (pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory))
if (pItem && IsTotemCategoryCompatiableWith(pItem->GetTemplate()->TotemCategory,TotemCategory))
return true;
}
for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i)
@@ -10428,7 +10428,7 @@ bool Player::HasItemTotemCategory(uint32 TotemCategory) const
for (uint32 j = 0; j < pBag->GetBagSize(); ++j)
{
pItem = GetUseableItemByPos(i, j);
if (pItem && IsTotemCategoryCompatiableWith(pItem->GetProto()->TotemCategory,TotemCategory))
if (pItem && IsTotemCategoryCompatiableWith(pItem->GetTemplate()->TotemCategory,TotemCategory))
return true;
}
}
@@ -10436,7 +10436,7 @@ bool Player::HasItemTotemCategory(uint32 TotemCategory) const
return false;
}
uint8 Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemPrototype const *pProto, uint32& count, bool swap, Item* pSrcItem) const
uint8 Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32& count, bool swap, Item* pSrcItem) const
{
Item* pItem2 = GetItemByPos(bag, slot);
@@ -10472,7 +10472,7 @@ uint8 Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVe
if (!pBag)
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
ItemPrototype const* pBagProto = pBag->GetProto();
ItemTemplate const* pBagProto = pBag->GetTemplate();
if (!pBagProto)
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
@@ -10510,7 +10510,7 @@ uint8 Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVe
return EQUIP_ERR_OK;
}
uint8 Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemPrototype const *pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const
uint8 Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const
{
// skip specific bag already processed in first called _CanStoreItem_InBag
if (bag == skip_bag)
@@ -10524,7 +10524,7 @@ uint8 Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemPrototyp
if (pSrcItem && pSrcItem->IsNotEmptyBag())
return EQUIP_ERR_CAN_ONLY_DO_WITH_EMPTY_BAGS;
ItemPrototype const* pBagProto = pBag->GetProto();
ItemTemplate const* pBagProto = pBag->GetTemplate();
if (!pBagProto)
return EQUIP_ERR_ITEM_DOESNT_GO_INTO_BAG;
@@ -10580,7 +10580,7 @@ uint8 Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemPrototyp
return EQUIP_ERR_OK;
}
uint8 Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemPrototype const *pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const
uint8 Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const
{
//this is never called for non-bag slots so we can do this
if (pSrcItem && pSrcItem->IsNotEmptyBag())
@@ -10635,7 +10635,7 @@ uint8 Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32
{
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count);
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(entry);
ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(entry);
if (!pProto)
{
if (no_space_count)
@@ -11133,7 +11133,7 @@ uint8 Player::CanStoreItems(Item **pItems,int count) const
if (!pItem) continue;
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItems %i. item = %u, count = %u", k+1, pItem->GetEntry(), pItem->GetCount());
ItemPrototype const *pProto = pItem->GetProto();
ItemTemplate const *pProto = pItem->GetTemplate();
// strange item
if (!pProto)
@@ -11148,7 +11148,7 @@ uint8 Player::CanStoreItems(Item **pItems,int count) const
return EQUIP_ERR_DONT_OWN_THAT_ITEM;
Bag *pBag;
ItemPrototype const *pBagProto;
ItemTemplate const *pBagProto;
// item is 'one item only'
uint8 res = CanTakeMoreSimilarItems(pItem);
@@ -11200,7 +11200,7 @@ uint8 Player::CanStoreItems(Item **pItems,int count) const
{
if (pBag = GetBagByPos(t))
{
if (ItemCanGoIntoBag(pItem->GetProto(), pBag->GetProto()))
if (ItemCanGoIntoBag(pItem->GetTemplate(), pBag->GetTemplate()))
{
for (uint32 j = 0; j < pBag->GetBagSize(); j++)
{
@@ -11257,7 +11257,7 @@ uint8 Player::CanStoreItems(Item **pItems,int count) const
{
if (pBag = GetBagByPos(t))
{
pBagProto = pBag->GetProto();
pBagProto = pBag->GetTemplate();
// not plain container check
if (pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER) &&
@@ -11296,7 +11296,7 @@ uint8 Player::CanStoreItems(Item **pItems,int count) const
{
if (pBag = GetBagByPos(t))
{
pBagProto = pBag->GetProto();
pBagProto = pBag->GetTemplate();
// special bag already checked
if (pBagProto && (pBagProto->Class != ITEM_CLASS_CONTAINER || pBagProto->SubClass != ITEM_SUBCLASS_CONTAINER))
@@ -11343,7 +11343,7 @@ uint8 Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, boo
if (pItem)
{
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanEquipItem slot = %u, item = %u, count = %u", slot, pItem->GetEntry(), pItem->GetCount());
ItemPrototype const *pProto = pItem->GetProto();
ItemTemplate const *pProto = pItem->GetTemplate();
if (pProto)
{
// item used
@@ -11420,7 +11420,7 @@ uint8 Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, boo
{
if (pBag != pItem)
{
if (ItemPrototype const* pBagProto = pBag->GetProto())
if (ItemTemplate const* pBagProto = pBag->GetTemplate())
{
if (pBagProto->Class == pProto->Class && (!swap || pBag->GetSlot() != eslot))
return (pBagProto->SubClass == ITEM_SUBCLASS_AMMO_POUCH)
@@ -11495,7 +11495,7 @@ uint8 Player::CanUnequipItem(uint16 pos, bool swap) const
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUnequipItem slot = %u, item = %u, count = %u", pos, pItem->GetEntry(), pItem->GetCount());
ItemPrototype const *pProto = pItem->GetProto();
ItemTemplate const *pProto = pItem->GetTemplate();
if (!pProto)
return EQUIP_ERR_ITEM_NOT_FOUND;
@@ -11530,7 +11530,7 @@ uint8 Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pI
uint32 count = pItem->GetCount();
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount());
ItemPrototype const *pProto = pItem->GetProto();
ItemTemplate const *pProto = pItem->GetTemplate();
if (!pProto)
return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND;
@@ -11721,7 +11721,7 @@ uint8 Player::CanUseItem(Item *pItem, bool not_loading) const
//if (isStunned())
// return EQUIP_ERR_YOU_ARE_STUNNED;
ItemPrototype const *pProto = pItem->GetProto();
ItemTemplate const *pProto = pItem->GetTemplate();
if (pProto)
{
if (pItem->IsBindedNotWith(this))
@@ -11768,7 +11768,7 @@ uint8 Player::CanUseItem(Item *pItem, bool not_loading) const
return EQUIP_ERR_ITEM_NOT_FOUND;
}
uint8 Player::CanUseItem(ItemPrototype const *pProto) const
uint8 Player::CanUseItem(ItemTemplate const *pProto) const
{
// Used by group, function NeedBeforeGreed, to know if a prototype can be used by a player
@@ -11806,7 +11806,7 @@ uint8 Player::CanUseAmmo(uint32 item) const
return EQUIP_ERR_YOU_ARE_DEAD;
//if (isStunned())
// return EQUIP_ERR_YOU_ARE_STUNNED;
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item);
ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item);
if (pProto)
{
if (pProto->InventoryType!= INVTYPE_AMMO)
@@ -11880,12 +11880,12 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
pItem->SetItemRandomProperties(randomPropertyId);
pItem = StoreItem(dest, pItem, update);
const ItemPrototype *proto = pItem->GetProto();
const ItemTemplate *proto = pItem->GetTemplate();
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
CastSpell(this, proto->Spells[i].SpellId, true, pItem);
if (allowedLooters && pItem->GetProto()->GetMaxStackSize() == 1 && pItem->IsSoulBound())
if (allowedLooters && pItem->GetTemplate()->GetMaxStackSize() == 1 && pItem->IsSoulBound())
{
pItem->SetSoulboundTradeable(allowedLooters, this, true);
pItem->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, GetTotalPlayedTime());
@@ -11954,9 +11954,9 @@ Item* Player::_StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool
if (!pItem)
return NULL;
if (pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP ||
pItem->GetProto()->Bonding == BIND_QUEST_ITEM ||
(pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos)))
if (pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP ||
pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM ||
(pItem->GetTemplate()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos)))
pItem->SetBinding(true);
Bag* pBag = (bag == INVENTORY_SLOT_BAG_0) ? NULL : GetBagByPos(bag);
@@ -11994,9 +11994,9 @@ Item* Player::_StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool
}
else
{
if (pItem2->GetProto()->Bonding == BIND_WHEN_PICKED_UP ||
pItem2->GetProto()->Bonding == BIND_QUEST_ITEM ||
(pItem2->GetProto()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos)))
if (pItem2->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP ||
pItem2->GetTemplate()->Bonding == BIND_QUEST_ITEM ||
(pItem2->GetTemplate()->Bonding == BIND_WHEN_EQUIPED && IsBagPos(pos)))
pItem2->SetBinding(true);
pItem2->SetCount(pItem2->GetCount() + count);
@@ -12058,7 +12058,7 @@ Item* Player::EquipItem(uint16 pos, Item *pItem, bool update)
if (isAlive())
{
ItemPrototype const *pProto = pItem->GetProto();
ItemTemplate const *pProto = pItem->GetTemplate();
// item set bonuses applied only at equip and removed at unequip, and still active for broken items
if (pProto && pProto->ItemSet)
@@ -12197,7 +12197,7 @@ void Player::VisualizeItem(uint8 slot, Item *pItem)
return;
// check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory)
if (pItem->GetProto()->Bonding == BIND_WHEN_EQUIPED || pItem->GetProto()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetProto()->Bonding == BIND_QUEST_ITEM)
if (pItem->GetTemplate()->Bonding == BIND_WHEN_EQUIPED || pItem->GetTemplate()->Bonding == BIND_WHEN_PICKED_UP || pItem->GetTemplate()->Bonding == BIND_QUEST_ITEM)
pItem->SetBinding(true);
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: EquipItem slot = %u, item = %u", slot, pItem->GetEntry());
@@ -12235,7 +12235,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
{
if (slot < INVENTORY_SLOT_BAG_END)
{
ItemPrototype const *pProto = pItem->GetProto();
ItemTemplate const *pProto = pItem->GetTemplate();
// item set bonuses applied only at equip and removed at unequip, and still active for broken items
if (pProto && pProto->ItemSet)
@@ -12361,7 +12361,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
pItem->SetSoulboundTradeable(NULL, this, false);
RemoveTradeableItem(pItem);
const ItemPrototype *proto = pItem->GetProto();
const ItemTemplate *proto = pItem->GetTemplate();
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger
RemoveAurasDueToSpell(proto->Spells[i].SpellId);
@@ -12375,7 +12375,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
// equipment and equipped bags can have applied bonuses
if (slot < INVENTORY_SLOT_BAG_END)
{
ItemPrototype const *pProto = pItem->GetProto();
ItemTemplate const *pProto = pItem->GetTemplate();
// item set bonuses applied only at equip and removed at unequip, and still active for broken items
if (pProto && pProto->ItemSet)
@@ -12916,7 +12916,7 @@ void Player::SwapItem(uint16 src, uint16 dst)
// can be merge/fill
if (msg == EQUIP_ERR_OK)
{
if (pSrcItem->GetCount() + pDstItem->GetCount() <= pSrcItem->GetProto()->GetMaxStackSize())
if (pSrcItem->GetCount() + pDstItem->GetCount() <= pSrcItem->GetTemplate()->GetMaxStackSize())
{
RemoveItem(srcbag, srcslot, true);
@@ -12932,8 +12932,8 @@ void Player::SwapItem(uint16 src, uint16 dst)
}
else
{
pSrcItem->SetCount(pSrcItem->GetCount() + pDstItem->GetCount() - pSrcItem->GetProto()->GetMaxStackSize());
pDstItem->SetCount(pSrcItem->GetProto()->GetMaxStackSize());
pSrcItem->SetCount(pSrcItem->GetCount() + pDstItem->GetCount() - pSrcItem->GetTemplate()->GetMaxStackSize());
pDstItem->SetCount(pSrcItem->GetTemplate()->GetMaxStackSize());
pSrcItem->SetState(ITEM_CHANGED, this);
pDstItem->SetState(ITEM_CHANGED, this);
if (IsInWorld())
@@ -13011,7 +13011,7 @@ void Player::SwapItem(uint16 src, uint16 dst)
// bag swap (with items exchange) case
if (emptyBag && fullBag)
{
ItemPrototype const* emptyProto = emptyBag->GetProto();
ItemTemplate const* emptyProto = emptyBag->GetTemplate();
uint32 count = 0;
@@ -13021,7 +13021,7 @@ void Player::SwapItem(uint16 src, uint16 dst)
if (!bagItem)
continue;
ItemPrototype const* bagItemProto = bagItem->GetProto();
ItemTemplate const* bagItemProto = bagItem->GetTemplate();
if (!bagItemProto || !ItemCanGoIntoBag(bagItemProto, emptyProto))
{
// one from items not go to empty target bag
@@ -13162,7 +13162,7 @@ void Player::AddItemToBuyBackSlot(Item *pItem)
uint32 eslot = slot - BUYBACK_SLOT_START;
SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID());
if (ItemPrototype const *pProto = pItem->GetProto())
if (ItemTemplate const *pProto = pItem->GetTemplate())
SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, pProto->SellPrice * pItem->GetCount());
else
SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0);
@@ -13225,7 +13225,7 @@ void Player::SendEquipError(uint8 msg, Item* pItem, Item *pItem2, uint32 itemid)
case EQUIP_ERR_CANT_EQUIP_LEVEL_I:
case EQUIP_ERR_PURCHASE_LEVEL_TOO_LOW:
{
ItemPrototype const* proto = pItem ? pItem->GetProto() : ObjectMgr::GetItemPrototype(itemid);
ItemTemplate const* proto = pItem ? pItem->GetTemplate() : sObjectMgr->GetItemTemplate(itemid);
data << uint32(proto ? proto->RequiredLevel : 0);
break;
}
@@ -13240,7 +13240,7 @@ void Player::SendEquipError(uint8 msg, Item* pItem, Item *pItem2, uint32 itemid)
case EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_SOCKETED_EXCEEDED:
case EQUIP_ERR_ITEM_MAX_LIMIT_CATEGORY_EQUIPPED_EXCEEDED:
{
ItemPrototype const* proto = pItem ? pItem->GetProto() : ObjectMgr::GetItemPrototype(itemid);
ItemTemplate const* proto = pItem ? pItem->GetTemplate() : sObjectMgr->GetItemTemplate(itemid);
data << uint32(proto ? proto->ItemLimitCategory : 0);
break;
}
@@ -13346,7 +13346,7 @@ void Player::UpdateItemDuration(uint32 time, bool realtimeonly)
Item* item = *itr;
++itr; // current element can be erased in UpdateDuration
if ((realtimeonly && item->GetProto()->Duration < 0) || !realtimeonly)
if ((realtimeonly && item->GetTemplate()->Duration < 0) || !realtimeonly)
item->UpdateDuration(this,time);
}
}
@@ -13507,7 +13507,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
// If we're dealing with a gem inside a prismatic socket we need to check the prismatic socket requirements
// rather than the gem requirements itself. If the socket has no color it is a prismatic socket.
if((slot == SOCK_ENCHANTMENT_SLOT || slot == SOCK_ENCHANTMENT_SLOT_2 || slot == SOCK_ENCHANTMENT_SLOT_3)
&& !item->GetProto()->Socket[slot-SOCK_ENCHANTMENT_SLOT].Color)
&& !item->GetTemplate()->Socket[slot-SOCK_ENCHANTMENT_SLOT].Color)
{
// Check if the requirements for the prismatic socket are met before applying the gem stats
SpellItemEnchantmentEntry const *pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT));
@@ -13804,12 +13804,12 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool
float addValue = 0.0f;
if (item->GetSlot() == EQUIPMENT_SLOT_MAINHAND)
{
addValue = float(enchant_amount * item->GetProto()->Delay / 1000.0f);
addValue = float(enchant_amount * item->GetTemplate()->Delay / 1000.0f);
HandleStatModifier(UNIT_MOD_DAMAGE_MAINHAND, TOTAL_VALUE, addValue, apply);
}
else if (item->GetSlot() == EQUIPMENT_SLOT_OFFHAND)
{
addValue = float(enchant_amount * item->GetProto()->Delay / 1000.0f);
addValue = float(enchant_amount * item->GetTemplate()->Delay / 1000.0f);
HandleStatModifier(UNIT_MOD_DAMAGE_OFFHAND, TOTAL_VALUE, addValue, apply);
}
}
@@ -13880,7 +13880,7 @@ void Player::UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16
// If we're dealing with a gem inside a prismatic socket we need to check the prismatic socket requirements
// rather than the gem requirements itself. If the socket has no color it is a prismatic socket.
if ((slot == SOCK_ENCHANTMENT_SLOT || slot == SOCK_ENCHANTMENT_SLOT_2 || slot == SOCK_ENCHANTMENT_SLOT_3)
&& !m_items[i]->GetProto()->Socket[slot-SOCK_ENCHANTMENT_SLOT].Color)
&& !m_items[i]->GetTemplate()->Socket[slot-SOCK_ENCHANTMENT_SLOT].Color)
{
SpellItemEnchantmentEntry const *pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(m_items[i]->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT));
@@ -16036,7 +16036,7 @@ bool Player::HasQuestForItem(uint32 itemid) const
// examined item is a source item
if (qinfo->ReqSourceId[j] == itemid)
{
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(itemid);
ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(itemid);
// 'unique' item
if (pProto->MaxCount && int32(GetItemCount(itemid, true)) < pProto->MaxCount)
@@ -17309,7 +17309,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
Item* item = NULL;
uint32 itemGuid = fields[13].GetUInt32();
uint32 itemEntry = fields[14].GetUInt32();
if (ItemPrototype const * proto = ObjectMgr::GetItemPrototype(itemEntry))
if (ItemTemplate const * proto = sObjectMgr->GetItemTemplate(itemEntry))
{
bool remove = false;
item = NewItemOrBag(proto);
@@ -17425,7 +17425,7 @@ void Player::_LoadMailedItems(Mail *mail)
mail->AddItem(item_guid_low, item_template);
ItemPrototype const *proto = ObjectMgr::GetItemPrototype(item_template);
ItemTemplate const *proto = sObjectMgr->GetItemTemplate(item_template);
if (!proto)
{
@@ -18051,7 +18051,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report
else if (mapDiff->hasErrorMessage) // if (missingAchievement) covered by this case
SendTransferAborted(target_map, TRANSFER_ABORT_DIFFICULTY, target_difficulty);
else if (missingItem)
GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), LevelMin, ObjectMgr::GetItemPrototype(missingItem)->Name1);
GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED_AND_ITEM), LevelMin, sObjectMgr->GetItemTemplate(missingItem)->Name1);
else if (LevelMin)
GetSession()->SendAreaTriggerMessage(GetSession()->GetTrinityString(LANG_LEVEL_MINREQUIRED), LevelMin);
}
@@ -20154,7 +20154,7 @@ void Player::InitDisplayIds()
}
}
inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemPrototype const *pProto, Creature *pVendor, VendorItem const* crItem, bool bStore)
inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const *pProto, Creature *pVendor, VendorItem const* crItem, bool bStore)
{
ItemPosCountVec vDest;
uint16 uiDest = 0;
@@ -20229,7 +20229,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
if (!isAlive())
return false;
ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item);
ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item);
if (!pProto)
{
SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, item, 0);
@@ -20480,7 +20480,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellEntry const* spellInfo, uint32 it
if (itemId)
{
if (ItemPrototype const* proto = ObjectMgr::GetItemPrototype(itemId))
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId))
{
for (uint8 idx = 0; idx < MAX_ITEM_SPELLS; ++idx)
{
@@ -20593,7 +20593,7 @@ void Player::UpdatePotionCooldown(Spell* spell)
if (!spell)
{
// spell/item pair let set proper cooldown (except not existed charged spell cooldown spellmods for potions)
if (ItemPrototype const* proto = ObjectMgr::GetItemPrototype(m_lastPotionId))
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(m_lastPotionId))
for (uint8 idx = 0; idx < MAX_ITEM_SPELLS; ++idx)
if (proto->Spells[idx].SpellId && proto->Spells[idx].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE)
if (SpellEntry const* spellInfo = sSpellStore.LookupEntry(proto->Spells[idx].SpellId))
@@ -20625,7 +20625,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
if (i == slot)
continue;
Item *pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i);
if (pItem2 && !pItem2->IsBroken() && pItem2->GetProto()->Socket[0].Color)
if (pItem2 && !pItem2->IsBroken() && pItem2->GetTemplate()->Socket[0].Color)
{
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot)
{
@@ -20641,7 +20641,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot)
if (!gemid)
continue;
ItemPrototype const* gemProto = sItemStorage.LookupEntry<ItemPrototype>(gemid);
ItemTemplate const* gemProto = sObjectMgr->GetItemTemplate(gemid);
if (!gemProto)
continue;
@@ -20702,7 +20702,7 @@ void Player::CorrectMetaGemEnchants(uint8 exceptslot, bool apply)
Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
if (!pItem || !pItem->GetProto()->Socket[0].Color)
if (!pItem || !pItem->GetTemplate()->Socket[0].Color)
continue;
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot)
@@ -20744,7 +20744,7 @@ void Player::ToggleMetaGemsActive(uint8 exceptslot, bool apply)
Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
if (!pItem || !pItem->GetProto()->Socket[0].Color) //if item has no sockets or no item is equipped go to next item
if (!pItem || !pItem->GetTemplate()->Socket[0].Color) //if item has no sockets or no item is equipped go to next item
continue;
//cycle all (gem)enchants
@@ -21443,7 +21443,7 @@ void Player::ApplyEquipCooldown(Item * pItem)
for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
{
_Spell const& spellData = pItem->GetProto()->Spells[i];
_Spell const& spellData = pItem->GetTemplate()->Spells[i];
// no spell
if (!spellData.SpellId)
@@ -21954,11 +21954,11 @@ void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/)
return;
// unequip offhand weapon if player doesn't have dual wield anymore
if (!CanDualWield() && (offItem->GetProto()->InventoryType == INVTYPE_WEAPONOFFHAND || offItem->GetProto()->InventoryType == INVTYPE_WEAPON))
if (!CanDualWield() && (offItem->GetTemplate()->InventoryType == INVTYPE_WEAPONOFFHAND || offItem->GetTemplate()->InventoryType == INVTYPE_WEAPON))
force = true;
// need unequip offhand for 2h-weapon without TitanGrip (in any from hands)
if (!force && (CanTitanGrip() || (offItem->GetProto()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed())))
if (!force && (CanTitanGrip() || (offItem->GetTemplate()->InventoryType != INVTYPE_2HWEAPON && !IsTwoHandUsed())))
return;
ItemPosCountVec off_dest;
@@ -23269,7 +23269,7 @@ uint32 Player::GetPhaseMaskForSpawn() const
uint8 Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limit_count) const
{
ItemPrototype const* pProto = pItem->GetProto();
ItemTemplate const* pProto = pItem->GetTemplate();
// proto based limitations
if (uint8 res = CanEquipUniqueItem(pProto,eslot,limit_count))
@@ -23285,7 +23285,7 @@ uint8 Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limit_count) c
if (!enchantEntry)
continue;
ItemPrototype const* pGem = ObjectMgr::GetItemPrototype(enchantEntry->GemID);
ItemTemplate const* pGem = sObjectMgr->GetItemTemplate(enchantEntry->GemID);
if (!pGem)
continue;
@@ -23300,7 +23300,7 @@ uint8 Player::CanEquipUniqueItem(Item* pItem, uint8 eslot, uint32 limit_count) c
return EQUIP_ERR_OK;
}
uint8 Player::CanEquipUniqueItem(ItemPrototype const* itemProto, uint8 except_slot, uint32 limit_count) const
uint8 Player::CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot, uint32 limit_count) const
{
// check unique-equipped on item
if (itemProto->Flags & ITEM_PROTO_FLAG_UNIQUE_EQUIPPED)
@@ -24581,8 +24581,8 @@ float Player::GetAverageItemLevel()
if (i == EQUIPMENT_SLOT_TABARD || i == EQUIPMENT_SLOT_RANGED || i == EQUIPMENT_SLOT_OFFHAND || i == EQUIPMENT_SLOT_CHEST)
continue;
if (m_items[i] && m_items[i]->GetProto())
sum += m_items[i]->GetProto()->GetItemLevelIncludingQuality();
if (m_items[i] && m_items[i]->GetTemplate())
sum += m_items[i]->GetTemplate()->GetItemLevelIncludingQuality();
count++;
}
+14 -14
View File
@@ -1171,7 +1171,7 @@ class Player : public Unit, public GridObject<Player>
void SetVirtualItemSlot(uint8 i, Item* item);
void SetSheath(SheathState sheathed); // overwrite Unit version
uint8 FindEquipSlot(ItemPrototype const* proto, uint32 slot, bool swap) const;
uint8 FindEquipSlot(ItemTemplate const* proto, uint32 slot, bool swap) const;
uint32 GetItemCount(uint32 item, bool inBankAlso = false, Item* skipItem = NULL) const;
uint32 GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem = NULL) const;
Item* GetItemByGuid(uint64 guid) const;
@@ -1224,13 +1224,13 @@ class Player : public Unit, public GridObject<Player>
uint8 CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading = true) const;
uint8 CanEquipUniqueItem(Item * pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
uint8 CanEquipUniqueItem(ItemPrototype const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
uint8 CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const;
uint8 CanUnequipItems(uint32 item, uint32 count) const;
uint8 CanUnequipItem(uint16 src, bool swap) const;
uint8 CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, Item *pItem, bool swap, bool not_loading = true) const;
uint8 CanUseItem(Item *pItem, bool not_loading = true) const;
bool HasItemTotemCategory(uint32 TotemCategory) const;
uint8 CanUseItem(ItemPrototype const *pItem) const;
uint8 CanUseItem(ItemTemplate const *pItem) const;
uint8 CanUseAmmo(uint32 item) const;
Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0, AllowedLooterSet* allowedLooters = NULL);
Item* StoreItem(ItemPosCountVec const& pos, Item *pItem, bool update);
@@ -1252,7 +1252,7 @@ class Player : public Unit, public GridObject<Player>
void SetAmmo(uint32 item);
void RemoveAmmo();
float GetAmmoDPS() const { return m_ammoDPS; }
bool CheckAmmoCompatibility(const ItemPrototype *ammo_proto) const;
bool CheckAmmoCompatibility(const ItemTemplate *ammo_proto) const;
void QuickEquipItem(uint16 pos, Item *pItem);
void VisualizeItem(uint8 slot, Item *pItem);
void SetVisibleItemSlot(uint8 slot, Item *pItem);
@@ -1293,11 +1293,11 @@ class Player : public Unit, public GridObject<Player>
bool IsTwoHandUsed() const
{
Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND);
return mainItem && mainItem->GetProto()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip();
return mainItem && mainItem->GetTemplate()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip();
}
void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast = false);
bool BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot);
bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemPrototype const *pProto, Creature *pVendor, VendorItem const* crItem, bool bStore);
bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const *pProto, Creature *pVendor, VendorItem const* crItem, bool bStore);
float GetReputationPriceDiscount(Creature const* pCreature) const;
@@ -1813,7 +1813,7 @@ class Player : public Unit, public GridObject<Player>
uint32 GetBaseDefenseSkillValue() const { return GetBaseSkillValue(SKILL_DEFENSE); }
uint32 GetBaseWeaponSkillValue(WeaponAttackType attType) const;
uint32 GetSpellByProto(ItemPrototype *proto);
uint32 GetSpellByProto(ItemTemplate *proto);
float GetHealthBonusFromStamina();
float GetManaBonusFromIntellect();
@@ -2047,8 +2047,8 @@ class Player : public Unit, public GridObject<Player>
void _RemoveAllItemMods();
void _ApplyAllItemMods();
void _ApplyAllLevelScaleItemMods(bool apply);
void _ApplyItemBonuses(ItemPrototype const *proto,uint8 slot,bool apply, bool only_level_scale = false);
void _ApplyWeaponDamage(uint8 slot, ItemPrototype const *proto, ScalingStatValuesEntry const *ssv, bool apply);
void _ApplyItemBonuses(ItemTemplate const *proto,uint8 slot,bool apply, bool only_level_scale = false);
void _ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply);
void _ApplyAmmoBonuses();
bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot);
void ToggleMetaGemsActive(uint8 exceptslot, bool apply);
@@ -2060,7 +2060,7 @@ class Player : public Unit, public GridObject<Player>
void UpdateEquipSpellsAtFormChange();
void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx);
void CastItemUseSpell(Item *item,SpellCastTargets const& targets,uint8 cast_count, uint32 glyphIndex);
void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item *item, ItemPrototype const * proto);
void CastItemCombatSpell(Unit *target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item *item, ItemTemplate const * proto);
void SendEquipmentSetList();
void SetEquipmentSet(uint32 index, EquipmentSet eqset);
@@ -2687,9 +2687,9 @@ class Player : public Unit, public GridObject<Player>
bool isAlwaysDetectableFor(WorldObject const* seer) const;
private:
// internal common parts for CanStore/StoreItem functions
uint8 _CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool swap, Item *pSrcItem) const;
uint8 _CanStoreItem_InBag(uint8 bag, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
uint8 _CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemPrototype const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
uint8 _CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const *pProto, uint32& count, bool swap, Item *pSrcItem) const;
uint8 _CanStoreItem_InBag(uint8 bag, ItemPosCountVec& dest, ItemTemplate const *pProto, uint32& count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
uint8 _CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemTemplate const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const;
Item* _StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool update);
Item* _LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields);
@@ -2759,7 +2759,7 @@ class Player : public Unit, public GridObject<Player>
};
void AddItemsSetItem(Player*player,Item *item);
void RemoveItemsSetItem(Player*player,ItemPrototype const *proto);
void RemoveItemsSetItem(Player*player,ItemTemplate const *proto);
// "the bodies of template functions must be made available in a header file"
template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell)
+5 -5
View File
@@ -2677,7 +2677,7 @@ float Unit::GetUnitBlockChance() const
if (player->CanBlock())
{
Item *tmpitem = player->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetProto()->Block)
if (tmpitem && !tmpitem->IsBroken() && tmpitem->GetTemplate()->Block)
return GetFloatValue(PLAYER_BLOCK_PERCENTAGE);
}
// is player but has no block ability or no not broken shield equipped
@@ -14655,7 +14655,7 @@ float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized)
if (!Weapon)
return 2.4f; // fist attack
switch (Weapon->GetProto()->InventoryType)
switch (Weapon->GetTemplate()->InventoryType)
{
case INVTYPE_2HWEAPON:
return 3.3f;
@@ -14667,7 +14667,7 @@ float Unit::GetAPMultiplier(WeaponAttackType attType, bool normalized)
case INVTYPE_WEAPONMAINHAND:
case INVTYPE_WEAPONOFFHAND:
default:
return Weapon->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER ? 1.7f : 2.4f;
return Weapon->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_DAGGER ? 1.7f : 2.4f;
}
}
@@ -14845,14 +14845,14 @@ bool Unit::IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry co
if (this->ToPlayer()->IsInFeralForm())
return false;
if (!item || item->IsBroken() || item->GetProto()->Class != ITEM_CLASS_WEAPON || !((1<<item->GetProto()->SubClass) & spellProto->EquippedItemSubClassMask))
if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_WEAPON || !((1<<item->GetTemplate()->SubClass) & spellProto->EquippedItemSubClassMask))
return false;
}
else if (spellProto->EquippedItemClass == ITEM_CLASS_ARMOR)
{
// Check if player is wearing shield
Item *item = this->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND);
if (!item || item->IsBroken() || item->GetProto()->Class != ITEM_CLASS_ARMOR || !((1<<item->GetProto()->SubClass) & spellProto->EquippedItemSubClassMask))
if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1<<item->GetTemplate()->SubClass) & spellProto->EquippedItemSubClassMask))
return false;
}
}