mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[7404] Fixed cheating in rated arena matches by alt+f4.
Signed-off-by: Triply <triply@getmangos.com>
This commit is contained in:
parent
54f2dbefa0
commit
8a9942619b
7 changed files with 39 additions and 58 deletions
|
|
@ -163,7 +163,7 @@ void BattleGround::Update(uint32 diff)
|
||||||
m_RemovedPlayers.clear();
|
m_RemovedPlayers.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove offline players from bg after ~5 minutes
|
// remove offline players from bg after 5 minutes
|
||||||
if(GetPlayersSize())
|
if(GetPlayersSize())
|
||||||
{
|
{
|
||||||
for(std::map<uint64, BattleGroundPlayer>::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
for(std::map<uint64, BattleGroundPlayer>::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||||
|
|
@ -172,19 +172,18 @@ void BattleGround::Update(uint32 diff)
|
||||||
itr->second.LastOnlineTime += diff;
|
itr->second.LastOnlineTime += diff;
|
||||||
|
|
||||||
if(plr)
|
if(plr)
|
||||||
itr->second.LastOnlineTime = 0; // update last online time
|
itr->second.LastOnlineTime = 0; // update last online time
|
||||||
else
|
else
|
||||||
if(itr->second.LastOnlineTime >= MAX_OFFLINE_TIME) // 5 minutes
|
if(itr->second.LastOnlineTime >= MAX_OFFLINE_TIME)
|
||||||
m_RemovedPlayers[itr->first] = 1; // add to remove list (BG)
|
m_RemovedPlayers[itr->first] = 1; // add to remove list (BG)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: move this system to spell system and ressurect players correclt there!
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/*** BATTLEGROUND RESSURECTION SYSTEM ***/
|
/*** BATTLEGROUND RESSURECTION SYSTEM ***/
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
|
|
||||||
//this should be handled by spell system:
|
//this should be handled by spell system
|
||||||
m_LastResurrectTime += diff;
|
m_LastResurrectTime += diff;
|
||||||
if (m_LastResurrectTime >= RESURRECTION_INTERVAL)
|
if (m_LastResurrectTime >= RESURRECTION_INTERVAL)
|
||||||
{
|
{
|
||||||
|
|
@ -323,16 +322,13 @@ void BattleGround::Update(uint32 diff)
|
||||||
//remove preparation
|
//remove preparation
|
||||||
if( isArena() )
|
if( isArena() )
|
||||||
{
|
{
|
||||||
//TODO : add arena sound (PlaySoundToAll(SOUND_ARENA_START);
|
//TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START);
|
||||||
|
|
||||||
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||||
if(Player *plr = objmgr.GetPlayer(itr->first))
|
if(Player *plr = objmgr.GetPlayer(itr->first))
|
||||||
plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
|
plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
|
||||||
|
|
||||||
if(!GetPlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE))
|
CheckArenaWinConditions();
|
||||||
EndBattleGround(HORDE);
|
|
||||||
else if(GetPlayersCountByTeam(ALLIANCE) && !GetPlayersCountByTeam(HORDE))
|
|
||||||
EndBattleGround(ALLIANCE);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -342,7 +338,7 @@ void BattleGround::Update(uint32 diff)
|
||||||
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
for(BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||||
if(Player* plr = objmgr.GetPlayer(itr->first))
|
if(Player* plr = objmgr.GetPlayer(itr->first))
|
||||||
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
|
plr->RemoveAurasDueToSpell(SPELL_PREPARATION);
|
||||||
//Announce BG starting:
|
//Announce BG starting
|
||||||
if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE) )
|
if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE) )
|
||||||
{
|
{
|
||||||
sWorld.SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), GetMinLevel(), GetMaxLevel());
|
sWorld.SendWorldText(LANG_BG_STARTED_ANNOUNCE_WORLD, GetName(), GetMinLevel(), GetMaxLevel());
|
||||||
|
|
@ -1102,6 +1098,17 @@ void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This method should be called when player logs out from running battleground
|
||||||
|
void BattleGround::EventPlayerLoggedOut(Player* player)
|
||||||
|
{
|
||||||
|
if( GetStatus() == STATUS_IN_PROGRESS )
|
||||||
|
{
|
||||||
|
if( isBattleGround() )
|
||||||
|
EventPlayerDroppedFlag(player);
|
||||||
|
else
|
||||||
|
CheckArenaWinConditions();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* This method should be called only once ... it adds pointer to queue */
|
/* This method should be called only once ... it adds pointer to queue */
|
||||||
void BattleGround::AddToBGFreeSlotQueue()
|
void BattleGround::AddToBGFreeSlotQueue()
|
||||||
|
|
@ -1629,6 +1636,14 @@ uint32 BattleGround::GetAlivePlayersCountByTeam(uint32 Team) const
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BattleGround::CheckArenaWinConditions()
|
||||||
|
{
|
||||||
|
if( !GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE) )
|
||||||
|
EndBattleGround(HORDE);
|
||||||
|
else if( GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE) )
|
||||||
|
EndBattleGround(ALLIANCE);
|
||||||
|
}
|
||||||
|
|
||||||
void BattleGround::SetBgRaid( uint32 TeamID, Group *bg_raid )
|
void BattleGround::SetBgRaid( uint32 TeamID, Group *bg_raid )
|
||||||
{
|
{
|
||||||
Group* &old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE];
|
Group* &old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE];
|
||||||
|
|
|
||||||
|
|
@ -435,9 +435,10 @@ class BattleGround
|
||||||
|
|
||||||
// used for rated arena battles
|
// used for rated arena battles
|
||||||
void SetArenaTeamIdForTeam(uint32 Team, uint32 ArenaTeamId) { m_ArenaTeamIds[GetTeamIndexByTeamId(Team)] = ArenaTeamId; }
|
void SetArenaTeamIdForTeam(uint32 Team, uint32 ArenaTeamId) { m_ArenaTeamIds[GetTeamIndexByTeamId(Team)] = ArenaTeamId; }
|
||||||
uint32 GetArenaTeamIdForTeam(uint32 Team) const { return m_ArenaTeamIds[GetTeamIndexByTeamId(Team)]; }
|
uint32 GetArenaTeamIdForTeam(uint32 Team) const { return m_ArenaTeamIds[GetTeamIndexByTeamId(Team)]; }
|
||||||
void SetArenaTeamRatingChangeForTeam(uint32 Team, int32 RatingChange) { m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)] = RatingChange; }
|
void SetArenaTeamRatingChangeForTeam(uint32 Team, int32 RatingChange) { m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)] = RatingChange; }
|
||||||
int32 GetArenaTeamRatingChangeForTeam(uint32 Team) const { return m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)]; }
|
int32 GetArenaTeamRatingChangeForTeam(uint32 Team) const { return m_ArenaTeamRatingChanges[GetTeamIndexByTeamId(Team)]; }
|
||||||
|
void CheckArenaWinConditions();
|
||||||
|
|
||||||
/* Triggers handle */
|
/* Triggers handle */
|
||||||
// must be implemented in BG subclass
|
// must be implemented in BG subclass
|
||||||
|
|
@ -449,6 +450,7 @@ class BattleGround
|
||||||
virtual void EventPlayerDroppedFlag(Player* /*player*/) {}
|
virtual void EventPlayerDroppedFlag(Player* /*player*/) {}
|
||||||
virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*target_obj*/) {}
|
virtual void EventPlayerClickedOnFlag(Player* /*player*/, GameObject* /*target_obj*/) {}
|
||||||
virtual void EventPlayerCapturedFlag(Player* /*player*/) {}
|
virtual void EventPlayerCapturedFlag(Player* /*player*/) {}
|
||||||
|
void EventPlayerLoggedOut(Player* player);
|
||||||
|
|
||||||
/* Death related */
|
/* Death related */
|
||||||
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player);
|
||||||
|
|
|
||||||
|
|
@ -92,10 +92,7 @@ void BattleGroundBE::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||||
UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
|
UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||||
UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE));
|
UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE));
|
||||||
|
|
||||||
if(!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE))
|
CheckArenaWinConditions();
|
||||||
EndBattleGround(HORDE);
|
|
||||||
else if(GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE))
|
|
||||||
EndBattleGround(ALLIANCE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
|
void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
|
||||||
|
|
@ -114,16 +111,7 @@ void BattleGroundBE::HandleKillPlayer(Player *player, Player *killer)
|
||||||
UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
|
UpdateWorldState(0x9f1, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||||
UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE));
|
UpdateWorldState(0x9f0, GetAlivePlayersCountByTeam(HORDE));
|
||||||
|
|
||||||
if(!GetAlivePlayersCountByTeam(ALLIANCE))
|
CheckArenaWinConditions();
|
||||||
{
|
|
||||||
// all opponents killed
|
|
||||||
EndBattleGround(HORDE);
|
|
||||||
}
|
|
||||||
else if(!GetAlivePlayersCountByTeam(HORDE))
|
|
||||||
{
|
|
||||||
// all opponents killed
|
|
||||||
EndBattleGround(ALLIANCE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleGroundBE::HandlePlayerUnderMap(Player *player)
|
bool BattleGroundBE::HandlePlayerUnderMap(Player *player)
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,7 @@ void BattleGroundNA::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||||
UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
|
UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||||
UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE));
|
UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE));
|
||||||
|
|
||||||
if(!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE))
|
CheckArenaWinConditions();
|
||||||
EndBattleGround(HORDE);
|
|
||||||
else if(GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE))
|
|
||||||
EndBattleGround(ALLIANCE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
|
void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
|
||||||
|
|
@ -111,16 +108,7 @@ void BattleGroundNA::HandleKillPlayer(Player *player, Player *killer)
|
||||||
UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
|
UpdateWorldState(0xa0f, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||||
UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE));
|
UpdateWorldState(0xa10, GetAlivePlayersCountByTeam(HORDE));
|
||||||
|
|
||||||
if(!GetAlivePlayersCountByTeam(ALLIANCE))
|
CheckArenaWinConditions();
|
||||||
{
|
|
||||||
// all opponents killed
|
|
||||||
EndBattleGround(HORDE);
|
|
||||||
}
|
|
||||||
else if(!GetAlivePlayersCountByTeam(HORDE))
|
|
||||||
{
|
|
||||||
// all opponents killed
|
|
||||||
EndBattleGround(ALLIANCE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleGroundNA::HandlePlayerUnderMap(Player *player)
|
bool BattleGroundNA::HandlePlayerUnderMap(Player *player)
|
||||||
|
|
|
||||||
|
|
@ -89,10 +89,7 @@ void BattleGroundRL::RemovePlayer(Player* /*plr*/, uint64 /*guid*/)
|
||||||
UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE));
|
UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||||
UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE));
|
UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE));
|
||||||
|
|
||||||
if(!GetAlivePlayersCountByTeam(ALLIANCE) && GetPlayersCountByTeam(HORDE))
|
CheckArenaWinConditions();
|
||||||
EndBattleGround(HORDE);
|
|
||||||
else if(GetPlayersCountByTeam(ALLIANCE) && !GetAlivePlayersCountByTeam(HORDE))
|
|
||||||
EndBattleGround(ALLIANCE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
|
void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
|
||||||
|
|
@ -111,16 +108,7 @@ void BattleGroundRL::HandleKillPlayer(Player *player, Player *killer)
|
||||||
UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE));
|
UpdateWorldState(0xbb8, GetAlivePlayersCountByTeam(ALLIANCE));
|
||||||
UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE));
|
UpdateWorldState(0xbb9, GetAlivePlayersCountByTeam(HORDE));
|
||||||
|
|
||||||
if(!GetAlivePlayersCountByTeam(ALLIANCE))
|
CheckArenaWinConditions();
|
||||||
{
|
|
||||||
// all opponents killed
|
|
||||||
EndBattleGround(HORDE);
|
|
||||||
}
|
|
||||||
else if(!GetAlivePlayersCountByTeam(HORDE))
|
|
||||||
{
|
|
||||||
// all opponents killed
|
|
||||||
EndBattleGround(ALLIANCE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool BattleGroundRL::HandlePlayerUnderMap(Player *player)
|
bool BattleGroundRL::HandlePlayerUnderMap(Player *player)
|
||||||
|
|
|
||||||
|
|
@ -300,7 +300,7 @@ void WorldSession::LogoutPlayer(bool Save)
|
||||||
}
|
}
|
||||||
//drop a flag if player is carrying it
|
//drop a flag if player is carrying it
|
||||||
if(BattleGround *bg = _player->GetBattleGround())
|
if(BattleGround *bg = _player->GetBattleGround())
|
||||||
bg->EventPlayerDroppedFlag(_player);
|
bg->EventPlayerLoggedOut(_player);
|
||||||
|
|
||||||
///- Teleport to home if the player is in an invalid instance
|
///- Teleport to home if the player is in an invalid instance
|
||||||
if(!_player->m_InstanceValid && !_player->isGameMaster())
|
if(!_player->m_InstanceValid && !_player->isGameMaster())
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7403"
|
#define REVISION_NR "7404"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue