Event/Midsummer: improve pole ribbon functionality (#17464)

Event/Midsummer: improve pole ribbon functionality:

- Bunny creature should hover, which puts it in the intended position.
- Use correct visual and internal spells to handle cosmetics and timers.
This commit is contained in:
SnapperRy
2016-07-05 15:19:30 +02:00
committed by GitHub
parent 42028a1842
commit 03b15d968b
5 changed files with 166 additions and 1 deletions

View File

@@ -1187,6 +1187,7 @@ enum RibbonPoleData
{
SPELL_HAS_FULL_MIDSUMMER_SET = 58933,
SPELL_BURNING_HOT_POLE_DANCE = 58934,
SPELL_RIBBON_DANCE_COSMETIC = 29726,
SPELL_RIBBON_DANCE = 29175,
GO_RIBBON_POLE = 181605,
};
@@ -1214,10 +1215,11 @@ class spell_gen_ribbon_pole_dancer_check : public SpellScriptLoader
Unit* target = GetTarget();
// check if aura needs to be removed
if (!target->FindNearestGameObject(GO_RIBBON_POLE, 20.0f) || !target->HasUnitState(UNIT_STATE_CASTING))
if (!target->FindNearestGameObject(GO_RIBBON_POLE, 8.0f) || !target->HasUnitState(UNIT_STATE_CASTING))
{
target->InterruptNonMeleeSpells(false);
target->RemoveAurasDueToSpell(GetId());
target->RemoveAura(SPELL_RIBBON_DANCE_COSMETIC);
return;
}

View File

@@ -1197,6 +1197,29 @@ public:
}
};
enum MidsummerPoleRibbon
{
SPELL_POLE_DANCE = 29726,
SPELL_BLUE_FIRE_RING = 46842,
NPC_POLE_RIBBON_BUNNY = 17066,
ACTION_COSMETIC_FIRES = 0
};
class go_midsummer_ribbon_pole : public GameObjectScript
{
public:
go_midsummer_ribbon_pole() : GameObjectScript("go_midsummer_ribbon_pole") { }
bool OnGossipHello(Player* player, GameObject* go) override
{
if (Creature* creature = go->FindNearestCreature(NPC_POLE_RIBBON_BUNNY, 10.0f))
{
creature->GetAI()->DoAction(ACTION_COSMETIC_FIRES);
player->CastSpell(creature, SPELL_POLE_DANCE, true);
}
return true;
}
};
enum ToyTrainSpells
{
@@ -1274,5 +1297,6 @@ void AddSC_go_scripts()
new go_veil_skith_cage();
new go_frostblade_shrine();
new go_midsummer_bonfire();
new go_midsummer_ribbon_pole();
new go_toy_train_set();
}

View File

@@ -579,6 +579,115 @@ public:
}
};
/*######
## npc_midsummer_bunny_pole
######*/
enum RibbonPoleData
{
GO_RIBBON_POLE = 181605,
SPELL_RIBBON_DANCE_COSMETIC = 29726,
SPELL_RED_FIRE_RING = 46836,
SPELL_BLUE_FIRE_RING = 46842,
EVENT_CAST_RED_FIRE_RING = 1,
EVENT_CAST_BLUE_FIRE_RING = 2
};
class npc_midsummer_bunny_pole : public CreatureScript
{
public:
npc_midsummer_bunny_pole() : CreatureScript("npc_midsummer_bunny_pole") { }
struct npc_midsummer_bunny_poleAI : public ScriptedAI
{
npc_midsummer_bunny_poleAI(Creature* creature) : ScriptedAI(creature)
{
Initialize();
}
void Initialize()
{
events.Reset();
running = false;
}
void Reset() override
{
Initialize();
}
void DoAction(int32 /*action*/) override
{
// Don't start event if it's already running.
if (running)
return;
running = true;
events.ScheduleEvent(EVENT_CAST_RED_FIRE_RING, 1);
}
bool checkNearbyPlayers()
{
// Returns true if no nearby player has aura "Test Ribbon Pole Channel".
std::list<Player*> players;
Trinity::UnitAuraCheck check(true, SPELL_RIBBON_DANCE_COSMETIC);
Trinity::PlayerListSearcher<Trinity::UnitAuraCheck> searcher(me, players, check);
me->VisitNearbyWorldObject(10.0f, searcher);
return players.empty();
}
void UpdateAI(uint32 diff) override
{
if (!running)
return;
events.Update(diff);
switch (events.ExecuteEvent())
{
case EVENT_CAST_RED_FIRE_RING:
{
if (checkNearbyPlayers())
{
Reset();
return;
}
if (GameObject* go = me->FindNearestGameObject(GO_RIBBON_POLE, 10.0f))
me->CastSpell(go, SPELL_RED_FIRE_RING, true);
events.ScheduleEvent(EVENT_CAST_BLUE_FIRE_RING, Seconds(5));
}
break;
case EVENT_CAST_BLUE_FIRE_RING:
{
if (checkNearbyPlayers())
{
Reset();
return;
}
if (GameObject* go = me->FindNearestGameObject(GO_RIBBON_POLE, 10.0f))
me->CastSpell(go, SPELL_BLUE_FIRE_RING, true);
events.ScheduleEvent(EVENT_CAST_RED_FIRE_RING, Seconds(5));
}
break;
}
}
private:
EventMap events;
bool running;
};
CreatureAI* GetAI(Creature* creature) const override
{
return new npc_midsummer_bunny_poleAI(creature);
}
};
/*######
## Triage quest
######*/
@@ -2447,6 +2556,7 @@ void AddSC_npcs_special()
new npc_chicken_cluck();
new npc_dancing_flames();
new npc_torch_tossing_target_bunny_controller();
new npc_midsummer_bunny_pole();
new npc_doctor();
new npc_injured_patient();
new npc_garments_of_quests();