Scripts/Events: Update event scripts to new register model 2 (#27824)

(cherry picked from commit 3abcbcd4a2)
This commit is contained in:
offl
2022-02-25 01:10:14 +02:00
committed by Shauren
parent 3ab87f3029
commit 88670c44ee
5 changed files with 591 additions and 723 deletions

View File

@@ -0,0 +1,3 @@
--
UPDATE `spell_script_names` SET `ScriptName` = 'spell_operation_gnomeregan_basic_orders_emote' WHERE `ScriptName` = 'spell_q25199_emote';
UPDATE `spell_script_names` SET `ScriptName` = 'spell_winter_veil_reindeer_transformation' WHERE `ScriptName` = 'spell_item_reindeer_transformation';

View File

@@ -33,9 +33,9 @@ enum BasicOrdersEmote
73836 - [DND] Test Roar
73837 - [DND] Test Dance
73886 - [DND] Test Stop Dance */
class spell_q25199_emote : public AuraScript
class spell_operation_gnomeregan_basic_orders_emote : public AuraScript
{
PrepareAuraScript(spell_q25199_emote);
PrepareAuraScript(spell_operation_gnomeregan_basic_orders_emote);
void HandlePeriodic(AuraEffect const* /*aurEff*/)
{
@@ -66,11 +66,11 @@ class spell_q25199_emote : public AuraScript
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_q25199_emote::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_operation_gnomeregan_basic_orders_emote::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
void AddSC_event_operation_gnomeregan()
{
RegisterSpellScript(spell_q25199_emote);
RegisterSpellScript(spell_operation_gnomeregan_basic_orders_emote);
}

View File

@@ -34,47 +34,34 @@ enum PilgrimsBountyBuffFood
SPELL_WELL_FED_SPIRIT_TRIGGER = 65415
};
class spell_pilgrims_bounty_buff_food : public SpellScriptLoader
class spell_pilgrims_bounty_buff_food : public AuraScript
{
private:
uint32 const _triggeredSpellId;
public:
spell_pilgrims_bounty_buff_food(char const* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
PrepareAuraScript(spell_pilgrims_bounty_buff_food);
private:
uint32 const _triggeredSpellId;
class spell_pilgrims_bounty_buff_food_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pilgrims_bounty_buff_food_AuraScript);
private:
uint32 const _triggeredSpellId;
public:
spell_pilgrims_bounty_buff_food(uint32 triggeredSpellId) : AuraScript(), _triggeredSpellId(triggeredSpellId)
{
_handled = false;
}
public:
spell_pilgrims_bounty_buff_food_AuraScript(uint32 triggeredSpellId) : AuraScript(), _triggeredSpellId(triggeredSpellId)
{
_handled = false;
}
void HandleTriggerSpell(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (_handled)
return;
void HandleTriggerSpell(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (_handled)
return;
_handled = true;
GetTarget()->CastSpell(GetTarget(), _triggeredSpellId, true);
}
_handled = true;
GetTarget()->CastSpell(GetTarget(), _triggeredSpellId, true);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pilgrims_bounty_buff_food::HandleTriggerSpell, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_pilgrims_bounty_buff_food_AuraScript::HandleTriggerSpell, EFFECT_2, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
bool _handled;
};
AuraScript* GetAuraScript() const override
{
return new spell_pilgrims_bounty_buff_food_AuraScript(_triggeredSpellId);
}
bool _handled;
};
enum FeastOnSpells
@@ -97,75 +84,64 @@ enum FeastOnSpells
61786 - Feast On Sweet Potatoes
61787 - Feast On Pie
61788 - Feast On Stuffing */
class spell_pilgrims_bounty_feast_on : public SpellScriptLoader
class spell_pilgrims_bounty_feast_on : public SpellScript
{
public:
spell_pilgrims_bounty_feast_on() : SpellScriptLoader("spell_pilgrims_bounty_feast_on") { }
PrepareSpellScript(spell_pilgrims_bounty_feast_on);
class spell_pilgrims_bounty_feast_on_SpellScript : public SpellScript
bool Validate(SpellInfo const* spellInfo) override
{
return !spellInfo->GetEffects().empty()
&& ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) })
&& !sSpellMgr->AssertSpellInfo(spellInfo->GetEffect(EFFECT_0).CalcValue(), DIFFICULTY_NONE)->GetEffects().empty();
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
uint32 _spellId = 0;
switch (GetSpellInfo()->Id)
{
PrepareSpellScript(spell_pilgrims_bounty_feast_on_SpellScript);
bool Validate(SpellInfo const* spellInfo) override
{
return !spellInfo->GetEffects().empty()
&& ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_0).CalcValue()) })
&& !sSpellMgr->AssertSpellInfo(spellInfo->GetEffect(EFFECT_0).CalcValue(), DIFFICULTY_NONE)->GetEffects().empty();
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
uint32 _spellId = 0;
switch (GetSpellInfo()->Id)
{
case FEAST_ON_TURKEY:
_spellId = SPELL_TURKEY_HELPINS;
break;
case FEAST_ON_CRANBERRIES:
_spellId = SPELL_CRANBERRY_HELPINS;
break;
case FEAST_ON_SWEET_POTATOES:
_spellId = SPELL_SWEET_POTATO_HELPINS;
break;
case FEAST_ON_PIE:
_spellId = SPELL_PIE_HELPINS;
break;
case FEAST_ON_STUFFING:
_spellId = SPELL_STUFFING_HELPINS;
break;
default:
return;
}
if (Vehicle* vehicle = caster->GetVehicleKit())
if (Unit* target = vehicle->GetPassenger(0))
if (Player* player = target->ToPlayer())
{
player->CastSpell(player, SPELL_ON_PLATE_EAT_VISUAL, true);
caster->CastSpell(player, _spellId, CastSpellExtraArgs(TRIGGERED_FULL_MASK)
.SetOriginalCaster(player->GetGUID()));
}
if (Aura* aura = caster->GetAura(GetEffectValue()))
{
if (aura->GetStackAmount() == 1)
caster->RemoveAurasDueToSpell(aura->GetSpellInfo()->GetEffect(EFFECT_0).CalcValue());
aura->ModStackAmount(-1);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_feast_on_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_pilgrims_bounty_feast_on_SpellScript();
case FEAST_ON_TURKEY:
_spellId = SPELL_TURKEY_HELPINS;
break;
case FEAST_ON_CRANBERRIES:
_spellId = SPELL_CRANBERRY_HELPINS;
break;
case FEAST_ON_SWEET_POTATOES:
_spellId = SPELL_SWEET_POTATO_HELPINS;
break;
case FEAST_ON_PIE:
_spellId = SPELL_PIE_HELPINS;
break;
case FEAST_ON_STUFFING:
_spellId = SPELL_STUFFING_HELPINS;
break;
default:
return;
}
if (Vehicle* vehicle = caster->GetVehicleKit())
if (Unit* target = vehicle->GetPassenger(0))
if (Player* player = target->ToPlayer())
{
player->CastSpell(player, SPELL_ON_PLATE_EAT_VISUAL, true);
caster->CastSpell(player, _spellId, CastSpellExtraArgs(TRIGGERED_FULL_MASK)
.SetOriginalCaster(player->GetGUID()));
}
if (Aura* aura = caster->GetAura(GetEffectValue()))
{
if (aura->GetStackAmount() == 1)
caster->RemoveAurasDueToSpell(aura->GetSpellInfo()->GetEffect(EFFECT_0).CalcValue());
aura->ModStackAmount(-1);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_feast_on::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
enum TheTurkinator
@@ -179,66 +155,55 @@ enum TheTurkinator
};
// 62014 - Turkey Tracker
class spell_pilgrims_bounty_turkey_tracker : public SpellScriptLoader
class spell_pilgrims_bounty_turkey_tracker : public SpellScript
{
public:
spell_pilgrims_bounty_turkey_tracker() : SpellScriptLoader("spell_pilgrims_bounty_turkey_tracker") { }
PrepareSpellScript(spell_pilgrims_bounty_turkey_tracker);
class spell_pilgrims_bounty_turkey_tracker_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ SPELL_KILL_COUNTER_VISUAL, SPELL_KILL_COUNTER_VISUAL_MAX });
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
Creature* caster = GetCaster()->ToCreature();
Unit* target = GetHitUnit();
if (!target || !caster)
return;
if (target->HasAura(SPELL_KILL_COUNTER_VISUAL_MAX))
return;
if (Aura const* aura = target->GetAura(GetSpellInfo()->Id))
{
PrepareSpellScript(spell_pilgrims_bounty_turkey_tracker_SpellScript);
bool Validate(SpellInfo const* /*spell*/) override
switch (aura->GetStackAmount())
{
return ValidateSpellInfo({ SPELL_KILL_COUNTER_VISUAL, SPELL_KILL_COUNTER_VISUAL_MAX });
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
Creature* caster = GetCaster()->ToCreature();
Unit* target = GetHitUnit();
if (!target || !caster)
case 10:
caster->AI()->Talk(EMOTE_TURKEY_HUNTER, target);
break;
case 20:
caster->AI()->Talk(EMOTE_TURKEY_DOMINATION, target);
break;
case 30:
caster->AI()->Talk(EMOTE_TURKEY_SLAUGHTER, target);
break;
case 40:
caster->AI()->Talk(EMOTE_TURKEY_TRIUMPH, target);
target->CastSpell(target, SPELL_KILL_COUNTER_VISUAL_MAX, true);
target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
break;
default:
return;
if (target->HasAura(SPELL_KILL_COUNTER_VISUAL_MAX))
return;
if (Aura const* aura = target->GetAura(GetSpellInfo()->Id))
{
switch (aura->GetStackAmount())
{
case 10:
caster->AI()->Talk(EMOTE_TURKEY_HUNTER, target);
break;
case 20:
caster->AI()->Talk(EMOTE_TURKEY_DOMINATION, target);
break;
case 30:
caster->AI()->Talk(EMOTE_TURKEY_SLAUGHTER, target);
break;
case 40:
caster->AI()->Talk(EMOTE_TURKEY_TRIUMPH, target);
target->CastSpell(target, SPELL_KILL_COUNTER_VISUAL_MAX, true);
target->RemoveAurasDueToSpell(GetSpellInfo()->Id);
break;
default:
return;
}
target->CastSpell(target, SPELL_KILL_COUNTER_VISUAL, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_turkey_tracker_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_pilgrims_bounty_turkey_tracker_SpellScript();
target->CastSpell(target, SPELL_KILL_COUNTER_VISUAL, true);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_turkey_tracker::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
enum SpiritOfSharing
@@ -246,70 +211,56 @@ enum SpiritOfSharing
SPELL_THE_SPIRIT_OF_SHARING = 61849
};
class spell_pilgrims_bounty_well_fed : public SpellScriptLoader
class spell_pilgrims_bounty_well_fed : public SpellScript
{
private:
uint32 _triggeredSpellId;
PrepareSpellScript(spell_pilgrims_bounty_well_fed);
public:
spell_pilgrims_bounty_well_fed(char const* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
uint32 _triggeredSpellId;
class spell_pilgrims_bounty_well_fed_SpellScript : public SpellScript
public:
spell_pilgrims_bounty_well_fed(uint32 triggeredSpellId) : SpellScript(), _triggeredSpellId(triggeredSpellId) { }
private:
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ _triggeredSpellId });
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Player* target = GetHitPlayer();
if (!target)
return;
if (Aura const* aura = target->GetAura(GetSpellInfo()->Id))
{
PrepareSpellScript(spell_pilgrims_bounty_well_fed_SpellScript);
uint32 _triggeredSpellId;
public:
spell_pilgrims_bounty_well_fed_SpellScript(uint32 triggeredSpellId) : SpellScript(), _triggeredSpellId(triggeredSpellId) { }
private:
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ _triggeredSpellId });
}
void HandleScript(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Player* target = GetHitPlayer();
if (!target)
return;
if (Aura const* aura = target->GetAura(GetSpellInfo()->Id))
{
if (aura->GetStackAmount() == 5)
target->CastSpell(target, _triggeredSpellId, true);
}
Aura const* turkey = target->GetAura(SPELL_TURKEY_HELPINS);
Aura const* cranberies = target->GetAura(SPELL_CRANBERRY_HELPINS);
Aura const* stuffing = target->GetAura(SPELL_STUFFING_HELPINS);
Aura const* sweetPotatoes = target->GetAura(SPELL_SWEET_POTATO_HELPINS);
Aura const* pie = target->GetAura(SPELL_PIE_HELPINS);
if ((turkey && turkey->GetStackAmount() == 5) && (cranberies && cranberies->GetStackAmount() == 5) && (stuffing && stuffing->GetStackAmount() == 5)
&& (sweetPotatoes && sweetPotatoes->GetStackAmount() == 5) && (pie && pie->GetStackAmount() == 5))
{
target->CastSpell(target, SPELL_THE_SPIRIT_OF_SHARING, true);
target->RemoveAurasDueToSpell(SPELL_TURKEY_HELPINS);
target->RemoveAurasDueToSpell(SPELL_CRANBERRY_HELPINS);
target->RemoveAurasDueToSpell(SPELL_STUFFING_HELPINS);
target->RemoveAurasDueToSpell(SPELL_SWEET_POTATO_HELPINS);
target->RemoveAurasDueToSpell(SPELL_PIE_HELPINS);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_well_fed_SpellScript::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_pilgrims_bounty_well_fed_SpellScript(_triggeredSpellId);
if (aura->GetStackAmount() == 5)
target->CastSpell(target, _triggeredSpellId, true);
}
Aura const* turkey = target->GetAura(SPELL_TURKEY_HELPINS);
Aura const* cranberies = target->GetAura(SPELL_CRANBERRY_HELPINS);
Aura const* stuffing = target->GetAura(SPELL_STUFFING_HELPINS);
Aura const* sweetPotatoes = target->GetAura(SPELL_SWEET_POTATO_HELPINS);
Aura const* pie = target->GetAura(SPELL_PIE_HELPINS);
if ((turkey && turkey->GetStackAmount() == 5) && (cranberies && cranberies->GetStackAmount() == 5) && (stuffing && stuffing->GetStackAmount() == 5)
&& (sweetPotatoes && sweetPotatoes->GetStackAmount() == 5) && (pie && pie->GetStackAmount() == 5))
{
target->CastSpell(target, SPELL_THE_SPIRIT_OF_SHARING, true);
target->RemoveAurasDueToSpell(SPELL_TURKEY_HELPINS);
target->RemoveAurasDueToSpell(SPELL_CRANBERRY_HELPINS);
target->RemoveAurasDueToSpell(SPELL_STUFFING_HELPINS);
target->RemoveAurasDueToSpell(SPELL_SWEET_POTATO_HELPINS);
target->RemoveAurasDueToSpell(SPELL_PIE_HELPINS);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_well_fed::HandleScript, EFFECT_1, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
enum BountifulTableMisc
@@ -349,118 +300,100 @@ enum BountifulTableMisc
66260 - Pass The Pie
66261 - Pass The Cranberries
66262 - Pass The Sweet Potatoes */
class spell_pilgrims_bounty_on_plate : public SpellScriptLoader
class spell_pilgrims_bounty_on_plate : public SpellScript
{
private:
uint32 _triggeredSpellId1;
uint32 _triggeredSpellId2;
uint32 _triggeredSpellId3;
uint32 _triggeredSpellId4;
PrepareSpellScript(spell_pilgrims_bounty_on_plate);
public:
spell_pilgrims_bounty_on_plate(char const* name, uint32 triggeredSpellId1, uint32 triggeredSpellId2, uint32 triggeredSpellId3, uint32 triggeredSpellId4) : SpellScriptLoader(name),
_triggeredSpellId1(triggeredSpellId1), _triggeredSpellId2(triggeredSpellId2), _triggeredSpellId3(triggeredSpellId3), _triggeredSpellId4(triggeredSpellId4) { }
uint32 _triggeredSpellId1;
uint32 _triggeredSpellId2;
uint32 _triggeredSpellId3;
uint32 _triggeredSpellId4;
class spell_pilgrims_bounty_on_plate_SpellScript : public SpellScript
public:
spell_pilgrims_bounty_on_plate(uint32 triggeredSpellId1, uint32 triggeredSpellId2, uint32 triggeredSpellId3, uint32 triggeredSpellId4) : SpellScript(),
_triggeredSpellId1(triggeredSpellId1), _triggeredSpellId2(triggeredSpellId2), _triggeredSpellId3(triggeredSpellId3), _triggeredSpellId4(triggeredSpellId4) { }
private:
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo(
{
PrepareSpellScript(spell_pilgrims_bounty_on_plate_SpellScript);
_triggeredSpellId1,
_triggeredSpellId2,
_triggeredSpellId3,
_triggeredSpellId4
});
}
uint32 _triggeredSpellId1;
uint32 _triggeredSpellId2;
uint32 _triggeredSpellId3;
uint32 _triggeredSpellId4;
public:
spell_pilgrims_bounty_on_plate_SpellScript(uint32 triggeredSpellId1, uint32 triggeredSpellId2, uint32 triggeredSpellId3, uint32 triggeredSpellId4) : SpellScript(),
_triggeredSpellId1(triggeredSpellId1), _triggeredSpellId2(triggeredSpellId2), _triggeredSpellId3(triggeredSpellId3), _triggeredSpellId4(triggeredSpellId4) { }
private:
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo(
{
_triggeredSpellId1,
_triggeredSpellId2,
_triggeredSpellId3,
_triggeredSpellId4
});
}
Vehicle* GetTable(Unit* target)
{
if (target->GetTypeId() == TYPEID_PLAYER)
{
if (Unit* vehBase = target->GetVehicleBase())
if (Vehicle* table = vehBase->GetVehicle())
if (table->GetCreatureEntry() == NPC_BOUNTIFUL_TABLE)
return table;
}
else if (Vehicle* veh = target->GetVehicle())
if (veh->GetCreatureEntry() == NPC_BOUNTIFUL_TABLE)
return veh;
return nullptr;
}
Unit* GetPlateInSeat(Vehicle* table, uint8 seat)
{
if (Unit* holderUnit = table->GetPassenger(SEAT_PLATE_HOLDER))
if (Vehicle* holder = holderUnit->GetVehicleKit())
if (Unit* plate = holder->GetPassenger(seat))
return plate;
return nullptr;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (!target || caster == target)
return;
Vehicle* table = GetTable(caster);
if (!table || table != GetTable(target))
return;
if (Vehicle* casterChair = caster->GetVehicleKit())
if (Unit* casterPlr = casterChair->GetPassenger(SEAT_PLAYER))
{
if (casterPlr == target)
return;
casterPlr->CastSpell(casterPlr, _triggeredSpellId2, true); //Credit for Sharing is Caring(always)
uint8 seat = target->GetTransSeat();
if (target->GetTypeId() == TYPEID_PLAYER && target->GetVehicleBase())
seat = target->GetVehicleBase()->GetTransSeat();
if (Unit* plate = GetPlateInSeat(table, seat))
{
if (target->GetTypeId() == TYPEID_PLAYER) //Food Fight case
{
casterPlr->CastSpell(target, _triggeredSpellId1, true);
caster->CastSpell(target->GetVehicleBase(), _triggeredSpellId4, true); //CanEat-chair(always)
}
else
{
casterPlr->CastSpell(plate, _triggeredSpellId3, true); //Food Visual on plate
caster->CastSpell(target, _triggeredSpellId4, true); //CanEat-chair(always)
}
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_on_plate_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
Vehicle* GetTable(Unit* target)
{
if (target->GetTypeId() == TYPEID_PLAYER)
{
return new spell_pilgrims_bounty_on_plate_SpellScript(_triggeredSpellId1, _triggeredSpellId2, _triggeredSpellId3, _triggeredSpellId4);
if (Unit* vehBase = target->GetVehicleBase())
if (Vehicle* table = vehBase->GetVehicle())
if (table->GetCreatureEntry() == NPC_BOUNTIFUL_TABLE)
return table;
}
else if (Vehicle* veh = target->GetVehicle())
if (veh->GetCreatureEntry() == NPC_BOUNTIFUL_TABLE)
return veh;
return nullptr;
}
Unit* GetPlateInSeat(Vehicle* table, uint8 seat)
{
if (Unit* holderUnit = table->GetPassenger(SEAT_PLATE_HOLDER))
if (Vehicle* holder = holderUnit->GetVehicleKit())
if (Unit* plate = holder->GetPassenger(seat))
return plate;
return nullptr;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
Unit* target = GetHitUnit();
if (!target || caster == target)
return;
Vehicle* table = GetTable(caster);
if (!table || table != GetTable(target))
return;
if (Vehicle* casterChair = caster->GetVehicleKit())
if (Unit* casterPlr = casterChair->GetPassenger(SEAT_PLAYER))
{
if (casterPlr == target)
return;
casterPlr->CastSpell(casterPlr, _triggeredSpellId2, true); //Credit for Sharing is Caring(always)
uint8 seat = target->GetTransSeat();
if (target->GetTypeId() == TYPEID_PLAYER && target->GetVehicleBase())
seat = target->GetVehicleBase()->GetTransSeat();
if (Unit* plate = GetPlateInSeat(table, seat))
{
if (target->GetTypeId() == TYPEID_PLAYER) //Food Fight case
{
casterPlr->CastSpell(target, _triggeredSpellId1, true);
caster->CastSpell(target->GetVehicleBase(), _triggeredSpellId4, true); //CanEat-chair(always)
}
else
{
casterPlr->CastSpell(plate, _triggeredSpellId3, true); //Food Visual on plate
caster->CastSpell(target, _triggeredSpellId4, true); //CanEat-chair(always)
}
}
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_pilgrims_bounty_on_plate::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
/* 61804 - A Serving of Cranberries
@@ -473,91 +406,78 @@ class spell_pilgrims_bounty_on_plate : public SpellScriptLoader
61795 - Stuffing Server
61796 - Turkey Server
61797 - Sweet Potatoes Server */
class spell_pilgrims_bounty_a_serving_of : public SpellScriptLoader
class spell_pilgrims_bounty_a_serving_of : public AuraScript
{
private:
uint32 _triggeredSpellId;
public:
spell_pilgrims_bounty_a_serving_of(char const* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
PrepareAuraScript(spell_pilgrims_bounty_a_serving_of);
class spell_pilgrims_bounty_a_serving_of_AuraScript : public AuraScript
{
PrepareAuraScript(spell_pilgrims_bounty_a_serving_of_AuraScript);
uint32 _triggeredSpellId;
uint32 _triggeredSpellId;
public:
spell_pilgrims_bounty_a_serving_of(uint32 triggeredSpellId) : AuraScript(), _triggeredSpellId(triggeredSpellId) { }
public:
spell_pilgrims_bounty_a_serving_of_AuraScript(uint32 triggeredSpellId) : AuraScript(), _triggeredSpellId(triggeredSpellId) { }
private:
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ _triggeredSpellId });
}
private:
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo({ _triggeredSpellId });
}
void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->CastSpell(target, uint32(aurEff->GetAmount()), true);
HandlePlate(target, true);
}
void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->CastSpell(target, uint32(aurEff->GetAmount()), true);
HandlePlate(target, true);
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->RemoveAurasDueToSpell(aurEff->GetAmount());
HandlePlate(target, false);
}
void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->RemoveAurasDueToSpell(aurEff->GetAmount());
HandlePlate(target, false);
}
void HandlePlate(Unit* target, bool apply)
{
if (Vehicle* table = target->GetVehicle())
if (Unit* holderUnit = table->GetPassenger(SEAT_PLATE_HOLDER))
if (Vehicle* holder = holderUnit->GetVehicleKit())
if (Unit* plate = holder->GetPassenger(target->GetTransSeat()))
{
if (apply)
target->CastSpell(plate, _triggeredSpellId, true);
else
plate->RemoveAurasDueToSpell(_triggeredSpellId);
}
}
void HandlePlate(Unit* target, bool apply)
{
if (Vehicle* table = target->GetVehicle())
if (Unit* holderUnit = table->GetPassenger(SEAT_PLATE_HOLDER))
if (Vehicle* holder = holderUnit->GetVehicleKit())
if (Unit* plate = holder->GetPassenger(target->GetTransSeat()))
{
if (apply)
target->CastSpell(plate, _triggeredSpellId, true);
else
plate->RemoveAurasDueToSpell(_triggeredSpellId);
}
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_pilgrims_bounty_a_serving_of_AuraScript::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_pilgrims_bounty_a_serving_of_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_pilgrims_bounty_a_serving_of_AuraScript(_triggeredSpellId);
}
void Register() override
{
AfterEffectApply += AuraEffectApplyFn(spell_pilgrims_bounty_a_serving_of::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
OnEffectRemove += AuraEffectRemoveFn(spell_pilgrims_bounty_a_serving_of::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
void AddSC_event_pilgrims_bounty()
{
new spell_pilgrims_bounty_buff_food("spell_gen_slow_roasted_turkey", SPELL_WELL_FED_AP_TRIGGER);
new spell_pilgrims_bounty_buff_food("spell_gen_cranberry_chutney", SPELL_WELL_FED_ZM_TRIGGER);
new spell_pilgrims_bounty_buff_food("spell_gen_spice_bread_stuffing", SPELL_WELL_FED_HIT_TRIGGER);
new spell_pilgrims_bounty_buff_food("spell_gen_pumpkin_pie", SPELL_WELL_FED_SPIRIT_TRIGGER);
new spell_pilgrims_bounty_buff_food("spell_gen_candied_sweet_potato", SPELL_WELL_FED_HASTE_TRIGGER);
new spell_pilgrims_bounty_feast_on();
new spell_pilgrims_bounty_well_fed("spell_pilgrims_bounty_well_fed_turkey", SPELL_WELL_FED_AP_TRIGGER);
new spell_pilgrims_bounty_well_fed("spell_pilgrims_bounty_well_fed_cranberry", SPELL_WELL_FED_ZM_TRIGGER);
new spell_pilgrims_bounty_well_fed("spell_pilgrims_bounty_well_fed_stuffing", SPELL_WELL_FED_HIT_TRIGGER);
new spell_pilgrims_bounty_well_fed("spell_pilgrims_bounty_well_fed_sweet_potatoes", SPELL_WELL_FED_HASTE_TRIGGER);
new spell_pilgrims_bounty_well_fed("spell_pilgrims_bounty_well_fed_pie", SPELL_WELL_FED_SPIRIT_TRIGGER);
new spell_pilgrims_bounty_turkey_tracker();
new spell_pilgrims_bounty_on_plate("spell_pilgrims_bounty_on_plate_turkey", SPELL_ON_PLATE_TURKEY, SPELL_PASS_THE_TURKEY, SPELL_ON_PLATE_VISUAL_TURKEY, SPELL_A_SERVING_OF_TURKEY_CHAIR);
new spell_pilgrims_bounty_on_plate("spell_pilgrims_bounty_on_plate_cranberries", SPELL_ON_PLATE_CRANBERRIES, SPELL_PASS_THE_CRANBERRIES, SPELL_ON_PLATE_VISUAL_CRANBERRIES, SPELL_A_SERVING_OF_CRANBERRIES_CHAIR);
new spell_pilgrims_bounty_on_plate("spell_pilgrims_bounty_on_plate_stuffing", SPELL_ON_PLATE_STUFFING, SPELL_PASS_THE_STUFFING, SPELL_ON_PLATE_VISUAL_STUFFING, SPELL_A_SERVING_OF_STUFFING_CHAIR);
new spell_pilgrims_bounty_on_plate("spell_pilgrims_bounty_on_plate_sweet_potatoes", SPELL_ON_PLATE_SWEET_POTATOES, SPELL_PASS_THE_SWEET_POTATOES, SPELL_ON_PLATE_VISUAL_POTATOES, SPELL_A_SERVING_OF_SWEET_POTATOES_CHAIR);
new spell_pilgrims_bounty_on_plate("spell_pilgrims_bounty_on_plate_pie", SPELL_ON_PLATE_PIE, SPELL_PASS_THE_PIE, SPELL_ON_PLATE_VISUAL_PIE, SPELL_A_SERVING_OF_PIE_CHAIR);
new spell_pilgrims_bounty_a_serving_of("spell_pilgrims_bounty_a_serving_of_cranberries", SPELL_A_SERVING_OF_CRANBERRIES_PLATE);
new spell_pilgrims_bounty_a_serving_of("spell_pilgrims_bounty_a_serving_of_turkey", SPELL_A_SERVING_OF_TURKEY_PLATE);
new spell_pilgrims_bounty_a_serving_of("spell_pilgrims_bounty_a_serving_of_stuffing", SPELL_A_SERVING_OF_STUFFING_PLATE);
new spell_pilgrims_bounty_a_serving_of("spell_pilgrims_bounty_a_serving_of_potatoes", SPELL_A_SERVING_OF_SWEET_POTATOES_PLATE);
new spell_pilgrims_bounty_a_serving_of("spell_pilgrims_bounty_a_serving_of_pie", SPELL_A_SERVING_OF_PIE_PLATE);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_buff_food, "spell_gen_slow_roasted_turkey", SPELL_WELL_FED_AP_TRIGGER);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_buff_food, "spell_gen_cranberry_chutney", SPELL_WELL_FED_ZM_TRIGGER);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_buff_food, "spell_gen_spice_bread_stuffing", SPELL_WELL_FED_HIT_TRIGGER);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_buff_food, "spell_gen_pumpkin_pie", SPELL_WELL_FED_SPIRIT_TRIGGER);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_buff_food, "spell_gen_candied_sweet_potato", SPELL_WELL_FED_HASTE_TRIGGER);
RegisterSpellScript(spell_pilgrims_bounty_feast_on);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_well_fed, "spell_pilgrims_bounty_well_fed_turkey", SPELL_WELL_FED_AP_TRIGGER);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_well_fed, "spell_pilgrims_bounty_well_fed_cranberry", SPELL_WELL_FED_ZM_TRIGGER);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_well_fed, "spell_pilgrims_bounty_well_fed_stuffing", SPELL_WELL_FED_HIT_TRIGGER);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_well_fed, "spell_pilgrims_bounty_well_fed_sweet_potatoes", SPELL_WELL_FED_HASTE_TRIGGER);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_well_fed, "spell_pilgrims_bounty_well_fed_pie", SPELL_WELL_FED_SPIRIT_TRIGGER);
RegisterSpellScript(spell_pilgrims_bounty_turkey_tracker);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_on_plate, "spell_pilgrims_bounty_on_plate_turkey", SPELL_ON_PLATE_TURKEY, SPELL_PASS_THE_TURKEY, SPELL_ON_PLATE_VISUAL_TURKEY, SPELL_A_SERVING_OF_TURKEY_CHAIR);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_on_plate, "spell_pilgrims_bounty_on_plate_cranberries", SPELL_ON_PLATE_CRANBERRIES, SPELL_PASS_THE_CRANBERRIES, SPELL_ON_PLATE_VISUAL_CRANBERRIES, SPELL_A_SERVING_OF_CRANBERRIES_CHAIR);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_on_plate, "spell_pilgrims_bounty_on_plate_stuffing", SPELL_ON_PLATE_STUFFING, SPELL_PASS_THE_STUFFING, SPELL_ON_PLATE_VISUAL_STUFFING, SPELL_A_SERVING_OF_STUFFING_CHAIR);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_on_plate, "spell_pilgrims_bounty_on_plate_sweet_potatoes", SPELL_ON_PLATE_SWEET_POTATOES, SPELL_PASS_THE_SWEET_POTATOES, SPELL_ON_PLATE_VISUAL_POTATOES, SPELL_A_SERVING_OF_SWEET_POTATOES_CHAIR);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_on_plate, "spell_pilgrims_bounty_on_plate_pie", SPELL_ON_PLATE_PIE, SPELL_PASS_THE_PIE, SPELL_ON_PLATE_VISUAL_PIE, SPELL_A_SERVING_OF_PIE_CHAIR);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_a_serving_of, "spell_pilgrims_bounty_a_serving_of_cranberries", SPELL_A_SERVING_OF_CRANBERRIES_PLATE);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_a_serving_of, "spell_pilgrims_bounty_a_serving_of_turkey", SPELL_A_SERVING_OF_TURKEY_PLATE);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_a_serving_of, "spell_pilgrims_bounty_a_serving_of_stuffing", SPELL_A_SERVING_OF_STUFFING_PLATE);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_a_serving_of, "spell_pilgrims_bounty_a_serving_of_potatoes", SPELL_A_SERVING_OF_SWEET_POTATOES_PLATE);
RegisterSpellScriptWithArgs(spell_pilgrims_bounty_a_serving_of, "spell_pilgrims_bounty_a_serving_of_pie", SPELL_A_SERVING_OF_PIE_PLATE);
}

