Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Scripts/ZulAman): text with symbol and improved frog movement #21206

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 16 additions & 14 deletions src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,21 @@ struct npc_forest_frog : public ScriptedAI
me->DespawnOrUnsummon(1000);
}

Player* PlayerCaster() { return ObjectAccessor::GetPlayer(me->GetMap(), PlayerGUID); }
grimgravy marked this conversation as resolved.
Show resolved Hide resolved

void UpdateAI(uint32 diff) override
{
events.Update(diff);
if (eventTimer)
{
Player* player = ObjectAccessor::GetPlayer(me->GetMap(), PlayerGUID);
switch (events.ExecuteEvent())
{
case 1:

if (me->GetEntry() == NPC_ADARRAH)
Talk(SAY_THANKS_FREED + 1, player);
Talk(SAY_THANKS_FREED + 1, PlayerCaster());
else
Talk(SAY_THANKS_FREED, player);
Talk(SAY_THANKS_FREED, PlayerCaster());

eventTimer = 2;
events.ScheduleEvent(eventTimer, urand(4000, 5000));
Expand All @@ -108,28 +109,28 @@ struct npc_forest_frog : public ScriptedAI
case NPC_DEEZ:
case NPC_GALATHRYN:
DoCastSelf(SPELL_SUMMON_AMANI_CHARM_CHEST_2, true);
Talk(SAY_CHEST_SPAWN, player);
Talk(SAY_CHEST_SPAWN, PlayerCaster());
break;
case NPC_ADARRAH:
DoCastSelf(SPELL_SUMMON_AMANI_CHARM_CHEST_2, true);
Talk(SAY_CHEST_SPAWN + 1, player);
Talk(SAY_CHEST_SPAWN + 1, PlayerCaster());
break;
case NPC_DARWEN:
case NPC_FUDGERICK:
DoCastSelf(SPELL_SUMMON_MONEY_BAG, true);
me->LoadEquipment(0, true);
Talk(SAY_CHEST_SPAWN, player);
Talk(SAY_CHEST_SPAWN, PlayerCaster());
break;
case NPC_KYREN:
case NPC_GUNTER:
Talk(SAY_CHEST_SPAWN, player);
Talk(SAY_CHEST_SPAWN, PlayerCaster());
break;
case NPC_MITZI:
case NPC_CHRISTIAN:
case NPC_BRENNAN:
case NPC_HOLLEE:
DoCastSelf(SPELL_SUMMON_AMANI_CHARM_CHEST_1, true);
Talk(SAY_CHEST_SPAWN, player);
Talk(SAY_CHEST_SPAWN, PlayerCaster());
break;
}
eventTimer = 3;
Expand All @@ -139,9 +140,9 @@ struct npc_forest_frog : public ScriptedAI
me->SetStandState(EMOTE_ONESHOT_NONE);

if (me->GetEntry() == NPC_ADARRAH)
Talk(SAY_CHEST_TALK + 1, player);
Talk(SAY_CHEST_TALK + 1, PlayerCaster());
else
Talk(SAY_CHEST_TALK);
Talk(SAY_CHEST_TALK, PlayerCaster());

eventTimer = 4;
if (me->GetEntry() == NPC_GUNTER || me->GetEntry() == NPC_KYREN)
Expand All @@ -153,9 +154,9 @@ struct npc_forest_frog : public ScriptedAI
me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE);

if (me->GetEntry() == NPC_ADARRAH)
Talk(SAY_GOODBYE + 1, player);
Talk(SAY_GOODBYE + 1, PlayerCaster());
else
Talk(SAY_GOODBYE);
Talk(SAY_GOODBYE, PlayerCaster());

eventTimer = 5;
events.ScheduleEvent(eventTimer, 2000);
Expand Down Expand Up @@ -201,14 +202,16 @@ struct npc_forest_frog : public ScriptedAI
events.ScheduleEvent(eventTimer, 3000);

me->UpdateEntry(cEntry);

if (Player* player = PlayerCaster())
me->SetFacingToObject(player);
}

void SpellHit(Unit* caster, SpellInfo const* spell) override
{
if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->IsPlayer() && me->GetEntry() == NPC_FOREST_FROG)
{
me->GetMotionMaster()->MoveIdle();
me->SetFacingToObject(caster);
PlayerGUID = caster->GetGUID();

if (roll_chance_i(2))
Expand All @@ -223,7 +226,6 @@ struct npc_forest_frog : public ScriptedAI

private:
InstanceScript* instance;
EventMap events;
uint8 eventTimer;
ObjectGuid PlayerGUID;
};
Expand Down
Loading