aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authorleak <leakzx@googlemail.com>2011-04-28 22:42:33 +0200
committerleak <leakzx@googlemail.com>2011-04-28 22:42:33 +0200
commita82654debd8fd00fec3f2024290876ab0d6dd175 (patch)
tree034e8ac183c66fe28e3823484e2a85e99c4b6114 /src/server/game/Spells/Spell.cpp
parent03365e9a573667f5485f44642b47b05473094474 (diff)
Core/ObjectMgr: Refactor sItemStorage
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp60
1 files changed, 30 insertions, 30 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index f020ef72249..15d61322db3 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -468,7 +468,7 @@ m_caster(Caster), m_spellValue(new SpellValue(m_spellInfo))
if ((m_caster->getClassMask() & CLASSMASK_WAND_USERS) != 0 && m_caster->GetTypeId() == TYPEID_PLAYER)
{
if (Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK))
- m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetProto()->Damage[0].DamageType);
+ m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->Damage[0].DamageType);
}
}
@@ -3802,7 +3802,7 @@ void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 ca
for (int8 x=0;x < 3;x++)
if (spellInfo->EffectItemType[x])
item = spellInfo->EffectItemType[x];
- ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item);
+ ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item);
if (pProto && pProto->ItemLimitCategory)
data << uint32(pProto->ItemLimitCategory);
break;
@@ -3981,15 +3981,15 @@ void Spell::WriteAmmoToPacket(WorldPacket * data)
Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
if (pItem)
{
- ammoInventoryType = pItem->GetProto()->InventoryType;
+ ammoInventoryType = pItem->GetTemplate()->InventoryType;
if (ammoInventoryType == INVTYPE_THROWN)
- ammoDisplayID = pItem->GetProto()->DisplayInfoID;
+ ammoDisplayID = pItem->GetTemplate()->DisplayInfoID;
else
{
uint32 ammoID = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID);
if (ammoID)
{
- ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(ammoID);
+ ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(ammoID);
if (pProto)
{
ammoDisplayID = pProto->DisplayInfoID;
@@ -4307,7 +4307,7 @@ void Spell::TakeCastItem()
if (m_IsTriggeredSpell)
return;
- ItemPrototype const *proto = m_CastItem->GetProto();
+ ItemTemplate const *proto = m_CastItem->GetTemplate();
if (!proto)
{
@@ -4426,10 +4426,10 @@ void Spell::TakeAmmo()
Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
// wands don't have ammo
- if (!pItem || pItem->IsBroken() || pItem->GetProto()->SubClass == ITEM_SUBCLASS_WEAPON_WAND)
+ if (!pItem || pItem->IsBroken() || pItem->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_WAND)
return;
- if (pItem->GetProto()->InventoryType == INVTYPE_THROWN)
+ if (pItem->GetTemplate()->InventoryType == INVTYPE_THROWN)
{
if (pItem->GetMaxStackCount() == 1)
{
@@ -4579,7 +4579,7 @@ void Spell::TakeReagents()
return;
// do not take reagents for these item casts
- if (m_CastItem && m_CastItem->GetProto()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST)
+ if (m_CastItem && m_CastItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST)
return;
Player* p_caster = (Player*)m_caster;
@@ -4597,7 +4597,7 @@ void Spell::TakeReagents()
// if CastItem is also spell reagent
if (m_CastItem)
{
- ItemPrototype const *proto = m_CastItem->GetProto();
+ ItemTemplate const *proto = m_CastItem->GetTemplate();
if (proto && proto->ItemId == itemid)
{
for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
@@ -5140,10 +5140,10 @@ SpellCastResult Spell::CheckCast(bool strict)
if (!pet)
return SPELL_FAILED_NO_PET;
- if (!pet->HaveInDiet(foodItem->GetProto()))
+ if (!pet->HaveInDiet(foodItem->GetTemplate()))
return SPELL_FAILED_WRONG_PET_FOOD;
- if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel))
+ if (!pet->GetCurrentFoodBenefitLevel(foodItem->GetTemplate()->ItemLevel))
return SPELL_FAILED_FOOD_LOWLEVEL;
if (m_caster->isInCombat() || pet->isInCombat())
@@ -5224,7 +5224,7 @@ SpellCastResult Spell::CheckCast(bool strict)
// we need a go target, or an openable item target in case of TARGET_GAMEOBJECT_ITEM
if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_GAMEOBJECT_ITEM &&
!m_targets.getGOTarget() &&
- (!pTempItem || !pTempItem->GetProto()->LockID || !pTempItem->IsLocked()))
+ (!pTempItem || !pTempItem->GetTemplate()->LockID || !pTempItem->IsLocked()))
return SPELL_FAILED_BAD_TARGETS;
if (m_spellInfo->Id != 1842 || (m_targets.getGOTarget() &&
@@ -5242,7 +5242,7 @@ SpellCastResult Spell::CheckCast(bool strict)
return SPELL_FAILED_BAD_TARGETS;
}
else if (Item* itm = m_targets.getItemTarget())
- lockId = itm->GetProto()->LockID;
+ lockId = itm->GetTemplate()->LockID;
SkillType skillId = SKILL_NONE;
int32 reqSkillValue = 0;
@@ -5901,7 +5901,7 @@ SpellCastResult Spell::CheckItems()
if (!p_caster->HasItemCount(itemid, 1))
return SPELL_FAILED_ITEM_NOT_READY;
- ItemPrototype const *proto = m_CastItem->GetProto();
+ ItemTemplate const *proto = m_CastItem->GetTemplate();
if (!proto)
return SPELL_FAILED_ITEM_NOT_READY;
@@ -6003,7 +6003,7 @@ SpellCastResult Spell::CheckItems()
}
// do not take reagents for these item casts
- if (!(m_CastItem && m_CastItem->GetProto()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST))
+ if (!(m_CastItem && m_CastItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST))
{
bool checkReagents = !m_IsTriggeredSpell && !p_caster->CanNoReagentCast(m_spellInfo);
// Not own traded item (in trader trade slot) requires reagents even if triggered spell
@@ -6026,7 +6026,7 @@ SpellCastResult Spell::CheckItems()
// if CastItem is also spell reagent
if (m_CastItem && m_CastItem->GetEntry() == itemid)
{
- ItemPrototype const *proto = m_CastItem->GetProto();
+ ItemTemplate const *proto = m_CastItem->GetTemplate();
if (!proto)
return SPELL_FAILED_ITEM_NOT_READY;
for (int s=0; s < MAX_ITEM_PROTO_SPELLS; ++s)
@@ -6095,7 +6095,7 @@ SpellCastResult Spell::CheckItems()
uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1);
if (msg != EQUIP_ERR_OK)
{
- ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(m_spellInfo->EffectItemType[i]);
+ ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(m_spellInfo->EffectItemType[i]);
// TODO: Needs review
if (pProto && !(pProto->ItemLimitCategory))
{
@@ -6124,7 +6124,7 @@ SpellCastResult Spell::CheckItems()
if (m_targets.getItemTarget()->GetOwner() != m_caster)
return SPELL_FAILED_NOT_TRADEABLE;
// do not allow to enchant vellum from scroll made by vellum-prevent exploit
- if (m_CastItem && m_CastItem->GetProto()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST)
+ if (m_CastItem && m_CastItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST)
return SPELL_FAILED_TOTEM_CATEGORY;
ItemPosCountVec dest;
uint8 msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->EffectItemType[i], 1);
@@ -6140,13 +6140,13 @@ SpellCastResult Spell::CheckItems()
if (!targetItem)
return SPELL_FAILED_ITEM_NOT_FOUND;
- if (targetItem->GetProto()->ItemLevel < m_spellInfo->baseLevel)
+ if (targetItem->GetTemplate()->ItemLevel < m_spellInfo->baseLevel)
return SPELL_FAILED_LOWLEVEL;
bool isItemUsable = false;
for (uint8 e = 0; e < MAX_ITEM_PROTO_SPELLS; ++e)
{
- ItemPrototype const *proto = targetItem->GetProto();
+ ItemTemplate const *proto = targetItem->GetTemplate();
if (proto->Spells[e].SpellId && (
proto->Spells[e].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE ||
proto->Spells[e].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE))
@@ -6202,7 +6202,7 @@ SpellCastResult Spell::CheckItems()
if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID())
return SPELL_FAILED_CANT_BE_DISENCHANTED;
- ItemPrototype const* itemProto = m_targets.getItemTarget()->GetProto();
+ ItemTemplate const* itemProto = m_targets.getItemTarget()->GetTemplate();
if (!itemProto)
return SPELL_FAILED_CANT_BE_DISENCHANTED;
@@ -6226,13 +6226,13 @@ SpellCastResult Spell::CheckItems()
if (!m_targets.getItemTarget())
return SPELL_FAILED_CANT_BE_PROSPECTED;
//ensure item is a prospectable ore
- if (!(m_targets.getItemTarget()->GetProto()->Flags & ITEM_PROTO_FLAG_PROSPECTABLE))
+ if (!(m_targets.getItemTarget()->GetTemplate()->Flags & ITEM_PROTO_FLAG_PROSPECTABLE))
return SPELL_FAILED_CANT_BE_PROSPECTED;
//prevent prospecting in trade slot
if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID())
return SPELL_FAILED_CANT_BE_PROSPECTED;
//Check for enough skill in jewelcrafting
- uint32 item_prospectingskilllevel = m_targets.getItemTarget()->GetProto()->RequiredSkillRank;
+ uint32 item_prospectingskilllevel = m_targets.getItemTarget()->GetTemplate()->RequiredSkillRank;
if (item_prospectingskilllevel >p_caster->GetSkillValue(SKILL_JEWELCRAFTING))
return SPELL_FAILED_LOW_CASTLEVEL;
//make sure the player has the required ores in inventory
@@ -6249,13 +6249,13 @@ SpellCastResult Spell::CheckItems()
if (!m_targets.getItemTarget())
return SPELL_FAILED_CANT_BE_MILLED;
//ensure item is a millable herb
- if (!(m_targets.getItemTarget()->GetProto()->Flags & ITEM_PROTO_FLAG_MILLABLE))
+ if (!(m_targets.getItemTarget()->GetTemplate()->Flags & ITEM_PROTO_FLAG_MILLABLE))
return SPELL_FAILED_CANT_BE_MILLED;
//prevent milling in trade slot
if (m_targets.getItemTarget()->GetOwnerGUID() != m_caster->GetGUID())
return SPELL_FAILED_CANT_BE_MILLED;
//Check for enough skill in inscription
- uint32 item_millingskilllevel = m_targets.getItemTarget()->GetProto()->RequiredSkillRank;
+ uint32 item_millingskilllevel = m_targets.getItemTarget()->GetTemplate()->RequiredSkillRank;
if (item_millingskilllevel >p_caster->GetSkillValue(SKILL_INSCRIPTION))
return SPELL_FAILED_LOW_CASTLEVEL;
//make sure the player has the required herbs in inventory
@@ -6277,7 +6277,7 @@ SpellCastResult Spell::CheckItems()
if (!pItem || pItem->IsBroken())
return SPELL_FAILED_EQUIPPED_ITEM;
- switch(pItem->GetProto()->SubClass)
+ switch(pItem->GetTemplate()->SubClass)
{
case ITEM_SUBCLASS_WEAPON_THROWN:
{
@@ -6299,7 +6299,7 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_NO_AMMO;
}
- ItemPrototype const *ammoProto = ObjectMgr::GetItemPrototype(ammo);
+ ItemTemplate const *ammoProto = sObjectMgr->GetItemTemplate(ammo);
if (!ammoProto)
return SPELL_FAILED_NO_AMMO;
@@ -6307,7 +6307,7 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_NO_AMMO;
// check ammo ws. weapon compatibility
- switch(pItem->GetProto()->SubClass)
+ switch(pItem->GetTemplate()->SubClass)
{
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
@@ -6338,7 +6338,7 @@ SpellCastResult Spell::CheckItems()
case SPELL_EFFECT_CREATE_MANA_GEM:
{
uint32 item_id = m_spellInfo->EffectItemType[i];
- ItemPrototype const *pProto = ObjectMgr::GetItemPrototype(item_id);
+ ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item_id);
if (!pProto)
return SPELL_FAILED_ITEM_AT_MAX_CHARGES;