Core/ObjectMgr: Refactor sItemStorage
This commit is contained in:
@@ -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++;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user