aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells
diff options
context:
space:
mode:
authorkaelima <kaelima@live.se>2011-11-25 18:54:59 +0100
committerkaelima <kaelima@live.se>2011-11-25 18:54:59 +0100
commitec54bb48952fb0f766c61976f736ad727f9aadd0 (patch)
tree816594e7dc4373461cb87743d2d09365234b3b1a /src/server/game/Spells
parent9696d6ba7b02b722b4a03e253ffa653e16940af1 (diff)
Core/Misc:
Clearing compile errors since UpdateFields were changed: - Completely remove ammo (Cataclysm change) - Revert some changes with power/maxpower and only store the 5 needed powers in db (the rest is useless) - Remove GuildId from corpse - Move PLAYER_GUILDID to character db (removed updatefield) Note: Compile is still not working as we need to change currency handling
Diffstat (limited to 'src/server/game/Spells')
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp10
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp124
-rwxr-xr-xsrc/server/game/Spells/Spell.h3
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp2
4 files changed, 5 insertions, 134 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index b7cc673962c..20ee5ce39e4 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -1984,7 +1984,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
case FORM_DIREBEAR:
{
// get furor proc chance
- uint32 FurorChance = 0;
+ int32 FurorChance = 0;
if (AuraEffect const* dummy = target->GetDummyAuraEffect(SPELLFAMILY_DRUID, 238, 0))
FurorChance = std::max(dummy->GetAmount(), 0);
@@ -2003,7 +2003,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
target->CastSpell(target, 17057, true);
default:
{
- uint32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance);
+ int32 newEnergy = std::min(target->GetPower(POWER_ENERGY), FurorChance);
target->SetPower(POWER_ENERGY, newEnergy);
}
break;
@@ -2056,7 +2056,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
case FORM_DEFENSIVESTANCE:
case FORM_BERSERKERSTANCE:
{
- uint32 Rage_val = 0;
+ int32 Rage_val = 0;
// Defensive Tactics
if (form == FORM_DEFENSIVESTANCE)
{
@@ -4757,10 +4757,6 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
target->GetMotionMaster()->MoveFall(currentGroundLevel);
}
break;
- case 46699: // Requires No Ammo
- if (target->GetTypeId() == TYPEID_PLAYER)
- target->ToPlayer()->RemoveAmmo(); // not use ammo and not allow use
- break;
case 49028:
if (caster)
if (AuraEffect* aurEff = caster->GetAuraEffect(63330, 0)) // glyph of Dancing Rune Weapon
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 4003f2f3b36..c1749867945 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -3738,8 +3738,6 @@ void Spell::SendSpellStart()
if ((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell)
castFlags |= CAST_FLAG_PENDING;
- if (m_spellInfo->Attributes & SPELL_ATTR0_REQ_AMMO)
- castFlags |= CAST_FLAG_AMMO;
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet()))
&& m_spellInfo->PowerType != POWER_HEALTH)
@@ -3765,9 +3763,6 @@ void Spell::SendSpellStart()
if (castFlags & CAST_FLAG_POWER_LEFT_SELF)
data << uint32(m_caster->GetPower((Powers)m_spellInfo->PowerType));
- if (castFlags & CAST_FLAG_AMMO)
- WriteAmmoToPacket(&data);
-
if (castFlags & CAST_FLAG_UNKNOWN_23)
{
data << uint32(0);
@@ -3791,8 +3786,6 @@ void Spell::SendSpellGo()
if ((IsTriggered() && !m_spellInfo->IsAutoRepeatRangedSpell()) || m_triggeredByAuraSpell)
castFlags |= CAST_FLAG_PENDING;
- if (m_spellInfo->Attributes & SPELL_ATTR0_REQ_AMMO)
- castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual
if ((m_caster->GetTypeId() == TYPEID_PLAYER ||
(m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isPet()))
&& m_spellInfo->PowerType != POWER_HEALTH)
@@ -3863,9 +3856,6 @@ void Spell::SendSpellGo()
data << uint32(0);
}
- if (castFlags & CAST_FLAG_AMMO)
- WriteAmmoToPacket(&data);
-
if (castFlags & CAST_FLAG_UNKNOWN_20) // unknown wotlk
{
data << uint32(0);
@@ -3880,78 +3870,6 @@ void Spell::SendSpellGo()
m_caster->SendMessageToSet(&data, true);
}
-void Spell::WriteAmmoToPacket(WorldPacket* data)
-{
- uint32 ammoInventoryType = 0;
- uint32 ammoDisplayID = 0;
-
- if (m_caster->GetTypeId() == TYPEID_PLAYER)
- {
- Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
- if (pItem)
- {
- ammoInventoryType = pItem->GetTemplate()->InventoryType;
- if (ammoInventoryType == INVTYPE_THROWN)
- ammoDisplayID = pItem->GetTemplate()->DisplayInfoID;
- else
- {
- uint32 ammoID = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID);
- if (ammoID)
- {
- ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(ammoID);
- if (pProto)
- {
- ammoDisplayID = pProto->DisplayInfoID;
- ammoInventoryType = pProto->InventoryType;
- }
- }
- else if (m_caster->HasAura(46699)) // Requires No Ammo
- {
- ammoDisplayID = 5996; // normal arrow
- ammoInventoryType = INVTYPE_AMMO;
- }
- }
- }
- }
- else
- {
- for (uint8 i = 0; i < 3; ++i)
- {
- if (uint32 item_id = m_caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + i))
- {
- if (ItemEntry const* itemEntry = sItemStore.LookupEntry(item_id))
- {
- if (itemEntry->Class == ITEM_CLASS_WEAPON)
- {
- switch (itemEntry->SubClass)
- {
- case ITEM_SUBCLASS_WEAPON_THROWN:
- ammoDisplayID = itemEntry->DisplayId;
- ammoInventoryType = itemEntry->InventoryType;
- break;
- case ITEM_SUBCLASS_WEAPON_BOW:
- case ITEM_SUBCLASS_WEAPON_CROSSBOW:
- ammoDisplayID = 5996; // is this need fixing?
- ammoInventoryType = INVTYPE_AMMO;
- break;
- case ITEM_SUBCLASS_WEAPON_GUN:
- ammoDisplayID = 5998; // is this need fixing?
- ammoInventoryType = INVTYPE_AMMO;
- break;
- }
-
- if (ammoDisplayID)
- break;
- }
- }
- }
- }
- }
-
- *data << uint32(ammoDisplayID);
- *data << uint32(ammoInventoryType);
-}
-
void Spell::WriteSpellGoTargets(WorldPacket* data)
{
// This function also fill data for channeled spells:
@@ -4319,8 +4237,6 @@ void Spell::TakeAmmo()
m_caster->ToPlayer()->DestroyItemCount(pItem, count, true);
}
}
- else if (uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID))
- m_caster->ToPlayer()->DestroyItemCount(ammo, 1, true);
}
}
@@ -6136,46 +6052,6 @@ SpellCastResult Spell::CheckItems()
case ITEM_SUBCLASS_WEAPON_GUN:
case ITEM_SUBCLASS_WEAPON_BOW:
case ITEM_SUBCLASS_WEAPON_CROSSBOW:
- {
- uint32 ammo = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID);
- if (!ammo)
- {
- // Requires No Ammo
- if (m_caster->HasAura(46699))
- break; // skip other checks
-
- return SPELL_FAILED_NO_AMMO;
- }
-
- ItemTemplate const* ammoProto = sObjectMgr->GetItemTemplate(ammo);
- if (!ammoProto)
- return SPELL_FAILED_NO_AMMO;
-
- if (ammoProto->Class != ITEM_CLASS_PROJECTILE)
- return SPELL_FAILED_NO_AMMO;
-
- // check ammo ws. weapon compatibility
- switch (pItem->GetTemplate()->SubClass)
- {
- case ITEM_SUBCLASS_WEAPON_BOW:
- case ITEM_SUBCLASS_WEAPON_CROSSBOW:
- if (ammoProto->SubClass != ITEM_SUBCLASS_ARROW)
- return SPELL_FAILED_NO_AMMO;
- break;
- case ITEM_SUBCLASS_WEAPON_GUN:
- if (ammoProto->SubClass != ITEM_SUBCLASS_BULLET)
- return SPELL_FAILED_NO_AMMO;
- break;
- default:
- return SPELL_FAILED_NO_AMMO;
- }
-
- if (!m_caster->ToPlayer()->HasItemCount(ammo, 1))
- {
- m_caster->ToPlayer()->SetUInt32Value(PLAYER_AMMO_ID, 0);
- return SPELL_FAILED_NO_AMMO;
- }
- }; break;
case ITEM_SUBCLASS_WEAPON_WAND:
break;
default:
diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h
index 624c3b9b9b3..02f415e88c3 100755
--- a/src/server/game/Spells/Spell.h
+++ b/src/server/game/Spells/Spell.h
@@ -43,7 +43,7 @@ enum SpellCastFlags
CAST_FLAG_UNKNOWN_3 = 0x00000004,
CAST_FLAG_UNKNOWN_4 = 0x00000008, // ignore AOE visual
CAST_FLAG_UNKNOWN_5 = 0x00000010,
- CAST_FLAG_AMMO = 0x00000020, // Projectiles visual
+ CAST_FLAG_UNKNOWN_6 = 0x00000020,
CAST_FLAG_UNKNOWN_7 = 0x00000040,
CAST_FLAG_UNKNOWN_8 = 0x00000080,
CAST_FLAG_UNKNOWN_9 = 0x00000100,
@@ -402,7 +402,6 @@ class Spell
void DoCreateItem(uint32 i, uint32 itemtype);
void WriteSpellGoTargets(WorldPacket* data);
- void WriteAmmoToPacket(WorldPacket* data);
void InitExplicitTargets(SpellCastTargets const& targets);
void SelectSpellTargets();
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
index 8cb001ed0ac..a3ff66f7b5b 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -7344,7 +7344,7 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex)
if (!(spellInfo->AttributesEx7 & SPELL_ATTR7_SUMMON_PLAYER_TOTEM))
continue;
- uint32 cost = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask());
+ int32 cost = spellInfo->CalcPowerCost(m_caster, spellInfo->GetSchoolMask());
if (m_caster->GetPower(POWER_MANA) < cost)
continue;