Core/Misc: Kill AnyPlayerInObjectRangeCheck (duplicate of AnyUnitInObjectRangeCheck)

Port From (https://github.com/TrinityCore/TrinityCore/commit/0f9a0accf17ba3a9f20d6a7575b51ed2cb09a73c)
This commit is contained in:
Hondacrx
2025-08-18 10:07:50 -04:00
parent b444c2f23c
commit 2bbd77bd94
5 changed files with 30 additions and 56 deletions
+7 -13
View File
@@ -51,21 +51,15 @@ namespace Scripts.Events.LoveIsInTheAir
bool foundSomeone = false;
// For nearby players, check if they have the same aura. If so, cast Romantic Picnic (45123)
// required by achievement and "hearts" visual
List<Player> playerList = new();
AnyPlayerInObjectRangeCheck checker = new(target, SharedConst.InteractionDistance * 2);
PlayerListSearcher searcher = new(target, playerList, checker);
Cell.VisitWorldObjects(target, searcher, SharedConst.InteractionDistance * 2);
foreach (var playerFound in playerList)
List<Player> playerList = target.GetPlayerListInGrid(SharedConst.InteractionDistance * 2);
foreach (Player playerFound in playerList)
{
if (playerFound != null)
if (target != playerFound && playerFound.HasAura(GetId()))
{
if (target != playerFound && playerFound.HasAura(GetId()))
{
playerFound.CastSpell(playerFound, SpellRomanticPicnicAchiev, true);
target.CastSpell(target, SpellRomanticPicnicAchiev, true);
foundSomeone = true;
break;
}
playerFound.CastSpell(playerFound, SpellRomanticPicnicAchiev, true);
target.CastSpell(target, SpellRomanticPicnicAchiev, true);
foundSomeone = true;
break;
}
}