Make some adjustments to .summon and .group summon behavior to make t…

…hem 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.)
This commit is contained in:
Aokromes committed 2017-06-12 18:03:01 +02:00
1 parent 6c686876d0
commit 558bbbcf98
3 files changed
+50 -41

No files matched your search

+20 -17
View File
@@ -65,7 +65,6 @@ public:
if (!group)
{
handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
handler->SetSentErrorMessage(true);
return false;
}
@@ -73,19 +72,22 @@ public:
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(LANG_CANNOT_SUMMON_TO_INST);
handler->SetSentErrorMessage(true);
return false;
Player* groupLeader = ObjectAccessor::GetPlayer(gmMap, group->GetLeaderGUID());
if (!groupLeader || (groupLeader->GetMapId() != gmMap->GetId()) || (groupLeader->GetInstanceId() != gmMap->GetInstanceId()))
{
handler->SendSysMessage(LANG_PARTIAL_GROUP_SUMMON);
onlyLocalSummon = true;
}
}
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
for (GroupReference* itr = group->GetFirstMember(); itr != nullptr; itr = itr->next())
{
Player* player = itr->GetSource();
@@ -94,27 +96,28 @@ public:
// check online security
if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
return false;
continue;
std::string plNameLink = handler->GetNameLink(player);
if (player->IsBeingTeleported())
{
handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
handler->SetSentErrorMessage(true);
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->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str());
handler->SetSentErrorMessage(true);
return false;
handler->PSendSysMessage(LANG_CANNOT_SUMMON_INST_INST, plNameLink.c_str());
continue;
}
}