-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added a spectator script and crowd upon completion of a wave.
- Loading branch information
Showing
6 changed files
with
114 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#ifndef MODULE_TRIAL_OF_STRENGTH_ARENA_SPECTATOR_H | ||
#define MODULE_TRIAL_OF_STRENGTH_ARENA_SPECTATOR_H | ||
|
||
#include "ScriptedCreature.h" | ||
|
||
class ToSArenaSpectatorScript : public CreatureScript | ||
{ | ||
public: | ||
ToSArenaSpectatorScript() : CreatureScript("ToSArenaSpectatorScript") { } | ||
|
||
CreatureAI* GetAI(Creature* creature) const override | ||
{ | ||
return new ToSArenaSpectatorAIScript(creature); | ||
} | ||
|
||
class ToSArenaSpectatorAIScript : public ScriptedAI | ||
{ | ||
enum ToSSpectatorConstants | ||
{ | ||
TOS_ARENA_SPEC_DO_EMOTE = 1 | ||
}; | ||
|
||
public: | ||
ToSArenaSpectatorAIScript(Creature* creature) : ScriptedAI(creature) | ||
{ | ||
events.Reset(); | ||
events.ScheduleEvent(TOS_ARENA_SPEC_DO_EMOTE, randtime(3s, 10s)); | ||
|
||
crowdCheerAlternate = false; | ||
} | ||
|
||
void UpdateAI(uint32 diff) override | ||
{ | ||
events.Update(diff); | ||
|
||
switch (events.ExecuteEvent()) | ||
{ | ||
case TOS_ARENA_SPEC_DO_EMOTE: | ||
DoEmote(); | ||
events.RescheduleEvent(TOS_ARENA_SPEC_DO_EMOTE, randtime(3s, 10s)); | ||
break; | ||
} | ||
} | ||
|
||
void DoEmote() | ||
{ | ||
auto iScript = me->GetInstanceScript(); | ||
if (!iScript) | ||
{ | ||
events.Reset(); | ||
LOG_WARN("module", "Failed to find instance script for Arena Spectator."); | ||
return; | ||
} | ||
|
||
if (!iScript->IsEncounterInProgress()) | ||
{ | ||
return; | ||
} | ||
|
||
switch (urand(0, 2)) | ||
{ | ||
case 0: | ||
me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER); | ||
break; | ||
|
||
case 1: | ||
me->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); | ||
break; | ||
|
||
case 2: | ||
me->HandleEmoteCommand(EMOTE_ONESHOT_APPLAUD); | ||
break; | ||
} | ||
} | ||
|
||
private: | ||
EventMap events; | ||
bool crowdCheerAlternate; | ||
}; | ||
|
||
private: | ||
EventMap events; | ||
}; | ||
|
||
#endif // MODULE_TRIAL_OF_STRENGTH_ARENA_SPECTATOR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters