aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsirikfoll <sirikfoll@hotmail.com>2016-12-19 12:11:02 -0200
committersirikfoll <sirikfoll@hotmail.com>2016-12-19 12:30:43 -0200
commit75df296bb6f8d30a65f669dab6af3d1b2d6046f7 (patch)
treea15a6818ce8031bb1612af9ac54b592278ac3741 /src
parent85c68d634663028f2b60748eca469838d431f74b (diff)
Scripts/Events Implement Pilgrim's Bounty Bountiful Table
Diffstat (limited to 'src')
-rw-r--r--src/server/scripts/Spells/spell_holiday.cpp234
-rw-r--r--src/server/scripts/World/npcs_special.cpp117
2 files changed, 351 insertions, 0 deletions
diff --git a/src/server/scripts/Spells/spell_holiday.cpp b/src/server/scripts/Spells/spell_holiday.cpp
index a7b58737374..83c1df89e82 100644
--- a/src/server/scripts/Spells/spell_holiday.cpp
+++ b/src/server/scripts/Spells/spell_holiday.cpp
@@ -734,6 +734,230 @@ class spell_pilgrims_bounty_well_fed : public SpellScriptLoader
}
};
+enum BountifulTableMisc
+{
+ SEAT_PLAYER = 0,
+ SEAT_PLATE_HOLDER = 6,
+ NPC_BOUNTIFUL_TABLE = 32823,
+ SPELL_ON_PLATE_TURKEY = 61928,
+ SPELL_ON_PLATE_CRANBERRIES = 61925,
+ SPELL_ON_PLATE_STUFFING = 61927,
+ SPELL_ON_PLATE_SWEET_POTATOES = 61929,
+ SPELL_ON_PLATE_PIE = 61926,
+ SPELL_PASS_THE_TURKEY = 66373,
+ SPELL_PASS_THE_CRANBERRIES = 66372,
+ SPELL_PASS_THE_STUFFING = 66375,
+ SPELL_PASS_THE_SWEET_POTATOES = 66376,
+ SPELL_PASS_THE_PIE = 66374,
+ SPELL_ON_PLATE_VISUAL_PIE = 61825,
+ SPELL_ON_PLATE_VISUAL_CRANBERRIES = 61821,
+ SPELL_ON_PLATE_VISUAL_POTATOES = 61824,
+ SPELL_ON_PLATE_VISUAL_TURKEY = 61822,
+ SPELL_ON_PLATE_VISUAL_STUFFING = 61823,
+ SPELL_A_SERVING_OF_CRANBERRIES_PLATE = 61833,
+ SPELL_A_SERVING_OF_TURKEY_PLATE = 61835,
+ SPELL_A_SERVING_OF_STUFFING_PLATE = 61836,
+ SPELL_A_SERVING_OF_SWEET_POTATOES_PLATE = 61837,
+ SPELL_A_SERVING_OF_PIE_PLATE = 61838,
+ SPELL_A_SERVING_OF_CRANBERRIES_CHAIR = 61804,
+ SPELL_A_SERVING_OF_TURKEY_CHAIR = 61807,
+ SPELL_A_SERVING_OF_STUFFING_CHAIR = 61806,
+ SPELL_A_SERVING_OF_SWEET_POTATOES_CHAIR = 61808,
+ SPELL_A_SERVING_OF_PIE_CHAIR = 61805
+};
+
+/* 66250 - Pass The Turkey
+ 66259 - Pass The Stuffing
+ 66260 - Pass The Pie
+ 66261 - Pass The Cranberries
+ 66262 - Pass The Sweet Potatoes */
+class spell_pilgrims_bounty_on_plate : public SpellScriptLoader
+{
+ private:
+ uint32 _triggeredSpellId1;
+ uint32 _triggeredSpellId2;
+ uint32 _triggeredSpellId3;
+ uint32 _triggeredSpellId4;
+
+ public:
+ spell_pilgrims_bounty_on_plate(const char* name, uint32 triggeredSpellId1, uint32 triggeredSpellId2, uint32 triggeredSpellId3, uint32 triggeredSpellId4) : SpellScriptLoader(name),
+ _triggeredSpellId1(triggeredSpellId1), _triggeredSpellId2(triggeredSpellId2), _triggeredSpellId3(triggeredSpellId3), _triggeredSpellId4(triggeredSpellId4) { }
+
+ class spell_pilgrims_bounty_on_plate_SpellScript : public SpellScript
+ {
+ PrepareSpellScript(spell_pilgrims_bounty_on_plate_SpellScript);
+ private:
+ 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) { }
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(_triggeredSpellId1)
+ || !sSpellMgr->GetSpellInfo(_triggeredSpellId2)
+ || !sSpellMgr->GetSpellInfo(_triggeredSpellId3)
+ || !sSpellMgr->GetSpellInfo(_triggeredSpellId4))
+ return false;
+ return true;
+ }
+
+ 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
+ {
+ return new spell_pilgrims_bounty_on_plate_SpellScript(_triggeredSpellId1, _triggeredSpellId2, _triggeredSpellId3, _triggeredSpellId4);
+ }
+};
+
+/* 61804 - A Serving of Cranberries
+ 61805 - A Serving of Pie
+ 61806 - A Serving of Stuffing
+ 61807 - A Serving of Turkey
+ 61808 - A Serving of Sweet Potatoes
+ 61793 - Cranberry Server
+ 61794 - Pie Server
+ 61795 - Stuffing Server
+ 61796 - Turkey Server
+ 61797 - Sweet Potatoes Server */
+class spell_pilgrims_bounty_a_serving_of : public SpellScriptLoader
+{
+ private:
+ uint32 _triggeredSpellId;
+ public:
+ spell_pilgrims_bounty_a_serving_of(const char* name, uint32 triggeredSpellId) : SpellScriptLoader(name), _triggeredSpellId(triggeredSpellId) { }
+
+ class spell_pilgrims_bounty_a_serving_of_AuraScript : public AuraScript
+ {
+ PrepareAuraScript(spell_pilgrims_bounty_a_serving_of_AuraScript);
+
+ private:
+ uint32 _triggeredSpellId;
+
+ public:
+ spell_pilgrims_bounty_a_serving_of_AuraScript(uint32 triggeredSpellId) : AuraScript(), _triggeredSpellId(triggeredSpellId) { }
+
+ bool Validate(SpellInfo const* /*spell*/) override
+ {
+ if (!sSpellMgr->GetSpellInfo(_triggeredSpellId))
+ return false;
+ return true;
+ }
+
+ void OnApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->CastSpell(target, uint32(aurEff->GetBaseAmount()), true);
+ HandlePlate(target, true);
+ }
+
+ void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
+ {
+ Unit* target = GetTarget();
+ target->RemoveAurasDueToSpell(aurEff->GetBaseAmount());
+ 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 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);
+ }
+};
+
enum Mistletoe
{
SPELL_CREATE_MISTLETOE = 26206,
@@ -1406,6 +1630,16 @@ void AddSC_holiday_spell_scripts()
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);
// Winter Veil
new spell_winter_veil_mistletoe();
new spell_winter_veil_px_238_winter_wondervolt();
diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
index 8dd606f8b66..c0571317329 100644
--- a/src/server/scripts/World/npcs_special.cpp
+++ b/src/server/scripts/World/npcs_special.cpp
@@ -34,6 +34,8 @@
#include "Pet.h"
#include "CreatureTextMgr.h"
#include "SmartAI.h"
+#include "Vehicle.h"
+#include "MoveSplineInit.h"
/*########
# npc_air_force_bots
@@ -2600,6 +2602,120 @@ public:
}
};
+enum BountifulTable
+{
+ SEAT_TURKEY_CHAIR = 0,
+ SEAT_CRANBERRY_CHAIR = 1,
+ SEAT_STUFFING_CHAIR = 2,
+ SEAT_SWEET_POTATO_CHAIR = 3,
+ SEAT_PIE_CHAIR = 4,
+ SEAT_FOOD_HOLDER = 5,
+ SEAT_PLATE_HOLDER = 6,
+ NPC_THE_TURKEY_CHAIR = 34812,
+ NPC_THE_CRANBERRY_CHAIR = 34823,
+ NPC_THE_STUFFING_CHAIR = 34819,
+ NPC_THE_SWEET_POTATO_CHAIR = 34824,
+ NPC_THE_PIE_CHAIR = 34822,
+ SPELL_CRANBERRY_SERVER = 61793,
+ SPELL_PIE_SERVER = 61794,
+ SPELL_STUFFING_SERVER = 61795,
+ SPELL_TURKEY_SERVER = 61796,
+ SPELL_SWEET_POTATOES_SERVER = 61797
+};
+
+typedef std::unordered_map<uint32 /*Entry*/, uint32 /*Spell*/> ChairSpells;
+ChairSpells const _chairSpells =
+{
+ { NPC_THE_CRANBERRY_CHAIR, SPELL_CRANBERRY_SERVER },
+ { NPC_THE_PIE_CHAIR, SPELL_PIE_SERVER },
+ { NPC_THE_STUFFING_CHAIR, SPELL_STUFFING_SERVER },
+ { NPC_THE_TURKEY_CHAIR, SPELL_TURKEY_SERVER },
+ { NPC_THE_SWEET_POTATO_CHAIR, SPELL_SWEET_POTATOES_SERVER },
+};
+
+class CastFoodSpell : public BasicEvent
+{
+ public:
+ CastFoodSpell(Unit* owner, uint32 spellId) : _owner(owner), _spellId(spellId) { }
+
+ bool Execute(uint64 /*execTime*/, uint32 /*diff*/) override
+ {
+ _owner->CastSpell(_owner, _spellId, true);
+ return false;
+ }
+
+ private:
+ Unit* _owner;
+ uint32 _spellId;
+};
+
+class npc_bountiful_table : public CreatureScript
+{
+public:
+ npc_bountiful_table() : CreatureScript("npc_bountiful_table") { }
+
+ struct npc_bountiful_tableAI : public PassiveAI
+ {
+ npc_bountiful_tableAI(Creature* creature) : PassiveAI(creature) { }
+
+ void PassengerBoarded(Unit* who, int8 seatId, bool /*apply*/) override
+ {
+ float x = 0.0f;
+ float y = 0.0f;
+ float z = 0.0f;
+ float o = 0.0f;
+
+ switch (seatId)
+ {
+ case SEAT_TURKEY_CHAIR:
+ x = 3.87f;
+ y = 2.07f;
+ o = 3.700098f;
+ break;
+ case SEAT_CRANBERRY_CHAIR:
+ x = 3.87f;
+ y = -2.07f;
+ o = 2.460914f;
+ break;
+ case SEAT_STUFFING_CHAIR:
+ x = -2.52f;
+ break;
+ case SEAT_SWEET_POTATO_CHAIR:
+ x = -0.09f;
+ y = -3.24f;
+ o = 1.186824f;
+ break;
+ case SEAT_PIE_CHAIR:
+ x = -0.18f;
+ y = 3.24f;
+ o = 5.009095f;
+ break;
+ case SEAT_FOOD_HOLDER:
+ case SEAT_PLATE_HOLDER:
+ if (Vehicle* holders = who->GetVehicleKit())
+ holders->InstallAllAccessories(true);
+ return;
+ default:
+ break;
+ }
+
+ Movement::MoveSplineInit init(who);
+ init.DisableTransportPathTransformations();
+ init.MoveTo(x, y, z, false);
+ init.SetFacing(o);
+ init.Launch();
+ who->m_Events.AddEvent(new CastFoodSpell(who, _chairSpells.at(who->GetEntry())), who->m_Events.CalculateTime(1000));
+ if (who->GetTypeId() == TYPEID_UNIT)
+ who->SetDisplayId(who->ToCreature()->GetCreatureTemplate()->Modelid1);
+ }
+ };
+
+ CreatureAI* GetAI(Creature* creature) const override
+ {
+ return new npc_bountiful_tableAI(creature);
+ }
+};
+
void AddSC_npcs_special()
{
new npc_air_force_bots();
@@ -2625,4 +2741,5 @@ void AddSC_npcs_special()
new npc_stable_master();
new npc_train_wrecker();
new npc_argent_squire_gruntling();
+ new npc_bountiful_table();
}