Hello i am getting this error.
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(167): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(168): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(182): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(183): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(184): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(189): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(190): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(191): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(196): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(197): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(198): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(203): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(206): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(207): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(212): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(213): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(216): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(222): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(223): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(226): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(232): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(233): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(236): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(242): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(243): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(246): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Cfbg\Cfbg.cpp(57): warning C4553: '==' : operator has no effect; did you intend '='?
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Cfbg\Cfbg.cpp(62): warning C4553: '==' : operator has no effect; did you intend '='?
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Cfbg\Cfbg.cpp(70): warning C4553: '==' : operator has no effect; did you intend '='?
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Cfbg\Cfbg.cpp(112): error C3861: 'BuildPlayerChat': identifier not found
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Cfbg\Cfbg.cpp(114): error C3861: 'BuildPlayerChat': identifier not found
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAB.cpp(145): error C2660: 'Battleground::RewardReputationToTeam' : function does not take 3 arguments
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Entities\Player\Player.cpp(22886): error C2065: 'LOG_FILTER_PLAYER_LOADING' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(167): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(168): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(182): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(183): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(184): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(189): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(190): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(191): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(196): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(197): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(198): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(203): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(206): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(207): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(212): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(213): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(216): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(222): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(223): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(226): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(232): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(233): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(236): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(242): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(243): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAV.cpp(246): error C2065: 'team' : undeclared identifier
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Cfbg\Cfbg.cpp(57): warning C4553: '==' : operator has no effect; did you intend '='?
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Cfbg\Cfbg.cpp(62): warning C4553: '==' : operator has no effect; did you intend '='?
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Cfbg\Cfbg.cpp(70): warning C4553: '==' : operator has no effect; did you intend '='?
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Cfbg\Cfbg.cpp(112): error C3861: 'BuildPlayerChat': identifier not found
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Cfbg\Cfbg.cpp(114): error C3861: 'BuildPlayerChat': identifier not found
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Battlegrounds\Zones\BattlegroundAB.cpp(145): error C2660: 'Battleground::RewardReputationToTeam' : function does not take 3 arguments
3>C:\Users\Wow\TestMappe\Cores\src\server\game\Entities\Player\Player.cpp(22886): error C2065: 'LOG_FILTER_PLAYER_LOADING' : undeclared identifier
Code:
void BattlegroundAV::HandleQuestComplete(uint32 questid, Player* player)
{
if (GetStatus() != STATUS_IN_PROGRESS)
return;//maybe we should log this, cause this must be a cheater or a big bug
uint8 oteam = GetTeamIndexByTeamId(GetOtherTeam(player->GetTeam()));
/// @todo add reputation, events (including quest not available anymore, next quest availabe, go/npc de/spawning)and maybe honor
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed", questid);
switch (questid)
{
case AV_QUEST_A_SCRAPS1:
case AV_QUEST_A_SCRAPS2:
case AV_QUEST_H_SCRAPS1:
case AV_QUEST_H_SCRAPS2:
m_Team_QuestStatus[team][0]+=20;
if (m_Team_QuestStatus[team][0] == 500 || m_Team_QuestStatus[team][0] == 1000 || m_Team_QuestStatus[team][0] == 1500) //25, 50, 75 turn ins
{
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed starting with unit upgrading..", questid);
for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i)
if (m_Nodes[i].Owner == player->GetTeam() && m_Nodes[i].State == POINT_CONTROLED)
{
DePopulateNode(i);
PopulateNode(i);
//maybe this is bad, because it will instantly respawn all creatures on every grave..
}
}
break;
case AV_QUEST_A_COMMANDER1:
case AV_QUEST_H_COMMANDER1:
m_Team_QuestStatus[team][1]++;
RewardReputationToTeam(team, oteam, 1, player->GetTeam());
if (m_Team_QuestStatus[team][1] == 30)
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
break;
case AV_QUEST_A_COMMANDER2:
case AV_QUEST_H_COMMANDER2:
m_Team_QuestStatus[team][2]++;
RewardReputationToTeam(team, oteam, 1, player->GetTeam());
if (m_Team_QuestStatus[team][2] == 60)
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
break;
case AV_QUEST_A_COMMANDER3:
case AV_QUEST_H_COMMANDER3:
m_Team_QuestStatus[team][3]++;
RewardReputationToTeam(team, oteam, 1, player->GetTeam());;
if (m_Team_QuestStatus[team][3] == 120)
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
break;
case AV_QUEST_A_BOSS1:
case AV_QUEST_H_BOSS1:
m_Team_QuestStatus[team][4] += 9; //you can turn in 10 or 1 item..
case AV_QUEST_A_BOSS2:
case AV_QUEST_H_BOSS2:
m_Team_QuestStatus[team][4]++;
if (m_Team_QuestStatus[team][4] >= 200)
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
break;
case AV_QUEST_A_NEAR_MINE:
case AV_QUEST_H_NEAR_MINE:
m_Team_QuestStatus[team][5]++;
if (m_Team_QuestStatus[team][5] == 28)
{
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[team][6] == 7)
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid);
}
break;
case AV_QUEST_A_OTHER_MINE:
case AV_QUEST_H_OTHER_MINE:
m_Team_QuestStatus[team][6]++;
if (m_Team_QuestStatus[team][6] == 7)
{
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[team][5] == 20)
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - ground assault ready", questid);
}
break;
case AV_QUEST_A_RIDER_HIDE:
case AV_QUEST_H_RIDER_HIDE:
m_Team_QuestStatus[team][7]++;
if (m_Team_QuestStatus[team][7] == 25)
{
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[team][8] == 25)
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid);
}
break;
case AV_QUEST_A_RIDER_TAME:
case AV_QUEST_H_RIDER_TAME:
m_Team_QuestStatus[team][8]++;
if (m_Team_QuestStatus[team][8] == 25)
{
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here", questid);
if (m_Team_QuestStatus[team][7] == 25)
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed (need to implement some events here - rider assault ready", questid);
}
break;
default:
TC_LOG_DEBUG("bg.battleground", "BG_AV Quest %i completed but is not interesting at all", questid);
return; //was no interesting quest at all
break;
}
}
Code:
#include "Cfbg.h"
#include "Battleground.h"
#include "BattlegroundMgr.h"
#include "Player.h"
#include "Chat.h"
#include "BattlegroundQueue.h"
/*####################################################################################
###############################CROSSFACTION BATTLEGROUNDS#############################
####################################################################################*/
uint8 Unit::getRace(bool forceoriginal) const
{
if (GetTypeId() == TYPEID_PLAYER)
{
Player* pPlayer = ((Player*)this);
if (forceoriginal)
return pPlayer->getORace();
if (pPlayer->InArena())
return GetByteValue(UNIT_FIELD_BYTES_0, 0);
if (!pPlayer->IsPlayingNative())
return pPlayer->getFRace();
}
return GetByteValue(UNIT_FIELD_BYTES_0, 0);
}
bool Player::SendRealNameQuery()
{
if (IsPlayingNative())
return false;
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8 + 1 + 1 + 1 + 1 + 1 + 10));
data.appendPackGUID(GetGUID()); // player guid
data << uint8(0); // added in 3.1; if > 1, then end of packet
data << GetName(); // played name
data << uint8(0); // realm name for cross realm BG usage
data << uint8(getORace());
data << uint8(getGender());
data << uint8(getClass());
data << uint8(0); // is not declined
GetSession()->SendPacket(&data);
return true;
}
void Player::SetFakeRaceAndMorph()
{
if (getClass() == CLASS_DRUID)
{
if (GetOTeam() == ALLIANCE)
{
m_FakeMorph = getGender() == GENDER_MALE ? FAKE_M_TAUREN : FAKE_F_TAUREN;
m_FakeRace == RACE_TAUREN;
}
else if (getGender() == GENDER_MALE) // HORDE PLAYER, ONLY HAVE MALE NELF ID
{
m_FakeMorph = FAKE_M_NELF;
m_FakeRace == RACE_NIGHTELF;
}
else
m_FakeRace = GetOTeam() == ALLIANCE ? RACE_BLOODELF : RACE_HUMAN;
}
else if (getClass() == CLASS_SHAMAN && GetOTeam() == HORDE && getGender() == GENDER_FEMALE)
{
m_FakeMorph = FAKE_F_DRANAEI; // Female Draenei
m_FakeRace == RACE_DRAENEI;
}
else
{
m_FakeRace = GetOTeam() == ALLIANCE ? RACE_BLOODELF : RACE_HUMAN;
if (GetOTeam() == HORDE)
{
if (getGender() == GENDER_MALE)
m_FakeMorph = 19723;
else
m_FakeMorph = 19724;
}
else
{
if (getGender() == GENDER_MALE)
m_FakeMorph = 20578;
else
m_FakeMorph = 20579;
}
}
}
bool Player::SendBattleGroundChat(uint32 msgtype, std::string message)
{
// Select distance to broadcast to.
float distance = msgtype == CHAT_MSG_SAY ? sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_SAY) : sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_YELL);
if (Battleground* pBattleGround = GetBattleground())
{
if (pBattleGround->isArena()) // Only fake chat in BG's. CFBG should not interfere with arenas.
return false;
for (Battleground::BattlegroundPlayerMap::const_iterator itr = pBattleGround->GetPlayers().begin(); itr != pBattleGround->GetPlayers().end(); ++itr)
{
if (Player* pPlayer = ObjectAccessor::FindPlayer(itr->first))
{
if (GetDistance2d(pPlayer->GetPositionX(), pPlayer->GetPositionY()) <= distance)
{
WorldPacket data(SMSG_MESSAGECHAT, 200);
if (GetTeam() == pPlayer->GetTeam())
BuildPlayerChat(&data, msgtype, message, LANG_UNIVERSAL);
else if (msgtype != CHAT_MSG_EMOTE)
BuildPlayerChat(&data, msgtype, message, pPlayer->GetTeam() == ALLIANCE ? LANG_ORCISH : LANG_COMMON);
pPlayer->GetSession()->SendPacket(&data);
}
}
}
return true;
}
else
return false;
}
void Player::MorphFit(bool value)
{
if (!IsPlayingNative() && value)
{
SetDisplayId(GetFakeMorph());
SetNativeDisplayId(GetFakeMorph());
}
else
InitDisplayIds();
}
void Player::FitPlayerInTeam(bool action, Battleground* pBattleGround)
{
if (!pBattleGround)
pBattleGround = GetBattleground();
if ((!pBattleGround || pBattleGround->isArena()) && action)
return;
if(!IsPlayingNative() && action)
setFactionForRace(getRace());
else
setFactionForRace(getORace());
if (action)
SetForgetBGPlayers(true);
else
SetForgetInListPlayers(true);
MorphFit(action);
if (pBattleGround && action)
SendChatMessage("%sYou are playing for the %s%s in this %s", MSG_COLOR_WHITE, GetTeam() == ALLIANCE ? MSG_COLOR_DARKBLUE"alliance" : MSG_COLOR_RED"horde", MSG_COLOR_WHITE, pBattleGround->GetName());
}
void Player::DoForgetPlayersInList()
{
// m_FakePlayers is filled from a vector within the battleground
// they were in previously so all players that have been in that BG will be invalidated.
for (FakePlayers::const_iterator itr = m_FakePlayers.begin(); itr != m_FakePlayers.end(); ++itr)
{
WorldPacket data(SMSG_INVALIDATE_PLAYER, 8);
data << *itr;
GetSession()->SendPacket(&data);
if (Player* pPlayer = ObjectAccessor::FindPlayer(*itr))
GetSession()->SendNameQueryOpcode(pPlayer->GetGUID());
}
m_FakePlayers.clear();
}
void Player::DoForgetPlayersInBG(Battleground* pBattleGround)
{
for (Battleground::BattlegroundPlayerMap::const_iterator itr = pBattleGround->GetPlayers().begin(); itr != pBattleGround->GetPlayers().end(); ++itr)
{
// Here we invalidate players in the bg to the added player
WorldPacket data1(SMSG_INVALIDATE_PLAYER, 8);
data1 << itr->first;
GetSession()->SendPacket(&data1);
if (Player* pPlayer = ObjectAccessor::FindPlayer(itr->first))
{
GetSession()->SendNameQueryOpcode(pPlayer->GetGUID()); // Send namequery answer instantly if player is available
// Here we invalidate the player added to players in the bg
WorldPacket data2(SMSG_INVALIDATE_PLAYER, 8);
data2 << GetGUID();
pPlayer->GetSession()->SendPacket(&data2);
pPlayer->GetSession()->SendNameQueryOpcode(GetGUID());
}
}
}
bool BattlegroundQueue::CheckCrossFactionMatch(BattlegroundBracketId bracket_id, Battleground* bg)
{
if (!sWorld->getBoolConfig(BATTLEGROUND_CROSSFACTION_ENABLED) || bg->isArena())
return false; // Only do this if crossbg's are enabled.
// Here we will add all players to selectionpool, later we check if there are enough and launch a bg.
FillXPlayersToBG(bracket_id, bg, true);
if (sBattlegroundMgr->isTesting() && (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() || m_SelectionPools[TEAM_HORDE].GetPlayerCount()))
return true;
uint8 MPT = bg->GetMinPlayersPerTeam();
if (m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() < MPT || m_SelectionPools[TEAM_HORDE].GetPlayerCount() < MPT)
return false;
return true;
}
// This function will invite players in the least populated faction, which makes battleground queues much faster.
// This function will return true if cross faction battlegrounds are enabled, otherwise return false,
// which is useful in FillPlayersToBG. Because then we can interrupt the regular invitation if cross faction bg's are enabled.
bool BattlegroundQueue::FillXPlayersToBG(BattlegroundBracketId bracket_id, Battleground* bg, bool start)
{
uint8 queuedPeople = 0;
for (GroupsQueueType::const_iterator itr = m_QueuedGroups[bracket_id][BG_QUEUE_MIXED].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_MIXED].end(); ++itr)
if (!(*itr)->IsInvitedToBGInstanceGUID)
queuedPeople += (*itr)->Players.size();
if (sWorld->getBoolConfig(BATTLEGROUND_CROSSFACTION_ENABLED) && (sBattlegroundMgr->isTesting() || queuedPeople >= bg->GetMinPlayersPerTeam()*2 || !start))
{
int32 aliFree = start ? bg->GetMaxPlayersPerTeam() : bg->GetFreeSlotsForTeam(ALLIANCE);
int32 hordeFree = start ? bg->GetMaxPlayersPerTeam() : bg->GetFreeSlotsForTeam(HORDE);
// Empty selection pools. They will be refilled from queued groups.
m_SelectionPools[TEAM_ALLIANCE].Init();
m_SelectionPools[TEAM_HORDE].Init();
int32 valiFree = aliFree;
int32 vhordeFree = hordeFree;
int32 diff = 0;
// Add teams to their own factions as far as possible.
if (start)
{
QueuedGroupMap m_PreGroupMap_a, m_PreGroupMap_h;
int32 m_SmallestOfTeams = 0;
int32 queuedAlliance = 0;
int32 queuedHorde = 0;
for (GroupsQueueType::const_iterator itr = m_QueuedGroups[bracket_id][BG_QUEUE_MIXED].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_MIXED].end(); ++itr)
{
if ((*itr)->IsInvitedToBGInstanceGUID)
continue;
bool alliance = (*itr)->OTeam == ALLIANCE;
if (alliance)
{
m_PreGroupMap_a.insert(std::make_pair((*itr)->Players.size(), *itr));
queuedAlliance += (*itr)->Players.size();
}
else
{
m_PreGroupMap_h.insert(std::make_pair((*itr)->Players.size(), *itr));
queuedHorde += (*itr)->Players.size();
}
}
m_SmallestOfTeams = std::min(std::min(aliFree, queuedAlliance), std::min(hordeFree, queuedHorde));
valiFree -= PreAddPlayers(m_PreGroupMap_a, m_SmallestOfTeams, aliFree);
vhordeFree -= PreAddPlayers(m_PreGroupMap_h, m_SmallestOfTeams, hordeFree);
}
QueuedGroupMap m_QueuedGroupMap;
for (GroupsQueueType::const_iterator itr = m_QueuedGroups[bracket_id][BG_QUEUE_MIXED].begin(); itr != m_QueuedGroups[bracket_id][BG_QUEUE_MIXED].end(); ++itr)
m_QueuedGroupMap.insert(std::make_pair((*itr)->Players.size(), *itr));
for (QueuedGroupMap::reverse_iterator itr = m_QueuedGroupMap.rbegin(); itr != m_QueuedGroupMap.rend(); ++itr)
{
GroupsQueueType allypool = m_SelectionPools[TEAM_ALLIANCE].SelectedGroups;
GroupsQueueType hordepool = m_SelectionPools[TEAM_HORDE].SelectedGroups;
GroupQueueInfo* ginfo = itr->second;
// If player already was invited via pre adding (add to own team first) or he was already invited to a bg, skip.
if (ginfo->IsInvitedToBGInstanceGUID ||
std::find(allypool.begin(), allypool.end(), ginfo) != allypool.end() ||
std::find(hordepool.begin(), hordepool.end(), ginfo) != hordepool.end() ||
(m_SelectionPools[TEAM_ALLIANCE].GetPlayerCount() >= bg->GetMinPlayersPerTeam() &&
m_SelectionPools[TEAM_HORDE].GetPlayerCount() >= bg->GetMinPlayersPerTeam()))
continue;
diff = abs(valiFree - vhordeFree);
bool moreAli = valiFree < vhordeFree;
if (diff > 0)
ginfo->Team = moreAli ? HORDE : ALLIANCE;
bool alliance = ginfo->Team == ALLIANCE;
if (m_SelectionPools[alliance ? TEAM_ALLIANCE : TEAM_HORDE].AddGroup(ginfo, alliance ? aliFree : hordeFree))
alliance ? valiFree -= ginfo->Players.size() : vhordeFree -= ginfo->Players.size();
}
return true;
}
return false;
}
int32 BattlegroundQueue::PreAddPlayers(QueuedGroupMap m_PreGroupMap, int32 MaxAdd, uint32 MaxInTeam)
{
int32 LeftToAdd = MaxAdd;
uint32 Added = 0;
for (QueuedGroupMap::reverse_iterator itr = m_PreGroupMap.rbegin(); itr != m_PreGroupMap.rend(); ++itr)
{
int32 PlayerSize = itr->first;
bool alliance = itr->second->OTeam == ALLIANCE;
if (PlayerSize <= LeftToAdd && m_SelectionPools[alliance ? TEAM_ALLIANCE : TEAM_HORDE].AddGroup(itr->second, MaxInTeam))
LeftToAdd -= PlayerSize, Added -= PlayerSize;
}
return LeftToAdd;
}
void Player::SendChatMessage(const char *format, ...)
{
if (!IsInWorld())
return;
if (format)
{
va_list ap;
char str [2048];
va_start(ap, format);
vsnprintf(str, 2048, format, ap);
va_end(ap);
ChatHandler(GetSession()).SendSysMessage(str);
}
}
Code:
if (m_lastTick[team] > BG_AB_TickIntervals[points])
{
m_lastTick[team] -= BG_AB_TickIntervals[points];
m_TeamScores[team] += BG_AB_TickPoints[points];
m_HonorScoreTics[team] += BG_AB_TickPoints[points];
m_ReputationScoreTics[team] += BG_AB_TickPoints[points];
if (m_ReputationScoreTics[team] >= m_ReputationTics)
{
(team == TEAM_ALLIANCE) ? RewardReputationToTeam(509, 10, ALLIANCE) : RewardReputationToTeam(510, 10, HORDE);
m_ReputationScoreTics[team] -= m_ReputationTics;
}
if (m_HonorScoreTics[team] >= m_HonorTics)
{
RewardHonorToTeam(GetBonusHonorFromKill(1), (team == TEAM_ALLIANCE) ? ALLIANCE : HORDE);
m_HonorScoreTics[team] -= m_HonorTics;
}
if (!m_IsInformedNearVictory && m_TeamScores[team] > BG_AB_WARNING_NEAR_VICTORY_SCORE)
{
if (team == TEAM_ALLIANCE)
SendMessageToAll(LANG_BG_AB_A_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
else
SendMessageToAll(LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
m_IsInformedNearVictory = true;
}
if (m_TeamScores[team] > BG_AB_MAX_TEAM_SCORE)
m_TeamScores[team] = BG_AB_MAX_TEAM_SCORE;
if (team == TEAM_ALLIANCE)
UpdateWorldState(BG_AB_OP_RESOURCES_ALLY, m_TeamScores[team]);
else if (team == TEAM_HORDE)
UpdateWorldState(BG_AB_OP_RESOURCES_HORDE, m_TeamScores[team]);
// update achievement flags
// we increased m_TeamScores[team] so we just need to check if it is 500 more than other teams resources
uint8 otherTeam = (team + 1) % BG_TEAMS_COUNT;
if (m_TeamScores[team] > m_TeamScores[otherTeam] + 500)
m_TeamScores500Disadvantage[otherTeam] = true;
}
}
Code:
void Player::learnDefaultSpells()
{
// learn default race/class spells
PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getORace(), getClass());
for (PlayerCreateInfoSpells::const_iterator itr = info->spell.begin(); itr != info->spell.end(); ++itr)
{
uint32 tspell = *itr;
TC_LOG_DEBUG(LOG_FILTER_PLAYER_LOADING, "PLAYER (Class: %u Race: %u): Adding initial spell, id = %u", uint32(getClass()), uint32(getORace()), tspell);
if (!IsInWorld()) // will send in INITIAL_SPELLS in list anyway at map add
if (!IsInWorld()) // will send in INITIAL_SPELLS in list anyway at map add
addSpell(tspell, true, true, true, false);
else // but send in normal spell in game learn case
learnSpell(tspell, true);
}
}