aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Handlers/MiscHandler.cpp29
-rw-r--r--src/server/game/Server/WorldSession.cpp39
-rw-r--r--src/server/game/Server/WorldSession.h2
3 files changed, 17 insertions, 53 deletions
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index c7299be2853..14bff05a412 100644
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -375,33 +375,34 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/)
if (uint64 lguid = GetPlayer()->GetLootGUID())
DoLootRelease(lguid);
- uint8 reason = 0;
+ bool instantLogout = (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && !GetPlayer()->isInCombat()) ||
+ GetPlayer()->isInFlight() || HasPermission(RBAC_PERM_INSTANT_LOGOUT);
- if (GetPlayer()->isInCombat())
+ /// TODO: Possibly add RBAC permission to log out in combat
+ bool canLogoutInCombat = GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
+
+ uint32 reason = 0;
+ if (GetPlayer()->isInCombat() && !canLogoutInCombat)
reason = 1;
else if (GetPlayer()->m_movementInfo.HasMovementFlag(MOVEMENTFLAG_FALLING | MOVEMENTFLAG_FALLING_FAR))
reason = 3; // is jumping or falling
else if (GetPlayer()->duel || GetPlayer()->HasAura(9454)) // is dueling or frozen by GM via freeze command
reason = 2; // FIXME - Need the correct value
+ WorldPacket data(SMSG_LOGOUT_RESPONSE, 1+4);
+ data << uint32(reason);
+ data << uint8(instantLogout);
+ SendPacket(&data);
+
if (reason)
{
- WorldPacket data(SMSG_LOGOUT_RESPONSE, 1+4);
- data << uint8(reason);
- data << uint32(0);
- SendPacket(&data);
LogoutRequest(0);
return;
}
//instant logout in taverns/cities or on taxi or for admins, gm's, mod's if its enabled in worldserver.conf
- if (GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) || GetPlayer()->isInFlight() ||
- HasPermission(RBAC_PERM_INSTANT_LOGOUT))
+ if (instantLogout)
{
- WorldPacket data(SMSG_LOGOUT_RESPONSE, 1+4);
- data << uint8(0);
- data << uint32(16777216);
- SendPacket(&data);
LogoutPlayer(true);
return;
}
@@ -418,10 +419,6 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recvData*/)
GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
}
- WorldPacket data(SMSG_LOGOUT_RESPONSE, 1+4);
- data << uint8(0);
- data << uint32(0);
- SendPacket(&data);
LogoutRequest(time(NULL));
}
diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp
index 522dc95105d..610047dac2f 100644
--- a/src/server/game/Server/WorldSession.cpp
+++ b/src/server/game/Server/WorldSession.cpp
@@ -408,14 +408,14 @@ bool WorldSession::Update(uint32 diff, PacketFilter& updater)
}
/// %Log the player out
-void WorldSession::LogoutPlayer(bool Save)
+void WorldSession::LogoutPlayer(bool save)
{
// finish pending transfers before starting the logout
while (_player && _player->IsBeingTeleportedFar())
HandleMoveWorldportAckOpcode();
m_playerLogout = true;
- m_playerSave = Save;
+ m_playerSave = save;
if (_player)
{
@@ -430,39 +430,6 @@ void WorldSession::LogoutPlayer(bool Save)
_player->BuildPlayerRepop();
_player->RepopAtGraveyard();
}
- else if (!_player->getAttackers().empty())
- {
- // build set of player who attack _player or who have pet attacking of _player
- std::set<Player*> aset;
- for (Unit::AttackerSet::const_iterator itr = _player->getAttackers().begin(); itr != _player->getAttackers().end(); ++itr)
- {
- Unit* owner = (*itr)->GetOwner(); // including player controlled case
- if (owner && owner->GetTypeId() == TYPEID_PLAYER)
- aset.insert(owner->ToPlayer());
- else if ((*itr)->GetTypeId() == TYPEID_PLAYER)
- aset.insert((Player*)(*itr));
- }
-
- // CombatStop() method is removing all attackers from the AttackerSet
- // That is why it must be AFTER building current set of attackers
- _player->CombatStop();
- _player->getHostileRefManager().setOnlineOfflineState(false);
- _player->RemoveAllAurasOnDeath();
- _player->SetPvPDeath(!aset.empty());
- _player->KillPlayer();
- _player->BuildPlayerRepop();
- _player->RepopAtGraveyard();
-
- // give honor to all attackers from set like group case
- for (std::set<Player*>::const_iterator itr = aset.begin(); itr != aset.end(); ++itr)
- (*itr)->RewardHonor(_player, aset.size());
-
- // give bg rewards and update counters like kill by first from attackers
- // this can't be called for all attackers.
- if (!aset.empty())
- if (Battleground* bg = _player->GetBattleground())
- bg->HandleKillPlayer(_player, *aset.begin());
- }
else if (_player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
{
// this will kill character by SPELL_AURA_SPIRIT_OF_REDEMPTION
@@ -511,7 +478,7 @@ void WorldSession::LogoutPlayer(bool Save)
///- empty buyback items and save the player in the database
// some save parts only correctly work in case player present in map/player_lists (pets, etc)
- if (Save)
+ if (save)
{
uint32 eslot;
for (int j = BUYBACK_SLOT_START; j < BUYBACK_SLOT_END; ++j)
diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h
index c1d7f0b00db..42242e93742 100644
--- a/src/server/game/Server/WorldSession.h
+++ b/src/server/game/Server/WorldSession.h
@@ -253,7 +253,7 @@ class WorldSession
return (_logoutTime > 0 && currTime >= _logoutTime + 20);
}
- void LogoutPlayer(bool Save);
+ void LogoutPlayer(bool save);
void KickPlayer();
void QueuePacket(WorldPacket* new_packet);