aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells
diff options
context:
space:
mode:
authorRat <gmstreetrat@gmail.com>2011-11-26 20:38:25 +0100
committerRat <gmstreetrat@gmail.com>2011-11-26 20:38:25 +0100
commitca03e79ce787702f97f3b3e3a09e39646bedc28f (patch)
treef4df95bb5bf59823f002fd3e456f569936677283 /src/server/game/Spells
parent8cf3fde3291e8fdadef564232c2981d670a1e274 (diff)
parentbc37c75dfde1882b208be13731f9ffdc54938d62 (diff)
Merge branch '4.x' of github.com:TrinityCore/TrinityCore into 4.x
Diffstat (limited to 'src/server/game/Spells')
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuraEffects.cpp16
-rwxr-xr-xsrc/server/game/Spells/Auras/SpellAuras.cpp12
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp126
-rwxr-xr-xsrc/server/game/Spells/Spell.h3
-rwxr-xr-xsrc/server/game/Spells/SpellEffects.cpp9
-rw-r--r--src/server/game/Spells/SpellInfo.cpp1
6 files changed, 24 insertions, 143 deletions
diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
index b7cc673962c..bd9a0159c72 100755
--- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
+++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
@@ -1972,7 +1972,7 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
if (PowerType != POWER_MANA)
{
- uint32 oldPower = target->GetPower(PowerType);
+ int32 oldPower = target->GetPower(PowerType);
// reset power to default values only at power change
if (target->getPowerType() != PowerType)
target->setPowerType(PowerType);
@@ -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);
@@ -1992,18 +1992,18 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
{
case FORM_CAT:
{
- int32 basePoints = int32(std::min(oldPower, FurorChance));
+ int32 basePoints = std::min<int32>(oldPower, FurorChance);
target->SetPower(POWER_ENERGY, 0);
target->CastCustomSpell(target, 17099, &basePoints, NULL, NULL, true, NULL, this);
}
break;
case FORM_BEAR:
case FORM_DIREBEAR:
- if (urand(0, 99) < FurorChance)
+ if (irand(0, 99) < FurorChance)
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/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp
index 525084a70ed..ffe3b0084a9 100755
--- a/src/server/game/Spells/Auras/SpellAuras.cpp
+++ b/src/server/game/Spells/Auras/SpellAuras.cpp
@@ -192,7 +192,7 @@ void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const
uint32 flags = m_flags;
if (aura->GetMaxDuration() > 0 && !(aura->GetSpellInfo()->AttributesEx5 & SPELL_ATTR5_HIDE_DURATION))
flags |= AFLAG_DURATION;
- data << uint8(flags);
+ data << uint16(flags);
data << uint8(aura->GetCasterLevel());
// send stack amount for aura which could be stacked (never 0 - causes incorrect display) or charges
// stack amount has priority over charges (checked on retail with spell 50262)
@@ -206,6 +206,16 @@ void AuraApplication::BuildUpdatePacket(ByteBuffer& data, bool remove) const
data << uint32(aura->GetMaxDuration());
data << uint32(aura->GetDuration());
}
+
+ if (flags & AFLAG_ANY_EFFECT_AMOUNT_SENT)
+ {
+ if (flags & AFLAG_EFF_INDEX_0)
+ data << uint32(0); // Effect 0 value
+ if (flags & AFLAG_EFF_INDEX_1)
+ data << uint32(0); // Effect 1 value
+ if (flags & AFLAG_EFF_INDEX_2)
+ data << uint32(0); // Effect 2 value
+ }
}
void AuraApplication::ClientUpdate(bool remove)
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 4003f2f3b36..c47d6d08990 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -513,7 +513,7 @@ m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharme
// wand case
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->GetTemplate()->Damage[0].DamageType);
+ m_spellSchoolMask = SpellSchoolMask(1 << pItem->GetTemplate()->DamageType);
if (originalCasterGUID)
m_originalCasterGUID = originalCasterGUID;
@@ -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 a4cf8e6a469..e95203d97be 100755
--- a/src/server/game/Spells/SpellEffects.cpp
+++ b/src/server/game/Spells/SpellEffects.cpp
@@ -694,13 +694,13 @@ void Spell::EffectSchoolDMG(SpellEffIndex effIndex)
Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK);
if (item)
{
- float dmg_min = item->GetTemplate()->Damage->DamageMin;
- float dmg_max = item->GetTemplate()->Damage->DamageMax;
+ float dmg_min = item->GetTemplate()->DamageMin;
+ float dmg_max = item->GetTemplate()->DamageMax;
if (dmg_max == 0.0f && dmg_min > dmg_max)
damage += int32(dmg_min);
else
damage += irand(int32(dmg_min), int32(dmg_max));
- damage += int32(m_caster->ToPlayer()->GetAmmoDPS()*item->GetTemplate()->Delay*0.001f);
+ damage += int32(item->GetTemplate()->Delay*0.001f);
}
}
}
@@ -6195,6 +6195,7 @@ void Spell::EffectSelfResurrect(SpellEffIndex effIndex)
player->SetPower(POWER_MANA, mana);
player->SetPower(POWER_RAGE, 0);
player->SetPower(POWER_ENERGY, player->GetMaxPower(POWER_ENERGY));
+ player->SetPower(POWER_FOCUS, 0);
player->SpawnCorpseBones();
}
@@ -7343,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;
diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp
index 78de015f200..3edf682f5bb 100644
--- a/src/server/game/Spells/SpellInfo.cpp
+++ b/src/server/game/Spells/SpellInfo.cpp
@@ -2170,7 +2170,6 @@ uint32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask)
case POWER_RAGE:
case POWER_FOCUS:
case POWER_ENERGY:
- case POWER_HAPPINESS:
powerCost += int32(CalculatePctU(caster->GetMaxPower(Powers(PowerType)), ManaCostPercentage));
break;
case POWER_RUNE: