fix(Scripts): Midsummer Music Range (#12248)

* fix(Scripts): Midsummer Music Range

* Refactor iterating nearby players

Co-authored-by: Nefertumm <nefertum.dev@protonmail.com>

* Update go_scripts.cpp

* Update go_scripts.cpp

Co-authored-by: Nefertumm <nefertum.dev@protonmail.com>
This commit is contained in:
ZhengPeiRu21
2022-07-01 14:24:01 -06:00
committed by GitHub
parent 2fd98c2bbc
commit 7df342b41c
+5 -5
View File
@@ -821,10 +821,11 @@ public:
if (!IsHolidayActive(HOLIDAY_FIRE_FESTIVAL)) if (!IsHolidayActive(HOLIDAY_FIRE_FESTIVAL))
break; break;
Map::PlayerList const& players = me->GetMap()->GetPlayers(); std::list<Player*> targets;
for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) Acore::AnyPlayerInObjectRangeCheck check(me, me->GetVisibilityRange(), false);
{ Acore::PlayerListSearcherWithSharedVision<Acore::AnyPlayerInObjectRangeCheck> searcher(me, targets, check);
if (Player* player = itr->GetSource()) Cell::VisitWorldObjects(me, searcher, me->GetVisibilityRange());
for (Player* player : targets)
{ {
if (player->GetTeamId() == TEAM_HORDE) if (player->GetTeamId() == TEAM_HORDE)
{ {
@@ -835,7 +836,6 @@ public:
me->PlayDirectMusic(EVENTMIDSUMMERFIREFESTIVAL_A, player); me->PlayDirectMusic(EVENTMIDSUMMERFIREFESTIVAL_A, player);
} }
} }
}
_events.ScheduleEvent(EVENT_MM_START_MUSIC, 5000); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client (sniffed value) _events.ScheduleEvent(EVENT_MM_START_MUSIC, 5000); // Every 5 second's SMSG_PLAY_MUSIC packet (PlayDirectMusic) is pushed to the client (sniffed value)
break; break;