Scripts/Spells: Convert code from Spell::EffectDummy to spell scripts.
This commit is contained in:
1 parent
d55c8c7cc4
commit
c517806a23
24 files changed
+4446
-2965
No files matched your search
@@ -22,7 +22,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_gen_"
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "SkillDiscovery.h"
|
||||
#include "GridNotifiers.h"
|
||||
@@ -236,9 +235,7 @@ class spell_gen_parachute : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PARACHUTE) || !sSpellMgr->GetSpellInfo(SPELL_PARACHUTE_BUFF))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -246,13 +243,11 @@ class spell_gen_parachute : public SpellScriptLoader
|
||||
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
if (Player* target = GetTarget()->ToPlayer())
|
||||
{
|
||||
if (target->IsFalling())
|
||||
{
|
||||
target->RemoveAurasDueToSpell(SPELL_PARACHUTE);
|
||||
target->CastSpell(target, SPELL_PARACHUTE_BUFF, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -283,13 +278,14 @@ class spell_gen_pet_summoned : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_gen_pet_summoned_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
Player* player = caster->ToPlayer();
|
||||
Player* player = GetCaster()->ToPlayer();
|
||||
if (player->GetLastPetNumber())
|
||||
{
|
||||
PetType newPetType = (player->getClass() == CLASS_HUNTER) ? HUNTER_PET : SUMMON_PET;
|
||||
@@ -340,10 +336,14 @@ class spell_gen_remove_flight_auras : public SpellScriptLoader
|
||||
class spell_gen_remove_flight_auras_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_remove_flight_auras_SpellScript);
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
GetHitUnit()->RemoveAurasByType(SPELL_AURA_FLY);
|
||||
GetHitUnit()->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED);
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
target->RemoveAurasByType(SPELL_AURA_FLY);
|
||||
target->RemoveAurasByType(SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -376,22 +376,21 @@ class spell_gen_leeching_swarm : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_DMG))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_HEAL))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_DMG) || !sSpellMgr->GetSpellInfo(SPELL_LEECHING_SWARM_HEAL))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleEffectPeriodic(AuraEffect const* aurEff)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetTarget())
|
||||
{
|
||||
int32 lifeLeeched = GetTarget()->CountPctFromCurHealth(aurEff->GetAmount());
|
||||
int32 lifeLeeched = target->CountPctFromCurHealth(aurEff->GetAmount());
|
||||
if (lifeLeeched < 250)
|
||||
lifeLeeched = 250;
|
||||
// Damage
|
||||
caster->CastCustomSpell(GetTarget(), SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, false);
|
||||
caster->CastCustomSpell(target, SPELL_LEECHING_SWARM_DMG, &lifeLeeched, 0, 0, false);
|
||||
// Heal
|
||||
caster->CastCustomSpell(caster, SPELL_LEECHING_SWARM_HEAL, &lifeLeeched, 0, 0, false);
|
||||
}
|
||||
@@ -500,31 +499,16 @@ class spell_gen_trick : public SpellScriptLoader
|
||||
PrepareSpellScript(spell_gen_trick_SpellScript);
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_FEMALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_MALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_FEMALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SKELETON_COSTUME))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_MALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_FEMALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TRICK_BUFF))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_PIRATE_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_MALE)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_NINJA_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_LEPER_GNOME_COSTUME_FEMALE)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_SKELETON_COSTUME) || !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_MALE) || !sSpellMgr->GetSpellInfo(SPELL_GHOST_COSTUME_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_TRICK_BUFF))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Player* target = GetHitPlayer())
|
||||
{
|
||||
uint8 gender = target->getGender();
|
||||
@@ -550,7 +534,7 @@ class spell_gen_trick : public SpellScriptLoader
|
||||
break;
|
||||
}
|
||||
|
||||
GetCaster()->CastSpell(target, spellId, true, NULL);
|
||||
caster->CastSpell(target, spellId, true, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,21 +569,18 @@ class spell_gen_trick_or_treat : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TRICK))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TREAT))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TRICKED_OR_TREATED))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TRICK) || !sSpellMgr->GetSpellInfo(SPELL_TREAT) || !sSpellMgr->GetSpellInfo(SPELL_TRICKED_OR_TREATED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Player* target = GetHitPlayer())
|
||||
{
|
||||
GetCaster()->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true, NULL);
|
||||
GetCaster()->CastSpell(target, SPELL_TRICKED_OR_TREATED, true, NULL);
|
||||
caster->CastSpell(target, roll_chance_i(50) ? SPELL_TRICK : SPELL_TREAT, true, NULL);
|
||||
caster->CastSpell(target, SPELL_TRICKED_OR_TREATED, true, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -661,11 +642,14 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_pvp_trinket_wotf_shared_cd_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER_WOTF))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -673,10 +657,7 @@ class spell_pvp_trinket_wotf_shared_cd : public SpellScriptLoader
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
if (!caster)
|
||||
return;
|
||||
SpellInfo const* spellInfo = GetSpellInfo();
|
||||
|
||||
caster->AddSpellCooldown(spellInfo->Id, 0, time(NULL) + sSpellMgr->GetSpellInfo(SPELL_WILL_OF_THE_FORSAKEN_COOLDOWN_TRIGGER)->GetRecoveryTime() / IN_MILLISECONDS);
|
||||
WorldPacket data(SMSG_SPELL_COOLDOWN, 8+1+4);
|
||||
data << uint64(caster->GetGUID());
|
||||
@@ -729,8 +710,9 @@ class spell_gen_animal_blood : public SpellScriptLoader
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (GetUnitOwner()->IsInWater())
|
||||
GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SPAWN_BLOOD_POOL, true);
|
||||
if (Unit* owner = GetUnitOwner())
|
||||
if (owner->IsInWater())
|
||||
owner->CastSpell(owner, SPELL_SPAWN_BLOOD_POOL, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -761,6 +743,11 @@ class spell_gen_divine_storm_cd_reset : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_gen_divine_storm_cd_reset_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_DIVINE_STORM))
|
||||
@@ -770,9 +757,9 @@ class spell_gen_divine_storm_cd_reset : public SpellScriptLoader
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Player* caster = GetCaster()->ToPlayer())
|
||||
if (caster->HasSpellCooldown(SPELL_DIVINE_STORM))
|
||||
caster->RemoveSpellCooldown(SPELL_DIVINE_STORM, true);
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
if (caster->HasSpellCooldown(SPELL_DIVINE_STORM))
|
||||
caster->RemoveSpellCooldown(SPELL_DIVINE_STORM, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -796,13 +783,15 @@ class spell_gen_gunship_portal : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_gen_gunship_portal_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleScript(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (caster->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
if (Battleground* bg = caster->ToPlayer()->GetBattleground())
|
||||
Player* caster = GetCaster()->ToPlayer();
|
||||
if (Battleground* bg = caster->GetBattleground())
|
||||
if (bg->GetTypeID(true) == BATTLEGROUND_IC)
|
||||
bg->DoAction(1, caster->GetGUID());
|
||||
}
|
||||
@@ -821,7 +810,7 @@ class spell_gen_gunship_portal : public SpellScriptLoader
|
||||
|
||||
enum parachuteIC
|
||||
{
|
||||
SPELL_PARACHUTE_IC = 66657
|
||||
SPELL_PARACHUTE_IC = 66657,
|
||||
};
|
||||
|
||||
class spell_gen_parachute_ic : public SpellScriptLoader
|
||||
@@ -835,13 +824,9 @@ class spell_gen_parachute_ic : public SpellScriptLoader
|
||||
|
||||
void HandleTriggerSpell(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
|
||||
if (!target->ToPlayer())
|
||||
return;
|
||||
|
||||
if (target->ToPlayer()->m_movementInfo.fallTime > 2000)
|
||||
target->CastSpell(target, SPELL_PARACHUTE_IC, true);
|
||||
if (Player* target = GetTarget()->ToPlayer())
|
||||
if (target->m_movementInfo.fallTime > 2000)
|
||||
target->CastSpell(target, SPELL_PARACHUTE_IC, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -868,7 +853,7 @@ class spell_gen_dungeon_credit : public SpellScriptLoader
|
||||
bool Load()
|
||||
{
|
||||
_handled = false;
|
||||
return true;
|
||||
return GetCaster()->GetTypeId() == TYPEID_UNIT;
|
||||
}
|
||||
|
||||
void CreditEncounter()
|
||||
@@ -878,9 +863,9 @@ class spell_gen_dungeon_credit : public SpellScriptLoader
|
||||
return;
|
||||
|
||||
_handled = true;
|
||||
if (GetCaster()->GetTypeId() == TYPEID_UNIT)
|
||||
if (InstanceScript* instance = GetCaster()->GetInstanceScript())
|
||||
instance->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, GetSpellInfo()->Id, GetCaster());
|
||||
Unit* caster = GetCaster();
|
||||
if (InstanceScript* instance = caster->GetInstanceScript())
|
||||
instance->UpdateEncounterState(ENCOUNTER_CREDIT_CAST_SPELL, GetSpellInfo()->Id, caster);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -906,9 +891,14 @@ class spell_gen_profession_research : public SpellScriptLoader
|
||||
{
|
||||
PrepareSpellScript(spell_gen_profession_research_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
SpellCastResult CheckRequirement()
|
||||
{
|
||||
if (GetCaster()->GetTypeId() == TYPEID_PLAYER && HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer()))
|
||||
if (HasDiscoveredAllSpells(GetSpellInfo()->Id, GetCaster()->ToPlayer()))
|
||||
{
|
||||
SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_NOTHING_TO_DISCOVER);
|
||||
return SPELL_FAILED_CUSTOM_ERROR;
|
||||
@@ -978,19 +968,11 @@ class spell_generic_clone_weapon : public SpellScriptLoader
|
||||
class spell_generic_clone_weapon_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_generic_clone_weapon_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_WEAPON_3) || !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_COPY_OFFHAND_2) || !sSpellMgr->GetSpellInfo(SPELL_COPY_RANGED))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
@@ -999,57 +981,56 @@ class spell_generic_clone_weapon : public SpellScriptLoader
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
Unit* caster = GetCaster();
|
||||
Unit* target = GetHitUnit();
|
||||
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
|
||||
target->CastSpell(caster, spellId, true);
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
switch (GetSpellInfo()->Id)
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
case SPELL_COPY_WEAPON:
|
||||
case SPELL_COPY_WEAPON_2:
|
||||
case SPELL_COPY_WEAPON_3:
|
||||
|
||||
uint32 spellId = uint32(GetSpellInfo()->Effects[EFFECT_0].CalcValue());
|
||||
target->CastSpell(caster, spellId, true);
|
||||
|
||||
if (target->GetTypeId() == TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
switch (GetSpellInfo()->Id)
|
||||
{
|
||||
if (Player* player = caster->ToPlayer())
|
||||
case SPELL_COPY_WEAPON:
|
||||
case SPELL_COPY_WEAPON_2:
|
||||
case SPELL_COPY_WEAPON_3:
|
||||
{
|
||||
if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry());
|
||||
if (Player* player = caster->ToPlayer())
|
||||
{
|
||||
if (Item* mainItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, mainItem->GetEntry());
|
||||
}
|
||||
else
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
|
||||
break;
|
||||
}
|
||||
else
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
|
||||
break;
|
||||
}
|
||||
case SPELL_COPY_OFFHAND:
|
||||
case SPELL_COPY_OFFHAND_2:
|
||||
{
|
||||
if (Player* player = caster->ToPlayer())
|
||||
case SPELL_COPY_OFFHAND:
|
||||
case SPELL_COPY_OFFHAND_2:
|
||||
{
|
||||
if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry());
|
||||
if (Player* player = caster->ToPlayer())
|
||||
{
|
||||
if (Item* offItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, offItem->GetEntry());
|
||||
}
|
||||
else
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
|
||||
break;
|
||||
}
|
||||
else
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
|
||||
break;
|
||||
}
|
||||
case SPELL_COPY_RANGED:
|
||||
{
|
||||
if (Player* player = caster->ToPlayer())
|
||||
case SPELL_COPY_RANGED:
|
||||
{
|
||||
if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry());
|
||||
if (Player* player = caster->ToPlayer())
|
||||
{
|
||||
if (Item* rangedItem = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED))
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, rangedItem->GetEntry());
|
||||
}
|
||||
else
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
|
||||
break;
|
||||
}
|
||||
else
|
||||
target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1095,10 +1076,10 @@ class spell_gen_seaforium_blast : public SpellScriptLoader
|
||||
void AchievementCredit(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
// but in effect handling OriginalCaster can become NULL
|
||||
if (!GetOriginalCaster() || !GetHitGObj() || GetHitGObj()->GetGOInfo()->type != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
|
||||
return;
|
||||
|
||||
GetOriginalCaster()->CastSpell(GetOriginalCaster(), SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT, true);
|
||||
if (Unit* originalCaster = GetOriginalCaster())
|
||||
if (GameObject* go = GetHitGObj())
|
||||
if (GetHitGObj()->GetGOInfo()->type == GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING)
|
||||
originalCaster->CastSpell(originalCaster, SPELL_PLANT_CHARGES_CREDIT_ACHIEVEMENT, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -1131,10 +1112,11 @@ class spell_gen_turkey_marker : public SpellScriptLoader
|
||||
{
|
||||
// store stack apply times, so we can pop them while they expire
|
||||
_applyTimes.push_back(getMSTime());
|
||||
Unit* target = GetTarget();
|
||||
|
||||
// on stack 15 cast the achievement crediting spell
|
||||
if (GetStackAmount() >= 15)
|
||||
GetTarget()->CastSpell(GetTarget(), SPELL_TURKEY_VENGEANCE, true, NULL, aurEff, GetCasterGUID());
|
||||
target->CastSpell(target, SPELL_TURKEY_VENGEANCE, true, NULL, aurEff, GetCasterGUID());
|
||||
}
|
||||
|
||||
void OnPeriodic(AuraEffect const* /*aurEff*/)
|
||||
@@ -1208,29 +1190,28 @@ class spell_gen_magic_rooster : public SpellScriptLoader
|
||||
void HandleScript(SpellEffIndex effIndex)
|
||||
{
|
||||
PreventHitDefaultEffect(effIndex);
|
||||
Player* target = GetHitPlayer();
|
||||
if (!target)
|
||||
return;
|
||||
|
||||
// prevent client crashes from stacking mounts
|
||||
target->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
|
||||
uint32 spellId = SPELL_MAGIC_ROOSTER_NORMAL;
|
||||
switch (target->getRace())
|
||||
if (Player* target = GetHitPlayer())
|
||||
{
|
||||
case RACE_DRAENEI:
|
||||
if (target->getGender() == GENDER_MALE)
|
||||
spellId = SPELL_MAGIC_ROOSTER_DRAENEI_MALE;
|
||||
break;
|
||||
case RACE_TAUREN:
|
||||
if (target->getGender() == GENDER_MALE)
|
||||
spellId = SPELL_MAGIC_ROOSTER_TAUREN_MALE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
// prevent client crashes from stacking mounts
|
||||
target->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
|
||||
target->CastSpell(target, spellId, true);
|
||||
uint32 spellId = SPELL_MAGIC_ROOSTER_NORMAL;
|
||||
switch (target->getRace())
|
||||
{
|
||||
case RACE_DRAENEI:
|
||||
if (target->getGender() == GENDER_MALE)
|
||||
spellId = SPELL_MAGIC_ROOSTER_DRAENEI_MALE;
|
||||
break;
|
||||
case RACE_TAUREN:
|
||||
if (target->getGender() == GENDER_MALE)
|
||||
spellId = SPELL_MAGIC_ROOSTER_TAUREN_MALE;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
target->CastSpell(target, spellId, true);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -1258,7 +1239,6 @@ public:
|
||||
{
|
||||
if (!GetCastItem())
|
||||
return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW;
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
@@ -1335,12 +1315,14 @@ class spell_gen_vehicle_scaling : public SpellScriptLoader
|
||||
{
|
||||
PrepareAuraScript(spell_gen_vehicle_scaling_AuraScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void CalculateAmount(AuraEffect const* /*aurEff*/, int32& amount, bool& /*canBeRecalculated*/)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster || !caster->ToPlayer())
|
||||
return;
|
||||
|
||||
float factor;
|
||||
uint16 baseItemLevel;
|
||||
|
||||
@@ -1379,21 +1361,23 @@ class spell_gen_vehicle_scaling : public SpellScriptLoader
|
||||
};
|
||||
|
||||
|
||||
class spell_gen_oracle_wolvar_reputation: public SpellScriptLoader
|
||||
class spell_gen_oracle_wolvar_reputation : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_oracle_wolvar_reputation() : SpellScriptLoader("spell_gen_oracle_wolvar_reputation") { }
|
||||
public:
|
||||
spell_gen_oracle_wolvar_reputation() : SpellScriptLoader("spell_gen_oracle_wolvar_reputation") { }
|
||||
|
||||
class spell_gen_oracle_wolvar_reputation_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_oracle_wolvar_reputation_SpellScript)
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
class spell_gen_oracle_wolvar_reputation_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_oracle_wolvar_reputation_SpellScript);
|
||||
|
||||
if (Player* player = GetCaster()->ToPlayer())
|
||||
bool Load()
|
||||
{
|
||||
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
{
|
||||
Player* player = GetCaster()->ToPlayer();
|
||||
uint32 factionId = GetSpellInfo()->Effects[effIndex].CalcValue();
|
||||
int32 repChange = GetSpellInfo()->Effects[EFFECT_1].CalcValue();
|
||||
|
||||
@@ -1410,18 +1394,16 @@ public:
|
||||
// EFFECT_INDEX_2 most likely update at war state, we already handle this in SetReputation
|
||||
}
|
||||
|
||||
}
|
||||
void Register()
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_gen_oracle_wolvar_reputation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
void Register()
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
OnEffectHit += SpellEffectFn(spell_gen_oracle_wolvar_reputation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
return new spell_gen_oracle_wolvar_reputation_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_oracle_wolvar_reputation_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum DamageReductionAura
|
||||
@@ -1435,53 +1417,48 @@ enum DamageReductionAura
|
||||
|
||||
class spell_gen_damage_reduction_aura : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_damage_reduction_aura() : SpellScriptLoader("spell_gen_damage_reduction_aura") { }
|
||||
public:
|
||||
spell_gen_damage_reduction_aura() : SpellScriptLoader("spell_gen_damage_reduction_aura") { }
|
||||
|
||||
class spell_gen_damage_reduction_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_damage_reduction_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
class spell_gen_damage_reduction_AuraScript : public AuraScript
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_DAMAGE_REDUCTION_AURA))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
PrepareAuraScript(spell_gen_damage_reduction_AuraScript);
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_DAMAGE_REDUCTION_AURA))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true);
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (target->HasAura(SPELL_DAMAGE_REDUCTION_AURA) && !(target->HasAura(SPELL_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_RENEWED_HOPE) ||
|
||||
target->HasAura(SPELL_VIGILANCE)))
|
||||
target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_gen_damage_reduction_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_gen_damage_reduction_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
target->CastSpell(target, SPELL_DAMAGE_REDUCTION_AURA, true);
|
||||
return new spell_gen_damage_reduction_AuraScript();
|
||||
}
|
||||
|
||||
void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (!target->HasAura(SPELL_DAMAGE_REDUCTION_AURA))
|
||||
return;
|
||||
|
||||
if (target->HasAura(SPELL_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_GREATER_BLESSING_OF_SANCTUARY) ||
|
||||
target->HasAura(SPELL_RENEWED_HOPE) ||
|
||||
target->HasAura(SPELL_VIGILANCE))
|
||||
return;
|
||||
|
||||
target->RemoveAurasDueToSpell(SPELL_DAMAGE_REDUCTION_AURA);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_gen_damage_reduction_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
OnEffectRemove += AuraEffectRemoveFn(spell_gen_damage_reduction_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const
|
||||
{
|
||||
return new spell_gen_damage_reduction_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_luck_of_the_draw : public SpellScriptLoader
|
||||
@@ -1493,6 +1470,11 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader
|
||||
{
|
||||
PrepareAuraScript(spell_gen_luck_of_the_draw_AuraScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetUnitOwner()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
// cheap hax to make it have update calls
|
||||
void CalcPeriodic(AuraEffect const* /*effect*/, bool& isPeriodic, int32& amplitude)
|
||||
{
|
||||
@@ -1502,30 +1484,30 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader
|
||||
|
||||
void Update(AuraEffect* /*effect*/)
|
||||
{
|
||||
if (GetUnitOwner()->GetTypeId() != TYPEID_PLAYER)
|
||||
return;
|
||||
|
||||
const LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(GetUnitOwner()->GetGUID());
|
||||
LfgDungeonSet::const_iterator itr = dungeons.begin();
|
||||
|
||||
if (itr == dungeons.end())
|
||||
if (Player* owner = GetUnitOwner()->ToPlayer())
|
||||
{
|
||||
const LfgDungeonSet dungeons = sLFGMgr->GetSelectedDungeons(owner->GetGUID());
|
||||
LfgDungeonSet::const_iterator itr = dungeons.begin();
|
||||
|
||||
if (itr == dungeons.end())
|
||||
{
|
||||
Remove(AURA_REMOVE_BY_DEFAULT);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*itr);
|
||||
if (Group* group = owner->GetGroup())
|
||||
if (Map const* map = owner->GetMap())
|
||||
if (group->isLFGGroup())
|
||||
if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true))
|
||||
if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
|
||||
if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty())
|
||||
if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM)
|
||||
return; // in correct dungeon
|
||||
|
||||
Remove(AURA_REMOVE_BY_DEFAULT);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*itr);
|
||||
Group* group = GetUnitOwner()->ToPlayer()->GetGroup();
|
||||
Map const* map = GetUnitOwner()->GetMap();
|
||||
if (group && group->isLFGGroup())
|
||||
if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true))
|
||||
if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId))
|
||||
if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty())
|
||||
if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM)
|
||||
return; // in correct dungeon
|
||||
|
||||
Remove(AURA_REMOVE_BY_DEFAULT);
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -1541,6 +1523,178 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
enum DummyTrigger
|
||||
{
|
||||
SPELL_PERSISTANT_SHIELD_TRIGGERED = 26470,
|
||||
SPELL_PERSISTANT_SHIELD = 26467,
|
||||
};
|
||||
|
||||
class spell_gen_dummy_trigger : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_dummy_trigger() : SpellScriptLoader("spell_gen_dummy_trigger") { }
|
||||
|
||||
class spell_gen_dummy_trigger_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_dummy_trigger_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PERSISTANT_SHIELD_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_PERSISTANT_SHIELD))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
if (SpellInfo const* triggeredByAuraSpell = GetTriggeringSpell())
|
||||
if (triggeredByAuraSpell->Id == SPELL_PERSISTANT_SHIELD_TRIGGERED)
|
||||
caster->CastCustomSpell(target, SPELL_PERSISTANT_SHIELD_TRIGGERED, &damage, NULL, NULL, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_dummy_trigger_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_dummy_trigger_SpellScript();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class spell_gen_spirit_healer_res : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_spirit_healer_res(): SpellScriptLoader("spell_gen_spirit_healer_res") { }
|
||||
|
||||
class spell_gen_spirit_healer_res_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_spirit_healer_res_SpellScript);
|
||||
|
||||
bool Load()
|
||||
{
|
||||
return GetOriginalCaster()->GetTypeId() == TYPEID_PLAYER;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
if (Player* originalCaster = GetOriginalCaster()->ToPlayer())
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8);
|
||||
data << uint64(target->GetGUID());
|
||||
originalCaster->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_spirit_healer_res_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_spirit_healer_res_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum TransporterBackfires
|
||||
{
|
||||
SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH = 23444,
|
||||
SPELL_TRANSPORTER_EVIL_TWIN = 23445,
|
||||
SPELL_TRANSPORTER_MALFUNCTION_MISS = 36902,
|
||||
};
|
||||
|
||||
class spell_gen_gadgetzan_transporter_backfire : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_gadgetzan_transporter_backfire() : SpellScriptLoader("spell_gen_gadgetzan_transporter_backfire") { }
|
||||
|
||||
class spell_gen_gadgetzan_transporter_backfire_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_gadgetzan_transporter_backfire_SpellScript)
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH) || !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_EVIL_TWIN)
|
||||
|| !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_MALFUNCTION_MISS))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
int32 r = irand(0, 119);
|
||||
if (r < 20) // Transporter Malfunction - 1/6 polymorph
|
||||
caster->CastSpell(caster, SPELL_TRANSPORTER_MALFUNCTION_POLYMORPH, true);
|
||||
else if (r < 100) // Evil Twin - 4/6 evil twin
|
||||
caster->CastSpell(caster, SPELL_TRANSPORTER_EVIL_TWIN, true);
|
||||
else // Transporter Malfunction - 1/6 miss the target
|
||||
caster->CastSpell(caster, SPELL_TRANSPORTER_MALFUNCTION_MISS, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_gadgetzan_transporter_backfire_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_gadgetzan_transporter_backfire_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum GnomishTransporter
|
||||
{
|
||||
SPELL_TRANSPORTER_SUCCESS = 23441,
|
||||
SPELL_TRANSPORTER_FAILURE = 23446,
|
||||
};
|
||||
|
||||
class spell_gen_gnomish_transporter : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_gnomish_transporter() : SpellScriptLoader("spell_gen_gnomish_transporter") { }
|
||||
|
||||
class spell_gen_gnomish_transporter_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_gnomish_transporter_SpellScript)
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_SUCCESS) || !sSpellMgr->GetSpellInfo(SPELL_TRANSPORTER_FAILURE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
caster->CastSpell(caster, roll_chance_i(50) ? SPELL_TRANSPORTER_SUCCESS : SPELL_TRANSPORTER_FAILURE , true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_gnomish_transporter_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_gnomish_transporter_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
enum DalaranDisguiseSpells
|
||||
{
|
||||
SPELL_SUNREAVER_DISGUISE_TRIGGER = 69672,
|
||||
@@ -1565,15 +1719,11 @@ class spell_gen_dalaran_disguise : public SpellScriptLoader
|
||||
switch (spellEntry->Id)
|
||||
{
|
||||
case SPELL_SUNREAVER_DISGUISE_TRIGGER:
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_FEMALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_MALE))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_SUNREAVER_DISGUISE_MALE))
|
||||
return false;
|
||||
break;
|
||||
case SPELL_SILVER_COVENANT_DISGUISE_TRIGGER:
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_FEMALE))
|
||||
return false;
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_MALE))
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_FEMALE) || !sSpellMgr->GetSpellInfo(SPELL_SILVER_COVENANT_DISGUISE_MALE))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@@ -1599,7 +1749,6 @@ class spell_gen_dalaran_disguise : public SpellScriptLoader
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
GetCaster()->CastSpell(player, spellId, true);
|
||||
}
|
||||
}
|
||||
@@ -2354,6 +2503,47 @@ class spell_gen_tournament_pennant : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
enum ChaosBlast
|
||||
{
|
||||
SPELL_CHAOS_BLAST = 37675,
|
||||
};
|
||||
|
||||
class spell_gen_chaos_blast : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_chaos_blast() : SpellScriptLoader("spell_gen_chaos_blast") { }
|
||||
|
||||
class spell_gen_chaos_blast_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_chaos_blast_SpellScript)
|
||||
|
||||
bool Validate(SpellInfo const* /*SpellEntry*/)
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_CHAOS_BLAST))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
void HandleDummy(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
int32 basepoints0 = 100;
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
caster->CastCustomSpell(target, SPELL_CHAOS_BLAST, &basepoints0, NULL, NULL, true);
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_gen_chaos_blast_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_gen_chaos_blast_SpellScript();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void AddSC_generic_spell_scripts()
|
||||
{
|
||||
new spell_gen_absorb0_hitlimit1();
|
||||
@@ -2387,6 +2577,10 @@ void AddSC_generic_spell_scripts()
|
||||
new spell_gen_oracle_wolvar_reputation();
|
||||
new spell_gen_damage_reduction_aura();
|
||||
new spell_gen_luck_of_the_draw();
|
||||
new spell_gen_dummy_trigger();
|
||||
new spell_gen_spirit_healer_res();
|
||||
new spell_gen_gadgetzan_transporter_backfire();
|
||||
new spell_gen_gnomish_transporter();
|
||||
new spell_gen_dalaran_disguise("spell_gen_sunreaver_disguise");
|
||||
new spell_gen_dalaran_disguise("spell_gen_silver_covenant_disguise");
|
||||
new spell_gen_elune_candle();
|
||||
@@ -2398,4 +2592,5 @@ void AddSC_generic_spell_scripts()
|
||||
new spell_gen_summon_tournament_mount();
|
||||
new spell_gen_on_tournament_mount();
|
||||
new spell_gen_tournament_pennant();
|
||||
new spell_gen_chaos_blast();
|
||||
}
|
||||
Reference in new issue
Block a user