View File

@@ -59,7 +59,6 @@ class spell_winter_veil_mistletoe : public SpellScript
}
};
// 26275 - PX-238 Winter Wondervolt TRAP
enum PX238WinterWondervolt
{
SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_1 = 26157,
@@ -68,7 +67,7 @@ enum PX238WinterWondervolt
SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_4 = 26274
};
uint32 const WonderboltTransformSpells[] =
std::array<uint32, 4> const WonderboltTransformSpells =
{
SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_1,
SPELL_PX_238_WINTER_WONDERVOLT_TRANSFORM_2,
@@ -115,9 +114,10 @@ enum ReindeerTransformation
SPELL_REINDEER_60 = 25858,
};
class spell_item_reindeer_transformation : public SpellScript
// 25860 - Reindeer Transformation
class spell_winter_veil_reindeer_transformation : public SpellScript
{
PrepareSpellScript(spell_item_reindeer_transformation);
PrepareSpellScript(spell_winter_veil_reindeer_transformation);
bool Validate(SpellInfo const* /*spell*/) override
{
@@ -162,7 +162,7 @@ class spell_item_reindeer_transformation : public SpellScript
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_reindeer_transformation::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
OnEffectHit += SpellEffectFn(spell_winter_veil_reindeer_transformation::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
@@ -170,5 +170,5 @@ void AddSC_event_winter_veil()
{
RegisterSpellScript(spell_winter_veil_mistletoe);
RegisterSpellScript(spell_winter_veil_px_238_winter_wondervolt);
RegisterSpellScript(spell_item_reindeer_transformation);
RegisterSpellScript(spell_winter_veil_reindeer_transformation);
}

View File

@@ -94,175 +94,153 @@ enum Points
POINT_URUZIN = 4026400,
};
class npc_tiger_matriarch_credit : public CreatureScript
struct npc_tiger_matriarch_credit : public ScriptedAI
{
public:
npc_tiger_matriarch_credit() : CreatureScript("npc_tiger_matriarch_credit") { }
npc_tiger_matriarch_credit(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
events.ScheduleEvent(EVENT_CHECK_SUMMON_AURA, 2s);
}
struct npc_tiger_matriarch_creditAI : public ScriptedAI
void UpdateAI(uint32 diff) override
{
events.Update(diff);
if (events.ExecuteEvent() == EVENT_CHECK_SUMMON_AURA)
{
npc_tiger_matriarch_creditAI(Creature* creature) : ScriptedAI(creature)
{
SetCombatMovement(false);
events.ScheduleEvent(EVENT_CHECK_SUMMON_AURA, 2s);
}
void UpdateAI(uint32 diff) override
std::list<Creature*> tigers;
GetCreatureListWithEntryInGrid(tigers, me, NPC_TIGER_VEHICLE, 15.0f);
if (!tigers.empty())
{
events.Update(diff);
if (events.ExecuteEvent() == EVENT_CHECK_SUMMON_AURA)
for (std::list<Creature*>::iterator itr = tigers.begin(); itr != tigers.end(); ++itr)
{
std::list<Creature*> tigers;
GetCreatureListWithEntryInGrid(tigers, me, NPC_TIGER_VEHICLE, 15.0f);
if (!tigers.empty())
{
for (std::list<Creature*>::iterator itr = tigers.begin(); itr != tigers.end(); ++itr)
if (!(*itr)->IsSummon())
continue;
if (Unit* summoner = (*itr)->ToTempSummon()->GetSummonerUnit())
if (!summoner->HasAura(SPELL_NO_SUMMON_AURA) && !summoner->HasAura(SPELL_SUMMON_ZENTABRA_TRIGGER)
&& !summoner->IsInCombat())
{
if (!(*itr)->IsSummon())
continue;
if (Unit* summoner = (*itr)->ToTempSummon()->GetSummonerUnit())
if (!summoner->HasAura(SPELL_NO_SUMMON_AURA) && !summoner->HasAura(SPELL_SUMMON_ZENTABRA_TRIGGER)
&& !summoner->IsInCombat())
{
me->AddAura(SPELL_NO_SUMMON_AURA, summoner);
me->AddAura(SPELL_DETECT_INVIS, summoner);
summoner->CastSpell(summoner, SPELL_SUMMON_MATRIARCH, true);
Talk(SAY_MATRIARCH_AGGRO, summoner);
}
me->AddAura(SPELL_NO_SUMMON_AURA, summoner);
me->AddAura(SPELL_DETECT_INVIS, summoner);
summoner->CastSpell(summoner, SPELL_SUMMON_MATRIARCH, true);
Talk(SAY_MATRIARCH_AGGRO, summoner);
}
}
events.ScheduleEvent(EVENT_CHECK_SUMMON_AURA, 5s);
}
}
private:
EventMap events;
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_tiger_matriarch_creditAI(creature);
events.ScheduleEvent(EVENT_CHECK_SUMMON_AURA, 5s);
}
}
private:
EventMap events;
};
class npc_tiger_matriarch : public CreatureScript
struct npc_tiger_matriarch : public ScriptedAI
{
public:
npc_tiger_matriarch() : CreatureScript("npc_tiger_matriarch") { }
npc_tiger_matriarch(Creature* creature) : ScriptedAI(creature)
{
}
struct npc_tiger_matriarchAI : public ScriptedAI
void JustEngagedWith(Unit* /*target*/) override
{
_events.Reset();
_events.ScheduleEvent(EVENT_POUNCE, 100ms);
_events.ScheduleEvent(EVENT_NOSUMMON, 50s);
}
void IsSummonedBy(WorldObject* summonerWO) override
{
Player* summoner = summonerWO->ToPlayer();
if (!summoner || !summoner->GetVehicle())
return;
_tigerGuid = summoner->GetVehicle()->GetBase()->GetGUID();
if (Unit* tiger = ObjectAccessor::GetUnit(*me, _tigerGuid))
{
npc_tiger_matriarchAI(Creature* creature) : ScriptedAI(creature)
{
}
void JustEngagedWith(Unit* /*target*/) override
{
_events.Reset();
_events.ScheduleEvent(EVENT_POUNCE, 100ms);
_events.ScheduleEvent(EVENT_NOSUMMON, 50s);
}
void IsSummonedBy(WorldObject* summonerWO) override
{
Player* summoner = summonerWO->ToPlayer();
if (!summoner || !summoner->GetVehicle())
return;
_tigerGuid = summoner->GetVehicle()->GetBase()->GetGUID();
if (Unit* tiger = ObjectAccessor::GetUnit(*me, _tigerGuid))
{
AddThreat(tiger, 500000.0f);
DoCast(me, SPELL_FURIOUS_BITE);
}
}
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() != TYPEID_UNIT || !victim->IsSummon())
return;
if (Unit* vehSummoner = victim->ToTempSummon()->GetSummonerUnit())
{
vehSummoner->RemoveAurasDueToSpell(SPELL_NO_SUMMON_AURA);
vehSummoner->RemoveAurasDueToSpell(SPELL_DETECT_INVIS);
vehSummoner->RemoveAurasDueToSpell(SPELL_SPIRIT_OF_THE_TIGER_RIDER);
vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER);
}
me->DespawnOrUnsummon();
}
void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
{
if (!attacker || !attacker->IsSummon())
return;
if (HealthBelowPct(20))
{
damage = 0;
me->AddUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
if (Unit* vehSummoner = attacker->ToTempSummon()->GetSummonerUnit())
{
vehSummoner->AddAura(SPELL_SUMMON_ZENTABRA_TRIGGER, vehSummoner);
vehSummoner->CastSpell(vehSummoner, SPELL_SUMMON_ZENTABRA, true);
attacker->CastSpell(attacker, SPELL_EJECT_PASSENGERS, true);
vehSummoner->RemoveAurasDueToSpell(SPELL_NO_SUMMON_AURA);
vehSummoner->RemoveAurasDueToSpell(SPELL_DETECT_INVIS);
vehSummoner->RemoveAurasDueToSpell(SPELL_SPIRIT_OF_THE_TIGER_RIDER);
vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER);
}
me->DespawnOrUnsummon();
}
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
if (!_tigerGuid)
return;
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_POUNCE:
DoCastVictim(SPELL_POUNCE);
_events.ScheduleEvent(EVENT_POUNCE, 30s);
break;
case EVENT_NOSUMMON: // Reapply SPELL_NO_SUMMON_AURA
if (Unit* tiger = ObjectAccessor::GetUnit(*me, _tigerGuid))
{
if (tiger->IsSummon())
if (Unit* vehSummoner = tiger->ToTempSummon()->GetSummonerUnit())
me->AddAura(SPELL_NO_SUMMON_AURA, vehSummoner);
}
_events.ScheduleEvent(EVENT_NOSUMMON, 50s);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
private:
EventMap _events;
ObjectGuid _tigerGuid;
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_tiger_matriarchAI(creature);
AddThreat(tiger, 500000.0f);
DoCast(me, SPELL_FURIOUS_BITE);
}
}
void KilledUnit(Unit* victim) override
{
if (victim->GetTypeId() != TYPEID_UNIT || !victim->IsSummon())
return;
if (Unit* vehSummoner = victim->ToTempSummon()->GetSummonerUnit())
{
vehSummoner->RemoveAurasDueToSpell(SPELL_NO_SUMMON_AURA);
vehSummoner->RemoveAurasDueToSpell(SPELL_DETECT_INVIS);
vehSummoner->RemoveAurasDueToSpell(SPELL_SPIRIT_OF_THE_TIGER_RIDER);
vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER);
}
me->DespawnOrUnsummon();
}
void DamageTaken(Unit* attacker, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
{
if (!attacker || !attacker->IsSummon())
return;
if (HealthBelowPct(20))
{
damage = 0;
me->AddUnitFlag(UNIT_FLAG_NON_ATTACKABLE);
if (Unit* vehSummoner = attacker->ToTempSummon()->GetSummonerUnit())
{
vehSummoner->AddAura(SPELL_SUMMON_ZENTABRA_TRIGGER, vehSummoner);
vehSummoner->CastSpell(vehSummoner, SPELL_SUMMON_ZENTABRA, true);
attacker->CastSpell(attacker, SPELL_EJECT_PASSENGERS, true);
vehSummoner->RemoveAurasDueToSpell(SPELL_NO_SUMMON_AURA);
vehSummoner->RemoveAurasDueToSpell(SPELL_DETECT_INVIS);
vehSummoner->RemoveAurasDueToSpell(SPELL_SPIRIT_OF_THE_TIGER_RIDER);
vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER);
}
me->DespawnOrUnsummon();
}
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
if (!_tigerGuid)
return;
_events.Update(diff);
while (uint32 eventId = _events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_POUNCE:
DoCastVictim(SPELL_POUNCE);
_events.ScheduleEvent(EVENT_POUNCE, 30s);
break;
case EVENT_NOSUMMON: // Reapply SPELL_NO_SUMMON_AURA
if (Unit* tiger = ObjectAccessor::GetUnit(*me, _tigerGuid))
{
if (tiger->IsSummon())
if (Unit* vehSummoner = tiger->ToTempSummon()->GetSummonerUnit())
me->AddAura(SPELL_NO_SUMMON_AURA, vehSummoner);
}
_events.ScheduleEvent(EVENT_NOSUMMON, 50s);
break;
default:
break;
}
}
DoMeleeAttackIfReady();
}
private:
EventMap _events;
ObjectGuid _tigerGuid;
};
// These models was found in sniff.
@@ -272,196 +250,163 @@ uint32 const trollmodel[] =
15702, 1882, 1897, 1976, 2025, 27286, 2734, 2735, 4084, 4085, 4087, 4089, 4231, 4357,
4358, 4360, 4361, 4362, 4363, 4370, 4532, 4537, 4540, 4610, 6839, 7037, 9767, 9768};
class npc_troll_volunteer : public CreatureScript
struct npc_troll_volunteer : public ScriptedAI
{
public:
npc_troll_volunteer() : CreatureScript("npc_troll_volunteer") { }
npc_troll_volunteer(Creature* creature) : ScriptedAI(creature)
{
Initialize();
_mountModel = 0;
}
struct npc_troll_volunteerAI : public ScriptedAI
void Initialize()
{
_complete = false;
}
void InitializeAI() override
{
if (me->isDead() || !me->GetOwner())
return;
Reset();
switch (urand(0, 3))
{
npc_troll_volunteerAI(Creature* creature) : ScriptedAI(creature)
{
Initialize();
_mountModel = 0;
}
void Initialize()
{
_complete = false;
}
void InitializeAI() override
{
if (me->isDead() || !me->GetOwner())
return;
Reset();
switch (urand(0, 3))
{
case 0:
_mountModel = 6471;
break;
case 1:
_mountModel = 6473;
break;
case 2:
_mountModel = 6469;
break;
default:
_mountModel = 6472;
break;
}
me->SetDisplayId(trollmodel[urand(0, 39)]);
if (Player* player = me->GetOwner()->ToPlayer())
me->GetMotionMaster()->MoveFollow(player, 5.0f, float(rand_norm() + 1.0f) * float(M_PI) / 3.0f * 4.0f);
}
void Reset() override
{
Initialize();
me->AddAura(SPELL_VOLUNTEER_AURA, me);
me->AddAura(SPELL_MOUNTING_CHECK, me);
DoCast(me, SPELL_PETACT_AURA);
me->SetReactState(REACT_PASSIVE);
Talk(SAY_VOLUNTEER_START);
}
// This is needed for mount check aura to know what mountmodel the npc got stored
uint32 GetMountId()
{
return _mountModel;
}
void MovementInform(uint32 type, uint32 id) override
{
if (type != POINT_MOTION_TYPE)
return;
if (id == POINT_URUZIN)
me->DespawnOrUnsummon();
}
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_AOE_TURNIN && caster->GetEntry() == NPC_URUZIN && !_complete)
{
_complete = true; // Preventing from giving credit twice
DoCast(me, SPELL_TURNIN);
DoCast(me, SPELL_QUEST_CREDIT);
me->RemoveAurasDueToSpell(SPELL_MOUNTING_CHECK);
me->Dismount();
Talk(SAY_VOLUNTEER_END);
me->GetMotionMaster()->MovePoint(POINT_URUZIN, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ());
}
}
private:
uint32 _mountModel;
bool _complete;
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_troll_volunteerAI(creature);
case 0:
_mountModel = 6471;
break;
case 1:
_mountModel = 6473;
break;
case 2:
_mountModel = 6469;
break;
default:
_mountModel = 6472;
break;
}
me->SetDisplayId(trollmodel[urand(0, 39)]);
if (Player* player = me->GetOwner()->ToPlayer())
me->GetMotionMaster()->MoveFollow(player, 5.0f, float(rand_norm() + 1.0f) * float(M_PI) / 3.0f * 4.0f);
}
void Reset() override
{
Initialize();
me->AddAura(SPELL_VOLUNTEER_AURA, me);
me->AddAura(SPELL_MOUNTING_CHECK, me);
DoCast(me, SPELL_PETACT_AURA);
me->SetReactState(REACT_PASSIVE);
Talk(SAY_VOLUNTEER_START);
}
// This is needed for mount check aura to know what mountmodel the npc got stored
uint32 GetMountId()
{
return _mountModel;
}
void MovementInform(uint32 type, uint32 id) override
{
if (type != POINT_MOTION_TYPE)
return;
if (id == POINT_URUZIN)
me->DespawnOrUnsummon();
}
void SpellHit(WorldObject* caster, SpellInfo const* spellInfo) override
{
if (spellInfo->Id == SPELL_AOE_TURNIN && caster->GetEntry() == NPC_URUZIN && !_complete)
{
_complete = true; // Preventing from giving credit twice
DoCast(me, SPELL_TURNIN);
DoCast(me, SPELL_QUEST_CREDIT);
me->RemoveAurasDueToSpell(SPELL_MOUNTING_CHECK);
me->Dismount();
Talk(SAY_VOLUNTEER_END);
me->GetMotionMaster()->MovePoint(POINT_URUZIN, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ());
}
}
private:
uint32 _mountModel;
bool _complete;
};
typedef npc_troll_volunteer::npc_troll_volunteerAI VolunteerAI;
typedef npc_troll_volunteer VolunteerAI;
// 75420 - Mounting Check
class spell_mount_check : public SpellScriptLoader
class spell_mount_check : public AuraScript
{
public:
spell_mount_check() : SpellScriptLoader("spell_mount_check") { }
PrepareAuraScript(spell_mount_check);
class spell_mount_check_AuraScript : public AuraScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_MOUNTING_CHECK });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
Unit* owner = target->GetOwner();
if (!owner)
return;
if (owner->IsMounted() && !target->IsMounted())
{
PrepareAuraScript(spell_mount_check_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_MOUNTING_CHECK });
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
Unit* target = GetTarget();
Unit* owner = target->GetOwner();
if (!owner)
return;
if (owner->IsMounted() && !target->IsMounted())
{
if (VolunteerAI* volunteerAI = CAST_AI(VolunteerAI, target->GetAI()))
target->Mount(volunteerAI->GetMountId());
}
else if (!owner->IsMounted() && target->IsMounted())
target->Dismount();
target->SetSpeedRate(MOVE_RUN, owner->GetSpeedRate(MOVE_RUN));
target->SetSpeedRate(MOVE_WALK, owner->GetSpeedRate(MOVE_WALK));
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mount_check_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
AuraScript* GetAuraScript() const override
{
return new spell_mount_check_AuraScript();
if (VolunteerAI* volunteerAI = CAST_AI(VolunteerAI, target->GetAI()))
target->Mount(volunteerAI->GetMountId());
}
else if (!owner->IsMounted() && target->IsMounted())
target->Dismount();
target->SetSpeedRate(MOVE_RUN, owner->GetSpeedRate(MOVE_RUN));
target->SetSpeedRate(MOVE_WALK, owner->GetSpeedRate(MOVE_WALK));
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_mount_check::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY);
}
};
// 75102 - Vol'jin's War Drums
class spell_voljin_war_drums : public SpellScriptLoader
class spell_voljin_war_drums : public SpellScript
{
public:
spell_voljin_war_drums() : SpellScriptLoader("spell_voljin_war_drums") { }
PrepareSpellScript(spell_voljin_war_drums);
class spell_voljin_war_drums_SpellScript : public SpellScript
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_MOTIVATE_1, SPELL_MOTIVATE_2 });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
PrepareSpellScript(spell_voljin_war_drums_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_MOTIVATE_1, SPELL_MOTIVATE_2 });
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* target = GetHitUnit())
{
uint32 motivate = 0;
if (target->GetEntry() == NPC_CITIZEN_1)
motivate = SPELL_MOTIVATE_1;
else if (target->GetEntry() == NPC_CITIZEN_2)
motivate = SPELL_MOTIVATE_2;
if (motivate)
caster->CastSpell(target, motivate, false);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_voljin_war_drums_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const override
{
return new spell_voljin_war_drums_SpellScript();
uint32 motivate = 0;
if (target->GetEntry() == NPC_CITIZEN_1)
motivate = SPELL_MOTIVATE_1;
else if (target->GetEntry() == NPC_CITIZEN_2)
motivate = SPELL_MOTIVATE_2;
if (motivate)
caster->CastSpell(target, motivate, false);
}
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_voljin_war_drums::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
void AddSC_event_zalazane_fall()
{
new npc_tiger_matriarch_credit();
new npc_tiger_matriarch();
new npc_troll_volunteer();
new spell_mount_check();
new spell_voljin_war_drums();
RegisterCreatureAI(npc_tiger_matriarch_credit);
RegisterCreatureAI(npc_tiger_matriarch);
RegisterCreatureAI(npc_troll_volunteer);
RegisterSpellScript(spell_mount_check);
RegisterSpellScript(spell_voljin_war_drums);
}