Make some adjustments to .summon and .group summon behavior to make them more permissive:

- Now only requires the either target's group leader or target itself to be on your map
- Now summons all applicable group members even if one member fails checks
- No longer has some truly weird edge case instance unbind code that could cause exploit behavior (Really, I have no idea why this existed, because it certainly didn't do what it might've been meant to do.)
Port From (https://github.com/TrinityCore/TrinityCore/commit/f543e570d65fec3546e982d27d458a759922602d)
This commit is contained in:
hondacrx
2020-07-24 11:46:44 -04:00
parent f7aa724d8f
commit e5b6703dd0
4 changed files with 45 additions and 38 deletions
+17 -12
View File
@@ -57,15 +57,19 @@ namespace Game.Chat
Group gmGroup = gmPlayer.GetGroup();
Map gmMap = gmPlayer.GetMap();
bool toInstance = gmMap.Instanceable();
bool onlyLocalSummon = false;
// we are in instance, and can summon only player in our group with us as lead
if (toInstance && (
!gmGroup || group.GetLeaderGUID() != gmPlayer.GetGUID() ||
gmGroup.GetLeaderGUID() != gmPlayer.GetGUID()))
// the last check is a bit excessive, but let it be, just in case
// make sure people end up on our instance of the map, disallow far summon if intended destination is different from actual destination
// note: we could probably relax this further by checking permanent saves and the like, but eh
// :close enough:
if (toInstance)
{
handler.SendSysMessage(CypherStrings.CannotSummonToInst);
return false;
Player groupLeader = Global.ObjAccessor.GetPlayer(gmMap, group.GetLeaderGUID());
if (!groupLeader || (groupLeader.GetMapId() != gmMap.GetId()) || (groupLeader.GetInstanceId() != gmMap.GetInstanceId()))
{
handler.SendSysMessage(CypherStrings.PartialGroupSummon);
onlyLocalSummon = true;
}
}
for (GroupReference refe = group.GetFirstMember(); refe != null; refe = refe.Next())
@@ -77,25 +81,26 @@ namespace Game.Chat
// check online security
if (handler.HasLowerSecurity(player, ObjectGuid.Empty))
return false;
continue;
string plNameLink = handler.GetNameLink(player);
if (player.IsBeingTeleported())
{
handler.SendSysMessage(CypherStrings.IsTeleported, plNameLink);
return false;
continue;
}
if (toInstance)
{
Map playerMap = player.GetMap();
if (playerMap.Instanceable() && playerMap.GetInstanceId() != gmMap.GetInstanceId())
if ((onlyLocalSummon || (playerMap.Instanceable() && playerMap.GetId() == gmMap.GetId())) && // either no far summon allowed or we're in the same map as player (no map switch)
((playerMap.GetId() != gmMap.GetId()) || (playerMap.GetInstanceId() != gmMap.GetInstanceId()))) // so we need to be in the same map and instance of the map, otherwise skip
{
// cannot summon from instance to instance
handler.SendSysMessage(CypherStrings.CannotSummonToInst, plNameLink);
return false;
handler.SendSysMessage(CypherStrings.CannotSummonInstInst, plNameLink);
continue;
}
}