diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index fcd86c38d..48764b8ca 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -177,6 +177,7 @@ void BattleGround::Update(uint32 diff) } } + //this should be handled by spell system: m_LastResurrectTime += diff; if (m_LastResurrectTime >= RESURRECTION_INTERVAL) { @@ -304,7 +305,7 @@ void BattleGround::SendPacketToTeam(uint32 TeamID, WorldPacket *packet, Player * if(!self && sender == plr) continue; - uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID()); + uint32 team = itr->second.Team; if(!team) team = plr->GetTeam(); if(team == TeamID) @@ -333,7 +334,7 @@ void BattleGround::PlaySoundToTeam(uint32 SoundID, uint32 TeamID) continue; } - uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID()); + uint32 team = itr->second.Team; if(!team) team = plr->GetTeam(); if(team == TeamID) @@ -356,7 +357,7 @@ void BattleGround::CastSpellOnTeam(uint32 SpellID, uint32 TeamID) continue; } - uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID()); + uint32 team = itr->second.Team; if(!team) team = plr->GetTeam(); if(team == TeamID) @@ -376,7 +377,7 @@ void BattleGround::RewardHonorToTeam(uint32 Honor, uint32 TeamID) continue; } - uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID()); + uint32 team = itr->second.Team; if(!team) team = plr->GetTeam(); if(team == TeamID) @@ -401,7 +402,7 @@ void BattleGround::RewardReputationToTeam(uint32 faction_id, uint32 Reputation, continue; } - uint32 team = itr->second.Team;//GetPlayerTeam(plr->GetGUID()); + uint32 team = itr->second.Team; if(!team) team = plr->GetTeam(); if(team == TeamID) @@ -889,9 +890,6 @@ void BattleGround::Reset() m_Players.clear(); m_PlayerScores.clear(); - - // reset BGSubclass - ResetBGSubclass(); } void BattleGround::StartBattleGround() @@ -972,10 +970,37 @@ void BattleGround::AddPlayer(Player *plr) plr->CastSpell(plr, SPELL_PREPARATION, true); // reduces all mana cost of spells. } + // setup BG group membership + PlayerRelogin(plr); + AddOrSetPlayerToCorrectBgGroup(plr, guid, team); + // Log sLog.outDetail("BATTLEGROUND: Player %s joined the battle.", plr->GetName()); } +/* this method adds player to his team's bg group, or sets his correct group if player is already in bg group */ +void BattleGround::AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team) +{ + Group* group = GetBgRaid(team); + if(!group) // first player joined + { + group = new Group; + SetBgRaid(team, group); + group->Create(plr_guid, plr->GetName()); + } + else // raid already exist + { + if(group->IsMember(plr_guid)) + { + uint8 subgroup = group->GetMemberGroup(plr_guid); + plr->SetGroup(group, subgroup); + } + else + GetBgRaid(team)->AddMember(plr_guid, plr->GetName()); + } +} + + /* This method should be called only once ... it adds pointer to queue */ void BattleGround::AddToBGFreeSlotQueue() { diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 3b7df71e8..501946438 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -248,10 +248,7 @@ class BattleGround { return true; } - void Reset(); // resets all common properties for battlegrounds - virtual void ResetBGSubclass() // must be implemented in BG subclass - { - } + virtual void Reset(); // resets all common properties for battlegrounds, must be implemented and called in BG subclass /* Battleground */ // Get methods: @@ -411,6 +408,8 @@ class BattleGround virtual void AddPlayer(Player *plr); // must be implemented in BG subclass + void AddOrSetPlayerToCorrectBgGroup(Player *plr, uint64 plr_guid, uint32 team); + virtual void RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPacket); // can be extended in in BG subclass diff --git a/src/game/BattleGroundAB.cpp b/src/game/BattleGroundAB.cpp index 5e901b28e..9c6c040e0 100644 --- a/src/game/BattleGroundAB.cpp +++ b/src/game/BattleGroundAB.cpp @@ -576,8 +576,11 @@ bool BattleGroundAB::SetupBattleGround() return true; } -void BattleGroundAB::ResetBGSubclass() +void BattleGroundAB::Reset() { + //call parent's class reset + BattleGround::Reset(); + m_TeamScores[BG_TEAM_ALLIANCE] = 0; m_TeamScores[BG_TEAM_HORDE] = 0; m_lastTick[BG_TEAM_ALLIANCE] = 0; diff --git a/src/game/BattleGroundAB.h b/src/game/BattleGroundAB.h index e76f35209..0ea386bcd 100644 --- a/src/game/BattleGroundAB.h +++ b/src/game/BattleGroundAB.h @@ -241,7 +241,7 @@ class BattleGroundAB : public BattleGround void RemovePlayer(Player *plr,uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); virtual bool SetupBattleGround(); - virtual void ResetBGSubclass(); + virtual void Reset(); virtual WorldSafeLocsEntry const* GetClosestGraveYard(float x, float y, float z, uint32 team); /* Scorekeeping */ diff --git a/src/game/BattleGroundBE.cpp b/src/game/BattleGroundBE.cpp index 32c84958a..412479093 100644 --- a/src/game/BattleGroundBE.cpp +++ b/src/game/BattleGroundBE.cpp @@ -200,9 +200,10 @@ void BattleGroundBE::FillInitialWorldStates(WorldPacket &data) data << uint32(0x9f3) << uint32(1); // 9 } -void BattleGroundBE::ResetBGSubclass() +void BattleGroundBE::Reset() { - + //call parent's class reset + BattleGround::Reset(); } bool BattleGroundBE::SetupBattleGround() diff --git a/src/game/BattleGroundBE.h b/src/game/BattleGroundBE.h index 4e5663d03..3d15d612d 100644 --- a/src/game/BattleGroundBE.h +++ b/src/game/BattleGroundBE.h @@ -63,7 +63,7 @@ class BattleGroundBE : public BattleGround void RemovePlayer(Player *plr, uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); - void ResetBGSubclass(); + virtual void Reset(); virtual void FillInitialWorldStates(WorldPacket &d); void HandleKillPlayer(Player* player, Player *killer); bool HandlePlayerUnderMap(Player * plr); diff --git a/src/game/BattleGroundEY.cpp b/src/game/BattleGroundEY.cpp index 11263d26e..8b826f0cd 100644 --- a/src/game/BattleGroundEY.cpp +++ b/src/game/BattleGroundEY.cpp @@ -513,8 +513,11 @@ bool BattleGroundEY::SetupBattleGround() return true; } -void BattleGroundEY::ResetBGSubclass() +void BattleGroundEY::Reset() { + //call parent's class reset + BattleGround::Reset(); + m_TeamScores[BG_TEAM_ALLIANCE] = 0; m_TeamScores[BG_TEAM_HORDE] = 0; m_TeamPointsCount[BG_TEAM_ALLIANCE] = 0; diff --git a/src/game/BattleGroundEY.h b/src/game/BattleGroundEY.h index 38291313d..5db6a796b 100644 --- a/src/game/BattleGroundEY.h +++ b/src/game/BattleGroundEY.h @@ -317,7 +317,7 @@ class BattleGroundEY : public BattleGround void HandleKillPlayer(Player *player, Player *killer); virtual WorldSafeLocsEntry const* GetClosestGraveYard(float x, float y, float z, uint32 team); virtual bool SetupBattleGround(); - virtual void ResetBGSubclass(); + virtual void Reset(); void UpdateTeamScore(uint32 Team); void UpdatePlayerScore(Player *Source, uint32 type, uint32 value); virtual void FillInitialWorldStates(WorldPacket& data); diff --git a/src/game/BattleGroundMgr.cpp b/src/game/BattleGroundMgr.cpp index 67622a712..989e15290 100644 --- a/src/game/BattleGroundMgr.cpp +++ b/src/game/BattleGroundMgr.cpp @@ -53,12 +53,6 @@ INSTANTIATE_SINGLETON_1( BattleGroundMgr ); BattleGroundQueue::BattleGroundQueue() { //queues are empty, we don't have to call clear() -/* for (int i = 0; i < MAX_BATTLEGROUND_QUEUES; i++) - { - //m_QueuedPlayers[i].Horde = 0; - //m_QueuedPlayers[i].Alliance = 0; - //m_QueuedPlayers[i].AverageTime = 0; - }*/ } BattleGroundQueue::~BattleGroundQueue() @@ -85,17 +79,17 @@ void BattleGroundQueue::EligibleGroups::Init(BattleGroundQueue::QueuedGroupsList { next = itr; ++next; - if( (*itr)->BgTypeId == BgTypeId && // bg type must match - (*itr)->ArenaType == ArenaType && // arena type must match - (*itr)->IsRated == IsRated && // israted must match - (*itr)->IsInvitedToBGInstanceGUID == 0 && // leave out already invited groups - (*itr)->Team == side && // match side - (*itr)->Players.size() <= MaxPlayers && // the group must fit in the bg + if( (*itr)->BgTypeId == BgTypeId && // bg type must match + (*itr)->ArenaType == ArenaType && // arena type must match + (*itr)->IsRated == IsRated && // israted must match + (*itr)->IsInvitedToBGInstanceGUID == 0 && // leave out already invited groups + (*itr)->Team == side && // match side + (*itr)->Players.size() <= MaxPlayers && // the group must fit in the bg ( !excludeTeam || (*itr)->ArenaTeamId != excludeTeam ) && // if excludeTeam is specified, leave out those arena team ids ( !IsRated || (*itr)->Players.size() == MaxPlayers ) && // if rated, then pass only if the player count is exact NEEDS TESTING! (but now this should never happen) - ( (*itr)->JoinTime <= DisregardTime // pass if disregard time is greater than join time - || (*itr)->ArenaTeamRating == 0 // pass if no rating info - || ( (*itr)->ArenaTeamRating >= MinRating // pass if matches the rating range + ( (*itr)->JoinTime <= DisregardTime // pass if disregard time is greater than join time + || (*itr)->ArenaTeamRating == 0 // pass if no rating info + || ( (*itr)->ArenaTeamRating >= MinRating // pass if matches the rating range && (*itr)->ArenaTeamRating <= MaxRating ) ) ) { // the group matches the conditions @@ -1479,9 +1473,8 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI bg = new BattleGroundRV(*(BattleGroundRV*)bg_template); break; default: - //bg = new BattleGround; + //error, but it is handled few lines above return 0; - break; // placeholder for non implemented BG } // generate a new instance id @@ -1509,11 +1502,10 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI } // used to create the BG templates -uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO) +uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO) { // Create the BG BattleGround *bg = NULL; - switch(bgTypeId) { case BATTLEGROUND_AV: bg = new BattleGroundAV; break; @@ -1534,19 +1526,13 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 M bg->Reset(); - BattlemasterListEntry const *bl = sBattlemasterListStore.LookupEntry(bgTypeId); - //in previous method is checked if exists entry in sBattlemasterListStore, so no check needed - if (bl) - { - bg->SetArenaorBGType(bl->type == TYPE_ARENA); - } - bg->SetTypeID(bgTypeId); - bg->SetInstanceID(0); // template bg, instance id is 0 + bg->SetInstanceID(0); + bg->SetArenaorBGType(IsArena); bg->SetMinPlayersPerTeam(MinPlayersPerTeam); bg->SetMaxPlayersPerTeam(MaxPlayersPerTeam); - bg->SetMinPlayers(MinPlayersPerTeam*2); - bg->SetMaxPlayers(MaxPlayersPerTeam*2); + bg->SetMinPlayers(MinPlayersPerTeam * 2); + bg->SetMaxPlayers(MaxPlayersPerTeam * 2); bg->SetName(BattleGroundName); bg->SetTeamStartLoc(ALLIANCE, Team1StartLocX, Team1StartLocY, Team1StartLocZ, Team1StartLocO); bg->SetTeamStartLoc(HORDE, Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO); @@ -1568,6 +1554,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() uint32 MaxPlayersPerTeam, MinPlayersPerTeam, MinLvl, MaxLvl, start1, start2; BattlemasterListEntry const *bl; WorldSafeLocsEntry const *start; + bool IsArena; uint32 count = 0; @@ -1598,28 +1585,28 @@ void BattleGroundMgr::CreateInitialBattleGrounds() bl = sBattlemasterListStore.LookupEntry(bgTypeID_); if(!bl) { - sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.",bgTypeID_); + sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_); continue; } BattleGroundTypeId bgTypeID = BattleGroundTypeId(bgTypeID_); - MaxPlayersPerTeam = bl->maxplayersperteam; - MinPlayersPerTeam = bl->maxplayersperteam/2; - MinLvl = bl->minlvl; - MaxLvl = bl->maxlvl; - - if(fields[1].GetUInt32()) - MinPlayersPerTeam = fields[1].GetUInt32(); - - if(fields[2].GetUInt32()) - MaxPlayersPerTeam = fields[2].GetUInt32(); - - if(fields[3].GetUInt32()) - MinLvl = fields[3].GetUInt32(); - - if(fields[4].GetUInt32()) - MaxLvl = fields[4].GetUInt32(); + IsArena = (bl->type == TYPE_ARENA); + MinPlayersPerTeam = fields[1].GetUInt32(); + MaxPlayersPerTeam = fields[2].GetUInt32(); + MinLvl = fields[3].GetUInt32(); + MaxLvl = fields[4].GetUInt32(); + //check values from DB + if( MaxPlayersPerTeam == 0 || MinPlayersPerTeam == 0 || MinPlayersPerTeam > MaxPlayersPerTeam ) + { + MaxPlayersPerTeam = bl->maxplayersperteam; + MinPlayersPerTeam = bl->maxplayersperteam / 2; + } + if( MinLvl == 0 || MaxLvl == 0 || MinLvl > MaxLvl ) + { + MinLvl = bl->minlvl; + MaxLvl = bl->maxlvl; + } start1 = fields[5].GetUInt32(); @@ -1640,7 +1627,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds() } else { - sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.",bgTypeID,start1); + sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `AllianceStartLoc`. BG not created.", bgTypeID, start1); continue; } @@ -1663,12 +1650,12 @@ void BattleGroundMgr::CreateInitialBattleGrounds() } else { - sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.",bgTypeID,start2); + sLog.outErrorDb("Table `battleground_template` for id %u have non-existed WorldSafeLocs.dbc id %u in field `HordeStartLoc`. BG not created.", bgTypeID, start2); continue; } //sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl); - if(!CreateBattleGround(bgTypeID, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3])) + if(!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3])) continue; ++count; diff --git a/src/game/BattleGroundMgr.h b/src/game/BattleGroundMgr.h index dd2c868ff..df5e9668c 100644 --- a/src/game/BattleGroundMgr.h +++ b/src/game/BattleGroundMgr.h @@ -201,7 +201,7 @@ class BattleGroundMgr BattleGround * GetBattleGroundTemplate(BattleGroundTypeId bgTypeId); BattleGround * CreateNewBattleGround(BattleGroundTypeId bgTypeId); - uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO); + uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO); void AddBattleGround(uint32 InstanceID, BattleGround* BG) { m_BattleGrounds[InstanceID] = BG; }; void RemoveBattleGround(uint32 instanceID) { m_BattleGrounds.erase(instanceID); } diff --git a/src/game/BattleGroundNA.cpp b/src/game/BattleGroundNA.cpp index e90bfcaa8..01d766adf 100644 --- a/src/game/BattleGroundNA.cpp +++ b/src/game/BattleGroundNA.cpp @@ -193,9 +193,10 @@ void BattleGroundNA::FillInitialWorldStates(WorldPacket &data) data << uint32(0xa11) << uint32(1); // 9 } -void BattleGroundNA::ResetBGSubclass() +void BattleGroundNA::Reset() { - + //call parent's class reset + BattleGround::Reset(); } bool BattleGroundNA::SetupBattleGround() diff --git a/src/game/BattleGroundNA.h b/src/game/BattleGroundNA.h index 866dbca42..ab70dea55 100644 --- a/src/game/BattleGroundNA.h +++ b/src/game/BattleGroundNA.h @@ -64,7 +64,7 @@ class BattleGroundNA : public BattleGround void RemovePlayer(Player *plr, uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); - virtual void ResetBGSubclass(); + virtual void Reset(); virtual void FillInitialWorldStates(WorldPacket &d); void HandleKillPlayer(Player* player, Player *killer); bool HandlePlayerUnderMap(Player * plr); diff --git a/src/game/BattleGroundRL.cpp b/src/game/BattleGroundRL.cpp index c7877fb1b..b1dbaec55 100644 --- a/src/game/BattleGroundRL.cpp +++ b/src/game/BattleGroundRL.cpp @@ -195,9 +195,10 @@ void BattleGroundRL::FillInitialWorldStates(WorldPacket &data) data << uint32(0xbba) << uint32(1); // 9 } -void BattleGroundRL::ResetBGSubclass() +void BattleGroundRL::Reset() { - + //call parent's reset + BattleGround::Reset(); } bool BattleGroundRL::SetupBattleGround() diff --git a/src/game/BattleGroundRL.h b/src/game/BattleGroundRL.h index 427ed9402..87ac54a98 100644 --- a/src/game/BattleGroundRL.h +++ b/src/game/BattleGroundRL.h @@ -56,12 +56,12 @@ class BattleGroundRL : public BattleGround /* inherited from BattlegroundClass */ virtual void AddPlayer(Player *plr); + virtual void Reset(); + virtual void FillInitialWorldStates(WorldPacket &d); void RemovePlayer(Player *plr, uint64 guid); void HandleAreaTrigger(Player *Source, uint32 Trigger); bool SetupBattleGround(); - virtual void ResetBGSubclass(); - virtual void FillInitialWorldStates(WorldPacket &d); void HandleKillPlayer(Player* player, Player *killer); bool HandlePlayerUnderMap(Player * plr); }; diff --git a/src/game/BattleGroundWS.cpp b/src/game/BattleGroundWS.cpp index 2bea2360c..0c85dff86 100644 --- a/src/game/BattleGroundWS.cpp +++ b/src/game/BattleGroundWS.cpp @@ -629,8 +629,11 @@ bool BattleGroundWS::SetupBattleGround() return true; } -void BattleGroundWS::ResetBGSubclass() +void BattleGroundWS::Reset() { + //call parent's class reset + BattleGround::Reset(); + m_FlagKeepers[BG_TEAM_ALLIANCE] = 0; m_FlagKeepers[BG_TEAM_HORDE] = 0; m_DroppedFlagGUID[BG_TEAM_ALLIANCE] = 0; diff --git a/src/game/BattleGroundWS.h b/src/game/BattleGroundWS.h index d5756d42e..281d182d5 100644 --- a/src/game/BattleGroundWS.h +++ b/src/game/BattleGroundWS.h @@ -159,7 +159,7 @@ class BattleGroundWS : public BattleGround void HandleAreaTrigger(Player *Source, uint32 Trigger); void HandleKillPlayer(Player *player, Player *killer); bool SetupBattleGround(); - virtual void ResetBGSubclass(); + virtual void Reset(); void UpdateFlagState(uint32 team, uint32 value); void UpdateTeamScore(uint32 team); diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 4b5754650..9dc84d62f 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -95,7 +95,6 @@ void WorldSession::HandleMoveWorldportAckOpcode() // cleanup seting if outdated if(!mEntry->IsBattleGroundOrArena()) { - // Do next only if found in battleground _player->SetBattleGroundId(0); // We're not in BG. // reset destination bg team _player->SetBGTeam(0); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 7a9087491..49e6cda37 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -1518,7 +1518,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati } else { - sLog.outDebug("Player %s will teleported to map %u", GetName(), mapid); + sLog.outDebug("Player %s is being teleported to map %u", GetName(), mapid); } // if we were on a transport, leave @@ -14186,6 +14186,10 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) SetBattleGroundId(currentBg->GetInstanceID()); SetBGTeam(bgteam); + //join player to battleground group + currentBg->PlayerRelogin(this); + currentBg->AddOrSetPlayerToCorrectBgGroup(this, GetGUID(), bgteam); + SetInviteForBattleGroundQueueType(bgQueueTypeId,currentBg->GetInstanceID()); } else @@ -18107,40 +18111,6 @@ void Player::SendInitialPacketsAfterAddToMap() SendMessageToSet(&data,true); } - // setup BG group membership if need - if(BattleGround* currentBg = GetBattleGround()) - { - // call for invited (join) or listed (relogin) and avoid other cases (GM teleport) - if (IsInvitedForBattleGroundInstance(GetBattleGroundId()) || - currentBg->IsPlayerInBattleGround(GetGUID())) - { - currentBg->PlayerRelogin(this); - if(currentBg->GetMapId() == GetMapId()) // we teleported/login to/in bg - { - uint32 team = currentBg->GetPlayerTeam(GetGUID()); - if(!team) - team = GetTeam(); - Group* group = currentBg->GetBgRaid(team); - if(!group) // first player joined - { - group = new Group; - currentBg->SetBgRaid(team, group); - group->Create(GetGUIDLow(), GetName()); - } - else // raid already exist - { - if(group->IsMember(GetGUID())) - { - uint8 subgroup = group->GetMemberGroup(GetGUID()); - SetGroup(group, subgroup); - } - else - currentBg->GetBgRaid(team)->AddMember(GetGUID(), GetName()); - } - } - } - } - SendAurasForTarget(this); SendEnchantmentDurations(); // must be after add to map SendItemDurations(); // must be after add to map diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 253f4bc1c..868623fc8 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 "7275" + #define REVISION_NR "7276" #endif // __REVISION_NR_H__