diff options
| author | Kittnz <frederik156@hotmail.com> | 2017-10-18 18:26:56 +0200 |
|---|---|---|
| committer | funjoker <funjoker109@gmail.com> | 2021-01-08 21:12:11 +0100 |
| commit | 05ee64631d3afafb57cbe7b49a4549440eaa6814 (patch) | |
| tree | fd8af15108270c6a9ac551c7b6ecd06eee391530 | |
| parent | 2808e1db678bdc28961e0e5d4696c0273b2fda00 (diff) | |
Event/Brewfest: Fix logic for Brewfest Music
Closes #20589
(cherry picked from commit f909d4f1957bde5da6b3f491e6b552389a8f3ac2)
| -rw-r--r-- | src/server/scripts/World/go_scripts.cpp | 126 |
1 files changed, 91 insertions, 35 deletions
diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index dba64bed1cf..73f5816e536 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -1601,43 +1601,99 @@ public: case EVENT_BM_START_MUSIC: if (!IsHolidayActive(HOLIDAY_BREWFEST)) // Check if Brewfest is active break; - // Check if gob is correct area, play music, set time of music - if (me->GetAreaId() == SILVERMOON || me->GetAreaId() == UNDERCITY || me->GetAreaId() == ORGRIMMAR_1 || me->GetAreaId() == ORGRIMMAR_2 || me->GetAreaId() == THUNDERBLUFF || me->GetAreaId() == SHATTRATH) - { - if (rnd == 0) - { - me->PlayDirectMusic(EVENT_BREWFESTGOBLIN01); - musicTime = EVENT_BREWFESTGOBLIN01_TIME; - } - else if (rnd == 1) - { - me->PlayDirectMusic(EVENT_BREWFESTGOBLIN02); - musicTime = EVENT_BREWFESTGOBLIN02_TIME; - } - else - { - me->PlayDirectMusic(EVENT_BREWFESTGOBLIN03); - musicTime = EVENT_BREWFESTGOBLIN03_TIME; - } - } - if (me->GetAreaId() == IRONFORGE_1 || me->GetAreaId() == IRONFORGE_2 || me->GetAreaId() == STORMWIND || me->GetAreaId() == EXODAR || me->GetAreaId() == DARNASSUS || me->GetAreaId() == SHATTRATH) + + switch (me->GetAreaId()) { - if (rnd == 0) - { - me->PlayDirectMusic(EVENT_BREWFESTDWARF01); - musicTime = EVENT_BREWFESTDWARF01_TIME; - } - else if (rnd == 1) - { - me->PlayDirectMusic(EVENT_BREWFESTDWARF02); - musicTime = EVENT_BREWFESTDWARF02_TIME; - } - else - { - me->PlayDirectMusic(EVENT_BREWFESTDWARF03); - musicTime = EVENT_BREWFESTDWARF03_TIME; - } + // Horde + case SILVERMOON: + case UNDERCITY: + case ORGRIMMAR_1: + case ORGRIMMAR_2: + case THUNDERBLUFF: + if (rnd == 0) + { + me->PlayDirectMusic(EVENT_BREWFESTGOBLIN01); + musicTime = EVENT_BREWFESTGOBLIN01_TIME; + } + else if (rnd == 1) + { + me->PlayDirectMusic(EVENT_BREWFESTGOBLIN02); + musicTime = EVENT_BREWFESTGOBLIN02_TIME; + } + else + { + me->PlayDirectMusic(EVENT_BREWFESTGOBLIN03); + musicTime = EVENT_BREWFESTGOBLIN03_TIME; + } + break; + // Alliance + case IRONFORGE_1: + case IRONFORGE_2: + case STORMWIND: + case EXODAR: + case DARNASSUS: + if (rnd == 0) + { + me->PlayDirectMusic(EVENT_BREWFESTDWARF01); + musicTime = EVENT_BREWFESTDWARF01_TIME; + } + else if (rnd == 1) + { + me->PlayDirectMusic(EVENT_BREWFESTDWARF02); + musicTime = EVENT_BREWFESTDWARF02_TIME; + } + else + { + me->PlayDirectMusic(EVENT_BREWFESTDWARF03); + musicTime = EVENT_BREWFESTDWARF03_TIME; + } + break; + // Neurtal + case SHATTRATH: + std::vector<Player*> playersNearby; + me->GetPlayerListInGrid(playersNearby, me->GetVisibilityRange()); + for (Player* player : playersNearby) + { + if (player->GetTeamId() == TEAM_HORDE) + { + if (rnd == 0) + { + me->PlayDirectMusic(EVENT_BREWFESTGOBLIN01); + musicTime = EVENT_BREWFESTGOBLIN01_TIME; + } + else if (rnd == 1) + { + me->PlayDirectMusic(EVENT_BREWFESTGOBLIN02); + musicTime = EVENT_BREWFESTGOBLIN02_TIME; + } + else + { + me->PlayDirectMusic(EVENT_BREWFESTGOBLIN03); + musicTime = EVENT_BREWFESTGOBLIN03_TIME; + } + } + else + { + if (rnd == 0) + { + me->PlayDirectMusic(EVENT_BREWFESTDWARF01); + musicTime = EVENT_BREWFESTDWARF01_TIME; + } + else if (rnd == 1) + { + me->PlayDirectMusic(EVENT_BREWFESTDWARF02); + musicTime = EVENT_BREWFESTDWARF02_TIME; + } + else + { + me->PlayDirectMusic(EVENT_BREWFESTDWARF03); + musicTime = EVENT_BREWFESTDWARF03_TIME; + } + } + } + break; } + _events.ScheduleEvent(EVENT_BM_START_MUSIC, 5000); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client break; default: |
