mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-27 20:32:21 +01:00
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.)
This commit is contained in:
5
sql/updates/world/3.3.5/2017_06_12_00_world.sql
Normal file
5
sql/updates/world/3.3.5/2017_06_12_00_world.sql
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
--
|
||||||
|
UPDATE `trinity_string` SET `content_default`="You can only summon a player to your instance if either that player or his group leader is in your instance, too." WHERE `entry`=103;
|
||||||
|
DELETE FROM `trinity_string` WHERE `entry`=187;
|
||||||
|
INSERT INTO `trinity_string` (`entry`,`content_default`) VALUES
|
||||||
|
(187, "The group's leader is not in your instance - summoning only members that are already in your map.");
|
||||||
@@ -215,7 +215,8 @@ enum TrinityStrings
|
|||||||
LANG_GRID_POSITION = 178,
|
LANG_GRID_POSITION = 178,
|
||||||
// 179-185 used in 6.x branch
|
// 179-185 used in 6.x branch
|
||||||
LANG_TRANSPORT_POSITION = 186,
|
LANG_TRANSPORT_POSITION = 186,
|
||||||
// Room for more level 1 187-199 not used
|
LANG_PARTIAL_GROUP_SUMMON = 187,
|
||||||
|
// Room for more level 1 188-199 not used
|
||||||
|
|
||||||
// level 2 chat
|
// level 2 chat
|
||||||
LANG_NO_SELECTION = 200,
|
LANG_NO_SELECTION = 200,
|
||||||
|
|||||||
@@ -66,7 +66,6 @@ public:
|
|||||||
if (!group)
|
if (!group)
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
|
handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str());
|
||||||
handler->SetSentErrorMessage(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,19 +73,22 @@ public:
|
|||||||
Group* gmGroup = gmPlayer->GetGroup();
|
Group* gmGroup = gmPlayer->GetGroup();
|
||||||
Map* gmMap = gmPlayer->GetMap();
|
Map* gmMap = gmPlayer->GetMap();
|
||||||
bool toInstance = gmMap->Instanceable();
|
bool toInstance = gmMap->Instanceable();
|
||||||
|
bool onlyLocalSummon = false;
|
||||||
|
|
||||||
// we are in instance, and can summon only player in our group with us as lead
|
// make sure people end up on our instance of the map, disallow far summon if intended destination is different from actual destination
|
||||||
if (toInstance && (
|
// note: we could probably relax this further by checking permanent saves and the like, but eh
|
||||||
!gmGroup || group->GetLeaderGUID() != gmPlayer->GetGUID() ||
|
// :close enough:
|
||||||
gmGroup->GetLeaderGUID() != gmPlayer->GetGUID()))
|
if (toInstance)
|
||||||
// the last check is a bit excessive, but let it be, just in case
|
|
||||||
{
|
{
|
||||||
handler->SendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
|
Player* groupLeader = ObjectAccessor::GetPlayer(gmMap, group->GetLeaderGUID());
|
||||||
handler->SetSentErrorMessage(true);
|
if (!groupLeader || (groupLeader->GetMapId() != gmMap->GetId()) || (groupLeader->GetInstanceId() != gmMap->GetInstanceId()))
|
||||||
return false;
|
{
|
||||||
|
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();
|
Player* player = itr->GetSource();
|
||||||
|
|
||||||
@@ -95,27 +97,28 @@ public:
|
|||||||
|
|
||||||
// check online security
|
// check online security
|
||||||
if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
|
if (handler->HasLowerSecurity(player, ObjectGuid::Empty))
|
||||||
return false;
|
continue;
|
||||||
|
|
||||||
std::string plNameLink = handler->GetNameLink(player);
|
std::string plNameLink = handler->GetNameLink(player);
|
||||||
|
|
||||||
if (player->IsBeingTeleported())
|
if (player->IsBeingTeleported())
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
handler->PSendSysMessage(LANG_IS_TELEPORTED, plNameLink.c_str());
|
||||||
handler->SetSentErrorMessage(true);
|
continue;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toInstance)
|
if (toInstance)
|
||||||
{
|
{
|
||||||
Map* playerMap = player->GetMap();
|
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
|
// cannot summon from instance to instance
|
||||||
handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, plNameLink.c_str());
|
handler->PSendSysMessage(LANG_CANNOT_SUMMON_INST_INST, plNameLink.c_str());
|
||||||
handler->SetSentErrorMessage(true);
|
continue;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Map* map = handler->GetSession()->GetPlayer()->GetMap();
|
Map* map = _player->GetMap();
|
||||||
|
|
||||||
if (map->IsBattlegroundOrArena())
|
if (map->IsBattlegroundOrArena())
|
||||||
{
|
{
|
||||||
@@ -516,30 +516,35 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// if both players are in different bgs
|
// if both players are in different bgs
|
||||||
else if (target->GetBattlegroundId() && handler->GetSession()->GetPlayer()->GetBattlegroundId() != target->GetBattlegroundId())
|
else if (target->GetBattlegroundId() && _player->GetBattlegroundId() != target->GetBattlegroundId())
|
||||||
target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff
|
target->LeaveBattleground(false); // Note: should be changed so target gets no Deserter debuff
|
||||||
|
|
||||||
// all's well, set bg id
|
// all's well, set bg id
|
||||||
// when porting out from the bg, it will be reset to 0
|
// when porting out from the bg, it will be reset to 0
|
||||||
target->SetBattlegroundId(handler->GetSession()->GetPlayer()->GetBattlegroundId(), handler->GetSession()->GetPlayer()->GetBattlegroundTypeId());
|
target->SetBattlegroundId(_player->GetBattlegroundId(), _player->GetBattlegroundTypeId());
|
||||||
// remember current position as entry point for return at bg end teleportation
|
// remember current position as entry point for return at bg end teleportation
|
||||||
if (!target->GetMap()->IsBattlegroundOrArena())
|
if (!target->GetMap()->IsBattlegroundOrArena())
|
||||||
target->SetBattlegroundEntryPoint();
|
target->SetBattlegroundEntryPoint();
|
||||||
}
|
}
|
||||||
else if (map->IsDungeon())
|
else if (map->Instanceable())
|
||||||
{
|
{
|
||||||
Map* destMap = target->GetMap();
|
Group* targetGroup = target->GetGroup();
|
||||||
|
Map* targetMap = target->GetMap();
|
||||||
|
Player* targetGroupLeader = ObjectAccessor::GetPlayer(map, targetGroup->GetLeaderGUID());
|
||||||
|
|
||||||
|
// check if far teleport is allowed
|
||||||
|
if (!targetGroupLeader || (targetGroupLeader->GetMapId() != map->GetId()) || (targetGroupLeader->GetInstanceId() != map->GetInstanceId()))
|
||||||
|
if ((targetMap->GetId() != map->GetId()) || (targetMap->GetInstanceId() != map->GetInstanceId()))
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (destMap->Instanceable() && destMap->GetInstanceId() != map->GetInstanceId())
|
// check if we're already in a different instance of the same map
|
||||||
target->UnbindInstance(map->GetInstanceId(), target->GetDungeonDifficulty(), true);
|
if ((targetMap->GetId() == map->GetId()) && (targetMap->GetInstanceId() != map->GetInstanceId()))
|
||||||
|
|
||||||
// we are in an instance, and can only summon players in our group with us as leader
|
|
||||||
if (!handler->GetSession()->GetPlayer()->GetGroup() || !target->GetGroup() ||
|
|
||||||
(target->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()) ||
|
|
||||||
(handler->GetSession()->GetPlayer()->GetGroup()->GetLeaderGUID() != handler->GetSession()->GetPlayer()->GetGUID()))
|
|
||||||
// the last check is a bit excessive, but let it be, just in case
|
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_CANNOT_SUMMON_TO_INST, nameLink.c_str());
|
handler->PSendSysMessage(LANG_CANNOT_SUMMON_INST_INST, nameLink.c_str());
|
||||||
handler->SetSentErrorMessage(true);
|
handler->SetSentErrorMessage(true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -561,9 +566,9 @@ public:
|
|||||||
|
|
||||||
// before GM
|
// before GM
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
handler->GetSession()->GetPlayer()->GetClosePoint(x, y, z, target->GetCombatReach());
|
_player->GetClosePoint(x, y, z, target->GetCombatReach());
|
||||||
target->TeleportTo(handler->GetSession()->GetPlayer()->GetMapId(), x, y, z, target->GetOrientation());
|
target->TeleportTo(_player->GetMapId(), x, y, z, target->GetOrientation());
|
||||||
target->SetPhaseMask(handler->GetSession()->GetPlayer()->GetPhaseMask(), true);
|
target->SetPhaseMask(_player->GetPhaseMask(), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -577,12 +582,12 @@ public:
|
|||||||
|
|
||||||
// in point where GM stay
|
// in point where GM stay
|
||||||
SQLTransaction dummy;
|
SQLTransaction dummy;
|
||||||
Player::SavePositionInDB(WorldLocation(handler->GetSession()->GetPlayer()->GetMapId(),
|
Player::SavePositionInDB(WorldLocation(_player->GetMapId(),
|
||||||
handler->GetSession()->GetPlayer()->GetPositionX(),
|
_player->GetPositionX(),
|
||||||
handler->GetSession()->GetPlayer()->GetPositionY(),
|
_player->GetPositionY(),
|
||||||
handler->GetSession()->GetPlayer()->GetPositionZ(),
|
_player->GetPositionZ(),
|
||||||
handler->GetSession()->GetPlayer()->GetOrientation()),
|
_player->GetOrientation()),
|
||||||
handler->GetSession()->GetPlayer()->GetZoneId(),
|
_player->GetZoneId(),
|
||||||
targetGuid, dummy);
|
targetGuid, dummy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user