From a69fe0cb1da000145455a25ca53efec6804434fb Mon Sep 17 00:00:00 2001 From: XTZGZoReX Date: Sat, 14 Nov 2009 15:07:00 +0100 Subject: [PATCH 01/11] [8813] Re-implement some changes in [8799], but with mutex calls commented. --- src/game/BattleGround.cpp | 2 +- src/game/BattleGroundHandler.cpp | 289 +++++++++++++------------------ src/game/BattleGroundMgr.cpp | 80 ++++++--- src/game/BattleGroundMgr.h | 20 ++- src/shared/revision_nr.h | 2 +- 5 files changed, 187 insertions(+), 206 deletions(-) diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 9517b206a..fa41ad7ea 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -1084,7 +1084,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac { // a player has left the battleground, so there are free slots -> add to queue AddToBGFreeSlotQueue(); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, GetQueueId()); + sBattleGroundMgr.ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, GetQueueId()); } // Let others know diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 903a5de89..30d98ee3e 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -148,8 +148,9 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) // if we're here, then the conditions to join a bg are met. We can proceed in joining. // _player->GetGroup() was already checked, grp is already initialized - GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, 0, false, isPremade, 0); - uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); + BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; + GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, bgTypeId, 0, false, isPremade, 0); + uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); if (joinAsGroup /* && _player->GetGroup()*/) { sLog.outDebug("Battleground: the following players are joining as group:"); @@ -166,7 +167,7 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) member->GetSession()->SendPacket(&data); sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, bgTypeId); member->GetSession()->SendPacket(&data); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddPlayer(member, ginfo); + bgQueue.AddPlayer(member, ginfo); sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName()); } sLog.outDebug("Battleground: group end"); @@ -181,12 +182,11 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType); SendPacket(&data); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddPlayer(_player, ginfo); + bgQueue.AddPlayer(_player, ginfo); sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName()); } - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel()); - if (!ginfo->IsInvitedToBGInstanceGUID) - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true); + sBattleGroundMgr.ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel()); + //we should announce queue status here, if we want } void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv_data*/ ) @@ -303,7 +303,6 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) uint8 type; // arenatype if arena uint8 unk2; // unk, can be 0x0 (may be if was invited?) and 0x1 - uint32 instanceId; uint32 bgTypeId_; // type id from dbc uint16 unk; // 0x1F90 constant? uint8 action; // enter battle 0x1, leave queue 0x0 @@ -312,183 +311,131 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) if (!sBattlemasterListStore.LookupEntry(bgTypeId_)) { - sLog.outError("Battleground: invalid bgtype (%u) received.", bgTypeId_); - // update battleground slots for the player to fix his UI and sent data. - // this is a HACK, I don't know why the client starts sending invalid packets in the first place. - // it usually happens with extremely high latency (if debugging / stepping in the code for example) - if (_player->InBattleGroundQueue()) - { - // update all queues, send invitation info if player is invited, queue info if queued - for (uint32 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) - { - BattleGroundQueueTypeId bgQueueTypeId = _player->GetBattleGroundQueueTypeId(i); - if (!bgQueueTypeId) - continue; - BattleGroundTypeId bgTypeId = BattleGroundMgr::BGTemplateId(bgQueueTypeId); - BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers; - BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID()); - // if the player is not in queue, continue or no group information - this should never happen - if (itrPlayerStatus == qpMap.end() || !itrPlayerStatus->second.GroupInfo) - continue; - - BattleGround * bg = NULL; - // get possibly needed data from groupinfo - uint8 arenatype = itrPlayerStatus->second.GroupInfo->ArenaType; - uint8 status = 0; - - if (!itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID) - { - // not invited to bg, get template - bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); - status = STATUS_WAIT_QUEUE; - } - else - { - // get the bg we're invited to - bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId); - status = STATUS_WAIT_JOIN; - } - - // if bg not found, then continue, don't invite if already in the instance - if (!bg || (_player->InBattleGround() && _player->GetBattleGround() && _player->GetBattleGround()->GetInstanceID() == bg->GetInstanceID())) - continue; - - // re - invite player with proper data - WorldPacket data; - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, i, status, INVITE_ACCEPT_WAIT_TIME, 0, arenatype); - SendPacket(&data); - } - } + sLog.outError("BattlegroundHandler: invalid bgtype (%u) received.", bgTypeId_); + return; + } + if (!_player->InBattleGroundQueue()) + { + sLog.outError("BattlegroundHandler: Invalid CMSG_BATTLEFIELD_PORT received from player (%u), he is not in bg_queue.", _player->GetGUIDLow()); return; } //get GroupQueueInfo from BattleGroundQueue BattleGroundTypeId bgTypeId = BattleGroundTypeId(bgTypeId_); BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bgTypeId, type); - BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers; - BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID()); - if (itrPlayerStatus == qpMap.end()) + BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; + //we must use temporary variable, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function + GroupQueueInfo ginfo; + if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo)) { - sLog.outError("Battleground: itrplayerstatus not found."); + sLog.outError("BattlegroundHandler: itrplayerstatus not found."); return; } - - instanceId = itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID; // if action == 1, then instanceId is required - if (!instanceId && action == 1) + if (!ginfo.IsInvitedToBGInstanceGUID && action == 1) { - sLog.outError("Battleground: instance not found."); + sLog.outError("BattlegroundHandler: instance not found."); return; } - BattleGround *bg = sBattleGroundMgr.GetBattleGround(instanceId, bgTypeId); + BattleGround *bg = sBattleGroundMgr.GetBattleGround(ginfo.IsInvitedToBGInstanceGUID, bgTypeId); // bg template might and must be used in case of leaving queue, when instance is not created yet if (!bg && action == 0) bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); if (!bg) { - sLog.outError("Battleground: bg_template not found for type id %u.", bgTypeId); + sLog.outError("BattlegroundHandler: bg_template not found for type id %u.", bgTypeId); return; } - if (_player->InBattleGroundQueue()) + //some checks if player isn't cheating - it is not exactly cheating, but we cannot allow it + if (action == 1 && ginfo.ArenaType == 0) { - //we must use temporary variables, because GroupQueueInfo pointer can be deleted in BattleGroundQueue::RemovePlayer() function! - uint32 team = itrPlayerStatus->second.GroupInfo->Team; - uint32 arenaType = itrPlayerStatus->second.GroupInfo->ArenaType; - uint32 isRated = itrPlayerStatus->second.GroupInfo->IsRated; - uint32 rating = itrPlayerStatus->second.GroupInfo->ArenaTeamRating; - uint32 opponentsRating = itrPlayerStatus->second.GroupInfo->OpponentsTeamRating; - - //some checks if player isn't cheating - it is not exactly cheating, but we cannot allow it - if (action == 1 && arenaType == 0) + //if player is trying to enter battleground (not arena!) and he has deserter debuff, we must just remove him from queue + if (!_player->CanJoinToBattleground()) { - //if player is trying to enter battleground (not arena!) and he has deserter debuff, we must just remove him from queue - if (!_player->CanJoinToBattleground()) - { - //send bg command result to show nice message - WorldPacket data2(SMSG_GROUP_JOINED_BATTLEGROUND, 4); - data2 << uint32(0xFFFFFFFE); - _player->GetSession()->SendPacket(&data2); - action = 0; - sLog.outDebug("Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow()); - } - //if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue - if (_player->getLevel() > bg->GetMaxLevel()) - { - sLog.outError("Battleground: Player %s (%u) has level higher than maxlevel of battleground! Do not port him to battleground!", _player->GetName(), _player->GetGUIDLow()); - action = 0; - } + //send bg command result to show nice message + WorldPacket data2(SMSG_GROUP_JOINED_BATTLEGROUND, 4); + data2 << uint32(0xFFFFFFFE); + _player->GetSession()->SendPacket(&data2); + action = 0; + sLog.outDebug("Battleground: player %s (%u) has a deserter debuff, do not port him to battleground!", _player->GetName(), _player->GetGUIDLow()); } - uint32 queueSlot = _player->GetBattleGroundQueueIndex(bgQueueTypeId); - WorldPacket data; - switch( action ) + //if player don't match battleground max level, then do not allow him to enter! (this might happen when player leveled up during his waiting in queue + if (_player->getLevel() > bg->GetMaxLevel()) { - case 1: // port to battleground - if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId)) - return; // cheating? - - _player->SetBattleGroundEntryPoint(); - - // resurrect the player - if (!_player->isAlive()) - { - _player->ResurrectPlayer(1.0f); - _player->SpawnCorpseBones(); - } - // stop taxi flight at port - if (_player->isInFlight()) - { - _player->GetMotionMaster()->MovementExpired(); - _player->m_taxi.ClearTaxiDestinations(); - } - - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType()); - _player->GetSession()->SendPacket(&data); - // remove battleground queue status from BGmgr - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(_player->GetGUID(), false); - // this is still needed here if battleground "jumping" shouldn't add deserter debuff - // also this is required to prevent stuck at old battleground after SetBattleGroundId set to new - if (BattleGround *currentBg = _player->GetBattleGround()) - currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true); - - // set the destination instance id - _player->SetBattleGroundId(bg->GetInstanceID(), bgTypeId); - // set the destination team - _player->SetBGTeam(team); - // bg->HandleBeforeTeleportToBattleGround(_player); - sBattleGroundMgr.SendToBattleGround(_player, instanceId, bgTypeId); - // add only in HandleMoveWorldPortAck() - // bg->AddPlayer(_player,team); - sLog.outDebug("Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetInstanceID(), bg->GetTypeID(), bgQueueTypeId); - break; - case 0: // leave queue - // if player leaves rated arena match before match start, it is counted as he played but he lost - if (isRated) - { - ArenaTeam * at = sObjectMgr.GetArenaTeamById(team); - if (at) - { - sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), opponentsRating); - at->MemberLost(_player, opponentsRating); - at->SaveToDB(); - } - } - _player->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].RemovePlayer(_player->GetGUID(), true); - // player left queue, we should update it - do not update Arena Queue - if (!arenaType) - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(), arenaType, isRated, rating); - SendPacket(&data); - sLog.outDebug("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId); - break; - default: - sLog.outError("Battleground port: unknown action %u", action); - break; + sLog.outError("Battleground: Player %s (%u) has level higher than maxlevel of battleground! Do not port him to battleground!", _player->GetName(), _player->GetGUIDLow()); + action = 0; } } + uint32 queueSlot = _player->GetBattleGroundQueueIndex(bgQueueTypeId); + WorldPacket data; + switch( action ) + { + case 1: // port to battleground + if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId)) + return; // cheating? + + _player->SetBattleGroundEntryPoint(); + + // resurrect the player + if (!_player->isAlive()) + { + _player->ResurrectPlayer(1.0f); + _player->SpawnCorpseBones(); + } + // stop taxi flight at port + if (_player->isInFlight()) + { + _player->GetMotionMaster()->MovementExpired(); + _player->m_taxi.ClearTaxiDestinations(); + } + + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_IN_PROGRESS, 0, bg->GetStartTime(), bg->GetArenaType()); + _player->GetSession()->SendPacket(&data); + // remove battleground queue status from BGmgr + bgQueue.RemovePlayer(_player->GetGUID(), false); + // this is still needed here if battleground "jumping" shouldn't add deserter debuff + // also this is required to prevent stuck at old battleground after SetBattleGroundId set to new + if (BattleGround *currentBg = _player->GetBattleGround()) + currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true); + + // set the destination instance id + _player->SetBattleGroundId(bg->GetInstanceID(), bgTypeId); + // set the destination team + _player->SetBGTeam(ginfo.Team); + // bg->HandleBeforeTeleportToBattleGround(_player); + sBattleGroundMgr.SendToBattleGround(_player, ginfo.IsInvitedToBGInstanceGUID, bgTypeId); + // add only in HandleMoveWorldPortAck() + // bg->AddPlayer(_player,team); + sLog.outDebug("Battleground: player %s (%u) joined battle for bg %u, bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetInstanceID(), bg->GetTypeID(), bgQueueTypeId); + break; + case 0: // leave queue + // if player leaves rated arena match before match start, it is counted as he played but he lost + if (ginfo.IsRated) + { + ArenaTeam * at = sObjectMgr.GetArenaTeamById(ginfo.Team); + if (at) + { + sLog.outDebug("UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating); + at->MemberLost(_player, ginfo.OpponentsTeamRating); + at->SaveToDB(); + } + } + _player->RemoveBattleGroundQueueId(bgQueueTypeId); // must be called this way, because if you move this call to queue->removeplayer, it causes bugs + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0); + bgQueue.RemovePlayer(_player->GetGUID(), true); + // player left queue, we should update it - do not update Arena Queue + if (!ginfo.ArenaType) + sBattleGroundMgr.ScheduleQueueUpdate(ginfo.ArenaTeamRating, ginfo.ArenaType, bgQueueTypeId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel()); + SendPacket(&data); + sLog.outDebug("Battleground: player %s (%u) left queue for bgtype %u, queue type %u.", _player->GetName(), _player->GetGUIDLow(), bg->GetTypeID(), bgQueueTypeId); + break; + default: + sLog.outError("Battleground port: unknown action %u", action); + break; + } } void WorldSession::HandleLeaveBattlefieldOpcode( WorldPacket & /*recv_data*/ ) @@ -544,16 +491,16 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) } //we are sending update to player about queue - he can be invited there! //get GroupQueueInfo for queue status - BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers; - BattleGroundQueue::QueuedPlayersMap::iterator itrPlayerStatus = qpMap.find(_player->GetGUID()); - if (itrPlayerStatus == qpMap.end()) + BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; + GroupQueueInfo ginfo; + if (!bgQueue.GetPlayerGroupInfoData(_player->GetGUID(), &ginfo)) continue; - if (itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID) + if (ginfo.IsInvitedToBGInstanceGUID) { - bg = sBattleGroundMgr.GetBattleGround(itrPlayerStatus->second.GroupInfo->IsInvitedToBGInstanceGUID, bgTypeId); + bg = sBattleGroundMgr.GetBattleGround(ginfo.IsInvitedToBGInstanceGUID, bgTypeId); if (!bg) continue; - uint32 remainingTime = getMSTimeDiff(getMSTime(), itrPlayerStatus->second.GroupInfo->RemoveInviteTime); + uint32 remainingTime = getMSTimeDiff(getMSTime(), ginfo.RemoveInviteTime); // send status invited to BattleGround sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, i, STATUS_WAIT_JOIN, remainingTime, 0, arenaType); SendPacket(&data); @@ -563,9 +510,9 @@ void WorldSession::HandleBattlefieldStatusOpcode( WorldPacket & /*recv_data*/ ) bg = sBattleGroundMgr.GetBattleGroundTemplate(bgTypeId); if (!bg) continue; - uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(itrPlayerStatus->second.GroupInfo, _player->GetBattleGroundQueueIdFromLevel()); + uint32 avgTime = bgQueue.GetAverageQueueWaitTime(&ginfo, _player->GetBattleGroundQueueIdFromLevel()); // send status in BattleGround Queue - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, i, STATUS_WAIT_QUEUE, avgTime, getMSTimeDiff(itrPlayerStatus->second.GroupInfo->JoinTime, getMSTime()), arenaType); + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, i, STATUS_WAIT_QUEUE, avgTime, getMSTimeDiff(ginfo.JoinTime, getMSTime()), arenaType); SendPacket(&data); } } @@ -725,8 +672,9 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) arenaRating = avg_pers_rating; } - GroupQueueInfo * ginfo = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddGroup(_player, bgTypeId, arenatype, isRated, false, arenaRating, ateamId); - uint32 avgTime = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); + BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; + GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, bgTypeId, arenatype, isRated, false, arenaRating, ateamId); + uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); if (asGroup) { sLog.outDebug("Battleground: arena join as group start"); @@ -745,12 +693,11 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) member->GetSession()->SendPacket(&data); sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, bgTypeId); member->GetSession()->SendPacket(&data); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddPlayer(member, ginfo); + bgQueue.AddPlayer(member, ginfo); sLog.outDebug("Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName()); } sLog.outDebug("Battleground: arena join as group end"); - if (isRated) - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AnnounceWorld(ginfo, _player->GetGUID(), true); + //announce to world ... removed } else { @@ -760,10 +707,10 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) // send status packet (in queue) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype); SendPacket(&data); - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].AddPlayer(_player, ginfo); + bgQueue.AddPlayer(_player, ginfo); sLog.outDebug("Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName()); } - sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, _player->GetBattleGroundQueueIdFromLevel(), arenatype, isRated, arenaRating); + sBattleGroundMgr.ScheduleQueueUpdate(arenaRating, arenatype, bgQueueTypeId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel()); } void WorldSession::HandleReportPvPAFK( WorldPacket & recv_data ) diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 2f23cbd5e..e79d12978 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -177,6 +177,7 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId index++; sLog.outDebug("Adding Group to BattleGroundQueue bgTypeId : %u, queue_id : %u, index : %u", BgTypeId, queue_id, index); + //ACE_Guard guard(m_Lock); m_QueuedGroups[queue_id][index].push_back(ginfo); // return ginfo, because it is needed to add players to this group info @@ -186,6 +187,8 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId //add player to playermap void BattleGroundQueue::AddPlayer(Player *plr, GroupQueueInfo *ginfo) { + //ACE_Guard guard(m_Lock); + //if player isn't in queue, he is added, if already is, then values are overwritten, no memory leak PlayerQueueInfo& info = m_QueuedPlayers[plr->GetGUID()]; info.LastOnlineTime = getMSTime(); @@ -248,6 +251,7 @@ uint32 BattleGroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueue void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCount) { //Player *plr = sObjectMgr.GetPlayer(guid); + //ACE_Guard guard(m_Lock); int32 queue_id = -1; // signed for proper for-loop finish QueuedPlayersMap::iterator itr; @@ -364,6 +368,26 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou } } +//returns true when player pl_guid is in queue and is invited to bgInstanceGuid +bool BattleGroundQueue::IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime) +{ + //ACE_Guard g(m_Lock); + QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(pl_guid); + return ( qItr != m_QueuedPlayers.end() + && qItr->second.GroupInfo->IsInvitedToBGInstanceGUID == bgInstanceGuid + && qItr->second.GroupInfo->RemoveInviteTime == removeTime ); +} + +bool BattleGroundQueue::GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo) +{ + //ACE_Guard g(m_Lock); + QueuedPlayersMap::const_iterator qItr = m_QueuedPlayers.find(guid); + if (qItr == m_QueuedPlayers.end()) + return false; + *ginfo = *(qItr->second.GroupInfo); + return true; +} + //Announce world message void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playerGUID, bool isAddedToQueue) { @@ -461,7 +485,7 @@ bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * b plr->SetInviteForBattleGroundQueueType(bgQueueTypeId, ginfo->IsInvitedToBGInstanceGUID); // create remind invite events - BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->RemoveInviteTime); + BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime); plr->m_Events.AddEvent(inviteEvent, plr->m_Events.CalculateTime(INVITATION_REMIND_TIME)); // create automatic remove events BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime); @@ -732,6 +756,7 @@ should be called from BattleGround::RemovePlayer function in some cases */ void BattleGroundQueue::Update(BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id, uint8 arenaType, bool isRated, uint32 arenaRating) { + //ACE_Guard guard(m_Lock); //if no players in queue - do nothing if( m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && m_QueuedGroups[queue_id][BG_QUEUE_PREMADE_HORDE].empty() && @@ -1021,17 +1046,15 @@ bool BGQueueInviteEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) BattleGroundQueueTypeId bgQueueTypeId = BattleGroundMgr::BGQueueTypeId(bg->GetTypeID(), bg->GetArenaType()); uint32 queueSlot = plr->GetBattleGroundQueueIndex(bgQueueTypeId); - if( queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES ) // player is in queue or in battleground + if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue or in battleground { // check if player is invited to this bg - BattleGroundQueue::QueuedPlayersMap const& qpMap = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId].m_QueuedPlayers; - BattleGroundQueue::QueuedPlayersMap::const_iterator qItr = qpMap.find(m_PlayerGuid); - if( qItr != qpMap.end() && qItr->second.GroupInfo->IsInvitedToBGInstanceGUID == m_BgInstanceGUID - && qItr->second.GroupInfo->RemoveInviteTime == m_RemoveTime ) + BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; + if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime)) { WorldPacket data; //we must send remaining time in queue - sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, qItr->second.GroupInfo->ArenaType); + sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME - INVITATION_REMIND_TIME, 0, m_ArenaType); plr->GetSession()->SendPacket(&data); } } @@ -1064,22 +1087,19 @@ bool BGQueueRemoveEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) //bg pointer can be NULL! so use it carefully! uint32 queueSlot = plr->GetBattleGroundQueueIndex(m_BgQueueTypeId); - if( queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES ) // player is in queue, or in Battleground + if (queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES) // player is in queue, or in Battleground { // check if player is in queue for this BG and if we are removing his invite event - BattleGroundQueue::QueuedPlayersMap& qpMap = sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId].m_QueuedPlayers; - BattleGroundQueue::QueuedPlayersMap::iterator qMapItr = qpMap.find(m_PlayerGuid); - if( qMapItr != qpMap.end() && qMapItr->second.GroupInfo - && qMapItr->second.GroupInfo->IsInvitedToBGInstanceGUID == m_BgInstanceGUID - && qMapItr->second.GroupInfo->RemoveInviteTime == m_RemoveTime ) + BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId]; + if (bgQueue.IsPlayerInvited(m_PlayerGuid, m_BgInstanceGUID, m_RemoveTime)) { sLog.outDebug("Battleground: removing player %u from bg queue for instance %u because of not pressing enter battle in time.",plr->GetGUIDLow(),m_BgInstanceGUID); plr->RemoveBattleGroundQueueId(m_BgQueueTypeId); - sBattleGroundMgr.m_BattleGroundQueues[m_BgQueueTypeId].RemovePlayer(m_PlayerGuid, true); + bgQueue.RemovePlayer(m_PlayerGuid, true); //update queues if battleground isn't ended - if (bg) - sBattleGroundMgr.ScheduleQueueUpdate(m_BgQueueTypeId, m_BgTypeId, bg->GetQueueId()); + if (bg && bg->isBattleGround() && bg->GetStatus() != STATUS_WAIT_LEAVE) + sBattleGroundMgr.ScheduleQueueUpdate(0, 0, m_BgQueueTypeId, m_BgTypeId, bg->GetQueueId()); WorldPacket data; sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0); @@ -1167,18 +1187,24 @@ void BattleGroundMgr::Update(uint32 diff) // update scheduled queues if (!m_QueueUpdateScheduler.empty()) { - //copy vector and clear the other - // TODO add lock - // TODO maybe std::list would be better and then unlock after end of cycle - std::vector scheduled(m_QueueUpdateScheduler); - m_QueueUpdateScheduler.clear(); - // TODO drop lock + std::vector scheduled; + { + //create mutex + //ACE_Guard guard(SchedulerLock); + //copy vector and clear the other + scheduled = std::vector(m_QueueUpdateScheduler); + m_QueueUpdateScheduler.clear(); + //release lock + } + for (uint8 i = 0; i < scheduled.size(); i++) { - BattleGroundQueueTypeId bgQueueTypeId = BattleGroundQueueTypeId(scheduled[i] >> 16); + uint32 arenaRating = scheduled[i] >> 32; + uint8 arenaType = scheduled[i] >> 24 & 255; + BattleGroundQueueTypeId bgQueueTypeId = BattleGroundQueueTypeId(scheduled[i] >> 16 & 255); BattleGroundTypeId bgTypeId = BattleGroundTypeId((scheduled[i] >> 8) & 255); BGQueueIdBasedOnLevel queue_id = BGQueueIdBasedOnLevel(scheduled[i] & 255); - m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, queue_id); + m_BattleGroundQueues[bgQueueTypeId].Update(bgTypeId, queue_id, arenaType, arenaRating > 0, arenaRating); } } @@ -2008,11 +2034,11 @@ void BattleGroundMgr::ToggleArenaTesting() sWorld.SendWorldText(LANG_DEBUG_ARENA_OFF); } -void BattleGroundMgr::ScheduleQueueUpdate(BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id) +void BattleGroundMgr::ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id) { - //This method must be atomic, TODO add mutex + //ACE_Guard guard(SchedulerLock); //we will use only 1 number created of bgTypeId and queue_id - uint32 schedule_id = (bgQueueTypeId << 16) | (bgTypeId << 8) | queue_id; + uint64 schedule_id = ((uint64)arenaRating << 32) | (arenaType << 24) | (bgQueueTypeId << 16) | (bgTypeId << 8) | queue_id; bool found = false; for (uint8 i = 0; i < m_QueueUpdateScheduler.size(); i++) { diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 4d72d9656..36f097cdb 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -23,6 +23,7 @@ #include "Policies/Singleton.h" #include "Utilities/EventProcessor.h" #include "BattleGround.h" +#include "ace/Recursive_Thread_Mutex.h" typedef std::map BattleGroundSet; @@ -83,12 +84,19 @@ class BattleGroundQueue GroupQueueInfo * AddGroup(Player * leader, BattleGroundTypeId bgTypeId, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0); void AddPlayer(Player *plr, GroupQueueInfo *ginfo); void RemovePlayer(const uint64& guid, bool decreaseInvitedCount); + bool IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime); + bool GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo); void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id); uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id); void DecreaseGroupLength(uint32 queueId, uint32 AsGroup); void AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playerGUID, bool isAddedToQueue); + private: + //mutex that should not allow changing private data, nor allowing to update Queue during private data change. + ACE_Recursive_Thread_Mutex m_Lock; + + typedef std::map QueuedPlayersMap; QueuedPlayersMap m_QueuedPlayers; @@ -123,8 +131,6 @@ class BattleGroundQueue //one selection pool for horde, other one for alliance SelectionPool m_SelectionPools[BG_TEAMS_COUNT]; - private: - bool InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side); uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_QUEUES][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME]; uint32 m_WaitTimeLastPlayer[BG_TEAMS_COUNT][MAX_BATTLEGROUND_QUEUES]; @@ -138,8 +144,8 @@ class BattleGroundQueue class BGQueueInviteEvent : public BasicEvent { public: - BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, uint32 removeTime) : - m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_RemoveTime(removeTime) + BGQueueInviteEvent(const uint64& pl_guid, uint32 BgInstanceGUID, BattleGroundTypeId BgTypeId, uint8 arenaType, uint32 removeTime) : + m_PlayerGuid(pl_guid), m_BgInstanceGUID(BgInstanceGUID), m_BgTypeId(BgTypeId), m_ArenaType(arenaType), m_RemoveTime(removeTime) { }; virtual ~BGQueueInviteEvent() {}; @@ -150,6 +156,7 @@ class BGQueueInviteEvent : public BasicEvent uint64 m_PlayerGuid; uint32 m_BgInstanceGUID; BattleGroundTypeId m_BgTypeId; + uint8 m_ArenaType; uint32 m_RemoveTime; }; @@ -219,7 +226,7 @@ class BattleGroundMgr BGFreeSlotQueueType BGFreeSlotQueue[MAX_BATTLEGROUND_TYPE_ID]; - void ScheduleQueueUpdate(BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id); + void ScheduleQueueUpdate(uint32 arenaRating, uint8 arenaType, BattleGroundQueueTypeId bgQueueTypeId, BattleGroundTypeId bgTypeId, BGQueueIdBasedOnLevel queue_id); uint32 GetMaxRatingDifference() const; uint32 GetRatingDiscardTimer() const; uint32 GetPrematureFinishTime() const; @@ -265,13 +272,14 @@ class BattleGroundMgr static bool IsBGWeekend(BattleGroundTypeId bgTypeId); private: + ACE_Thread_Mutex SchedulerLock; BattleMastersMap mBattleMastersMap; CreatureBattleEventIndexesMap m_CreatureBattleEventIndexMap; GameObjectBattleEventIndexesMap m_GameObjectBattleEventIndexMap; /* Battlegrounds */ BattleGroundSet m_BattleGrounds[MAX_BATTLEGROUND_TYPE_ID]; - std::vectorm_QueueUpdateScheduler; + std::vector m_QueueUpdateScheduler; std::set m_ClientBattleGroundIds[MAX_BATTLEGROUND_TYPE_ID][MAX_BATTLEGROUND_QUEUES]; //the instanceids just visible for the client uint32 m_NextRatingDiscardUpdate; time_t m_NextAutoDistributionTime; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 1aac25873..dccf7867c 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8812" + #define REVISION_NR "8813" #endif // __REVISION_NR_H__ From d5ee54436737831a5e8533b205b354c31756c714 Mon Sep 17 00:00:00 2001 From: crackm Date: Sat, 14 Nov 2009 15:42:35 +0100 Subject: [PATCH 02/11] [8814] removed some spells which made creatures invisible for dead --- src/game/SpellAuras.cpp | 3 --- src/shared/revision_nr.h | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 7f83e7e26..4975fe1fb 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -2476,11 +2476,8 @@ void Aura::HandleAuraDummy(bool apply, bool Real) m_target->PlayDirectSound(14972, (Player *)m_target); } return; - case 10848: - case 36978: case 40131: case 27978: - case 33900: if (apply) m_target->m_AuraFlags |= UNIT_AURAFLAG_ALIVE_INVISIBLE; else diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index dccf7867c..4c61818e7 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8813" + #define REVISION_NR "8814" #endif // __REVISION_NR_H__ From ef2690894870638e4cf85b85bddde30fb56e2473 Mon Sep 17 00:00:00 2001 From: Triply Date: Sat, 14 Nov 2009 18:34:27 +0100 Subject: [PATCH 03/11] [8815] Reimplemented bgQueues announces, fixed possible problems with multithreaded queues Mutexes have to be still commented because of ACE bug. When player enters new bg from battleground, do not rewrite his m_BgData with zeros. patch is tested. Signed-off-by: Triply --- sql/mangos.sql | 2 +- sql/updates/8815_01_mangos_mangos_string.sql | 8 + sql/updates/Makefile.am | 2 + src/game/BattleGroundHandler.cpp | 22 +-- src/game/BattleGroundMgr.cpp | 157 +++++++++---------- src/game/BattleGroundMgr.h | 6 +- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 8 files changed, 101 insertions(+), 100 deletions(-) create mode 100644 sql/updates/8815_01_mangos_mangos_string.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index a0990506b..39b07460b 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_8803_02_mangos_playercreateinfo_action` bit(1) default NULL + `required_8815_01_mangos_mangos_string` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- diff --git a/sql/updates/8815_01_mangos_mangos_string.sql b/sql/updates/8815_01_mangos_mangos_string.sql new file mode 100644 index 000000000..fef443571 --- /dev/null +++ b/sql/updates/8815_01_mangos_mangos_string.sql @@ -0,0 +1,8 @@ +ALTER TABLE db_version CHANGE COLUMN required_8803_02_mangos_playercreateinfo_action required_8815_01_mangos_mangos_string bit; + +-- this sql might delete some of your translated strings, if you translate them + +DELETE FROM mangos_string WHERE entry in (718, 719); + +INSERT INTO mangos_string VALUES (718,'|cffff0000[Arena Queue Announcer]:|r All Arenas -- Joined : %ux%u : %u|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +INSERT INTO mangos_string VALUES (719,'|cffff0000[Arena Queue Announcer]:|r All Arenas -- Left : %ux%u : %u|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index a7fce4537..10cb5112f 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -156,6 +156,7 @@ pkgdata_DATA = \ 8800_01_mangos_spell_elixir.sql \ 8803_01_mangos_playercreateinfo_spell.sql \ 8803_02_mangos_playercreateinfo_action.sql \ + 8815_01_mangos_mangos_string.sql \ README ## Additional files to include when running 'make dist' @@ -292,4 +293,5 @@ EXTRA_DIST = \ 8800_01_mangos_spell_elixir.sql \ 8803_01_mangos_playercreateinfo_spell.sql \ 8803_02_mangos_playercreateinfo_action.sql \ + 8815_01_mangos_mangos_string.sql \ README diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp index 30d98ee3e..f6d322989 100644 --- a/src/game/BattleGroundHandler.cpp +++ b/src/game/BattleGroundHandler.cpp @@ -149,11 +149,11 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) // _player->GetGroup() was already checked, grp is already initialized BattleGroundQueue& bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; - GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, bgTypeId, 0, false, isPremade, 0); - uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); if (joinAsGroup /* && _player->GetGroup()*/) { sLog.outDebug("Battleground: the following players are joining as group:"); + GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, 0, false, isPremade, 0); + uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { Player *member = itr->getSource(); @@ -167,13 +167,14 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) member->GetSession()->SendPacket(&data); sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, bgTypeId); member->GetSession()->SendPacket(&data); - bgQueue.AddPlayer(member, ginfo); sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName()); } sLog.outDebug("Battleground: group end"); } else { + GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, 0, false, isPremade, 0); + uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); // already checked if queueSlot is valid, now just get it uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId); @@ -181,12 +182,9 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data ) // send status packet (in queue) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType); SendPacket(&data); - - bgQueue.AddPlayer(_player, ginfo); sLog.outDebug("Battleground: player joined queue for bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName()); } sBattleGroundMgr.ScheduleQueueUpdate(0, 0, bgQueueTypeId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel()); - //we should announce queue status here, if we want } void WorldSession::HandleBattleGroundPlayerPositionsOpcode( WorldPacket & /*recv_data*/ ) @@ -377,7 +375,8 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data ) if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId)) return; // cheating? - _player->SetBattleGroundEntryPoint(); + if (!_player->InBattleGround()) + _player->SetBattleGroundEntryPoint(); // resurrect the player if (!_player->isAlive()) @@ -673,13 +672,14 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) } BattleGroundQueue &bgQueue = sBattleGroundMgr.m_BattleGroundQueues[bgQueueTypeId]; - GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, bgTypeId, arenatype, isRated, false, arenaRating, ateamId); - uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); if (asGroup) { sLog.outDebug("Battleground: arena join as group start"); if (isRated) sLog.outDebug("Battleground: arena team id %u, leader %s queued with rating %u for type %u",_player->GetArenaTeamId(arenaslot),_player->GetName(),arenaRating,arenatype); + + GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, arenatype, isRated, false, arenaRating, ateamId); + uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { Player *member = itr->getSource(); @@ -693,7 +693,6 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) member->GetSession()->SendPacket(&data); sBattleGroundMgr.BuildGroupJoinedBattlegroundPacket(&data, bgTypeId); member->GetSession()->SendPacket(&data); - bgQueue.AddPlayer(member, ginfo); sLog.outDebug("Battleground: player joined queue for arena as group bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,member->GetGUIDLow(), member->GetName()); } sLog.outDebug("Battleground: arena join as group end"); @@ -701,13 +700,14 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data ) } else { + GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, arenatype, isRated, false, arenaRating, ateamId); + uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, _player->GetBattleGroundQueueIdFromLevel()); uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId); WorldPacket data; // send status packet (in queue) sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype); SendPacket(&data); - bgQueue.AddPlayer(_player, ginfo); sLog.outDebug("Battleground: player joined queue for arena, skirmish, bg queue type %u bg type %u: GUID %u, NAME %s",bgQueueTypeId,bgTypeId,_player->GetGUIDLow(), _player->GetName()); } sBattleGroundMgr.ScheduleQueueUpdate(arenaRating, arenatype, bgQueueTypeId, bgTypeId, _player->GetBattleGroundQueueIdFromLevel()); diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index e79d12978..44014c448 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -147,14 +147,12 @@ bool BattleGroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 de /*** BATTLEGROUND QUEUES ***/ /*********************************************************/ -// add group to bg queue with the given leader and bg specifications -GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId BgTypeId, uint8 ArenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 arenateamid) +// add group or player (grp == NULL) to bg queue with the given leader and bg specifications +GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, Group* grp, BattleGroundTypeId BgTypeId, uint8 ArenaType, bool isRated, bool isPremade, uint32 arenaRating, uint32 arenateamid) { BGQueueIdBasedOnLevel queue_id = leader->GetBattleGroundQueueIdFromLevel(); // create new ginfo - // cannot use the method like in addplayer, because that could modify an in-queue group's stats - // (e.g. leader leaving queue then joining as individual again) GroupQueueInfo* ginfo = new GroupQueueInfo; ginfo->BgTypeId = BgTypeId; ginfo->ArenaType = ArenaType; @@ -177,27 +175,81 @@ GroupQueueInfo * BattleGroundQueue::AddGroup(Player *leader, BattleGroundTypeId index++; sLog.outDebug("Adding Group to BattleGroundQueue bgTypeId : %u, queue_id : %u, index : %u", BgTypeId, queue_id, index); - //ACE_Guard guard(m_Lock); - m_QueuedGroups[queue_id][index].push_back(ginfo); + uint32 lastOnlineTime = getMSTime(); + + //announce world (this don't need mutex) + if (isRated && sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)) + { + sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating); + } + + //add players from group to ginfo + { + //ACE_Guard guard(m_Lock); + if (grp) + { + for(GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + { + Player *member = itr->getSource(); + if(!member) + continue; // this should never happen + PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetGUID()]; + pl_info.LastOnlineTime = lastOnlineTime; + pl_info.GroupInfo = ginfo; + // add the pinfo to ginfo's list + ginfo->Players[member->GetGUID()] = &pl_info; + } + } + else + { + PlayerQueueInfo& pl_info = m_QueuedPlayers[leader->GetGUID()]; + pl_info.LastOnlineTime = lastOnlineTime; + pl_info.GroupInfo = ginfo; + ginfo->Players[leader->GetGUID()] = &pl_info; + } + + //add GroupInfo to m_QueuedGroups + m_QueuedGroups[queue_id][index].push_back(ginfo); + + //announce to world, this code needs mutex + if (!isRated && !isPremade && sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE)) + { + BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId); + if (bg) + { + char const* bgName = bg->GetName(); + uint32 MinPlayers = bg->GetMinPlayersPerTeam(); + uint32 qHorde = 0; + uint32 qAlliance = 0; + uint32 q_min_level = (queue_id + 1) * 10; + GroupsQueueType::const_iterator itr; + for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr) + if (!(*itr)->IsInvitedToBGInstanceGUID) + qAlliance += (*itr)->Players.size(); + for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].end(); ++itr) + if (!(*itr)->IsInvitedToBGInstanceGUID) + qHorde += (*itr)->Players.size(); + + // Show queue status to player only (when joining queue) + if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY)) + { + ChatHandler(leader).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, bgName, q_min_level, q_min_level + 10, + qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0); + } + // System message + else + { + sWorld.SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, bgName, q_min_level, q_min_level + 10, + qAlliance, (MinPlayers > qAlliance) ? MinPlayers - qAlliance : (uint32)0, qHorde, (MinPlayers > qHorde) ? MinPlayers - qHorde : (uint32)0); + } + } + } + //release mutex + } - // return ginfo, because it is needed to add players to this group info return ginfo; } -//add player to playermap -void BattleGroundQueue::AddPlayer(Player *plr, GroupQueueInfo *ginfo) -{ - //ACE_Guard guard(m_Lock); - - //if player isn't in queue, he is added, if already is, then values are overwritten, no memory leak - PlayerQueueInfo& info = m_QueuedPlayers[plr->GetGUID()]; - info.LastOnlineTime = getMSTime(); - info.GroupInfo = ginfo; - - // add the pinfo to ginfo's list - ginfo->Players[plr->GetGUID()] = &info; -} - void BattleGroundQueue::PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id) { uint32 timeInQueue = getMSTimeDiff(ginfo->JoinTime, getMSTime()); @@ -319,9 +371,9 @@ void BattleGroundQueue::RemovePlayer(const uint64& guid, bool decreaseInvitedCou // remove player queue info m_QueuedPlayers.erase(itr); - //if we left BG queue(not porting) OR if arena team left queue for rated match - if ((decreaseInvitedCount && !group->ArenaType) || (group->ArenaType && group->IsRated && group->Players.empty())) - AnnounceWorld(group, guid, false); + // announce to world if arena team left queue for rated match, show only once + if (group->ArenaType && group->IsRated && group->Players.empty() && sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)) + sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, group->ArenaType, group->ArenaType, group->ArenaTeamRating); //if player leaves queue and he is invited to rated arena match, then he have to loose if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount) @@ -388,63 +440,6 @@ bool BattleGroundQueue::GetPlayerGroupInfoData(const uint64& guid, GroupQueueInf return true; } -//Announce world message -void BattleGroundQueue::AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playerGUID, bool isAddedToQueue) -{ - if(ginfo->ArenaType) //if Arena - { - if (sWorld.getConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE) && ginfo->IsRated) - { - BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId); - if (!bg) - return; - - char const* bgName = bg->GetName(); - if (isAddedToQueue) - sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, bgName, ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating); - else - sWorld.SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, bgName, ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating); - } - } - else //if BG - { - if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE)) - { - Player *plr = sObjectMgr.GetPlayer(playerGUID); - BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(ginfo->BgTypeId); - if (!bg || !plr) - return; - - BGQueueIdBasedOnLevel queue_id = plr->GetBattleGroundQueueIdFromLevel(); - char const* bgName = bg->GetName(); - uint32 MinPlayers = bg->GetMinPlayersPerTeam(); - uint32 qHorde = 0; - uint32 qAlliance = 0; - uint32 q_min_level = (queue_id + 1) * 10; - GroupsQueueType::const_iterator itr; - for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_ALLIANCE].end(); ++itr) - if (!(*itr)->IsInvitedToBGInstanceGUID) - qAlliance += (*itr)->Players.size(); - for(itr = m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].begin(); itr != m_QueuedGroups[queue_id][BG_QUEUE_NORMAL_HORDE].end(); ++itr) - if (!(*itr)->IsInvitedToBGInstanceGUID) - qHorde += (*itr)->Players.size(); - - // Show queue status to player only (when joining queue) - if (sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY)) - { - ChatHandler(plr).PSendSysMessage(LANG_BG_QUEUE_ANNOUNCE_SELF, - bgName, q_min_level, q_min_level + 10, qAlliance, MinPlayers, qHorde, MinPlayers); - } - // System message - else - { - sWorld.SendWorldText(LANG_BG_QUEUE_ANNOUNCE_WORLD, - bgName, q_min_level, q_min_level + 10, qAlliance, MinPlayers, qHorde, MinPlayers); - } - } - } -} - bool BattleGroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, BattleGround * bg, uint32 side) { // set side if needed diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index 36f097cdb..7b646c6f8 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -81,17 +81,13 @@ class BattleGroundQueue bool CheckPremadeMatch(BGQueueIdBasedOnLevel queue_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam); bool CheckNormalMatch(BattleGround* bg_template, BGQueueIdBasedOnLevel queue_id, uint32 minPlayers, uint32 maxPlayers); bool CheckSkirmishForSameFaction(BGQueueIdBasedOnLevel queue_id, uint32 minPlayersPerTeam); - GroupQueueInfo * AddGroup(Player * leader, BattleGroundTypeId bgTypeId, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0); - void AddPlayer(Player *plr, GroupQueueInfo *ginfo); + GroupQueueInfo * AddGroup(Player* leader, Group* group, BattleGroundTypeId bgTypeId, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 ArenaTeamId = 0); void RemovePlayer(const uint64& guid, bool decreaseInvitedCount); bool IsPlayerInvited(const uint64& pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime); bool GetPlayerGroupInfoData(const uint64& guid, GroupQueueInfo* ginfo); void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id); uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo, BGQueueIdBasedOnLevel queue_id); - void DecreaseGroupLength(uint32 queueId, uint32 AsGroup); - void AnnounceWorld(GroupQueueInfo *ginfo, const uint64& playerGUID, bool isAddedToQueue); - private: //mutex that should not allow changing private data, nor allowing to update Queue during private data change. ACE_Recursive_Thread_Mutex m_Lock; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 4c61818e7..f075979b6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8814" + #define REVISION_NR "8815" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index 68bbe6d0a..f0e0bce64 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_8721_01_characters_guild" - #define REVISION_DB_MANGOS "required_8803_02_mangos_playercreateinfo_action" + #define REVISION_DB_MANGOS "required_8815_01_mangos_mangos_string" #define REVISION_DB_REALMD "required_8728_01_realmd_account" #endif // __REVISION_SQL_H__ From c3c7ab2f63abfce9cd4467208168d512c289ad87 Mon Sep 17 00:00:00 2001 From: balrok Date: Fri, 13 Nov 2009 08:07:58 -0500 Subject: [PATCH 04/11] [8816] call uncharm for all units at delete currently it was only done for players - but units also can have charms which must be removed --- src/game/Player.cpp | 11 ----------- src/game/Player.h | 1 - src/game/SpellAuras.cpp | 6 ++++++ src/game/Unit.cpp | 12 +++++++++++- src/game/Unit.h | 1 + src/shared/revision_nr.h | 2 +- 6 files changed, 19 insertions(+), 14 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 128d01c1f..efa68798c 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1879,7 +1879,6 @@ void Player::RemoveFromWorld() if(IsInWorld()) { ///- Release charmed creatures, unsummon totems and remove pets/guardians - Uncharm(); UnsummonAllTotems(); RemoveMiniPet(); } @@ -16446,16 +16445,6 @@ Pet* Player::GetMiniPet() return GetMap()->GetPet(m_miniPet); } -void Player::Uncharm() -{ - Unit* charm = GetCharm(); - if(!charm) - return; - - charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM); - charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS); -} - void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const { *data << (uint8)msgtype; diff --git a/src/game/Player.h b/src/game/Player.h index 79014e91d..c3b64691d 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1123,7 +1123,6 @@ class MANGOS_DLL_SPEC Player : public Unit void RemoveMiniPet(); Pet* GetMiniPet(); void SetMiniPet(Pet* pet) { m_miniPet = pet->GetGUID(); } - void Uncharm(); uint32 GetPhaseMaskForSpawn() const; // used for proper set phase for DB at GM-mode creature/GO spawn void Say(const std::string& text, const uint32 language); diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 4975fe1fb..a1cb8d774 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -3487,6 +3487,12 @@ void Aura::HandleModCharm(bool apply, bool Real) if( apply ) { + if (m_target->GetCharmerGUID()) + { + m_target->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM); + m_target->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS); + } + m_target->SetCharmerGUID(GetCasterGUID()); m_target->setFaction(caster->getFaction()); m_target->CastStop(m_target == caster ? GetId() : 0); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 166cbaa73..6ccb6f0ad 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -7977,7 +7977,7 @@ Pet* Unit::GetPet() const Unit* Unit::GetCharm() const { - if(uint64 charm_guid = GetCharmGUID()) + if (uint64 charm_guid = GetCharmGUID()) { if(Unit* pet = ObjectAccessor::GetUnit(*this, charm_guid)) return pet; @@ -7989,6 +7989,15 @@ Unit* Unit::GetCharm() const return NULL; } +void Unit::Uncharm() +{ + if (Unit* charm = GetCharm()) + { + charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_CHARM); + charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS); + } +} + float Unit::GetCombatDistance( const Unit* target ) const { float radius = target->GetFloatValue(UNIT_FIELD_COMBATREACH) + GetFloatValue(UNIT_FIELD_COMBATREACH); @@ -11090,6 +11099,7 @@ void Unit::RemoveFromWorld() // cleanup if(IsInWorld()) { + Uncharm(); RemoveNotOwnSingleTargetAuras(); RemoveGuardians(); } diff --git a/src/game/Unit.h b/src/game/Unit.h index 619df4a83..cfba59cd7 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1194,6 +1194,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject Pet* GetPet() const; Unit* GetCharmer() const; Unit* GetCharm() const; + void Uncharm(); Unit* GetCharmerOrOwner() const { return GetCharmerGUID() ? GetCharmer() : GetOwner(); } Unit* GetCharmerOrOwnerOrSelf() { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f075979b6..a726dbc06 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8815" + #define REVISION_NR "8816" #endif // __REVISION_NR_H__ From f1421a4ece6a4b3a7d774c1582241482266a1d94 Mon Sep 17 00:00:00 2001 From: balrok Date: Sat, 14 Nov 2009 04:32:21 -0500 Subject: [PATCH 05/11] [8817] remove corpses from world at halting server this fixes the crash after .server shutdown --- src/game/ObjectAccessor.cpp | 3 +++ src/shared/revision_nr.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 0599afb62..1bb11b4a1 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -47,7 +47,10 @@ ObjectAccessor::ObjectAccessor() {} ObjectAccessor::~ObjectAccessor() { for(Player2CorpsesMapType::const_iterator itr = i_player2corpse.begin(); itr != i_player2corpse.end(); ++itr) + { + itr->second->RemoveFromWorld(); delete itr->second; + } } Unit* diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index a726dbc06..f8c7f0cc0 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8816" + #define REVISION_NR "8817" #endif // __REVISION_NR_H__ From 537562f29f99a166e49d1f993cee03d00af62ed1 Mon Sep 17 00:00:00 2001 From: Triply Date: Sun, 15 Nov 2009 09:05:50 +0100 Subject: [PATCH 06/11] [8818] Language.h cleanup, TODO cleanup WS and EY messages. Removed 2 minutes starting message from battlegrounds. Signed-off-by: Triply --- sql/mangos.sql | 18 ++++------- sql/updates/8818_01_mangos_mangos_string.sql | 8 +++++ sql/updates/Makefile.am | 2 ++ src/game/BattleGround.cpp | 7 ++-- src/game/BattleGroundAB.cpp | 14 ++++---- src/game/BattleGroundABG.cpp | 2 +- src/game/BattleGroundAV.cpp | 16 ++++----- src/game/BattleGroundEY.cpp | 12 +------ src/game/BattleGroundIC.cpp | 2 +- src/game/BattleGroundSA.cpp | 2 +- src/game/BattleGroundWS.cpp | 2 +- src/game/Language.h | 34 +++++++++++--------- src/shared/revision_nr.h | 2 +- src/shared/revision_sql.h | 2 +- 14 files changed, 60 insertions(+), 63 deletions(-) create mode 100644 sql/updates/8818_01_mangos_mangos_string.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index 39b07460b..d8c98dae7 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_8815_01_mangos_mangos_string` bit(1) default NULL + `required_8818_01_mangos_mangos_string` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -3338,12 +3338,10 @@ INSERT INTO `mangos_string` VALUES (711,'Queue status for %s (Lvl: %u to %u)\nQueued alliances: %u (Need at least %u more)\nQueued hordes: %u (Need at least %u more)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (712,'|cffff0000[BG Queue Announcer]:|r %s -- [%u-%u] A: %u/%u, H: %u/%u|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (713,'You must be level %u to join an arena team!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(714,'%s is not high enough level to join your team',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (715,'You don\'t meet Battleground level requirements',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(716,'Your arena team is full, %s cannot join it.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (717,'|cffff0000[BG Queue Announcer]:|r %s -- [%u-%u] Started!|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(718,'|cffff0000[Arena Queue Announcer]:|r %s -- Joined : %ux%u : %u|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(719,'|cffff0000[Arena Queue Announcer]:|r %s -- Exited : %ux%u : %u|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(718,'|cffff0000[Arena Queue Announcer]:|r All Arenas -- Joined : %ux%u : %u|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(719,'|cffff0000[Arena Queue Announcer]:|r All Arenas -- Exited : %ux%u : %u|r',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (720,'Your group is too large for this battleground. Please regroup to join.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (721,'Your group is too large for this arena. Please regroup to join.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (722,'Your group has members not in your arena team. Please regroup to join.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), @@ -3372,15 +3370,12 @@ INSERT INTO `mangos_string` VALUES (746,'Done flushing Arena points.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (750,'Not enough players. This game will close in %u mins.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (751,'Not enough players. This game will close in %u seconds.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(753,'The battle for Warsong Gulch begins in 2 minutes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(754,'The battle for Arathi Basin begins in 2 minutes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(755,'The battle begins in 2 minutes.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(757,'Alliance',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(758,'Horde',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(752,'Only the Alliance can use that portal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(753,'Only the Horde can use that portal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (759,'%s was destroyed by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (760,'The %s is under attack! If left unchecked, the %s will destroy it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (761,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(762,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(762,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -- WTF? why 3 same strings? (763,'The %s was taken by the %s!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (764,'The %s is under attack! If left unchecked, the %s will capture it!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (765,'The %s has taken the %s! Its supplies will now be used for reinforcements!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), @@ -3401,7 +3396,6 @@ INSERT INTO `mangos_string` VALUES (780,'East Frostwolf Tower',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (781,'West Frostwolf Tower',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (782,'Frostwolf Relief Hut',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(783,'2 minutes until the battle for Alterac Valley begins.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (784,'1 minute until the battle for Alterac Valley begins.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (785,'30 seconds until the battle for Alterac Valley begins. Prepare yourselves!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (786,'The battle for Alterac Valley has begun!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), diff --git a/sql/updates/8818_01_mangos_mangos_string.sql b/sql/updates/8818_01_mangos_mangos_string.sql new file mode 100644 index 000000000..3ca9b6c35 --- /dev/null +++ b/sql/updates/8818_01_mangos_mangos_string.sql @@ -0,0 +1,8 @@ +ALTER TABLE db_version CHANGE COLUMN required_8815_01_mangos_mangos_string required_8818_01_mangos_mangos_string bit; + +-- this sql might delete some of your translated strings, if you translated them + +DELETE FROM mangos_string WHERE entry in (714, 716, 752, 753, 754, 755, 757, 758, 783); + +INSERT INTO mangos_string VALUES (752,'Only the Alliance can use that portal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); +INSERT INTO mangos_string VALUES (753,'Only the Horde can use that portal',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); \ No newline at end of file diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 10cb5112f..ecb0c3202 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -157,6 +157,7 @@ pkgdata_DATA = \ 8803_01_mangos_playercreateinfo_spell.sql \ 8803_02_mangos_playercreateinfo_action.sql \ 8815_01_mangos_mangos_string.sql \ + 8818_01_mangos_mangos_string.sql \ README ## Additional files to include when running 'make dist' @@ -294,4 +295,5 @@ EXTRA_DIST = \ 8803_01_mangos_playercreateinfo_spell.sql \ 8803_02_mangos_playercreateinfo_action.sql \ 8815_01_mangos_mangos_string.sql \ + 8818_01_mangos_mangos_string.sql \ README diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index fa41ad7ea..46a889f1a 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -270,7 +270,7 @@ BattleGround::BattleGround() m_StartDelayTimes[BG_STARTING_EVENT_THIRD] = BG_START_DELAY_30S; m_StartDelayTimes[BG_STARTING_EVENT_FOURTH] = BG_START_DELAY_NONE; //we must set to some default existing values - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; @@ -423,8 +423,9 @@ void BattleGround::Update(uint32 diff) StartingEventCloseDoors(); SetStartDelayTime(m_StartDelayTimes[BG_STARTING_EVENT_FIRST]); - //first start warning - 2 or 1 minute - SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); + //first start warning - 2 or 1 minute, only if defined + if (m_StartMessageIds[BG_STARTING_EVENT_FIRST]) + SendMessageToAll(m_StartMessageIds[BG_STARTING_EVENT_FIRST], CHAT_MSG_BG_SYSTEM_NEUTRAL); } // After 1 minute or 30 seconds, warning is signalled else if (GetStartDelayTime() <= m_StartDelayTimes[BG_STARTING_EVENT_SECOND] && !(m_Events & BG_STARTING_EVENT_2)) diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp index 42a44b984..4407bcf80 100644 --- a/src/game/BattleGroundAB.cpp +++ b/src/game/BattleGroundAB.cpp @@ -33,7 +33,7 @@ BattleGroundAB::BattleGroundAB() m_BuffChange = true; m_BgObjects.resize(BG_AB_OBJECT_MAX); - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AB_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AB_HAS_BEGUN; @@ -85,12 +85,12 @@ void BattleGroundAB::Update(uint32 diff) if (teamIndex == 0) { - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE,NULL,LANG_BG_AB_ALLY,_GetNodeNameId(node)); + SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE,NULL,LANG_BG_ALLY,_GetNodeNameId(node)); PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_ALLIANCE); } else { - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE,NULL,LANG_BG_AB_HORDE,_GetNodeNameId(node)); + SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE,NULL,LANG_BG_HORDE,_GetNodeNameId(node)); PlaySoundToAll(BG_AB_SOUND_NODE_CAPTURED_HORDE); } } @@ -363,9 +363,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* target m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; if (teamIndex == 0) - SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_AB_ALLY); + SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_ALLY); else - SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE); + SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_HORDE); sound = BG_AB_SOUND_NODE_CLAIMED; } @@ -430,9 +430,9 @@ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* target if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED) { if (teamIndex == BG_TEAM_ALLIANCE) - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node)); + SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_ALLY, _GetNodeNameId(node)); else - SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node)); + SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_HORDE, _GetNodeNameId(node)); } PlaySoundToAll(sound); } diff --git a/src/game/BattleGroundABG.cpp b/src/game/BattleGroundABG.cpp index 0d934659f..f749864cf 100644 --- a/src/game/BattleGroundABG.cpp +++ b/src/game/BattleGroundABG.cpp @@ -24,7 +24,7 @@ BattleGroundABG::BattleGroundABG() { //TODO FIX ME! - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; diff --git a/src/game/BattleGroundAV.cpp b/src/game/BattleGroundAV.cpp index dc4b3e5a9..a2a7e9bc1 100644 --- a/src/game/BattleGroundAV.cpp +++ b/src/game/BattleGroundAV.cpp @@ -27,7 +27,7 @@ BattleGroundAV::BattleGroundAV() { - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AV_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AV_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_AV_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_AV_HAS_BEGUN; @@ -435,11 +435,11 @@ void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) UpdateScore(BattleGroundTeamId(owner^0x1), (-1) * BG_AV_RES_TOWER); RewardReputationToTeam((owner == BG_TEAM_ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, m_RepTowerDestruction, owner); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_TOWER), owner); - SendYell2ToAll(LANG_BG_AV_TOWER_TAKEN, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), ( owner == BG_TEAM_ALLIANCE ) ? LANG_BG_AV_ALLY : LANG_BG_AV_HORDE); + SendYell2ToAll(LANG_BG_AV_TOWER_TAKEN, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), ( owner == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY : LANG_BG_HORDE); } else { - SendYell2ToAll(LANG_BG_AV_GRAVE_TAKEN, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), ( owner == BG_TEAM_ALLIANCE ) ? LANG_BG_AV_ALLY : LANG_BG_AV_HORDE); + SendYell2ToAll(LANG_BG_AV_GRAVE_TAKEN, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), ( owner == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY : LANG_BG_HORDE); } } @@ -469,7 +469,7 @@ void BattleGroundAV::ChangeMineOwner(uint8 mine, uint32 team) PlaySoundToAll((team == BG_TEAM_ALLIANCE) ? BG_AV_SOUND_ALLIANCE_GOOD : BG_AV_SOUND_HORDE_GOOD); m_Mine_Reclaim_Timer[mine] = BG_AV_MINE_RECLAIM_TIMER; SendYell2ToAll(LANG_BG_AV_MINE_TAKEN , LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), - (team == BG_TEAM_ALLIANCE ) ? LANG_BG_AV_ALLY : LANG_BG_AV_HORDE, + (team == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY : LANG_BG_HORDE, (mine == BG_AV_NORTH_MINE) ? LANG_BG_AV_MINE_NORTH : LANG_BG_AV_MINE_SOUTH); } } @@ -562,7 +562,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node) { SendYell2ToAll( LANG_BG_AV_TOWER_DEFENDED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), - ( team == BG_TEAM_ALLIANCE ) ? LANG_BG_AV_ALLY:LANG_BG_AV_HORDE); + ( team == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY:LANG_BG_HORDE); UpdatePlayerScore(player, SCORE_TOWERS_DEFENDED, 1); PlaySoundToAll(BG_AV_SOUND_BOTH_TOWER_DEFEND); } @@ -570,7 +570,7 @@ void BattleGroundAV::EventPlayerDefendsPoint(Player* player, BG_AV_Nodes node) { SendYell2ToAll(LANG_BG_AV_GRAVE_DEFENDED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), - ( team == BG_TEAM_ALLIANCE ) ? LANG_BG_AV_ALLY:LANG_BG_AV_HORDE); + ( team == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY:LANG_BG_HORDE); UpdatePlayerScore(player, SCORE_GRAVEYARDS_DEFENDED, 1); // update the statistic for the defending player PlaySoundToAll((team == BG_TEAM_ALLIANCE)?BG_AV_SOUND_ALLIANCE_GOOD:BG_AV_SOUND_HORDE_GOOD); @@ -593,14 +593,14 @@ void BattleGroundAV::EventPlayerAssaultsPoint(Player* player, BG_AV_Nodes node) { SendYell2ToAll(LANG_BG_AV_TOWER_ASSAULTED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), - ( team == BG_TEAM_ALLIANCE ) ? LANG_BG_AV_ALLY:LANG_BG_AV_HORDE); + ( team == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY:LANG_BG_HORDE); UpdatePlayerScore(player, SCORE_TOWERS_ASSAULTED, 1); } else { SendYell2ToAll(LANG_BG_AV_GRAVE_ASSAULTED, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), - ( team == BG_TEAM_ALLIANCE ) ? LANG_BG_AV_ALLY:LANG_BG_AV_HORDE); + ( team == BG_TEAM_ALLIANCE ) ? LANG_BG_ALLY:LANG_BG_HORDE); // update the statistic for the assaulting player UpdatePlayerScore(player, SCORE_GRAVEYARDS_ASSAULTED, 1); } diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index 8f5999109..74f278c48 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -38,7 +38,7 @@ BattleGroundEY::BattleGroundEY() m_Points_Trigger[DRAENEI_RUINS] = TR_DRAENEI_RUINS_BUFF; m_Points_Trigger[MAGE_TOWER] = TR_MAGE_TOWER_BUFF; - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_EY_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_EY_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_EY_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_EY_HAS_BEGUN; @@ -245,16 +245,6 @@ void BattleGroundEY::UpdatePointStatuses() void BattleGroundEY::UpdateTeamScore(uint32 Team) { uint32 score = GetTeamScore(Team); - //TODO there should be some sound played when one team is near victory!! - and define variables - /*if (!m_IsInformedNearVictory && score >= BG_EY_WARNING_NEAR_VICTORY_SCORE) - { - if (Team == ALLIANCE) - SendMessageToAll(LANG_BG_EY_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); - else - SendMessageToAll(LANG_BG_EY_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL); - PlaySoundToAll(BG_EY_SOUND_NEAR_VICTORY); - m_IsInformedNearVictory = true; - }*/ if (score >= BG_EY_MAX_TEAM_SCORE) { diff --git a/src/game/BattleGroundIC.cpp b/src/game/BattleGroundIC.cpp index 829dbcdb1..53918bf41 100644 --- a/src/game/BattleGroundIC.cpp +++ b/src/game/BattleGroundIC.cpp @@ -24,7 +24,7 @@ BattleGroundIC::BattleGroundIC() { //TODO FIX ME! - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; diff --git a/src/game/BattleGroundSA.cpp b/src/game/BattleGroundSA.cpp index 20cadac93..22e1ade01 100644 --- a/src/game/BattleGroundSA.cpp +++ b/src/game/BattleGroundSA.cpp @@ -24,7 +24,7 @@ BattleGroundSA::BattleGroundSA() { //TODO FIX ME! - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index c4ad4efbd..847ce6bc1 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -30,7 +30,7 @@ BattleGroundWS::BattleGroundWS() { - m_StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_WS_START_TWO_MINUTES; + m_StartMessageIds[BG_STARTING_EVENT_FIRST] = 0; m_StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE; m_StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN; diff --git a/src/game/Language.h b/src/game/Language.h index 627c0763c..3412200ae 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -571,7 +571,6 @@ enum MangosStrings LANG_BG_A_WINS = 600, LANG_BG_H_WINS = 601, - LANG_BG_WS_START_TWO_MINUTES = 753, LANG_BG_WS_START_ONE_MINUTE = 602, LANG_BG_WS_START_HALF_MINUTE = 603, LANG_BG_WS_HAS_BEGUN = 604, @@ -587,14 +586,14 @@ enum MangosStrings LANG_BG_WS_F_PLACED = 613, LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED = 614, LANG_BG_WS_HORDE_FLAG_RESPAWNED = 615, - - LANG_BG_EY_START_TWO_MINUTES = 755, + // 616 - 635 not used LANG_BG_EY_START_ONE_MINUTE = 636, LANG_BG_EY_START_HALF_MINUTE = 637, LANG_BG_EY_HAS_BEGUN = 638, + // 639 - 649 not used + LANG_BG_ALLY = 650, + LANG_BG_HORDE = 651, - LANG_BG_AB_ALLY = 650, - LANG_BG_AB_HORDE = 651, LANG_BG_AB_NODE_STABLES = 652, LANG_BG_AB_NODE_BLACKSMITH = 653, LANG_BG_AB_NODE_FARM = 654, @@ -605,7 +604,6 @@ enum MangosStrings LANG_BG_AB_NODE_ASSAULTED = 659, LANG_BG_AB_NODE_CLAIMED = 660, - LANG_BG_AB_START_TWO_MINUTES = 754, LANG_BG_AB_START_ONE_MINUTE = 661, LANG_BG_AB_START_HALF_MINUTE = 662, LANG_BG_AB_HAS_BEGUN = 663, @@ -634,7 +632,7 @@ enum MangosStrings LANG_BG_EY_CAPTURED_FLAG_H = 685, LANG_BG_EY_DROPPED_FLAG = 686, LANG_BG_EY_RESETED_FLAG = 687, - + // 688 - 699 not used LANG_ARENA_ONE_TOOLOW = 700, LANG_ARENA_ONE_MINUTE = 701, LANG_ARENA_THIRTY_SECONDS = 702, @@ -686,14 +684,18 @@ enum MangosStrings LANG_DIST_ARENA_POINTS_TEAM_START = 744, LANG_DIST_ARENA_POINTS_TEAM_END = 745, LANG_DIST_ARENA_POINTS_END = 746, - - LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING = 750, // "Not enough players. This game will close in %u mins." +// = 747, not used +// = 748, not used +// = 749, not used + LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING = 750, // "Not enough players. This game will close in %u mins." LANG_BATTLEGROUND_PREMATURE_FINISH_WARNING_SECS = 751, // "Not enough players. This game will close in %u seconds." - LANG_BATTLEGROUND_ONLY_ALLIANCE_USE = 752, // "Only The Alliance can use that portal" - LANG_BATTLEGROUND_ONLY_HORDE_USE = 753, // "Only The Horde can use that portal" - - LANG_BG_AV_ALLY = 757, - LANG_BG_AV_HORDE = 758, + LANG_BATTLEGROUND_ONLY_ALLIANCE_USE = 752, // "Only The Alliance can use that portal" + LANG_BATTLEGROUND_ONLY_HORDE_USE = 753, // "Only The Horde can use that portal" +// = 754, not used +// = 755, not used +// = 756, not used +// = 757, not used +// = 758, not used LANG_BG_AV_TOWER_TAKEN = 759, LANG_BG_AV_TOWER_ASSAULTED = 760, LANG_BG_AV_TOWER_DEFENDED = 761, @@ -720,7 +722,7 @@ enum MangosStrings LANG_BG_AV_NODE_TOWER_FROST_W = 781, LANG_BG_AV_NODE_GRAVE_FROST_HUT = 782, - LANG_BG_AV_START_TWO_MINUTES = 783, +// = 783, not used LANG_BG_AV_START_ONE_MINUTE = 784, LANG_BG_AV_START_HALF_MINUTE = 785, LANG_BG_AV_HAS_BEGUN = 786, @@ -730,7 +732,7 @@ enum MangosStrings LANG_BG_AV_A_GENERAL_DEAD = 790, - // Room for batleground/arena strings 790-799 not used + // Room for batleground/arena strings 791-799 not used // in game strings // = 800, not used diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index f8c7f0cc0..b38a79435 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8817" + #define REVISION_NR "8818" #endif // __REVISION_NR_H__ diff --git a/src/shared/revision_sql.h b/src/shared/revision_sql.h index f0e0bce64..968f55826 100644 --- a/src/shared/revision_sql.h +++ b/src/shared/revision_sql.h @@ -1,6 +1,6 @@ #ifndef __REVISION_SQL_H__ #define __REVISION_SQL_H__ #define REVISION_DB_CHARACTERS "required_8721_01_characters_guild" - #define REVISION_DB_MANGOS "required_8815_01_mangos_mangos_string" + #define REVISION_DB_MANGOS "required_8818_01_mangos_mangos_string" #define REVISION_DB_REALMD "required_8728_01_realmd_account" #endif // __REVISION_SQL_H__ From 35d64c8d620e53e7cba3fd196c91fdf773eae632 Mon Sep 17 00:00:00 2001 From: balrok Date: Tue, 10 Nov 2009 05:36:19 -0500 Subject: [PATCH 07/11] [8819] remove objects if unit leaves map prior this - the objects were only removed when unit itself gots removed this fix some crashes with Object::SetUint64 thx to juansalvador and vladimir :) --- src/game/Unit.cpp | 14 ++++++++------ src/shared/revision_nr.h | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 6ccb6f0ad..03e4dbefe 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -169,10 +169,12 @@ Unit::~Unit() } } - RemoveAllGameObjects(); - RemoveAllDynObjects(); + if (m_charmInfo) + delete m_charmInfo; - if(m_charmInfo) delete m_charmInfo; + // those should be already removed at "RemoveFromWorld()" call + assert(m_gameObj.size() == 0); + assert(m_dynObjGUIDs.size() == 0); } void Unit::Update( uint32 p_time ) @@ -11097,11 +11099,13 @@ void Unit::AddToWorld() void Unit::RemoveFromWorld() { // cleanup - if(IsInWorld()) + if (IsInWorld()) { Uncharm(); RemoveNotOwnSingleTargetAuras(); RemoveGuardians(); + RemoveAllGameObjects(); + RemoveAllDynObjects(); } Object::RemoveFromWorld(); @@ -11118,8 +11122,6 @@ void Unit::CleanupsBeforeDelete() DeleteThreatList(); getHostileRefManager().setOnlineOfflineState(false); RemoveAllAuras(AURA_REMOVE_BY_DELETE); - RemoveAllGameObjects(); - RemoveAllDynObjects(); GetMotionMaster()->Clear(false); // remove different non-standard movement generators. } WorldObject::CleanupsBeforeDelete(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index b38a79435..10cf6425b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8818" + #define REVISION_NR "8819" #endif // __REVISION_NR_H__ From 54754302358562565463418d50e95cf984fa8d91 Mon Sep 17 00:00:00 2001 From: balrok Date: Sun, 15 Nov 2009 20:04:53 +0100 Subject: [PATCH 08/11] [8820] drop unneded check at sessionupate session will never get NULL there --- src/game/World.cpp | 4 ---- src/shared/revision_nr.h | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/game/World.cpp b/src/game/World.cpp index 4491e4cf5..ca23473be 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -2050,10 +2050,6 @@ void World::UpdateSessions( uint32 diff ) { next = itr; ++next; - - if(!itr->second) - continue; - ///- and remove not active sessions from the list if(!itr->second->Update(diff)) // As interval = 0 { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 10cf6425b..08345e27b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8819" + #define REVISION_NR "8820" #endif // __REVISION_NR_H__ From 6199396b6914446e4e934610f469b9aee25fb05a Mon Sep 17 00:00:00 2001 From: balrok Date: Sun, 15 Nov 2009 20:08:00 +0100 Subject: [PATCH 09/11] [8821] removed some redundant player->SaveToDB calls SaveToDB will already be called at "SpawnCorpseBones" so no need to do this twice --- src/game/MiscHandler.cpp | 2 -- src/game/MovementHandler.cpp | 1 - src/game/NPCHandler.cpp | 2 -- src/game/SpellEffects.cpp | 2 -- src/shared/revision_nr.h | 2 +- 5 files changed, 1 insertion(+), 8 deletions(-) diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index a605fc595..e3f2865f5 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -646,8 +646,6 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) // spawn bones GetPlayer()->SpawnCorpseBones(); - - GetPlayer()->SaveToDB(); } void WorldSession::HandleResurrectResponseOpcode(WorldPacket & recv_data) diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 7f7ef94d9..99f8abc12 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -138,7 +138,6 @@ void WorldSession::HandleMoveWorldportAckOpcode() { GetPlayer()->ResurrectPlayer(0.5f); GetPlayer()->SpawnCorpseBones(); - GetPlayer()->SaveToDB(); } } diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index dd41863ee..096783e00 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -377,8 +377,6 @@ void WorldSession::SendSpiritResurrect() // or update at original position else _player->UpdateVisibilityForPlayer(); - - _player->SaveToDB(); } void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data ) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 6dd37ae88..3069f06a8 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -6210,8 +6210,6 @@ void Spell::EffectSelfResurrect(uint32 i) plr->SetPower(POWER_ENERGY, plr->GetMaxPower(POWER_ENERGY) ); plr->SpawnCorpseBones(); - - plr->SaveToDB(); } void Spell::EffectSkinning(uint32 /*i*/) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 08345e27b..61ce4b652 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8820" + #define REVISION_NR "8821" #endif // __REVISION_NR_H__ From 31a2996374f6c1877ab7db7fb84001ffdc223356 Mon Sep 17 00:00:00 2001 From: balrok Date: Sat, 14 Nov 2009 08:46:29 -0500 Subject: [PATCH 10/11] [8822] one big insert for character_aura and _SaveSpellCooldowns this is much faster than many multiple inserts.. code is partly stolen from AchievementMgr inserts (: --- src/game/Player.cpp | 42 ++++++++++++++++++++++++++++++++++++---- src/shared/revision_nr.h | 2 +- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/game/Player.cpp b/src/game/Player.cpp index efa68798c..247f2b7f8 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3469,6 +3469,10 @@ void Player::_SaveSpellCooldowns() time_t curTime = time(NULL); time_t infTime = curTime + infinityCooldownDelayCheck; + /* copied following sql-code partly from achievementmgr */ + bool first_round = true; + std::ostringstream ss; + // remove outdated and save active for(SpellCooldowns::iterator itr = m_spellCooldowns.begin();itr != m_spellCooldowns.end();) { @@ -3476,12 +3480,24 @@ void Player::_SaveSpellCooldowns() m_spellCooldowns.erase(itr++); else if(itr->second.end <= infTime) // not save locked cooldowns, it will be reset or set at reload { - CharacterDatabase.PExecute("INSERT INTO character_spell_cooldown (guid,spell,item,time) VALUES ('%u', '%u', '%u', '" UI64FMTD "')", GetGUIDLow(), itr->first, itr->second.itemid, uint64(itr->second.end)); + if (first_round) + { + ss << "INSERT INTO character_spell_cooldown (guid,spell,item,time) VALUES "; + first_round = false; + } + // next new/changed record prefix + else + ss << ", "; + ss << "(" << GetGUIDLow() << "," << itr->first << "," << itr->second.itemid << "," << uint64(itr->second.end) << ")"; ++itr; } else ++itr; + } + // if something changed execute + if (!first_round) + CharacterDatabase.Execute( ss.str().c_str() ); } uint32 Player::resetTalentsCost() const @@ -15792,6 +15808,9 @@ void Player::_SaveAuras() spellEffectPair lastEffectPair = auras.begin()->first; uint32 stackCounter = 1; + /* copied following sql-code partly from achievementmgr */ + bool first_round = true; + std::ostringstream ss; for(AuraMap::const_iterator itr = auras.begin(); ; ++itr) { if(itr == auras.end() || lastEffectPair != itr->first) @@ -15804,9 +15823,20 @@ void Player::_SaveAuras() //do not save single target auras (unless they were cast by the player) if (!itr2->second->IsPassive() && (itr2->second->GetCasterGUID() == GetGUID() || !itr2->second->IsSingleTarget())) { - CharacterDatabase.PExecute("INSERT INTO character_aura (guid,caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges) " - "VALUES ('%u', '" UI64FMTD "' ,'%u', '%u', '%u', '%d', '%d', '%d', '%d')", - GetGUIDLow(), itr2->second->GetCasterGUID(), (uint32)itr2->second->GetId(), (uint32)itr2->second->GetEffIndex(), stackCounter, itr2->second->GetModifier()->m_amount,int(itr2->second->GetAuraMaxDuration()),int(itr2->second->GetAuraDuration()),int(itr2->second->GetAuraCharges())); + if (first_round) + { + ss << "INSERT INTO character_aura (guid,caster_guid,spell,effect_index,stackcount,amount,maxduration,remaintime,remaincharges)VALUES "; + first_round = false; + } + // next new/changed record prefix + else + ss << ", "; + + ss << "("<< GetGUIDLow() << "," << itr2->second->GetCasterGUID() << "," + << (uint32)itr2->second->GetId() << "," << (uint32)itr2->second->GetEffIndex() << "," + << stackCounter << "," << itr2->second->GetModifier()->m_amount << "," + <second->GetAuraMaxDuration()) << "," << int(itr2->second->GetAuraDuration()) << "," + << int(itr2->second->GetAuraCharges()) << ")"; } if(itr == auras.end()) @@ -15821,6 +15851,10 @@ void Player::_SaveAuras() stackCounter = 1; } } + + // if something changed execute + if (!first_round) + CharacterDatabase.Execute( ss.str().c_str() ); } void Player::_SaveInventory() diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 61ce4b652..7fa18ce2b 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8821" + #define REVISION_NR "8822" #endif // __REVISION_NR_H__ From fbe9241a96f654f3a82eae10075569d94ba4d0ff Mon Sep 17 00:00:00 2001 From: balrok Date: Sat, 14 Nov 2009 08:48:35 -0500 Subject: [PATCH 11/11] [8823] removed ban-cleanup queries from realmd at login now they just getting executed when realmd is started i think this will improve speed a bit.. cause we don't need to cleanup those bans so often we just can check the conditions inside the select --- src/realmd/AuthSocket.cpp | 17 ++++++++--------- src/realmd/Main.cpp | 5 +++++ src/shared/revision_nr.h | 2 +- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/realmd/AuthSocket.cpp b/src/realmd/AuthSocket.cpp index f1c1027b6..cdbccb19c 100644 --- a/src/realmd/AuthSocket.cpp +++ b/src/realmd/AuthSocket.cpp @@ -379,15 +379,15 @@ bool AuthSocket::_HandleLogonChallenge() ///- Verify that this IP is not in the ip_banned table // No SQL injection possible (paste the IP address as passed by the socket) - loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); - std::string address = GetRemoteAddress(); loginDatabase.escape_string(address); - QueryResult *result = loginDatabase.PQuery( "SELECT * FROM ip_banned WHERE ip = '%s'",address.c_str()); - if(result) + QueryResult *result = loginDatabase.PQuery("SELECT unbandate FROM ip_banned WHERE " + // permanent still banned + "(unbandate = bandate OR unbandate > UNIX_TIMESTAMP()) AND ip = '%s'", address.c_str()); + if (result) { pkt << (uint8)REALM_AUTH_ACCOUNT_BANNED; - sLog.outBasic("[AuthChallenge] Banned ip %s tries to login!",GetRemoteAddress().c_str ()); + sLog.outBasic("[AuthChallenge] Banned ip %s tries to login!", GetRemoteAddress().c_str()); delete result; } else @@ -422,13 +422,12 @@ bool AuthSocket::_HandleLogonChallenge() if (!locked) { - //set expired bans to inactive - loginDatabase.Execute("UPDATE account_banned SET active = 0 WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); ///- If the account is banned, reject the logon attempt - QueryResult *banresult = loginDatabase.PQuery("SELECT bandate,unbandate FROM account_banned WHERE id = %u AND active = 1", (*result)[1].GetUInt32()); + QueryResult *banresult = loginDatabase.PQuery("SELECT bandate,unbandate FROM account_banned WHERE " + "id = %u AND active = 1 AND (unbandate > UNIX_TIMESTAMP() OR unbandate = bandate)", (*result)[1].GetUInt32()); if(banresult) { - if((*banresult)[0].GetUInt64() == (*banresult)[1].GetUInt64()) + if((*banresult)[0].GetUInt64() != (*banresult)[1].GetUInt64()) { pkt << (uint8) REALM_AUTH_ACCOUNT_BANNED; sLog.outBasic("[AuthChallenge] Banned account %s tries to login!",_login.c_str ()); diff --git a/src/realmd/Main.cpp b/src/realmd/Main.cpp index 70f93f431..c25d827d1 100644 --- a/src/realmd/Main.cpp +++ b/src/realmd/Main.cpp @@ -209,6 +209,11 @@ extern int main(int argc, char **argv) return 1; } + // cleanup query + //set expired bans to inactive + loginDatabase.Execute("UPDATE account_banned SET active = 0 WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); + loginDatabase.Execute("DELETE FROM ip_banned WHERE unbandate<=UNIX_TIMESTAMP() AND unbandate<>bandate"); + h.Add(&authListenSocket); ///- Catch termination signals diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 7fa18ce2b..d5fdb2f5f 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8822" + #define REVISION_NR "8823" #endif // __REVISION_NR_H__