mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-29 16:43:47 +00:00
converted all tabs to 4 spaces
This commit is contained in:
@@ -94,7 +94,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
|
||||
if (GetMembersSize() >= GetType() * 2)
|
||||
return false;
|
||||
|
||||
// xinef: Get player name and class from player storage or global data storage
|
||||
// xinef: Get player name and class from player storage or global data storage
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(playerGuid);
|
||||
if (player)
|
||||
{
|
||||
@@ -103,12 +103,12 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
|
||||
}
|
||||
else
|
||||
{
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(playerGuid));
|
||||
if (!playerData)
|
||||
return false;
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(playerGuid));
|
||||
if (!playerData)
|
||||
return false;
|
||||
|
||||
playerName = playerData->name;
|
||||
playerClass = playerData->playerClass;
|
||||
playerName = playerData->name;
|
||||
playerClass = playerData->playerClass;
|
||||
}
|
||||
|
||||
// Check if player is already in a similar arena team
|
||||
@@ -126,7 +126,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
|
||||
else if (GetRating() >= 1000)
|
||||
personalRating = 1000;
|
||||
|
||||
// xinef: zomg! sync query
|
||||
// xinef: zomg! sync query
|
||||
// Try to get player's match maker rating from db and fall back to config setting if not found
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MATCH_MAKER_RATING);
|
||||
stmt->setUInt32(0, GUID_LOPART(playerGuid));
|
||||
@@ -162,10 +162,10 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
|
||||
newMember.WeekWins = 0;
|
||||
newMember.PersonalRating = personalRating;
|
||||
newMember.MatchMakerRating = matchMakerRating;
|
||||
newMember.MaxMMR = maxMMR;
|
||||
newMember.MaxMMR = maxMMR;
|
||||
|
||||
Members.push_back(newMember);
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(playerGuid), GetSlot(), GetId());
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(playerGuid), GetSlot(), GetId());
|
||||
|
||||
// Save player's arena team membership to db
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER);
|
||||
@@ -244,7 +244,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
|
||||
newMember.Class = fields[7].GetUInt8();
|
||||
newMember.PersonalRating = fields[8].GetUInt16();
|
||||
newMember.MatchMakerRating = fields[9].GetUInt16() > 0 ? fields[9].GetUInt16() : sWorld->getIntConfig(CONFIG_ARENA_START_MATCHMAKER_RATING);;
|
||||
newMember.MaxMMR = std::max(fields[10].GetUInt16(), newMember.MatchMakerRating);
|
||||
newMember.MaxMMR = std::max(fields[10].GetUInt16(), newMember.MatchMakerRating);
|
||||
|
||||
// Delete member if character information is missing
|
||||
if (fields[6].GetString().empty())
|
||||
@@ -260,7 +260,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
|
||||
|
||||
// Put the player in the team
|
||||
Members.push_back(newMember);
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(newMember.Guid), GetSlot(), GetId());
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(newMember.Guid), GetSlot(), GetId());
|
||||
}
|
||||
while (result->NextRow());
|
||||
|
||||
@@ -310,7 +310,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
|
||||
if (itr->Guid == guid)
|
||||
{
|
||||
Members.erase(itr);
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(guid), GetSlot(), 0);
|
||||
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(guid), GetSlot(), 0);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -367,7 +367,7 @@ void ArenaTeam::Roster(WorldSession* session)
|
||||
Player* player = NULL;
|
||||
|
||||
uint8 unk308 = 0;
|
||||
std::string tempName;
|
||||
std::string tempName;
|
||||
|
||||
WorldPacket data(SMSG_ARENA_TEAM_ROSTER, 100);
|
||||
data << uint32(GetId()); // team id
|
||||
@@ -381,9 +381,9 @@ void ArenaTeam::Roster(WorldSession* session)
|
||||
|
||||
data << uint64(itr->Guid); // guid
|
||||
data << uint8((player ? 1 : 0)); // online flag
|
||||
tempName = "";
|
||||
sObjectMgr->GetPlayerNameByGUID(itr->Guid, tempName);
|
||||
data << tempName; // member name
|
||||
tempName = "";
|
||||
sObjectMgr->GetPlayerNameByGUID(itr->Guid, tempName);
|
||||
data << tempName; // member name
|
||||
data << uint32((itr->Guid == GetCaptain() ? 0 : 1));// captain flag 0 captain 1 member
|
||||
data << uint8((player ? player->getLevel() : 0)); // unknown, level?
|
||||
data << uint8(itr->Class); // class
|
||||
@@ -474,20 +474,20 @@ void ArenaTeamMember::ModifyPersonalRating(Player* player, int32 mod, uint32 typ
|
||||
|
||||
void ArenaTeamMember::ModifyMatchmakerRating(int32 mod, uint32 /*slot*/)
|
||||
{
|
||||
if (mod < 0)
|
||||
{
|
||||
// pussywizard: prevent lowering MMR too much from max achieved MMR
|
||||
int32 maxAllowedDrop = (int32)sWorld->getIntConfig(CONFIG_MAX_ALLOWED_MMR_DROP);
|
||||
mod = std::min<int32>(std::max<int32>(-((int32)MatchMakerRating - (int32)MaxMMR + maxAllowedDrop), mod), 0);
|
||||
}
|
||||
if (mod < 0)
|
||||
{
|
||||
// pussywizard: prevent lowering MMR too much from max achieved MMR
|
||||
int32 maxAllowedDrop = (int32)sWorld->getIntConfig(CONFIG_MAX_ALLOWED_MMR_DROP);
|
||||
mod = std::min<int32>(std::max<int32>(-((int32)MatchMakerRating - (int32)MaxMMR + maxAllowedDrop), mod), 0);
|
||||
}
|
||||
|
||||
if (int32(MatchMakerRating) + mod < 0)
|
||||
MatchMakerRating = 0;
|
||||
else
|
||||
MatchMakerRating += mod;
|
||||
|
||||
if (MatchMakerRating > MaxMMR)
|
||||
MaxMMR = MatchMakerRating;
|
||||
if (MatchMakerRating > MaxMMR)
|
||||
MaxMMR = MatchMakerRating;
|
||||
}
|
||||
|
||||
void ArenaTeam::BroadcastPacket(WorldPacket* packet)
|
||||
@@ -785,11 +785,11 @@ void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32
|
||||
itr->ModifyPersonalRating(player, mod, GetType());
|
||||
|
||||
// update matchmaker rating (pussywizard: but don't allow it to go over team rating)
|
||||
if (itr->MatchMakerRating < Stats.Rating)
|
||||
{
|
||||
mod = std::min(MatchmakerRatingChange, Stats.Rating - itr->MatchMakerRating);
|
||||
itr->ModifyMatchmakerRating(mod, GetSlot());
|
||||
}
|
||||
if (itr->MatchMakerRating < Stats.Rating)
|
||||
{
|
||||
mod = std::min(MatchmakerRatingChange, Stats.Rating - itr->MatchMakerRating);
|
||||
itr->ModifyMatchmakerRating(mod, GetSlot());
|
||||
}
|
||||
|
||||
// update personal stats
|
||||
itr->WeekGames +=1;
|
||||
@@ -867,7 +867,7 @@ void ArenaTeam::SaveToDB()
|
||||
stmt->setUInt32(0, GUID_LOPART(itr->Guid));
|
||||
stmt->setUInt8(1, GetSlot());
|
||||
stmt->setUInt16(2, itr->MatchMakerRating);
|
||||
stmt->setUInt16(3, itr->MaxMMR);
|
||||
stmt->setUInt16(3, itr->MaxMMR);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
@@ -900,7 +900,7 @@ bool ArenaTeam::IsFighting() const
|
||||
|
||||
ArenaTeamMember* ArenaTeam::GetMember(const std::string& name)
|
||||
{
|
||||
return GetMember(sObjectMgr->GetPlayerGUIDByName(name));
|
||||
return GetMember(sObjectMgr->GetPlayerGUIDByName(name));
|
||||
}
|
||||
|
||||
ArenaTeamMember* ArenaTeam::GetMember(uint64 guid)
|
||||
|
||||
@@ -97,7 +97,7 @@ struct ArenaTeamMember
|
||||
uint16 SeasonWins;
|
||||
uint16 PersonalRating;
|
||||
uint16 MatchMakerRating;
|
||||
uint16 MaxMMR;
|
||||
uint16 MaxMMR;
|
||||
|
||||
void ModifyPersonalRating(Player* player, int32 mod, uint32 type);
|
||||
void ModifyMatchmakerRating(int32 mod, uint32 slot);
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
ArenaTeamMgr::ArenaTeamMgr()
|
||||
{
|
||||
NextArenaTeamId = 1;
|
||||
LastArenaLogId = 0;
|
||||
LastArenaLogId = 0;
|
||||
}
|
||||
|
||||
ArenaTeamMgr::~ArenaTeamMgr()
|
||||
|
||||
@@ -45,13 +45,13 @@ public:
|
||||
uint32 GenerateArenaTeamId();
|
||||
void SetNextArenaTeamId(uint32 Id) { NextArenaTeamId = Id; }
|
||||
|
||||
uint32 GetNextArenaLogId() { return ++LastArenaLogId; }
|
||||
void SetLastArenaLogId(uint32 id) { LastArenaLogId = id; }
|
||||
uint32 GetNextArenaLogId() { return ++LastArenaLogId; }
|
||||
void SetLastArenaLogId(uint32 id) { LastArenaLogId = id; }
|
||||
|
||||
protected:
|
||||
uint32 NextArenaTeamId;
|
||||
ArenaTeamContainer ArenaTeamStore;
|
||||
uint32 LastArenaLogId;
|
||||
uint32 LastArenaLogId;
|
||||
};
|
||||
|
||||
#define sArenaTeamMgr ACE_Singleton<ArenaTeamMgr, ACE_Null_Mutex>::instance()
|
||||
|
||||
@@ -175,8 +175,8 @@ Battleground::Battleground()
|
||||
m_PlayersCount[TEAM_ALLIANCE] = 0;
|
||||
m_PlayersCount[TEAM_HORDE] = 0;
|
||||
|
||||
m_BgInvitedPlayers[TEAM_ALLIANCE]= 0;
|
||||
m_BgInvitedPlayers[TEAM_HORDE] = 0;
|
||||
m_BgInvitedPlayers[TEAM_ALLIANCE]= 0;
|
||||
m_BgInvitedPlayers[TEAM_HORDE] = 0;
|
||||
|
||||
m_TeamScores[TEAM_ALLIANCE] = 0;
|
||||
m_TeamScores[TEAM_HORDE] = 0;
|
||||
@@ -196,8 +196,8 @@ Battleground::Battleground()
|
||||
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
|
||||
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
|
||||
|
||||
// pussywizard:
|
||||
m_UpdateTimer = 0;
|
||||
// pussywizard:
|
||||
m_UpdateTimer = 0;
|
||||
}
|
||||
|
||||
Battleground::~Battleground()
|
||||
@@ -228,13 +228,13 @@ Battleground::~Battleground()
|
||||
|
||||
void Battleground::Update(uint32 diff)
|
||||
{
|
||||
// pussywizard:
|
||||
m_UpdateTimer += diff;
|
||||
if (m_UpdateTimer < BATTLEGROUND_UPDATE_INTERVAL)
|
||||
return;
|
||||
// pussywizard:
|
||||
m_UpdateTimer += diff;
|
||||
if (m_UpdateTimer < BATTLEGROUND_UPDATE_INTERVAL)
|
||||
return;
|
||||
|
||||
diff = BATTLEGROUND_UPDATE_INTERVAL; // just change diff value, no need to replace variable name in many places
|
||||
m_UpdateTimer -= BATTLEGROUND_UPDATE_INTERVAL;
|
||||
diff = BATTLEGROUND_UPDATE_INTERVAL; // just change diff value, no need to replace variable name in many places
|
||||
m_UpdateTimer -= BATTLEGROUND_UPDATE_INTERVAL;
|
||||
|
||||
if (!PreUpdateImpl(diff))
|
||||
return;
|
||||
@@ -303,7 +303,7 @@ inline void Battleground::_CheckSafePositions(uint32 diff)
|
||||
float x, y, z, o;
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
{
|
||||
itr->second->GetPosition(&pos);
|
||||
itr->second->GetPosition(&pos);
|
||||
GetTeamStartLoc(itr->second->GetBgTeamId(), x, y, z, o);
|
||||
if (pos.GetExactDistSq(x, y, z) > maxDist)
|
||||
{
|
||||
@@ -468,32 +468,32 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
m_Events |= BG_STARTING_EVENT_3;
|
||||
SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
|
||||
if (isArena())
|
||||
switch (GetBgTypeID())
|
||||
{
|
||||
case BATTLEGROUND_NA:
|
||||
DelObject(BG_NA_OBJECT_READY_MARKER_1);
|
||||
DelObject(BG_NA_OBJECT_READY_MARKER_2);
|
||||
break;
|
||||
case BATTLEGROUND_BE:
|
||||
DelObject(BG_BE_OBJECT_READY_MARKER_1);
|
||||
DelObject(BG_BE_OBJECT_READY_MARKER_2);
|
||||
break;
|
||||
case BATTLEGROUND_RL:
|
||||
DelObject(BG_RL_OBJECT_READY_MARKER_1);
|
||||
DelObject(BG_RL_OBJECT_READY_MARKER_2);
|
||||
break;
|
||||
case BATTLEGROUND_DS:
|
||||
DelObject(BG_DS_OBJECT_READY_MARKER_1);
|
||||
DelObject(BG_DS_OBJECT_READY_MARKER_2);
|
||||
break;
|
||||
case BATTLEGROUND_RV:
|
||||
DelObject(BG_RV_OBJECT_READY_MARKER_1);
|
||||
DelObject(BG_RV_OBJECT_READY_MARKER_2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (isArena())
|
||||
switch (GetBgTypeID())
|
||||
{
|
||||
case BATTLEGROUND_NA:
|
||||
DelObject(BG_NA_OBJECT_READY_MARKER_1);
|
||||
DelObject(BG_NA_OBJECT_READY_MARKER_2);
|
||||
break;
|
||||
case BATTLEGROUND_BE:
|
||||
DelObject(BG_BE_OBJECT_READY_MARKER_1);
|
||||
DelObject(BG_BE_OBJECT_READY_MARKER_2);
|
||||
break;
|
||||
case BATTLEGROUND_RL:
|
||||
DelObject(BG_RL_OBJECT_READY_MARKER_1);
|
||||
DelObject(BG_RL_OBJECT_READY_MARKER_2);
|
||||
break;
|
||||
case BATTLEGROUND_DS:
|
||||
DelObject(BG_DS_OBJECT_READY_MARKER_1);
|
||||
DelObject(BG_DS_OBJECT_READY_MARKER_2);
|
||||
break;
|
||||
case BATTLEGROUND_RV:
|
||||
DelObject(BG_RV_OBJECT_READY_MARKER_1);
|
||||
DelObject(BG_RV_OBJECT_READY_MARKER_2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Delay expired (after 2 or 1 minute)
|
||||
else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4))
|
||||
@@ -541,31 +541,31 @@ inline void Battleground::_ProcessJoin(uint32 diff)
|
||||
player->UpdateObjectVisibility(true);
|
||||
}
|
||||
|
||||
for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr)
|
||||
ArenaSpectator::HandleResetCommand(*itr);
|
||||
for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr)
|
||||
ArenaSpectator::HandleResetCommand(*itr);
|
||||
|
||||
CheckArenaWinConditions();
|
||||
|
||||
// pussywizard: arena spectator stuff
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
for (ToBeTeleportedMap::const_iterator itr = m_ToBeTeleported.begin(); itr != m_ToBeTeleported.end(); ++itr)
|
||||
if (Player* p = ObjectAccessor::GetObjectInOrOutOfWorld(itr->first, (Player*)NULL))
|
||||
if (Player* t = ObjectAccessor::FindPlayer(itr->second))
|
||||
{
|
||||
if (!t->FindMap() || t->FindMap() != GetBgMap())
|
||||
continue;
|
||||
// pussywizard: arena spectator stuff
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
for (ToBeTeleportedMap::const_iterator itr = m_ToBeTeleported.begin(); itr != m_ToBeTeleported.end(); ++itr)
|
||||
if (Player* p = ObjectAccessor::GetObjectInOrOutOfWorld(itr->first, (Player*)NULL))
|
||||
if (Player* t = ObjectAccessor::FindPlayer(itr->second))
|
||||
{
|
||||
if (!t->FindMap() || t->FindMap() != GetBgMap())
|
||||
continue;
|
||||
|
||||
p->SetSummonPoint(t->GetMapId(), t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 15, true);
|
||||
p->SetSummonPoint(t->GetMapId(), t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 15, true);
|
||||
|
||||
WorldPacket data(SMSG_SUMMON_REQUEST, 8+4+4);
|
||||
data << uint64(t->GetGUID());
|
||||
data << uint32(t->GetZoneId());
|
||||
data << uint32(15*IN_MILLISECONDS);
|
||||
p->GetSession()->SendPacket(&data);
|
||||
}
|
||||
m_ToBeTeleported.clear();
|
||||
}
|
||||
WorldPacket data(SMSG_SUMMON_REQUEST, 8+4+4);
|
||||
data << uint64(t->GetGUID());
|
||||
data << uint32(t->GetZoneId());
|
||||
data << uint32(15*IN_MILLISECONDS);
|
||||
p->GetSession()->SendPacket(&data);
|
||||
}
|
||||
m_ToBeTeleported.clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -599,7 +599,7 @@ inline void Battleground::_ProcessLeave(uint32 diff)
|
||||
{
|
||||
next = itr;
|
||||
++next;
|
||||
itr->second->LeaveBattleground(this); //itr is erased here!
|
||||
itr->second->LeaveBattleground(this); //itr is erased here!
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -621,7 +621,7 @@ void Battleground::SendPacketToAll(WorldPacket* packet)
|
||||
void Battleground::SendPacketToTeam(TeamId teamId, WorldPacket* packet, Player* sender, bool self)
|
||||
{
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (itr->second->GetBgTeamId() == teamId && (self || sender != itr->second))
|
||||
if (itr->second->GetBgTeamId() == teamId && (self || sender != itr->second))
|
||||
itr->second->GetSession()->SendPacket(packet);
|
||||
}
|
||||
|
||||
@@ -651,8 +651,8 @@ void Battleground::YellToAll(Creature* creature, char const* text, uint32 langua
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
WorldPacket data;
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, Language(language), creature, itr->second, text);
|
||||
itr->second->SendDirectMessage(&data);
|
||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, Language(language), creature, itr->second, text);
|
||||
itr->second->SendDirectMessage(&data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -668,12 +668,12 @@ void Battleground::RewardReputationToTeam(uint32 factionId, uint32 reputation, T
|
||||
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId))
|
||||
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
if (itr->second->GetBgTeamId() == teamId)
|
||||
{
|
||||
uint32 repGain = reputation;
|
||||
AddPct(repGain, itr->second->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
|
||||
AddPct(repGain, itr->second->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, factionId));
|
||||
itr->second->GetReputationMgr().ModifyReputation(factionEntry, repGain);
|
||||
}
|
||||
{
|
||||
uint32 repGain = reputation;
|
||||
AddPct(repGain, itr->second->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
|
||||
AddPct(repGain, itr->second->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, factionId));
|
||||
itr->second->GetReputationMgr().ModifyReputation(factionEntry, repGain);
|
||||
}
|
||||
}
|
||||
|
||||
void Battleground::UpdateWorldState(uint32 Field, uint32 Value)
|
||||
@@ -692,15 +692,15 @@ void Battleground::UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player*
|
||||
|
||||
void Battleground::EndBattleground(TeamId winnerTeamId)
|
||||
{
|
||||
// xinef: if this is true, it means that endbattleground is called second time
|
||||
// skip to avoid double rating reduce / add
|
||||
// can bug out due to multithreading ?
|
||||
// set as fast as possible
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
uint32 startDelay = StartDelayTimes[BG_STARTING_EVENT_FIRST]; // = BG_START_DELAY_1M = 60000 for all arenas
|
||||
bool bValidArena = isArena() && isRated() && GetStatus() == STATUS_IN_PROGRESS && GetStartTime() >= startDelay+15000; // pussywizard: only if arena lasted at least 15 secs
|
||||
SetStatus(STATUS_WAIT_LEAVE);
|
||||
// xinef: if this is true, it means that endbattleground is called second time
|
||||
// skip to avoid double rating reduce / add
|
||||
// can bug out due to multithreading ?
|
||||
// set as fast as possible
|
||||
if (GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return;
|
||||
uint32 startDelay = StartDelayTimes[BG_STARTING_EVENT_FIRST]; // = BG_START_DELAY_1M = 60000 for all arenas
|
||||
bool bValidArena = isArena() && isRated() && GetStatus() == STATUS_IN_PROGRESS && GetStartTime() >= startDelay+15000; // pussywizard: only if arena lasted at least 15 secs
|
||||
SetStatus(STATUS_WAIT_LEAVE);
|
||||
|
||||
ArenaTeam* winnerArenaTeam = NULL;
|
||||
ArenaTeam* loserArenaTeam = NULL;
|
||||
@@ -718,18 +718,18 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
|
||||
|
||||
if (winnerTeamId == TEAM_ALLIANCE)
|
||||
{
|
||||
SetWinner(TEAM_HORDE); // reversed in packet
|
||||
SetWinner(TEAM_HORDE); // reversed in packet
|
||||
winmsg_id = isBattleground() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS;
|
||||
PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound
|
||||
}
|
||||
else if (winnerTeamId == TEAM_HORDE)
|
||||
{
|
||||
SetWinner(TEAM_ALLIANCE); // reversed in packet
|
||||
SetWinner(TEAM_ALLIANCE); // reversed in packet
|
||||
winmsg_id = isBattleground() ? LANG_BG_H_WINS : LANG_ARENA_GREEN_WINS;
|
||||
PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound
|
||||
}
|
||||
else
|
||||
SetWinner(TEAM_NEUTRAL);
|
||||
else
|
||||
SetWinner(TEAM_NEUTRAL);
|
||||
|
||||
//we must set it this way, because end time is sent in packet!
|
||||
m_EndTime = TIME_TO_AUTOREMOVE;
|
||||
@@ -756,58 +756,58 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
|
||||
SetArenaTeamRatingChangeForTeam(GetOtherTeamId(winnerTeamId), loserChange);
|
||||
|
||||
// pussywizard: arena logs in database
|
||||
uint32 fightId = sArenaTeamMgr->GetNextArenaLogId();
|
||||
uint32 fightId = sArenaTeamMgr->GetNextArenaLogId();
|
||||
uint32 currOnline = (uint32)(sWorld->GetActiveSessionCount());
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
|
||||
stmt->setUInt32(0, fightId);
|
||||
stmt->setUInt8(1, m_ArenaType);
|
||||
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000));
|
||||
stmt->setUInt32(3, winnerArenaTeam->GetId());
|
||||
stmt->setUInt32(4, loserArenaTeam->GetId());
|
||||
stmt->setUInt16(5, (uint16)winnerTeamRating);
|
||||
stmt->setUInt16(6, (uint16)winnerMatchmakerRating);
|
||||
stmt->setInt16(7, (int16)winnerChange);
|
||||
stmt->setUInt16(8, (uint16)loserTeamRating);
|
||||
stmt->setUInt16(9, (uint16)loserMatchmakerRating);
|
||||
stmt->setInt16(10, (int16)loserChange);
|
||||
stmt->setUInt32(11, currOnline);
|
||||
trans->Append(stmt);
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
|
||||
stmt->setUInt32(0, fightId);
|
||||
stmt->setUInt8(1, m_ArenaType);
|
||||
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000));
|
||||
stmt->setUInt32(3, winnerArenaTeam->GetId());
|
||||
stmt->setUInt32(4, loserArenaTeam->GetId());
|
||||
stmt->setUInt16(5, (uint16)winnerTeamRating);
|
||||
stmt->setUInt16(6, (uint16)winnerMatchmakerRating);
|
||||
stmt->setInt16(7, (int16)winnerChange);
|
||||
stmt->setUInt16(8, (uint16)loserTeamRating);
|
||||
stmt->setUInt16(9, (uint16)loserMatchmakerRating);
|
||||
stmt->setInt16(10, (int16)loserChange);
|
||||
stmt->setUInt32(11, currOnline);
|
||||
trans->Append(stmt);
|
||||
|
||||
uint8 memberId = 0;
|
||||
uint8 memberId = 0;
|
||||
for (Battleground::ArenaLogEntryDataMap::const_iterator itr = ArenaLogEntries.begin(); itr != ArenaLogEntries.end(); ++itr)
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
|
||||
stmt->setUInt32(0, fightId);
|
||||
stmt->setUInt8(1, ++memberId);
|
||||
stmt->setString(2, itr->second.Name);
|
||||
stmt->setUInt32(3, itr->second.Guid);
|
||||
stmt->setUInt32(4, itr->second.ArenaTeamId);
|
||||
stmt->setUInt32(5, itr->second.Acc);
|
||||
stmt->setString(6, itr->second.IP);
|
||||
stmt->setUInt32(7, itr->second.DamageDone);
|
||||
stmt->setUInt32(8, itr->second.HealingDone);
|
||||
stmt->setUInt32(9, itr->second.KillingBlows);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
|
||||
stmt->setUInt32(0, fightId);
|
||||
stmt->setUInt8(1, ++memberId);
|
||||
stmt->setString(2, itr->second.Name);
|
||||
stmt->setUInt32(3, itr->second.Guid);
|
||||
stmt->setUInt32(4, itr->second.ArenaTeamId);
|
||||
stmt->setUInt32(5, itr->second.Acc);
|
||||
stmt->setString(6, itr->second.IP);
|
||||
stmt->setUInt32(7, itr->second.DamageDone);
|
||||
stmt->setUInt32(8, itr->second.HealingDone);
|
||||
stmt->setUInt32(9, itr->second.KillingBlows);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
// Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
|
||||
else
|
||||
{
|
||||
// pussywizard: in case of a draw, the following is always true:
|
||||
// winnerArenaTeam => TEAM_HORDE, loserArenaTeam => TEAM_ALLIANCE
|
||||
// pussywizard: in case of a draw, the following is always true:
|
||||
// winnerArenaTeam => TEAM_HORDE, loserArenaTeam => TEAM_ALLIANCE
|
||||
|
||||
winnerTeamRating = winnerArenaTeam->GetRating();
|
||||
winnerMatchmakerRating = GetArenaMatchmakerRating(TEAM_HORDE);
|
||||
loserTeamRating = loserArenaTeam->GetRating();
|
||||
loserTeamRating = loserArenaTeam->GetRating();
|
||||
loserMatchmakerRating = GetArenaMatchmakerRating(TEAM_ALLIANCE);
|
||||
winnerMatchmakerChange = 0;
|
||||
winnerMatchmakerChange = 0;
|
||||
loserMatchmakerChange = 0;
|
||||
winnerChange = ARENA_TIMELIMIT_POINTS_LOSS;
|
||||
loserChange = ARENA_TIMELIMIT_POINTS_LOSS;
|
||||
winnerChange = ARENA_TIMELIMIT_POINTS_LOSS;
|
||||
loserChange = ARENA_TIMELIMIT_POINTS_LOSS;
|
||||
|
||||
SetArenaTeamRatingChangeForTeam(TEAM_ALLIANCE, ARENA_TIMELIMIT_POINTS_LOSS);
|
||||
SetArenaTeamRatingChangeForTeam(TEAM_HORDE, ARENA_TIMELIMIT_POINTS_LOSS);
|
||||
@@ -815,43 +815,43 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
|
||||
loserArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS, GetBgMap());
|
||||
|
||||
// pussywizard: arena logs in database
|
||||
uint32 fightId = sArenaTeamMgr->GetNextArenaLogId();
|
||||
uint32 fightId = sArenaTeamMgr->GetNextArenaLogId();
|
||||
uint32 currOnline = (uint32)(sWorld->GetActiveSessionCount());
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
|
||||
stmt->setUInt32(0, fightId);
|
||||
stmt->setUInt8(1, m_ArenaType);
|
||||
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000));
|
||||
stmt->setUInt32(3, winnerArenaTeam->GetId());
|
||||
stmt->setUInt32(4, loserArenaTeam->GetId());
|
||||
stmt->setUInt16(5, (uint16)winnerTeamRating);
|
||||
stmt->setUInt16(6, (uint16)winnerMatchmakerRating);
|
||||
stmt->setInt16(7, (int16)winnerChange);
|
||||
stmt->setUInt16(8, (uint16)loserTeamRating);
|
||||
stmt->setUInt16(9, (uint16)loserMatchmakerRating);
|
||||
stmt->setInt16(10, (int16)loserChange);
|
||||
stmt->setUInt32(11, currOnline);
|
||||
trans->Append(stmt);
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
|
||||
stmt->setUInt32(0, fightId);
|
||||
stmt->setUInt8(1, m_ArenaType);
|
||||
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000));
|
||||
stmt->setUInt32(3, winnerArenaTeam->GetId());
|
||||
stmt->setUInt32(4, loserArenaTeam->GetId());
|
||||
stmt->setUInt16(5, (uint16)winnerTeamRating);
|
||||
stmt->setUInt16(6, (uint16)winnerMatchmakerRating);
|
||||
stmt->setInt16(7, (int16)winnerChange);
|
||||
stmt->setUInt16(8, (uint16)loserTeamRating);
|
||||
stmt->setUInt16(9, (uint16)loserMatchmakerRating);
|
||||
stmt->setInt16(10, (int16)loserChange);
|
||||
stmt->setUInt32(11, currOnline);
|
||||
trans->Append(stmt);
|
||||
|
||||
uint8 memberId = 0;
|
||||
uint8 memberId = 0;
|
||||
for (Battleground::ArenaLogEntryDataMap::const_iterator itr = ArenaLogEntries.begin(); itr != ArenaLogEntries.end(); ++itr)
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
|
||||
stmt->setUInt32(0, fightId);
|
||||
stmt->setUInt8(1, ++memberId);
|
||||
stmt->setString(2, itr->second.Name);
|
||||
stmt->setUInt32(3, itr->second.Guid);
|
||||
stmt->setUInt32(4, itr->second.ArenaTeamId);
|
||||
stmt->setUInt32(5, itr->second.Acc);
|
||||
stmt->setString(6, itr->second.IP);
|
||||
stmt->setUInt32(7, itr->second.DamageDone);
|
||||
stmt->setUInt32(8, itr->second.HealingDone);
|
||||
stmt->setUInt32(9, itr->second.KillingBlows);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
|
||||
stmt->setUInt32(0, fightId);
|
||||
stmt->setUInt8(1, ++memberId);
|
||||
stmt->setString(2, itr->second.Name);
|
||||
stmt->setUInt32(3, itr->second.Guid);
|
||||
stmt->setUInt32(4, itr->second.ArenaTeamId);
|
||||
stmt->setUInt32(5, itr->second.Acc);
|
||||
stmt->setString(6, itr->second.IP);
|
||||
stmt->setUInt32(7, itr->second.DamageDone);
|
||||
stmt->setUInt32(8, itr->second.HealingDone);
|
||||
stmt->setUInt32(9, itr->second.KillingBlows);
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -868,7 +868,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
|
||||
for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
{
|
||||
Player* player = itr->second;
|
||||
TeamId bgTeamId = player->GetBgTeamId();
|
||||
TeamId bgTeamId = player->GetBgTeamId();
|
||||
// should remove spirit of redemption
|
||||
if (player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
|
||||
player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
@@ -894,15 +894,15 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
|
||||
{
|
||||
if (bgTeamId == winnerTeamId)
|
||||
{
|
||||
if (bValidArena)
|
||||
{
|
||||
// update achievement BEFORE personal rating update
|
||||
uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot());
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId());
|
||||
if (bValidArena)
|
||||
{
|
||||
// update achievement BEFORE personal rating update
|
||||
uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot());
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId());
|
||||
|
||||
winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange);
|
||||
}
|
||||
winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -925,7 +925,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
|
||||
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(winner_kills));
|
||||
|
||||
// Xinef: check player level and not bracket level if (CanAwardArenaPoints())
|
||||
if (player->getLevel() >= BG_AWARD_ARENA_POINTS_MIN_LEVEL)
|
||||
if (player->getLevel() >= BG_AWARD_ARENA_POINTS_MIN_LEVEL)
|
||||
player->ModifyArenaPoints(winner_arena);
|
||||
|
||||
if (!player->GetRandomWinner())
|
||||
@@ -983,7 +983,7 @@ void Battleground::BlockMovement(Player* player)
|
||||
|
||||
void Battleground::RemovePlayerAtLeave(Player* player)
|
||||
{
|
||||
TeamId teamId = player->GetBgTeamId();
|
||||
TeamId teamId = player->GetBgTeamId();
|
||||
|
||||
// check if the player was a participant of the match, or only entered through gm command
|
||||
bool participant = false;
|
||||
@@ -995,7 +995,7 @@ void Battleground::RemovePlayerAtLeave(Player* player)
|
||||
participant = true;
|
||||
}
|
||||
|
||||
// delete player score if exists
|
||||
// delete player score if exists
|
||||
BattlegroundScoreMap::iterator itr2 = PlayerScores.find(player->GetGUID());
|
||||
if (itr2 != PlayerScores.end())
|
||||
{
|
||||
@@ -1005,7 +1005,7 @@ void Battleground::RemovePlayerAtLeave(Player* player)
|
||||
|
||||
RemovePlayerFromResurrectQueue(player);
|
||||
|
||||
// resurrect on exit
|
||||
// resurrect on exit
|
||||
if (!player->IsAlive())
|
||||
{
|
||||
player->ResurrectPlayer(1.0f);
|
||||
@@ -1014,10 +1014,10 @@ void Battleground::RemovePlayerAtLeave(Player* player)
|
||||
|
||||
player->RemoveAurasByType(SPELL_AURA_MOUNTED);
|
||||
|
||||
// BG subclass specific code
|
||||
// BG subclass specific code
|
||||
RemovePlayer(player);
|
||||
|
||||
// if the player was a match participant
|
||||
// if the player was a match participant
|
||||
if (participant)
|
||||
{
|
||||
WorldPacket data;
|
||||
@@ -1038,26 +1038,26 @@ void Battleground::RemovePlayerAtLeave(Player* player)
|
||||
|
||||
// remove from raid group if player is member
|
||||
if (Group* group = GetBgRaid(teamId))
|
||||
if (group->IsMember(player->GetGUID()))
|
||||
if (!group->RemoveMember(player->GetGUID())) // group was disbanded
|
||||
SetBgRaid(teamId, NULL);
|
||||
if (group->IsMember(player->GetGUID()))
|
||||
if (!group->RemoveMember(player->GetGUID())) // group was disbanded
|
||||
SetBgRaid(teamId, NULL);
|
||||
|
||||
// let others know
|
||||
sBattlegroundMgr->BuildPlayerLeftBattlegroundPacket(&data, player->GetGUID());
|
||||
SendPacketToTeam(teamId, &data, player, false);
|
||||
|
||||
// cast deserter
|
||||
if (isBattleground() && !player->IsGameMaster() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_CAST_DESERTER))
|
||||
if (GetStatus() == STATUS_IN_PROGRESS || GetStatus() == STATUS_WAIT_JOIN)
|
||||
player->ScheduleDelayedOperation(DELAYED_SPELL_CAST_DESERTER);
|
||||
// cast deserter
|
||||
if (isBattleground() && !player->IsGameMaster() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_CAST_DESERTER))
|
||||
if (GetStatus() == STATUS_IN_PROGRESS || GetStatus() == STATUS_WAIT_JOIN)
|
||||
player->ScheduleDelayedOperation(DELAYED_SPELL_CAST_DESERTER);
|
||||
}
|
||||
|
||||
// Remove shapeshift auras
|
||||
player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
// Remove shapeshift auras
|
||||
player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
|
||||
|
||||
player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE, PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
|
||||
|
||||
// Xinef: remove all criterias on bg leave
|
||||
// Xinef: remove all criterias on bg leave
|
||||
player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
|
||||
}
|
||||
|
||||
@@ -1073,10 +1073,10 @@ void Battleground::Init()
|
||||
m_Events = 0;
|
||||
|
||||
if (m_BgInvitedPlayers[TEAM_ALLIANCE] > 0 || m_BgInvitedPlayers[TEAM_HORDE] > 0)
|
||||
{
|
||||
{
|
||||
sLog->outError("Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!", m_BgInvitedPlayers[TEAM_ALLIANCE], m_BgInvitedPlayers[TEAM_HORDE], m_MapId, m_InstanceID);
|
||||
ASSERT(false);
|
||||
}
|
||||
ASSERT(false);
|
||||
}
|
||||
|
||||
m_BgInvitedPlayers[TEAM_ALLIANCE] = 0;
|
||||
m_BgInvitedPlayers[TEAM_HORDE] = 0;
|
||||
@@ -1142,10 +1142,10 @@ void Battleground::AddPlayer(Player* player)
|
||||
player->CastSpell(player, SPELL_ALLIANCE_GREEN_FLAG, true);
|
||||
}
|
||||
|
||||
// restore pets health before remove
|
||||
if (Pet* pet = player->GetPet())
|
||||
if (pet->IsAlive())
|
||||
pet->SetHealth(pet->GetMaxHealth());
|
||||
// restore pets health before remove
|
||||
if (Pet* pet = player->GetPet())
|
||||
if (pet->IsAlive())
|
||||
pet->SetHealth(pet->GetMaxHealth());
|
||||
|
||||
player->DestroyConjuredItems(true);
|
||||
player->UnsummonPetTemporaryIfAny();
|
||||
@@ -1162,7 +1162,7 @@ void Battleground::AddPlayer(Player* player)
|
||||
player->CastSpell(player, SPELL_PREPARATION, true); // reduces all mana cost of spells.
|
||||
}
|
||||
|
||||
// Xinef: reset all map criterias on map enter
|
||||
// Xinef: reset all map criterias on map enter
|
||||
player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
|
||||
|
||||
// setup BG group membership
|
||||
@@ -1176,11 +1176,11 @@ void Battleground::AddPlayer(Player* player)
|
||||
// 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* player, TeamId teamId)
|
||||
{
|
||||
if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup()))
|
||||
{
|
||||
sLog->outMisc("Battleground::AddOrSetPlayerToCorrectBgGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF"));
|
||||
return;
|
||||
}
|
||||
if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup()))
|
||||
{
|
||||
sLog->outMisc("Battleground::AddOrSetPlayerToCorrectBgGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF"));
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 playerGuid = player->GetGUID();
|
||||
Group* group = GetBgRaid(teamId);
|
||||
@@ -1193,7 +1193,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, TeamId teamId)
|
||||
else if (group->IsMember(playerGuid))
|
||||
{
|
||||
uint8 subgroup = group->GetMemberGroup(playerGuid);
|
||||
player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
|
||||
player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1215,39 +1215,39 @@ uint32 Battleground::GetFreeSlotsForTeam(TeamId teamId) const
|
||||
|
||||
uint32 Battleground::GetMaxFreeSlots() const
|
||||
{
|
||||
return std::max<uint32>(GetFreeSlotsForTeam(TEAM_ALLIANCE), GetFreeSlotsForTeam(TEAM_HORDE));
|
||||
return std::max<uint32>(GetFreeSlotsForTeam(TEAM_ALLIANCE), GetFreeSlotsForTeam(TEAM_HORDE));
|
||||
}
|
||||
|
||||
bool Battleground::HasFreeSlots() const
|
||||
{
|
||||
if (GetStatus() != STATUS_WAIT_JOIN && GetStatus() != STATUS_IN_PROGRESS)
|
||||
return false;
|
||||
for (uint8 i=0; i<BG_TEAMS_COUNT; ++i)
|
||||
if (GetFreeSlotsForTeam((TeamId)i) > 0)
|
||||
return true;
|
||||
return false;
|
||||
if (GetStatus() != STATUS_WAIT_JOIN && GetStatus() != STATUS_IN_PROGRESS)
|
||||
return false;
|
||||
for (uint8 i=0; i<BG_TEAMS_COUNT; ++i)
|
||||
if (GetFreeSlotsForTeam((TeamId)i) > 0)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void Battleground::SpectatorsSendPacket(WorldPacket& data)
|
||||
{
|
||||
for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr)
|
||||
(*itr)->GetSession()->SendPacket(&data);
|
||||
for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr)
|
||||
(*itr)->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
void Battleground::ReadyMarkerClicked(Player* p)
|
||||
{
|
||||
if (!isArena() || GetStatus() >= STATUS_IN_PROGRESS || GetStartDelayTime() <= BG_START_DELAY_15S || (m_Events & BG_STARTING_EVENT_3) || p->IsSpectator())
|
||||
return;
|
||||
readyMarkerClickedSet.insert(p->GetGUIDLow());
|
||||
uint32 count = readyMarkerClickedSet.size();
|
||||
uint32 req = GetArenaType()*2;
|
||||
p->GetSession()->SendNotification("You are marked as ready %u/%u", count, req);
|
||||
if (count == req)
|
||||
{
|
||||
m_Events |= BG_STARTING_EVENT_2;
|
||||
m_StartTime += GetStartDelayTime()-BG_START_DELAY_15S;
|
||||
SetStartDelayTime(BG_START_DELAY_15S);
|
||||
}
|
||||
if (!isArena() || GetStatus() >= STATUS_IN_PROGRESS || GetStartDelayTime() <= BG_START_DELAY_15S || (m_Events & BG_STARTING_EVENT_3) || p->IsSpectator())
|
||||
return;
|
||||
readyMarkerClickedSet.insert(p->GetGUIDLow());
|
||||
uint32 count = readyMarkerClickedSet.size();
|
||||
uint32 req = GetArenaType()*2;
|
||||
p->GetSession()->SendNotification("You are marked as ready %u/%u", count, req);
|
||||
if (count == req)
|
||||
{
|
||||
m_Events |= BG_STARTING_EVENT_2;
|
||||
m_StartTime += GetStartDelayTime()-BG_START_DELAY_15S;
|
||||
SetStartDelayTime(BG_START_DELAY_15S);
|
||||
}
|
||||
}
|
||||
|
||||
void Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
@@ -1486,10 +1486,10 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y,
|
||||
|
||||
if (transport)
|
||||
{
|
||||
transport->CalculatePassengerPosition(x, y, z, &o);
|
||||
if (Creature* creature = transport->SummonCreature(entry, x, y, z, o, TEMPSUMMON_MANUAL_DESPAWN))
|
||||
transport->CalculatePassengerPosition(x, y, z, &o);
|
||||
if (Creature* creature = transport->SummonCreature(entry, x, y, z, o, TEMPSUMMON_MANUAL_DESPAWN))
|
||||
{
|
||||
transport->AddPassenger(creature, true);
|
||||
transport->AddPassenger(creature, true);
|
||||
BgCreatures[type] = creature->GetGUID();
|
||||
return creature;
|
||||
}
|
||||
@@ -1531,9 +1531,9 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y,
|
||||
if (respawntime)
|
||||
creature->SetRespawnDelay(respawntime);
|
||||
|
||||
// Xinef: Set PVP state for vehicles, should be for all creatures in bg?
|
||||
if (creature->IsVehicle())
|
||||
creature->SetPvP(true);
|
||||
// Xinef: Set PVP state for vehicles, should be for all creatures in bg?
|
||||
if (creature->IsVehicle())
|
||||
creature->SetPvP(true);
|
||||
|
||||
return creature;
|
||||
}
|
||||
@@ -1670,9 +1670,9 @@ char const* Battleground::GetTrinityString(int32 entry)
|
||||
|
||||
void Battleground::HandleTriggerBuff(GameObject* gameObject)
|
||||
{
|
||||
// Xinef: crash fix?
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || !GetPlayersSize() || BgObjects.empty())
|
||||
return;
|
||||
// Xinef: crash fix?
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || !GetPlayersSize() || BgObjects.empty())
|
||||
return;
|
||||
|
||||
uint32 index = 0;
|
||||
for (; index < BgObjects.size() && BgObjects[index] != gameObject->GetGUID(); ++index);
|
||||
@@ -1680,19 +1680,19 @@ void Battleground::HandleTriggerBuff(GameObject* gameObject)
|
||||
return;
|
||||
|
||||
if (m_BuffChange)
|
||||
{
|
||||
uint8 buff = urand(0, 2);
|
||||
if (gameObject->GetEntry() != Buff_Entries[buff])
|
||||
{
|
||||
SpawnBGObject(index, RESPAWN_ONE_DAY);
|
||||
for (uint8 currBuffTypeIndex = 0; currBuffTypeIndex < 3; ++currBuffTypeIndex)
|
||||
if (gameObject->GetEntry() == Buff_Entries[currBuffTypeIndex])
|
||||
{
|
||||
index -= currBuffTypeIndex;
|
||||
index += buff;
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
uint8 buff = urand(0, 2);
|
||||
if (gameObject->GetEntry() != Buff_Entries[buff])
|
||||
{
|
||||
SpawnBGObject(index, RESPAWN_ONE_DAY);
|
||||
for (uint8 currBuffTypeIndex = 0; currBuffTypeIndex < 3; ++currBuffTypeIndex)
|
||||
if (gameObject->GetEntry() == Buff_Entries[currBuffTypeIndex])
|
||||
{
|
||||
index -= currBuffTypeIndex;
|
||||
index += buff;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SpawnBGObject(index, BUFF_RESPAWN_TIME);
|
||||
}
|
||||
@@ -1734,7 +1734,7 @@ void Battleground::HandleKillPlayer(Player* victim, Player* killer)
|
||||
|
||||
TeamId Battleground::GetOtherTeamId(TeamId teamId)
|
||||
{
|
||||
return teamId != TEAM_NEUTRAL ? (teamId == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE) : TEAM_NEUTRAL;
|
||||
return teamId != TEAM_NEUTRAL ? (teamId == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE) : TEAM_NEUTRAL;
|
||||
}
|
||||
|
||||
bool Battleground::IsPlayerInBattleground(uint64 guid) const
|
||||
|
||||
@@ -75,7 +75,7 @@ enum BattlegroundMarks
|
||||
SPELL_AV_MARK_WINNER = 24955,
|
||||
SPELL_SA_MARK_WINNER = 61160,
|
||||
SPELL_SA_MARK_LOSER = 61159,
|
||||
SPELL_WG_MARK_WINNER = 56902,
|
||||
SPELL_WG_MARK_WINNER = 56902,
|
||||
ITEM_AV_MARK_OF_HONOR = 20560,
|
||||
ITEM_WS_MARK_OF_HONOR = 20558,
|
||||
ITEM_AB_MARK_OF_HONOR = 20559,
|
||||
@@ -171,7 +171,7 @@ enum BattlegroundStatus
|
||||
|
||||
enum BattlegroundTeams
|
||||
{
|
||||
BG_TEAMS_COUNT = 2
|
||||
BG_TEAMS_COUNT = 2
|
||||
};
|
||||
|
||||
struct BattlegroundObjectInfo
|
||||
@@ -256,30 +256,30 @@ struct BattlegroundScore
|
||||
uint32 BonusHonor;
|
||||
uint32 DamageDone;
|
||||
uint32 HealingDone;
|
||||
Player* player;
|
||||
Player* player;
|
||||
};
|
||||
|
||||
class ArenaLogEntryData
|
||||
{
|
||||
public:
|
||||
ArenaLogEntryData() : Guid(0), ArenaTeamId(0), DamageDone(0), HealingDone(0), KillingBlows(0) {}
|
||||
void Fill(const char* name, uint32 guid, uint32 acc, uint32 arenaTeamId, std::string ip)
|
||||
{
|
||||
Name = std::string(name);
|
||||
Guid = guid;
|
||||
Acc = acc;
|
||||
ArenaTeamId = arenaTeamId;
|
||||
IP = ip;
|
||||
}
|
||||
public:
|
||||
ArenaLogEntryData() : Guid(0), ArenaTeamId(0), DamageDone(0), HealingDone(0), KillingBlows(0) {}
|
||||
void Fill(const char* name, uint32 guid, uint32 acc, uint32 arenaTeamId, std::string ip)
|
||||
{
|
||||
Name = std::string(name);
|
||||
Guid = guid;
|
||||
Acc = acc;
|
||||
ArenaTeamId = arenaTeamId;
|
||||
IP = ip;
|
||||
}
|
||||
|
||||
std::string Name;
|
||||
uint32 Guid;
|
||||
uint32 Acc;
|
||||
uint32 ArenaTeamId;
|
||||
std::string IP;
|
||||
uint32 DamageDone;
|
||||
uint32 HealingDone;
|
||||
uint32 KillingBlows;
|
||||
std::string Name;
|
||||
uint32 Guid;
|
||||
uint32 Acc;
|
||||
uint32 ArenaTeamId;
|
||||
std::string IP;
|
||||
uint32 DamageDone;
|
||||
uint32 HealingDone;
|
||||
uint32 KillingBlows;
|
||||
};
|
||||
|
||||
enum BGHonorMode
|
||||
@@ -368,23 +368,23 @@ class Battleground
|
||||
void SetMaxPlayersPerTeam(uint32 MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; }
|
||||
void SetMinPlayersPerTeam(uint32 MinPlayers) { m_MinPlayersPerTeam = MinPlayers; }
|
||||
|
||||
void DecreaseInvitedCount(TeamId teamId) { ASSERT(m_BgInvitedPlayers[teamId] > 0); --m_BgInvitedPlayers[teamId]; }
|
||||
void IncreaseInvitedCount(TeamId teamId) { ++m_BgInvitedPlayers[teamId]; }
|
||||
uint32 GetInvitedCount(TeamId teamId) const { return m_BgInvitedPlayers[teamId]; }
|
||||
void DecreaseInvitedCount(TeamId teamId) { ASSERT(m_BgInvitedPlayers[teamId] > 0); --m_BgInvitedPlayers[teamId]; }
|
||||
void IncreaseInvitedCount(TeamId teamId) { ++m_BgInvitedPlayers[teamId]; }
|
||||
uint32 GetInvitedCount(TeamId teamId) const { return m_BgInvitedPlayers[teamId]; }
|
||||
|
||||
bool HasFreeSlots() const;
|
||||
uint32 GetFreeSlotsForTeam(TeamId teamId) const;
|
||||
uint32 GetMaxFreeSlots() const;
|
||||
uint32 GetMaxFreeSlots() const;
|
||||
|
||||
typedef std::set<Player*> SpectatorList;
|
||||
typedef std::map<uint64, uint64> ToBeTeleportedMap;
|
||||
typedef std::map<uint64, uint64> ToBeTeleportedMap;
|
||||
void AddSpectator(Player* p) { m_Spectators.insert(p); }
|
||||
void RemoveSpectator(Player* p) { m_Spectators.erase(p); }
|
||||
bool HaveSpectators() { return !m_Spectators.empty(); }
|
||||
const SpectatorList& GetSpectators() const { return m_Spectators; }
|
||||
void AddToBeTeleported(uint64 spectator, uint64 participant) { m_ToBeTeleported[spectator] = participant; }
|
||||
void RemoveToBeTeleported(uint64 spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); }
|
||||
void SpectatorsSendPacket(WorldPacket& data);
|
||||
const SpectatorList& GetSpectators() const { return m_Spectators; }
|
||||
void AddToBeTeleported(uint64 spectator, uint64 participant) { m_ToBeTeleported[spectator] = participant; }
|
||||
void RemoveToBeTeleported(uint64 spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); }
|
||||
void SpectatorsSendPacket(WorldPacket& data);
|
||||
|
||||
bool isArena() const { return m_IsArena; }
|
||||
bool isBattleground() const { return !m_IsArena; }
|
||||
@@ -394,8 +394,8 @@ class Battleground
|
||||
BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
|
||||
uint32 GetPlayersSize() const { return m_Players.size(); }
|
||||
|
||||
void ReadyMarkerClicked(Player* p); // pussywizard
|
||||
std::set<uint32> readyMarkerClickedSet; // pussywizard
|
||||
void ReadyMarkerClicked(Player* p); // pussywizard
|
||||
std::set<uint32> readyMarkerClickedSet; // pussywizard
|
||||
|
||||
typedef std::map<uint64, BattlegroundScore*> BattlegroundScoreMap;
|
||||
typedef std::map<uint64, ArenaLogEntryData> ArenaLogEntryDataMap;// pussywizard
|
||||
@@ -624,8 +624,8 @@ class Battleground
|
||||
BGHonorMode m_HonorMode;
|
||||
int32 m_TeamScores[BG_TEAMS_COUNT];
|
||||
|
||||
// pussywizard:
|
||||
uint32 m_UpdateTimer;
|
||||
// pussywizard:
|
||||
uint32 m_UpdateTimer;
|
||||
private:
|
||||
// Battleground
|
||||
BattlegroundTypeId m_RealTypeID;
|
||||
@@ -684,13 +684,13 @@ class Battleground
|
||||
// Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction
|
||||
// Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG
|
||||
// Invited players counters
|
||||
uint32 m_BgInvitedPlayers[BG_TEAMS_COUNT];
|
||||
uint32 m_BgInvitedPlayers[BG_TEAMS_COUNT];
|
||||
|
||||
// Raid Group
|
||||
Group* m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde
|
||||
|
||||
SpectatorList m_Spectators;
|
||||
ToBeTeleportedMap m_ToBeTeleported;
|
||||
SpectatorList m_Spectators;
|
||||
ToBeTeleportedMap m_ToBeTeleported;
|
||||
|
||||
// Players count by team
|
||||
uint32 m_PlayersCount[BG_TEAMS_COUNT];
|
||||
|
||||
@@ -54,8 +54,8 @@
|
||||
BattlegroundMgr::BattlegroundMgr() : m_ArenaTesting(false), m_Testing(false),
|
||||
m_lastClientVisibleInstanceId(0), m_NextAutoDistributionTime(0), m_NextPeriodicQueueUpdateTime(5*IN_MILLISECONDS), randomBgDifficultyEntry(999, 0, 80, 80, 0)
|
||||
{
|
||||
for (uint32 qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
||||
m_BattlegroundQueues[qtype].SetBgTypeIdAndArenaType(BGTemplateId(BattlegroundQueueTypeId(qtype)), BGArenaType(BattlegroundQueueTypeId(qtype)));
|
||||
for (uint32 qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
||||
m_BattlegroundQueues[qtype].SetBgTypeIdAndArenaType(BGTemplateId(BattlegroundQueueTypeId(qtype)), BGArenaType(BattlegroundQueueTypeId(qtype)));
|
||||
}
|
||||
|
||||
BattlegroundMgr::~BattlegroundMgr()
|
||||
@@ -65,19 +65,19 @@ BattlegroundMgr::~BattlegroundMgr()
|
||||
|
||||
void BattlegroundMgr::DeleteAllBattlegrounds()
|
||||
{
|
||||
while (!m_Battlegrounds.empty())
|
||||
delete m_Battlegrounds.begin()->second;
|
||||
m_Battlegrounds.clear();
|
||||
while (!m_Battlegrounds.empty())
|
||||
delete m_Battlegrounds.begin()->second;
|
||||
m_Battlegrounds.clear();
|
||||
|
||||
while (!m_BattlegroundTemplates.empty())
|
||||
delete m_BattlegroundTemplates.begin()->second;
|
||||
m_BattlegroundTemplates.clear();
|
||||
while (!m_BattlegroundTemplates.empty())
|
||||
delete m_BattlegroundTemplates.begin()->second;
|
||||
m_BattlegroundTemplates.clear();
|
||||
}
|
||||
|
||||
// used to update running battlegrounds, and delete finished ones
|
||||
void BattlegroundMgr::Update(uint32 diff)
|
||||
{
|
||||
// update all battlegrounds and delete if needed
|
||||
// update all battlegrounds and delete if needed
|
||||
for (BattlegroundContainer::iterator itr = m_Battlegrounds.begin(), itrDelete; itr != m_Battlegrounds.end(); )
|
||||
{
|
||||
itrDelete = itr++;
|
||||
@@ -91,8 +91,8 @@ void BattlegroundMgr::Update(uint32 diff)
|
||||
}
|
||||
}
|
||||
|
||||
// update to change current bg type the random system is trying to create
|
||||
RandomSystem.Update(diff);
|
||||
// update to change current bg type the random system is trying to create
|
||||
RandomSystem.Update(diff);
|
||||
|
||||
// update events
|
||||
for (int qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
|
||||
@@ -120,19 +120,19 @@ void BattlegroundMgr::Update(uint32 diff)
|
||||
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
||||
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), 0x03, true, 0); // pussywizard: 0 for rated means looking for opponents for every team
|
||||
|
||||
// for battlegrounds and not rated arenas
|
||||
// in first loop try to fill already running battlegrounds, then in a second loop try to create new battlegrounds
|
||||
for (uint8 action = 1; action <= 2; ++action)
|
||||
for (uint32 qtype = BATTLEGROUND_QUEUE_AV; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype)
|
||||
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
||||
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), action, false, 0);
|
||||
// for battlegrounds and not rated arenas
|
||||
// in first loop try to fill already running battlegrounds, then in a second loop try to create new battlegrounds
|
||||
for (uint8 action = 1; action <= 2; ++action)
|
||||
for (uint32 qtype = BATTLEGROUND_QUEUE_AV; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype)
|
||||
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
|
||||
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), action, false, 0);
|
||||
|
||||
m_NextPeriodicQueueUpdateTime = 5*IN_MILLISECONDS;
|
||||
}
|
||||
else
|
||||
m_NextPeriodicQueueUpdateTime -= diff;
|
||||
|
||||
// arena points auto-distribution
|
||||
// arena points auto-distribution
|
||||
if (sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
|
||||
{
|
||||
if (sWorld->GetGameTime() > m_NextAutoDistributionTime)
|
||||
@@ -146,8 +146,8 @@ void BattlegroundMgr::Update(uint32 diff)
|
||||
|
||||
void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, TeamId teamId, bool isRated, BattlegroundTypeId forceBgTypeId)
|
||||
{
|
||||
// pussywizard:
|
||||
ASSERT(QueueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
|
||||
// pussywizard:
|
||||
ASSERT(QueueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
|
||||
|
||||
if (StatusID == STATUS_NONE || !bg)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
||||
for (TeamId iTeamId = TEAM_ALLIANCE; iTeamId <= TEAM_HORDE; iTeamId = TeamId(iTeamId+1))
|
||||
{
|
||||
// Xinef: oryginally this was looping in reverse order, loop order was changed so we have to change checked teamId
|
||||
int32 rating_change = bg->GetArenaTeamRatingChangeForTeam(Battleground::GetOtherTeamId(iTeamId));
|
||||
int32 rating_change = bg->GetArenaTeamRatingChangeForTeam(Battleground::GetOtherTeamId(iTeamId));
|
||||
|
||||
uint32 pointsLost = rating_change < 0 ? -rating_change : 0;
|
||||
uint32 pointsGained = rating_change > 0 ? rating_change : 0;
|
||||
@@ -233,7 +233,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
||||
else
|
||||
{
|
||||
*data << uint8(1); // bg ended
|
||||
*data << uint8(bg->GetWinner()); // who win
|
||||
*data << uint8(bg->GetWinner()); // who win
|
||||
}
|
||||
|
||||
size_t wpos = data->wpos();
|
||||
@@ -304,7 +304,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
|
||||
*data << uint32(0);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case BATTLEGROUND_AV:
|
||||
*data << uint32(0x00000005); // count of next fields
|
||||
*data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsAssaulted); // GraveyardsAssaulted
|
||||
@@ -422,12 +422,12 @@ uint32 BattlegroundMgr::GetNextClientVisibleInstanceId()
|
||||
// create a new battleground that will really be used to play
|
||||
Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId, uint32 minLevel, uint32 maxLevel, uint8 arenaType, bool isRated)
|
||||
{
|
||||
// pussywizard: random battleground is chosen before calling this function!
|
||||
ASSERT(bgTypeId != BATTLEGROUND_RB);
|
||||
// pussywizard: random battleground is chosen before calling this function!
|
||||
ASSERT(bgTypeId != BATTLEGROUND_RB);
|
||||
|
||||
// pussywizard: randomize for all arena
|
||||
if (bgTypeId == BATTLEGROUND_AA)
|
||||
bgTypeId = RAND<BattlegroundTypeId>(BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL, BATTLEGROUND_DS, BATTLEGROUND_RV);
|
||||
// pussywizard: randomize for all arena
|
||||
if (bgTypeId == BATTLEGROUND_AA)
|
||||
bgTypeId = RAND<BattlegroundTypeId>(BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL, BATTLEGROUND_DS, BATTLEGROUND_RV);
|
||||
|
||||
// get the template BG
|
||||
Battleground* bg_template = GetBattlegroundTemplate(bgTypeId);
|
||||
@@ -599,7 +599,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
|
||||
|
||||
uint32 bgTypeId = fields[0].GetUInt32();
|
||||
|
||||
// pussywizard: currently not supported
|
||||
// pussywizard: currently not supported
|
||||
//if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId, NULL))
|
||||
// continue;
|
||||
|
||||
@@ -889,8 +889,8 @@ void BattlegroundMgr::SetHolidayWeekends(uint32 mask)
|
||||
{
|
||||
for (uint32 bgtype = 1; bgtype < MAX_BATTLEGROUND_TYPE_ID; ++bgtype)
|
||||
{
|
||||
if (bgtype == BATTLEGROUND_RB)
|
||||
continue;
|
||||
if (bgtype == BATTLEGROUND_RB)
|
||||
continue;
|
||||
if (Battleground* bgt = GetBattlegroundTemplate(BattlegroundTypeId(bgtype)))
|
||||
bgt->SetHoliday(mask & (1 << bgtype));
|
||||
}
|
||||
@@ -1013,39 +1013,39 @@ bool BattlegroundMgr::IsBGWeekend(BattlegroundTypeId bgTypeId)
|
||||
|
||||
void BattlegroundMgr::AddBattleground(Battleground* bg)
|
||||
{
|
||||
if (bg->GetInstanceID() == 0)
|
||||
m_BattlegroundTemplates[bg->GetBgTypeID()] = bg;
|
||||
else
|
||||
m_Battlegrounds[bg->GetInstanceID()] = bg;
|
||||
if (bg->GetInstanceID() == 0)
|
||||
m_BattlegroundTemplates[bg->GetBgTypeID()] = bg;
|
||||
else
|
||||
m_Battlegrounds[bg->GetInstanceID()] = bg;
|
||||
}
|
||||
|
||||
void BattlegroundMgr::RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 instanceId)
|
||||
{
|
||||
if (instanceId == 0)
|
||||
m_BattlegroundTemplates.erase(bgTypeId);
|
||||
else
|
||||
m_Battlegrounds.erase(instanceId);
|
||||
if (instanceId == 0)
|
||||
m_BattlegroundTemplates.erase(bgTypeId);
|
||||
else
|
||||
m_Battlegrounds.erase(instanceId);
|
||||
}
|
||||
|
||||
void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, TeamId teamId)
|
||||
{
|
||||
ASSERT(!ginfo->IsInvitedToBGInstanceGUID);
|
||||
ASSERT(!ginfo->IsInvitedToBGInstanceGUID);
|
||||
|
||||
// set side if needed
|
||||
if (teamId != TEAM_NEUTRAL)
|
||||
ginfo->teamId = teamId;
|
||||
// set side if needed
|
||||
if (teamId != TEAM_NEUTRAL)
|
||||
ginfo->teamId = teamId;
|
||||
|
||||
// set invitation
|
||||
ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID();
|
||||
// set invitation
|
||||
ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID();
|
||||
|
||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(ginfo->BgTypeId, ginfo->ArenaType);
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(ginfo->BgTypeId, ginfo->ArenaType);
|
||||
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
|
||||
|
||||
// set ArenaTeamId for rated matches
|
||||
if (bg->isArena() && bg->isRated())
|
||||
bg->SetArenaTeamIdForTeam(ginfo->teamId, ginfo->ArenaTeamId);
|
||||
// set ArenaTeamId for rated matches
|
||||
if (bg->isArena() && bg->isRated())
|
||||
bg->SetArenaTeamIdForTeam(ginfo->teamId, ginfo->ArenaTeamId);
|
||||
|
||||
ginfo->RemoveInviteTime = World::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME;
|
||||
ginfo->RemoveInviteTime = World::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME;
|
||||
|
||||
// loop through the players
|
||||
for (std::set<uint64>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
|
||||
@@ -1054,7 +1054,7 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(*itr);
|
||||
|
||||
// player is removed from queue when logging out
|
||||
ASSERT(player);
|
||||
ASSERT(player);
|
||||
|
||||
// update average wait time
|
||||
bgQueue.PlayerInvitedToBGUpdateAverageWaitTime(ginfo);
|
||||
@@ -1072,15 +1072,15 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
|
||||
WorldPacket data;
|
||||
|
||||
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
|
||||
ASSERT(queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
|
||||
ASSERT(queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
|
||||
|
||||
// send status packet
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo->BgTypeId);
|
||||
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo->BgTypeId);
|
||||
player->GetSession()->SendPacket(&data);
|
||||
|
||||
// pussywizard:
|
||||
if (bg->isArena() && bg->isRated())
|
||||
bg->ArenaLogEntries[player->GetGUID()].Fill(player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), ginfo->ArenaTeamId, player->GetSession()->GetRemoteAddress());
|
||||
// pussywizard:
|
||||
if (bg->isArena() && bg->isRated())
|
||||
bg->ArenaLogEntries[player->GetGUID()].Fill(player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), ginfo->ArenaTeamId, player->GetSession()->GetRemoteAddress());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1090,52 +1090,52 @@ RandomBattlegroundSystem::RandomBattlegroundSystem() : m_CurrentRandomBg(BATTLEG
|
||||
|
||||
void RandomBattlegroundSystem::Update(uint32 diff)
|
||||
{
|
||||
if (m_SwitchTimer <= diff)
|
||||
{
|
||||
if (m_BgOrder.empty())
|
||||
{
|
||||
// order it like: big, small, big, small, small, small (stored backwards, actually)
|
||||
if (m_SwitchTimer <= diff)
|
||||
{
|
||||
if (m_BgOrder.empty())
|
||||
{
|
||||
// order it like: big, small, big, small, small, small (stored backwards, actually)
|
||||
|
||||
std::vector<BattlegroundTypeId> big, small;
|
||||
big.push_back(BATTLEGROUND_AV);
|
||||
big.push_back(BATTLEGROUND_IC);
|
||||
small.push_back(BATTLEGROUND_WS);
|
||||
small.push_back(BATTLEGROUND_EY);
|
||||
small.push_back(BATTLEGROUND_AB);
|
||||
small.push_back(BATTLEGROUND_SA);
|
||||
std::vector<BattlegroundTypeId> big, small;
|
||||
big.push_back(BATTLEGROUND_AV);
|
||||
big.push_back(BATTLEGROUND_IC);
|
||||
small.push_back(BATTLEGROUND_WS);
|
||||
small.push_back(BATTLEGROUND_EY);
|
||||
small.push_back(BATTLEGROUND_AB);
|
||||
small.push_back(BATTLEGROUND_SA);
|
||||
|
||||
std::random_shuffle(big.begin(), big.end());
|
||||
std::random_shuffle(small.begin(), small.end());
|
||||
std::random_shuffle(big.begin(), big.end());
|
||||
std::random_shuffle(small.begin(), small.end());
|
||||
|
||||
m_BgOrder.push_back(small.back()); small.pop_back();
|
||||
m_BgOrder.push_back(small.back()); small.pop_back();
|
||||
m_BgOrder.push_back(small.back()); small.pop_back();
|
||||
m_BgOrder.push_back(big.back()); big.pop_back();
|
||||
m_BgOrder.push_back(small.back()); small.pop_back();
|
||||
m_BgOrder.push_back(big.back()); big.pop_back();
|
||||
}
|
||||
m_BgOrder.push_back(small.back()); small.pop_back();
|
||||
m_BgOrder.push_back(small.back()); small.pop_back();
|
||||
m_BgOrder.push_back(small.back()); small.pop_back();
|
||||
m_BgOrder.push_back(big.back()); big.pop_back();
|
||||
m_BgOrder.push_back(small.back()); small.pop_back();
|
||||
m_BgOrder.push_back(big.back()); big.pop_back();
|
||||
}
|
||||
|
||||
m_CurrentRandomBg = m_BgOrder.back();
|
||||
m_BgOrder.pop_back();
|
||||
m_CurrentRandomBg = m_BgOrder.back();
|
||||
m_BgOrder.pop_back();
|
||||
|
||||
switch (m_CurrentRandomBg)
|
||||
{
|
||||
case BATTLEGROUND_AV: m_SwitchTimer = 180*IN_MILLISECONDS; break; // max 40 per team
|
||||
case BATTLEGROUND_WS: m_SwitchTimer = 30*IN_MILLISECONDS; break; // max 10 per team
|
||||
case BATTLEGROUND_IC: m_SwitchTimer = 180*IN_MILLISECONDS; break; // max 40 per team
|
||||
case BATTLEGROUND_EY: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
|
||||
case BATTLEGROUND_AB: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
|
||||
case BATTLEGROUND_SA: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
|
||||
default: ASSERT(false); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_SwitchTimer -= diff;
|
||||
switch (m_CurrentRandomBg)
|
||||
{
|
||||
case BATTLEGROUND_AV: m_SwitchTimer = 180*IN_MILLISECONDS; break; // max 40 per team
|
||||
case BATTLEGROUND_WS: m_SwitchTimer = 30*IN_MILLISECONDS; break; // max 10 per team
|
||||
case BATTLEGROUND_IC: m_SwitchTimer = 180*IN_MILLISECONDS; break; // max 40 per team
|
||||
case BATTLEGROUND_EY: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
|
||||
case BATTLEGROUND_AB: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
|
||||
case BATTLEGROUND_SA: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
|
||||
default: ASSERT(false); break;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_SwitchTimer -= diff;
|
||||
}
|
||||
|
||||
void RandomBattlegroundSystem::BattlegroundCreated(BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
// if created current random bg, set current to another one
|
||||
if (bgTypeId == m_CurrentRandomBg)
|
||||
Update(0xffffffff);
|
||||
// if created current random bg, set current to another one
|
||||
if (bgTypeId == m_CurrentRandomBg)
|
||||
Update(0xffffffff);
|
||||
}
|
||||
|
||||
@@ -58,15 +58,15 @@ struct GroupQueueInfo;
|
||||
// pussywizard
|
||||
class RandomBattlegroundSystem
|
||||
{
|
||||
public:
|
||||
RandomBattlegroundSystem();
|
||||
void Update(uint32 diff);
|
||||
BattlegroundTypeId GetCurrentRandomBg() const { return m_CurrentRandomBg; }
|
||||
void BattlegroundCreated(BattlegroundTypeId bgTypeId);
|
||||
private:
|
||||
BattlegroundTypeId m_CurrentRandomBg;
|
||||
uint32 m_SwitchTimer;
|
||||
std::vector<BattlegroundTypeId> m_BgOrder;
|
||||
public:
|
||||
RandomBattlegroundSystem();
|
||||
void Update(uint32 diff);
|
||||
BattlegroundTypeId GetCurrentRandomBg() const { return m_CurrentRandomBg; }
|
||||
void BattlegroundCreated(BattlegroundTypeId bgTypeId);
|
||||
private:
|
||||
BattlegroundTypeId m_CurrentRandomBg;
|
||||
uint32 m_SwitchTimer;
|
||||
std::vector<BattlegroundTypeId> m_BgOrder;
|
||||
};
|
||||
|
||||
class BattlegroundMgr
|
||||
@@ -142,22 +142,22 @@ class BattlegroundMgr
|
||||
return BATTLEGROUND_TYPE_NONE;
|
||||
}
|
||||
|
||||
const BattlegroundContainer& GetBattlegroundList() { return m_Battlegrounds; } // pussywizard
|
||||
RandomBattlegroundSystem RandomSystem; // pussywizard
|
||||
const BattlegroundContainer& GetBattlegroundList() { return m_Battlegrounds; } // pussywizard
|
||||
RandomBattlegroundSystem RandomSystem; // pussywizard
|
||||
|
||||
private:
|
||||
bool CreateBattleground(CreateBattlegroundData& data);
|
||||
uint32 GetNextClientVisibleInstanceId();
|
||||
|
||||
typedef std::map<BattlegroundTypeId, Battleground*> BattlegroundTemplateContainer;
|
||||
BattlegroundTemplateContainer m_BattlegroundTemplates;
|
||||
BattlegroundTemplateContainer m_BattlegroundTemplates;
|
||||
BattlegroundContainer m_Battlegrounds;
|
||||
|
||||
BattlegroundQueue m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES];
|
||||
|
||||
std::vector<uint64> m_ArenaQueueUpdateScheduler;
|
||||
uint32 m_lastClientVisibleInstanceId;
|
||||
uint32 m_NextPeriodicQueueUpdateTime;
|
||||
uint32 m_lastClientVisibleInstanceId;
|
||||
uint32 m_NextPeriodicQueueUpdateTime;
|
||||
time_t m_NextAutoDistributionTime;
|
||||
bool m_ArenaTesting;
|
||||
bool m_Testing;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -44,9 +44,9 @@ struct GroupQueueInfo // stores informatio
|
||||
uint32 OpponentsTeamRating; // for rated arena matches
|
||||
uint32 OpponentsMatchmakerRating; // for rated arena matches
|
||||
|
||||
// pussywizard: for internal use
|
||||
uint8 _bracketId;
|
||||
uint8 _groupType;
|
||||
// pussywizard: for internal use
|
||||
uint8 _bracketId;
|
||||
uint8 _groupType;
|
||||
};
|
||||
|
||||
enum BattlegroundQueueGroupTypes
|
||||
@@ -81,8 +81,8 @@ class BattlegroundQueue
|
||||
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo);
|
||||
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const;
|
||||
|
||||
void SetBgTypeIdAndArenaType(BattlegroundTypeId b, uint8 a) { m_bgTypeId = b; m_arenaType = ArenaType(a); } // pussywizard
|
||||
void AddEvent(BasicEvent* Event, uint64 e_time);
|
||||
void SetBgTypeIdAndArenaType(BattlegroundTypeId b, uint8 a) { m_bgTypeId = b; m_arenaType = ArenaType(a); } // pussywizard
|
||||
void AddEvent(BasicEvent* Event, uint64 e_time);
|
||||
|
||||
typedef std::map<uint64, GroupQueueInfo*> QueuedPlayersMap;
|
||||
QueuedPlayersMap m_QueuedPlayers;
|
||||
@@ -104,24 +104,24 @@ class BattlegroundQueue
|
||||
// class to select and invite groups to bg
|
||||
class SelectionPool
|
||||
{
|
||||
public:
|
||||
SelectionPool(): PlayerCount(0) {};
|
||||
void Init();
|
||||
bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount);
|
||||
bool KickGroup(const uint32 size);
|
||||
uint32 GetPlayerCount() const {return PlayerCount;}
|
||||
public:
|
||||
GroupsQueueType SelectedGroups;
|
||||
private:
|
||||
uint32 PlayerCount;
|
||||
public:
|
||||
SelectionPool(): PlayerCount(0) {};
|
||||
void Init();
|
||||
bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount);
|
||||
bool KickGroup(const uint32 size);
|
||||
uint32 GetPlayerCount() const {return PlayerCount;}
|
||||
public:
|
||||
GroupsQueueType SelectedGroups;
|
||||
private:
|
||||
uint32 PlayerCount;
|
||||
};
|
||||
|
||||
//one selection pool for horde, other one for alliance
|
||||
SelectionPool m_SelectionPools[BG_TEAMS_COUNT];
|
||||
private:
|
||||
|
||||
BattlegroundTypeId m_bgTypeId;
|
||||
ArenaType m_arenaType;
|
||||
BattlegroundTypeId m_bgTypeId;
|
||||
ArenaType m_arenaType;
|
||||
uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
|
||||
uint32 m_WaitTimeLastIndex[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
|
||||
|
||||
|
||||
@@ -20,12 +20,12 @@ BattlegroundAB::BattlegroundAB()
|
||||
BgObjects.resize(BG_AB_OBJECT_MAX);
|
||||
BgCreatures.resize(BG_AB_ALL_NODES_COUNT + BG_AB_DYNAMIC_NODES_COUNT); // xinef: +BG_AB_DYNAMIC_NODES_COUNT buff triggers
|
||||
|
||||
_controlledPoints[TEAM_ALLIANCE] = 0;
|
||||
_controlledPoints[TEAM_HORDE] = 0;
|
||||
_controlledPoints[TEAM_ALLIANCE] = 0;
|
||||
_controlledPoints[TEAM_HORDE] = 0;
|
||||
_teamScores500Disadvantage[TEAM_ALLIANCE] = false;
|
||||
_teamScores500Disadvantage[TEAM_HORDE] = false;
|
||||
_honorTics = 0;
|
||||
_reputationTics = 0;
|
||||
_teamScores500Disadvantage[TEAM_HORDE] = false;
|
||||
_honorTics = 0;
|
||||
_reputationTics = 0;
|
||||
|
||||
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES;
|
||||
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE;
|
||||
@@ -41,77 +41,77 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
_bgEvents.Update(diff);
|
||||
while (uint32 eventId =_bgEvents.ExecuteEvent())
|
||||
switch (eventId)
|
||||
{
|
||||
case BG_AB_EVENT_UPDATE_BANNER_STABLE:
|
||||
case BG_AB_EVENT_UPDATE_BANNER_FARM:
|
||||
case BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH:
|
||||
case BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL:
|
||||
case BG_AB_EVENT_UPDATE_BANNER_GOLDMINE:
|
||||
CreateBanner(eventId - BG_AB_EVENT_UPDATE_BANNER_STABLE, false);
|
||||
break;
|
||||
case BG_AB_EVENT_CAPTURE_STABLE:
|
||||
case BG_AB_EVENT_CAPTURE_FARM:
|
||||
case BG_AB_EVENT_CAPTURE_BLACKSMITH:
|
||||
case BG_AB_EVENT_CAPTURE_LUMBERMILL:
|
||||
case BG_AB_EVENT_CAPTURE_GOLDMINE:
|
||||
{
|
||||
uint8 node = eventId - BG_AB_EVENT_CAPTURE_STABLE;
|
||||
TeamId teamId = _capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED ? TEAM_ALLIANCE : TEAM_HORDE;
|
||||
DeleteBanner(node);
|
||||
_capturePointInfo[node]._ownerTeamId = teamId;
|
||||
_capturePointInfo[node]._state = teamId == TEAM_ALLIANCE ? BG_AB_NODE_STATE_ALLY_OCCUPIED : BG_AB_NODE_STATE_HORDE_OCCUPIED;
|
||||
_capturePointInfo[node]._captured = true;
|
||||
_bgEvents.Update(diff);
|
||||
while (uint32 eventId =_bgEvents.ExecuteEvent())
|
||||
switch (eventId)
|
||||
{
|
||||
case BG_AB_EVENT_UPDATE_BANNER_STABLE:
|
||||
case BG_AB_EVENT_UPDATE_BANNER_FARM:
|
||||
case BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH:
|
||||
case BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL:
|
||||
case BG_AB_EVENT_UPDATE_BANNER_GOLDMINE:
|
||||
CreateBanner(eventId - BG_AB_EVENT_UPDATE_BANNER_STABLE, false);
|
||||
break;
|
||||
case BG_AB_EVENT_CAPTURE_STABLE:
|
||||
case BG_AB_EVENT_CAPTURE_FARM:
|
||||
case BG_AB_EVENT_CAPTURE_BLACKSMITH:
|
||||
case BG_AB_EVENT_CAPTURE_LUMBERMILL:
|
||||
case BG_AB_EVENT_CAPTURE_GOLDMINE:
|
||||
{
|
||||
uint8 node = eventId - BG_AB_EVENT_CAPTURE_STABLE;
|
||||
TeamId teamId = _capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED ? TEAM_ALLIANCE : TEAM_HORDE;
|
||||
DeleteBanner(node);
|
||||
_capturePointInfo[node]._ownerTeamId = teamId;
|
||||
_capturePointInfo[node]._state = teamId == TEAM_ALLIANCE ? BG_AB_NODE_STATE_ALLY_OCCUPIED : BG_AB_NODE_STATE_HORDE_OCCUPIED;
|
||||
_capturePointInfo[node]._captured = true;
|
||||
|
||||
CreateBanner(node, false);
|
||||
NodeOccupied(node);
|
||||
SendNodeUpdate(node);
|
||||
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, teamId == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, teamId == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE, LANG_BG_AB_NODE_STABLES + node);
|
||||
PlaySoundToAll(teamId == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_CAPTURED_ALLIANCE : BG_AB_SOUND_NODE_CAPTURED_HORDE);
|
||||
break;
|
||||
}
|
||||
case BG_AB_EVENT_ALLIANCE_TICK:
|
||||
case BG_AB_EVENT_HORDE_TICK:
|
||||
{
|
||||
TeamId teamId = TeamId(eventId - BG_AB_EVENT_ALLIANCE_TICK);
|
||||
uint8 controlledPoints = _controlledPoints[teamId];
|
||||
if (controlledPoints == 0)
|
||||
{
|
||||
_bgEvents.ScheduleEvent(eventId, 3000);
|
||||
break;
|
||||
}
|
||||
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, teamId == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, teamId == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE, LANG_BG_AB_NODE_STABLES + node);
|
||||
PlaySoundToAll(teamId == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_CAPTURED_ALLIANCE : BG_AB_SOUND_NODE_CAPTURED_HORDE);
|
||||
break;
|
||||
}
|
||||
case BG_AB_EVENT_ALLIANCE_TICK:
|
||||
case BG_AB_EVENT_HORDE_TICK:
|
||||
{
|
||||
TeamId teamId = TeamId(eventId - BG_AB_EVENT_ALLIANCE_TICK);
|
||||
uint8 controlledPoints = _controlledPoints[teamId];
|
||||
if (controlledPoints == 0)
|
||||
{
|
||||
_bgEvents.ScheduleEvent(eventId, 3000);
|
||||
break;
|
||||
}
|
||||
|
||||
uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics);
|
||||
uint8 reputationRewards = uint8(m_TeamScores[teamId] / _reputationTics);
|
||||
uint8 information = uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE);
|
||||
m_TeamScores[teamId] += BG_AB_TickPoints[controlledPoints];
|
||||
if (m_TeamScores[teamId] > BG_AB_MAX_TEAM_SCORE)
|
||||
m_TeamScores[teamId] = BG_AB_MAX_TEAM_SCORE;
|
||||
uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics);
|
||||
uint8 reputationRewards = uint8(m_TeamScores[teamId] / _reputationTics);
|
||||
uint8 information = uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE);
|
||||
m_TeamScores[teamId] += BG_AB_TickPoints[controlledPoints];
|
||||
if (m_TeamScores[teamId] > BG_AB_MAX_TEAM_SCORE)
|
||||
m_TeamScores[teamId] = BG_AB_MAX_TEAM_SCORE;
|
||||
|
||||
if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics))
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), teamId);
|
||||
if (reputationRewards < uint8(m_TeamScores[teamId] / _reputationTics))
|
||||
RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, 10, teamId);
|
||||
if (information < uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE))
|
||||
{
|
||||
SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_AB_A_NEAR_VICTORY : LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
|
||||
}
|
||||
if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics))
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), teamId);
|
||||
if (reputationRewards < uint8(m_TeamScores[teamId] / _reputationTics))
|
||||
RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, 10, teamId);
|
||||
if (information < uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE))
|
||||
{
|
||||
SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_AB_A_NEAR_VICTORY : LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
|
||||
}
|
||||
|
||||
UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_AB_OP_RESOURCES_ALLY : BG_AB_OP_RESOURCES_HORDE, m_TeamScores[teamId]);
|
||||
if (m_TeamScores[teamId] > m_TeamScores[GetOtherTeamId(teamId)] + 500)
|
||||
_teamScores500Disadvantage[GetOtherTeamId(teamId)] = true;
|
||||
if (m_TeamScores[teamId] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleground(teamId);
|
||||
UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_AB_OP_RESOURCES_ALLY : BG_AB_OP_RESOURCES_HORDE, m_TeamScores[teamId]);
|
||||
if (m_TeamScores[teamId] > m_TeamScores[GetOtherTeamId(teamId)] + 500)
|
||||
_teamScores500Disadvantage[GetOtherTeamId(teamId)] = true;
|
||||
if (m_TeamScores[teamId] >= BG_AB_MAX_TEAM_SCORE)
|
||||
EndBattleground(teamId);
|
||||
|
||||
_bgEvents.ScheduleEvent(eventId, BG_AB_TickIntervals[controlledPoints]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
_bgEvents.ScheduleEvent(eventId, BG_AB_TickIntervals[controlledPoints]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundAB::StartingEventCloseDoors()
|
||||
@@ -140,8 +140,8 @@ void BattlegroundAB::StartingEventOpenDoors()
|
||||
DoorOpen(BG_AB_OBJECT_GATE_A);
|
||||
DoorOpen(BG_AB_OBJECT_GATE_H);
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, BG_AB_EVENT_START_BATTLE);
|
||||
_bgEvents.ScheduleEvent(BG_AB_EVENT_ALLIANCE_TICK, 3000);
|
||||
_bgEvents.ScheduleEvent(BG_AB_EVENT_HORDE_TICK, 3000);
|
||||
_bgEvents.ScheduleEvent(BG_AB_EVENT_ALLIANCE_TICK, 3000);
|
||||
_bgEvents.ScheduleEvent(BG_AB_EVENT_HORDE_TICK, 3000);
|
||||
}
|
||||
|
||||
void BattlegroundAB::AddPlayer(Player* player)
|
||||
@@ -152,7 +152,7 @@ void BattlegroundAB::AddPlayer(Player* player)
|
||||
|
||||
void BattlegroundAB::RemovePlayer(Player* player)
|
||||
{
|
||||
player->SetPhaseMask(1, false);
|
||||
player->SetPhaseMask(1, false);
|
||||
}
|
||||
|
||||
void BattlegroundAB::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
@@ -194,26 +194,26 @@ void BattlegroundAB::CreateBanner(uint8 node, bool delay)
|
||||
return;
|
||||
}
|
||||
|
||||
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_IMMEDIATELY);
|
||||
}
|
||||
|
||||
void BattlegroundAB::DeleteBanner(uint8 node)
|
||||
{
|
||||
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_ONE_DAY);
|
||||
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
void BattlegroundAB::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
{
|
||||
if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL)
|
||||
data << uint32(_capturePointInfo[node]._iconNone) << uint32(1);
|
||||
{
|
||||
if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL)
|
||||
data << uint32(_capturePointInfo[node]._iconNone) << uint32(1);
|
||||
|
||||
for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i)
|
||||
data << uint32(_capturePointInfo[node]._iconCapture + i-1) << uint32(_capturePointInfo[node]._state == i);
|
||||
}
|
||||
for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i)
|
||||
data << uint32(_capturePointInfo[node]._iconCapture + i-1) << uint32(_capturePointInfo[node]._state == i);
|
||||
}
|
||||
|
||||
data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(_controlledPoints[TEAM_ALLIANCE]);
|
||||
data << uint32(BG_AB_OP_OCCUPIED_BASES_HORDE) << uint32(_controlledPoints[TEAM_HORDE]);
|
||||
@@ -226,9 +226,9 @@ void BattlegroundAB::FillInitialWorldStates(WorldPacket& data)
|
||||
|
||||
void BattlegroundAB::SendNodeUpdate(uint8 node)
|
||||
{
|
||||
UpdateWorldState(_capturePointInfo[node]._iconNone, 0);
|
||||
for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i)
|
||||
UpdateWorldState(_capturePointInfo[node]._iconCapture + i-1, _capturePointInfo[node]._state == i);
|
||||
UpdateWorldState(_capturePointInfo[node]._iconNone, 0);
|
||||
for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i)
|
||||
UpdateWorldState(_capturePointInfo[node]._iconCapture + i-1, _capturePointInfo[node]._state == i);
|
||||
|
||||
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, _controlledPoints[TEAM_ALLIANCE]);
|
||||
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, _controlledPoints[TEAM_HORDE]);
|
||||
@@ -236,16 +236,16 @@ void BattlegroundAB::SendNodeUpdate(uint8 node)
|
||||
|
||||
void BattlegroundAB::NodeOccupied(uint8 node)
|
||||
{
|
||||
ApplyPhaseMask();
|
||||
AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], _capturePointInfo[node]._ownerTeamId);
|
||||
ApplyPhaseMask();
|
||||
AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], _capturePointInfo[node]._ownerTeamId);
|
||||
|
||||
++_controlledPoints[_capturePointInfo[node]._ownerTeamId];
|
||||
++_controlledPoints[_capturePointInfo[node]._ownerTeamId];
|
||||
if (_controlledPoints[_capturePointInfo[node]._ownerTeamId] >= 5)
|
||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, _capturePointInfo[node]._ownerTeamId);
|
||||
if (_controlledPoints[_capturePointInfo[node]._ownerTeamId] >= 4)
|
||||
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, _capturePointInfo[node]._ownerTeamId);
|
||||
|
||||
Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_AB_ALL_NODES_COUNT + node]);
|
||||
Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_AB_ALL_NODES_COUNT + node]);
|
||||
if (!trigger)
|
||||
trigger = AddCreature(WORLD_TRIGGER, BG_AB_ALL_NODES_COUNT + node, BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1], BG_AB_NodePositions[node][2], BG_AB_NodePositions[node][3]);
|
||||
|
||||
@@ -258,10 +258,10 @@ void BattlegroundAB::NodeOccupied(uint8 node)
|
||||
|
||||
void BattlegroundAB::NodeDeoccupied(uint8 node)
|
||||
{
|
||||
--_controlledPoints[_capturePointInfo[node]._ownerTeamId];
|
||||
--_controlledPoints[_capturePointInfo[node]._ownerTeamId];
|
||||
|
||||
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
|
||||
RelocateDeadPlayers(BgCreatures[node]);
|
||||
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
|
||||
RelocateDeadPlayers(BgCreatures[node]);
|
||||
|
||||
DelCreature(node); // Delete spirit healer
|
||||
DelCreature(BG_AB_ALL_NODES_COUNT + node); // Delete aura trigger
|
||||
@@ -270,90 +270,90 @@ void BattlegroundAB::NodeDeoccupied(uint8 node)
|
||||
void BattlegroundAB::EventPlayerClickedOnFlag(Player* player, GameObject* gameObject)
|
||||
{
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || !player->IsWithinDistInMap(gameObject, 10.0f))
|
||||
return;
|
||||
return;
|
||||
|
||||
uint8 node = BG_AB_NODE_STABLES;
|
||||
for (; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
if (player->GetDistance2d(BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1]) < 10.0f)
|
||||
break;
|
||||
for (; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
|
||||
if (player->GetDistance2d(BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1]) < 10.0f)
|
||||
break;
|
||||
|
||||
if (node == BG_AB_DYNAMIC_NODES_COUNT || _capturePointInfo[node]._ownerTeamId == player->GetTeamId() ||
|
||||
(_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED && player->GetTeamId() == TEAM_ALLIANCE) ||
|
||||
(_capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED && player->GetTeamId() == TEAM_HORDE))
|
||||
(_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED && player->GetTeamId() == TEAM_ALLIANCE) ||
|
||||
(_capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED && player->GetTeamId() == TEAM_HORDE))
|
||||
return;
|
||||
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
uint32 sound = 0;
|
||||
uint32 message = 0;
|
||||
uint32 message2 = 0;
|
||||
DeleteBanner(node);
|
||||
uint32 message = 0;
|
||||
uint32 message2 = 0;
|
||||
DeleteBanner(node);
|
||||
CreateBanner(node, true);
|
||||
|
||||
if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL)
|
||||
if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL)
|
||||
{
|
||||
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
|
||||
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
|
||||
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
|
||||
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
|
||||
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
|
||||
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
|
||||
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
|
||||
sound = BG_AB_SOUND_NODE_CLAIMED;
|
||||
message = LANG_BG_AB_NODE_CLAIMED;
|
||||
message2 = player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE;
|
||||
message = LANG_BG_AB_NODE_CLAIMED;
|
||||
message2 = player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE;
|
||||
}
|
||||
else if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED || _capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED)
|
||||
{
|
||||
if (!_capturePointInfo[node]._captured)
|
||||
if (!_capturePointInfo[node]._captured)
|
||||
{
|
||||
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
|
||||
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
|
||||
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
|
||||
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
|
||||
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
|
||||
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
|
||||
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
|
||||
message = LANG_BG_AB_NODE_ASSAULTED;
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
|
||||
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_OCCUPIED + player->GetTeamId();
|
||||
_capturePointInfo[node]._ownerTeamId = player->GetTeamId();
|
||||
_bgEvents.CancelEvent(BG_AB_EVENT_CAPTURE_STABLE + node);
|
||||
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_OCCUPIED + player->GetTeamId();
|
||||
_capturePointInfo[node]._ownerTeamId = player->GetTeamId();
|
||||
_bgEvents.CancelEvent(BG_AB_EVENT_CAPTURE_STABLE + node);
|
||||
NodeOccupied(node); // after setting team owner
|
||||
message = LANG_BG_AB_NODE_DEFENDED;
|
||||
}
|
||||
sound = player->GetTeamId() == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||
sound = player->GetTeamId() == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
|
||||
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
|
||||
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
|
||||
NodeDeoccupied(node); // before setting team owner to neutral
|
||||
|
||||
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
|
||||
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
|
||||
|
||||
ApplyPhaseMask();
|
||||
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
|
||||
ApplyPhaseMask();
|
||||
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
|
||||
message = LANG_BG_AB_NODE_ASSAULTED;
|
||||
sound = player->GetTeamId() == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
|
||||
}
|
||||
|
||||
SendNodeUpdate(node);
|
||||
PlaySoundToAll(sound);
|
||||
SendMessage2ToAll(message, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, player, LANG_BG_AB_NODE_STABLES + node, message2);
|
||||
SendMessage2ToAll(message, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, player, LANG_BG_AB_NODE_STABLES + node, message2);
|
||||
}
|
||||
|
||||
TeamId BattlegroundAB::GetPrematureWinner()
|
||||
{
|
||||
if (_controlledPoints[TEAM_ALLIANCE] > _controlledPoints[TEAM_HORDE])
|
||||
return TEAM_ALLIANCE;
|
||||
return _controlledPoints[TEAM_HORDE] > _controlledPoints[TEAM_ALLIANCE] ? TEAM_HORDE : Battleground::GetPrematureWinner();
|
||||
return _controlledPoints[TEAM_HORDE] > _controlledPoints[TEAM_ALLIANCE] ? TEAM_HORDE : Battleground::GetPrematureWinner();
|
||||
}
|
||||
|
||||
bool BattlegroundAB::SetupBattleground()
|
||||
{
|
||||
for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
{
|
||||
AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_ALLY + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_HORDE + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
AddObject(BG_AB_OBJECT_BANNER_CONT_A + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
@@ -373,22 +373,22 @@ bool BattlegroundAB::SetupBattleground()
|
||||
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
AddSpiritGuide(BG_AB_SPIRIT_ALIANCE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][3], TEAM_ALLIANCE);
|
||||
AddSpiritGuide(BG_AB_SPIRIT_HORDE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][3], TEAM_HORDE);
|
||||
AddSpiritGuide(BG_AB_SPIRIT_ALIANCE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][3], TEAM_ALLIANCE);
|
||||
AddSpiritGuide(BG_AB_SPIRIT_HORDE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][3], TEAM_HORDE);
|
||||
|
||||
for (uint32 i = BG_AB_OBJECT_BANNER_NEUTRAL; i < BG_AB_OBJECT_MAX; ++i)
|
||||
if (BgObjects[i] == 0)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundAB: Failed to spawn some object Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
for (uint32 i = BG_AB_OBJECT_BANNER_NEUTRAL; i < BG_AB_OBJECT_MAX; ++i)
|
||||
if (BgObjects[i] == 0)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundAB: Failed to spawn some object Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32 i = BG_AB_SPIRIT_ALIANCE; i <= BG_AB_SPIRIT_HORDE; ++i)
|
||||
if (BgCreatures[i] == 0)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundAB: Failed to spawn spirit guides Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
for (uint32 i = BG_AB_SPIRIT_ALIANCE; i <= BG_AB_SPIRIT_HORDE; ++i)
|
||||
if (BgCreatures[i] == 0)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundAB: Failed to spawn spirit guides Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -398,21 +398,21 @@ void BattlegroundAB::Init()
|
||||
//call parent's class reset
|
||||
Battleground::Init();
|
||||
|
||||
_bgEvents.Reset();
|
||||
_bgEvents.Reset();
|
||||
|
||||
_honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_AB_HONOR_TICK_WEEKEND : BG_AB_HONOR_TICK_NORMAL;
|
||||
_reputationTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_AB_REP_TICK_WEEKEND : BG_AB_REP_TICK_NORMAL;
|
||||
_honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_AB_HONOR_TICK_WEEKEND : BG_AB_HONOR_TICK_NORMAL;
|
||||
_reputationTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_AB_REP_TICK_WEEKEND : BG_AB_REP_TICK_NORMAL;
|
||||
|
||||
_capturePointInfo[BG_AB_NODE_STABLES]._iconNone = BG_AB_OP_STABLE_ICON;
|
||||
_capturePointInfo[BG_AB_NODE_FARM]._iconNone = BG_AB_OP_FARM_ICON;
|
||||
_capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconNone = BG_AB_OP_BLACKSMITH_ICON;
|
||||
_capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconNone = BG_AB_OP_LUMBERMILL_ICON;
|
||||
_capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconNone = BG_AB_OP_GOLDMINE_ICON;
|
||||
_capturePointInfo[BG_AB_NODE_STABLES]._iconCapture = BG_AB_OP_STABLE_STATE_ALIENCE;
|
||||
_capturePointInfo[BG_AB_NODE_FARM]._iconCapture = BG_AB_OP_FARM_STATE_ALIENCE;
|
||||
_capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconCapture = BG_AB_OP_BLACKSMITH_STATE_ALIENCE;
|
||||
_capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconCapture = BG_AB_OP_LUMBERMILL_STATE_ALIENCE;
|
||||
_capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconCapture = BG_AB_OP_GOLDMINE_STATE_ALIENCE;
|
||||
_capturePointInfo[BG_AB_NODE_STABLES]._iconNone = BG_AB_OP_STABLE_ICON;
|
||||
_capturePointInfo[BG_AB_NODE_FARM]._iconNone = BG_AB_OP_FARM_ICON;
|
||||
_capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconNone = BG_AB_OP_BLACKSMITH_ICON;
|
||||
_capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconNone = BG_AB_OP_LUMBERMILL_ICON;
|
||||
_capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconNone = BG_AB_OP_GOLDMINE_ICON;
|
||||
_capturePointInfo[BG_AB_NODE_STABLES]._iconCapture = BG_AB_OP_STABLE_STATE_ALIENCE;
|
||||
_capturePointInfo[BG_AB_NODE_FARM]._iconCapture = BG_AB_OP_FARM_STATE_ALIENCE;
|
||||
_capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconCapture = BG_AB_OP_BLACKSMITH_STATE_ALIENCE;
|
||||
_capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconCapture = BG_AB_OP_LUMBERMILL_STATE_ALIENCE;
|
||||
_capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconCapture = BG_AB_OP_GOLDMINE_STATE_ALIENCE;
|
||||
}
|
||||
|
||||
void BattlegroundAB::EndBattleground(TeamId winnerTeamId)
|
||||
@@ -421,23 +421,23 @@ void BattlegroundAB::EndBattleground(TeamId winnerTeamId)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), TEAM_HORDE);
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), TEAM_ALLIANCE);
|
||||
Battleground::EndBattleground(winnerTeamId);
|
||||
_bgEvents.Reset();
|
||||
_bgEvents.Reset();
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* BattlegroundAB::GetClosestGraveyard(Player* player)
|
||||
{
|
||||
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[BG_AB_SPIRIT_ALIANCE + player->GetTeamId()]);
|
||||
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[BG_AB_SPIRIT_ALIANCE + player->GetTeamId()]);
|
||||
WorldSafeLocsEntry const* nearestEntry = entry;
|
||||
|
||||
float pX = player->GetPositionX();
|
||||
float pY = player->GetPositionY();
|
||||
float dist = (entry->x - pX)*(entry->x - pX)+(entry->y - pY)*(entry->y - pY);
|
||||
float minDist = dist;
|
||||
float pX = player->GetPositionX();
|
||||
float pY = player->GetPositionY();
|
||||
float dist = (entry->x - pX)*(entry->x - pX)+(entry->y - pY)*(entry->y - pY);
|
||||
float minDist = dist;
|
||||
|
||||
for (uint8 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if (_capturePointInfo[i]._ownerTeamId == player->GetTeamId())
|
||||
{
|
||||
entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[i]);
|
||||
for (uint8 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if (_capturePointInfo[i]._ownerTeamId == player->GetTeamId())
|
||||
{
|
||||
entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[i]);
|
||||
dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY);
|
||||
if (dist < minDist)
|
||||
{
|
||||
@@ -478,15 +478,15 @@ bool BattlegroundAB::AllNodesConrolledByTeam(TeamId teamId) const
|
||||
|
||||
void BattlegroundAB::ApplyPhaseMask()
|
||||
{
|
||||
uint32 phaseMask = 1;
|
||||
for (uint32 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if (_capturePointInfo[i]._ownerTeamId != TEAM_NEUTRAL)
|
||||
phaseMask |= 1 << (i*2+1 + _capturePointInfo[i]._ownerTeamId);
|
||||
uint32 phaseMask = 1;
|
||||
for (uint32 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
|
||||
if (_capturePointInfo[i]._ownerTeamId != TEAM_NEUTRAL)
|
||||
phaseMask |= 1 << (i*2+1 + _capturePointInfo[i]._ownerTeamId);
|
||||
|
||||
const BattlegroundPlayerMap& bgPlayerMap = GetPlayers();
|
||||
for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr)
|
||||
{
|
||||
itr->second->SetPhaseMask(phaseMask, false);
|
||||
itr->second->UpdateObjectVisibility(true, false);
|
||||
}
|
||||
const BattlegroundPlayerMap& bgPlayerMap = GetPlayers();
|
||||
for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr)
|
||||
{
|
||||
itr->second->SetPhaseMask(phaseMask, false);
|
||||
itr->second->UpdateObjectVisibility(true, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,20 +9,20 @@ REWRITTEN BY XINEF
|
||||
|
||||
enum BG_AB_Events
|
||||
{
|
||||
BG_AB_EVENT_UPDATE_BANNER_STABLE = 1,
|
||||
BG_AB_EVENT_UPDATE_BANNER_FARM = 2,
|
||||
BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH = 3,
|
||||
BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL = 4,
|
||||
BG_AB_EVENT_UPDATE_BANNER_GOLDMINE = 5,
|
||||
BG_AB_EVENT_UPDATE_BANNER_STABLE = 1,
|
||||
BG_AB_EVENT_UPDATE_BANNER_FARM = 2,
|
||||
BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH = 3,
|
||||
BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL = 4,
|
||||
BG_AB_EVENT_UPDATE_BANNER_GOLDMINE = 5,
|
||||
|
||||
BG_AB_EVENT_CAPTURE_STABLE = 6,
|
||||
BG_AB_EVENT_CAPTURE_FARM = 7,
|
||||
BG_AB_EVENT_CAPTURE_BLACKSMITH = 8,
|
||||
BG_AB_EVENT_CAPTURE_LUMBERMILL = 9,
|
||||
BG_AB_EVENT_CAPTURE_GOLDMINE = 10,
|
||||
BG_AB_EVENT_CAPTURE_STABLE = 6,
|
||||
BG_AB_EVENT_CAPTURE_FARM = 7,
|
||||
BG_AB_EVENT_CAPTURE_BLACKSMITH = 8,
|
||||
BG_AB_EVENT_CAPTURE_LUMBERMILL = 9,
|
||||
BG_AB_EVENT_CAPTURE_GOLDMINE = 10,
|
||||
|
||||
BG_AB_EVENT_ALLIANCE_TICK = 11,
|
||||
BG_AB_EVENT_HORDE_TICK = 12
|
||||
BG_AB_EVENT_ALLIANCE_TICK = 11,
|
||||
BG_AB_EVENT_HORDE_TICK = 12
|
||||
};
|
||||
|
||||
enum BG_AB_WorldStates
|
||||
@@ -67,11 +67,11 @@ enum BG_AB_WorldStates
|
||||
|
||||
enum BG_AB_ObjectIds
|
||||
{
|
||||
BG_AB_OBJECTID_NODE_BANNER_0 = 180087, // Stables banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_1 = 180088, // Blacksmith banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_2 = 180089, // Farm banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_3 = 180090, // Lumber mill banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_4 = 180091, // Gold mine banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_0 = 180087, // Stables banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_1 = 180088, // Blacksmith banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_2 = 180089, // Farm banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_3 = 180090, // Lumber mill banner
|
||||
BG_AB_OBJECTID_NODE_BANNER_4 = 180091, // Gold mine banner
|
||||
|
||||
BG_AB_OBJECTID_BANNER_A = 180058,
|
||||
BG_AB_OBJECTID_BANNER_CONT_A = 180059,
|
||||
@@ -96,7 +96,7 @@ enum BG_AB_ObjectType
|
||||
BG_AB_OBJECT_AURA_ALLY = 5,
|
||||
BG_AB_OBJECT_AURA_HORDE = 6,
|
||||
BG_AB_OBJECT_AURA_CONTESTED = 7,
|
||||
BG_AB_OBJECTS_PER_NODE = 8,
|
||||
BG_AB_OBJECTS_PER_NODE = 8,
|
||||
|
||||
BG_AB_OBJECT_GATE_A = 40,
|
||||
BG_AB_OBJECT_GATE_H = 41,
|
||||
@@ -135,11 +135,11 @@ enum BG_AB_BattlegroundNodes
|
||||
|
||||
enum BG_AB_NodeStatus
|
||||
{
|
||||
BG_AB_NODE_STATE_NEUTRAL = 0,
|
||||
BG_AB_NODE_STATE_ALLY_OCCUPIED = 1,
|
||||
BG_AB_NODE_STATE_HORDE_OCCUPIED = 2,
|
||||
BG_AB_NODE_STATE_ALLY_CONTESTED = 3,
|
||||
BG_AB_NODE_STATE_HORDE_CONTESTED = 4
|
||||
BG_AB_NODE_STATE_NEUTRAL = 0,
|
||||
BG_AB_NODE_STATE_ALLY_OCCUPIED = 1,
|
||||
BG_AB_NODE_STATE_HORDE_OCCUPIED = 2,
|
||||
BG_AB_NODE_STATE_ALLY_CONTESTED = 3,
|
||||
BG_AB_NODE_STATE_HORDE_CONTESTED = 4
|
||||
};
|
||||
|
||||
enum BG_AB_Sounds
|
||||
@@ -156,19 +156,19 @@ enum BG_AB_Misc
|
||||
{
|
||||
BG_AB_OBJECTIVE_ASSAULT_BASE = 122,
|
||||
BG_AB_OBJECTIVE_DEFEND_BASE = 123,
|
||||
BG_AB_EVENT_START_BATTLE = 9158, // Achievement: Let's Get This Done
|
||||
BG_AB_QUEST_CREDIT_BASE = 15001,
|
||||
BG_AB_EVENT_START_BATTLE = 9158, // Achievement: Let's Get This Done
|
||||
BG_AB_QUEST_CREDIT_BASE = 15001,
|
||||
|
||||
BG_AB_HONOR_TICK_NORMAL = 260,
|
||||
BG_AB_HONOR_TICK_WEEKEND = 160,
|
||||
BG_AB_REP_TICK_NORMAL = 160,
|
||||
BG_AB_REP_TICK_WEEKEND = 120,
|
||||
BG_AB_HONOR_TICK_NORMAL = 260,
|
||||
BG_AB_HONOR_TICK_WEEKEND = 160,
|
||||
BG_AB_REP_TICK_NORMAL = 160,
|
||||
BG_AB_REP_TICK_WEEKEND = 120,
|
||||
|
||||
BG_AB_WARNING_NEAR_VICTORY_SCORE = 1400,
|
||||
BG_AB_MAX_TEAM_SCORE = 1600,
|
||||
|
||||
BG_AB_FLAG_CAPTURING_TIME = 60000,
|
||||
BG_AB_BANNER_UPDATE_TIME = 2000
|
||||
BG_AB_BANNER_UPDATE_TIME = 2000
|
||||
};
|
||||
|
||||
const uint32 BG_AB_TickIntervals[BG_AB_DYNAMIC_NODES_COUNT+1] = {0, 12000, 9000, 6000, 3000, 1000};
|
||||
@@ -250,26 +250,26 @@ class BattlegroundAB : public Battleground
|
||||
void SendNodeUpdate(uint8 node);
|
||||
void NodeOccupied(uint8 node);
|
||||
void NodeDeoccupied(uint8 node);
|
||||
void ApplyPhaseMask();
|
||||
void ApplyPhaseMask();
|
||||
|
||||
struct CapturePointInfo
|
||||
{
|
||||
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _iconNone(0), _iconCapture(0), _state(BG_AB_NODE_STATE_NEUTRAL), _captured(false)
|
||||
{
|
||||
}
|
||||
struct CapturePointInfo
|
||||
{
|
||||
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _iconNone(0), _iconCapture(0), _state(BG_AB_NODE_STATE_NEUTRAL), _captured(false)
|
||||
{
|
||||
}
|
||||
|
||||
uint8 _state;
|
||||
uint32 _iconNone;
|
||||
uint32 _iconCapture;
|
||||
TeamId _ownerTeamId;
|
||||
bool _captured;
|
||||
};
|
||||
uint8 _state;
|
||||
uint32 _iconNone;
|
||||
uint32 _iconCapture;
|
||||
TeamId _ownerTeamId;
|
||||
bool _captured;
|
||||
};
|
||||
|
||||
CapturePointInfo _capturePointInfo[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
EventMap _bgEvents;
|
||||
CapturePointInfo _capturePointInfo[BG_AB_DYNAMIC_NODES_COUNT];
|
||||
EventMap _bgEvents;
|
||||
uint32 _honorTics;
|
||||
uint32 _reputationTics;
|
||||
uint8 _controlledPoints[BG_TEAMS_COUNT];
|
||||
uint8 _controlledPoints[BG_TEAMS_COUNT];
|
||||
bool _teamScores500Disadvantage[BG_TEAMS_COUNT];
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -736,7 +736,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
|
||||
creatureid=(ownerId == TEAM_ALLIANCE)?AV_NPC_A_TOWERDEFENSE:AV_NPC_H_TOWERDEFENSE;
|
||||
else
|
||||
{
|
||||
if (m_Team_QuestStatus[ownerId][0] < 500)
|
||||
if (m_Team_QuestStatus[ownerId][0] < 500)
|
||||
creatureid = (ownerId == TEAM_ALLIANCE)? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0;
|
||||
else if (m_Team_QuestStatus[ownerId][0] < 1000)
|
||||
creatureid = (ownerId == TEAM_ALLIANCE)? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1;
|
||||
@@ -1008,8 +1008,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
|
||||
}
|
||||
}
|
||||
|
||||
// xinef: moved here, assure that no call to m_Nodes is used in IF statement bellow as it is modified
|
||||
AssaultNode(node, teamId);
|
||||
// xinef: moved here, assure that no call to m_Nodes is used in IF statement bellow as it is modified
|
||||
AssaultNode(node, teamId);
|
||||
|
||||
//if snowfall gots capped it can be handled like all other graveyards
|
||||
if (m_Nodes[node].TotalOwnerId != TEAM_NEUTRAL)
|
||||
@@ -1134,8 +1134,8 @@ void BattlegroundAV::SendMineWorldStates(uint32 mine)
|
||||
else if (m_Mine_Owner[mine] == TEAM_HORDE)
|
||||
owner = 2;
|
||||
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
UpdateWorldState(BG_AV_MineWorldStates[mine][i], 0); // Xinef: Clear data for consistency and buglessness
|
||||
for (uint8 i = 0; i < 3; ++i)
|
||||
UpdateWorldState(BG_AV_MineWorldStates[mine][i], 0); // Xinef: Clear data for consistency and buglessness
|
||||
|
||||
UpdateWorldState(BG_AV_MineWorldStates[mine][owner], 1);
|
||||
}
|
||||
@@ -1295,21 +1295,21 @@ bool BattlegroundAV::SetupBattleground()
|
||||
}
|
||||
}
|
||||
|
||||
// Handpacked snowdrift, only during holiday
|
||||
if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL))
|
||||
for (uint16 i= 0 ; i <= (BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX-BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN); i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN+i, BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT, BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), RESPAWN_ONE_DAY))
|
||||
return false;
|
||||
}
|
||||
// Handpacked snowdrift, only during holiday
|
||||
if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL))
|
||||
for (uint16 i= 0 ; i <= (BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX-BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN); i++)
|
||||
{
|
||||
if (!AddObject(BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN+i, BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT, BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), RESPAWN_ONE_DAY))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Quest banners
|
||||
if (!AddObject(BG_AV_OBJECT_FROSTWOLF_BANNER, BG_AV_OBJECTID_FROSTWOLF_BANNER, BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), RESPAWN_ONE_DAY))
|
||||
// Quest banners
|
||||
if (!AddObject(BG_AV_OBJECT_FROSTWOLF_BANNER, BG_AV_OBJECTID_FROSTWOLF_BANNER, BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
|
||||
return false;
|
||||
}
|
||||
if (!AddObject(BG_AV_OBJECT_STORMPIKE_BANNER, BG_AV_OBJECTID_STORMPIKE_BANNER, BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), RESPAWN_ONE_DAY))
|
||||
if (!AddObject(BG_AV_OBJECT_STORMPIKE_BANNER, BG_AV_OBJECTID_STORMPIKE_BANNER, BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), RESPAWN_ONE_DAY))
|
||||
{
|
||||
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
|
||||
return false;
|
||||
@@ -1354,15 +1354,15 @@ bool BattlegroundAV::SetupBattleground()
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
|
||||
SpawnBGObject(BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY);
|
||||
|
||||
// Handpacked snowdrift, only during holiday
|
||||
if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL))
|
||||
for (i = BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN ; i <= BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX; i++)
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
|
||||
// Handpacked snowdrift, only during holiday
|
||||
if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL))
|
||||
for (i = BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN ; i <= BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX; i++)
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
|
||||
// Quest banners
|
||||
SpawnBGObject(BG_AV_OBJECT_FROSTWOLF_BANNER, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_AV_OBJECT_STORMPIKE_BANNER, RESPAWN_IMMEDIATELY);
|
||||
// Quest banners
|
||||
SpawnBGObject(BG_AV_OBJECT_FROSTWOLF_BANNER, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_AV_OBJECT_STORMPIKE_BANNER, RESPAWN_IMMEDIATELY);
|
||||
|
||||
//creatures
|
||||
;//sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV start poputlating nodes");
|
||||
@@ -1509,7 +1509,7 @@ void BattlegroundAV::ResetBGSubclass()
|
||||
bool BattlegroundAV::IsBothMinesControlledByTeam(TeamId teamId) const
|
||||
{
|
||||
for (uint8 mine = 0; mine < 2; mine++)
|
||||
if (m_Mine_Owner[mine] != teamId)
|
||||
if (m_Mine_Owner[mine] != teamId)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -1567,8 +1567,8 @@ bool BattlegroundAV::IsAllTowersControlledAndCaptainAlive(TeamId teamId) const
|
||||
|
||||
TeamId BattlegroundAV::GetPrematureWinner()
|
||||
{
|
||||
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
|
||||
return TEAM_ALLIANCE;
|
||||
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
|
||||
return TEAM_ALLIANCE;
|
||||
|
||||
return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner();
|
||||
return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner();
|
||||
}
|
||||
|
||||
@@ -147,17 +147,17 @@ enum BG_AV_ObjectIds
|
||||
BG_AV_OBJECTID_GATE_H = 180424,
|
||||
|
||||
//mine supplies
|
||||
BG_AV_OBJECTID_MINE_N = 178785,
|
||||
BG_AV_OBJECTID_MINE_S = 178784,
|
||||
BG_AV_OBJECTID_MINE_N = 178785,
|
||||
BG_AV_OBJECTID_MINE_S = 178784,
|
||||
|
||||
BG_AV_OBJECTID_FIRE = 179065,
|
||||
BG_AV_OBJECTID_SMOKE = 179066,
|
||||
BG_AV_OBJECTID_FIRE = 179065,
|
||||
BG_AV_OBJECTID_SMOKE = 179066,
|
||||
|
||||
// Winter Veil Hardpacked Snowdrift
|
||||
BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT = 180654,
|
||||
// Winter Veil Hardpacked Snowdrift
|
||||
BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT = 180654,
|
||||
|
||||
BG_AV_OBJECTID_FROSTWOLF_BANNER = 179025,
|
||||
BG_AV_OBJECTID_STORMPIKE_BANNER = 179024,
|
||||
BG_AV_OBJECTID_FROSTWOLF_BANNER = 179025,
|
||||
BG_AV_OBJECTID_STORMPIKE_BANNER = 179024,
|
||||
};
|
||||
|
||||
enum BG_AV_Nodes
|
||||
@@ -310,10 +310,10 @@ enum BG_AV_ObjectTypes
|
||||
BG_AV_OBJECT_MINE_SUPPLY_N_MAX = 224,
|
||||
BG_AV_OBJECT_MINE_SUPPLY_S_MIN = 225,
|
||||
BG_AV_OBJECT_MINE_SUPPLY_S_MAX = 236,
|
||||
BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN = 237,
|
||||
BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX = 246,
|
||||
BG_AV_OBJECT_FROSTWOLF_BANNER = 247,
|
||||
BG_AV_OBJECT_STORMPIKE_BANNER = 248,
|
||||
BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN = 237,
|
||||
BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX = 246,
|
||||
BG_AV_OBJECT_FROSTWOLF_BANNER = 247,
|
||||
BG_AV_OBJECT_STORMPIKE_BANNER = 248,
|
||||
|
||||
BG_AV_OBJECT_MAX = 249
|
||||
};
|
||||
@@ -362,10 +362,10 @@ enum BG_AV_OBJECTS
|
||||
AV_OPLACE_MINE_SUPPLY_N_MAX = 136,
|
||||
AV_OPLACE_MINE_SUPPLY_S_MIN = 137,
|
||||
AV_OPLACE_MINE_SUPPLY_S_MAX = 148,
|
||||
AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN = 149,
|
||||
AV_OPLACE_HANDPACKED_SNOWDRIFT_MAX = 158,
|
||||
AV_OPLACE_FROSTWOLF_BANNER = 159,
|
||||
AV_OPLACE_STORMPIKE_BANNER = 160,
|
||||
AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN = 149,
|
||||
AV_OPLACE_HANDPACKED_SNOWDRIFT_MAX = 158,
|
||||
AV_OPLACE_FROSTWOLF_BANNER = 159,
|
||||
AV_OPLACE_STORMPIKE_BANNER = 160,
|
||||
|
||||
AV_OPLACE_MAX = 161
|
||||
};
|
||||
@@ -540,19 +540,19 @@ const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] =
|
||||
{-820.644f, -136.043f, 63.1977f, 2.40855f},
|
||||
{-947.642f, -208.807f, 77.0101f, 1.36136f},
|
||||
{-951.394f, -193.695f, 67.634f, 0.802851f},
|
||||
// hardpacked snowdrift
|
||||
{712.1f, -446.49f, 65.74f, 2.13f},
|
||||
{696.4f, -276.4f, 28.55f, 3.2f},
|
||||
{74.0f, -313.27f, 31.16f, 0.17f},
|
||||
{-75.4f, -224.4f, 10.24f, 2.99f},
|
||||
{-160.9f, -72.1f, 33.36f, 5.5f},
|
||||
{-255.8f, -217.55f, 7.66f, 2.8f},
|
||||
{-361.49f, -115.5f, 26.42f, 0.6f},
|
||||
{-389.5f, -325.0f, 17.98f, 3.89f},
|
||||
{-919.57f, -362.48f, 52.13f, 3.8f},
|
||||
{-1259.1f, -500.8f, 50.81f, 1.2f},
|
||||
{-1552.55f, -359.738f, 66.948f, 2.8875f},
|
||||
{40.0913f, 0.0153897f, -4.0962f, 0.96131f}
|
||||
// hardpacked snowdrift
|
||||
{712.1f, -446.49f, 65.74f, 2.13f},
|
||||
{696.4f, -276.4f, 28.55f, 3.2f},
|
||||
{74.0f, -313.27f, 31.16f, 0.17f},
|
||||
{-75.4f, -224.4f, 10.24f, 2.99f},
|
||||
{-160.9f, -72.1f, 33.36f, 5.5f},
|
||||
{-255.8f, -217.55f, 7.66f, 2.8f},
|
||||
{-361.49f, -115.5f, 26.42f, 0.6f},
|
||||
{-389.5f, -325.0f, 17.98f, 3.89f},
|
||||
{-919.57f, -362.48f, 52.13f, 3.8f},
|
||||
{-1259.1f, -500.8f, 50.81f, 1.2f},
|
||||
{-1552.55f, -359.738f, 66.948f, 2.8875f},
|
||||
{40.0913f, 0.0153897f, -4.0962f, 0.96131f}
|
||||
};
|
||||
|
||||
const float BG_AV_DoorPositons[2][4] =
|
||||
@@ -1593,7 +1593,7 @@ class BattlegroundAV : public Battleground
|
||||
void HandleKillUnit(Creature* unit, Player* killer);
|
||||
void HandleQuestComplete(uint32 questid, Player* player);
|
||||
bool PlayerCanDoMineQuest(int32 GOId, TeamId teamId);
|
||||
TeamId GetMineOwner(uint8 mine) { return m_Mine_Owner[mine]; }
|
||||
TeamId GetMineOwner(uint8 mine) { return m_Mine_Owner[mine]; }
|
||||
|
||||
void EndBattleground(TeamId winnerTeamId);
|
||||
|
||||
|
||||
@@ -115,27 +115,27 @@ void BattlegroundBE::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
case 4539: // buff trigger?
|
||||
//buff_guid = BgObjects[BG_BE_OBJECT_BUFF_2];
|
||||
break;
|
||||
// OUTSIDE OF ARENA, TELEPORT!
|
||||
case 4919:
|
||||
player->NearTeleportTo(6220.90f, 318.94f, 5.1f, 5.3f);
|
||||
break;
|
||||
case 4921:
|
||||
player->NearTeleportTo(6250.27f, 208.50f, 4.77f, 1.9f);
|
||||
break;
|
||||
case 4922:
|
||||
player->NearTeleportTo(6214.4f, 227.12f, 4.28f, 0.8f);
|
||||
break;
|
||||
case 4923:
|
||||
player->NearTeleportTo(6180.98f, 265.28f, 4.27f, 6.06f);
|
||||
break;
|
||||
case 4924:
|
||||
player->NearTeleportTo(6269.0f, 295.06f, 4.46f, 3.98f);
|
||||
break;
|
||||
case 4944: // under arena -20
|
||||
case 5039: // under arena -40
|
||||
case 5040: // under arena -60
|
||||
player->NearTeleportTo(6238.930176f, 262.963470f, 0.889519f, player->GetOrientation());
|
||||
break;
|
||||
// OUTSIDE OF ARENA, TELEPORT!
|
||||
case 4919:
|
||||
player->NearTeleportTo(6220.90f, 318.94f, 5.1f, 5.3f);
|
||||
break;
|
||||
case 4921:
|
||||
player->NearTeleportTo(6250.27f, 208.50f, 4.77f, 1.9f);
|
||||
break;
|
||||
case 4922:
|
||||
player->NearTeleportTo(6214.4f, 227.12f, 4.28f, 0.8f);
|
||||
break;
|
||||
case 4923:
|
||||
player->NearTeleportTo(6180.98f, 265.28f, 4.27f, 6.06f);
|
||||
break;
|
||||
case 4924:
|
||||
player->NearTeleportTo(6269.0f, 295.06f, 4.46f, 3.98f);
|
||||
break;
|
||||
case 4944: // under arena -20
|
||||
case 5039: // under arena -40
|
||||
case 5040: // under arena -60
|
||||
player->NearTeleportTo(6238.930176f, 262.963470f, 0.889519f, player->GetOrientation());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ enum BattlegroundBEObjectTypes
|
||||
BG_BE_OBJECT_DOOR_4 = 3,
|
||||
BG_BE_OBJECT_BUFF_1 = 4,
|
||||
BG_BE_OBJECT_BUFF_2 = 5,
|
||||
BG_BE_OBJECT_READY_MARKER_1 = 6,
|
||||
BG_BE_OBJECT_READY_MARKER_2 = 7,
|
||||
BG_BE_OBJECT_READY_MARKER_1 = 6,
|
||||
BG_BE_OBJECT_READY_MARKER_2 = 7,
|
||||
BG_BE_OBJECT_MAX = 8
|
||||
};
|
||||
|
||||
|
||||
@@ -201,24 +201,24 @@ void BattlegroundDS::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
if (getPipeKnockBackCount() >= BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT)
|
||||
setPipeKnockBackCount(0);
|
||||
break;
|
||||
// OUTSIDE OF ARENA, TELEPORT!
|
||||
case 5328:
|
||||
player->NearTeleportTo(1290.44f, 744.96f, 3.16f, 1.6f);
|
||||
break;
|
||||
case 5329:
|
||||
player->NearTeleportTo(1292.6f, 837.07f, 3.161f, 4.7f);
|
||||
break;
|
||||
case 5330:
|
||||
player->NearTeleportTo(1250.68f, 790.86f, 3.16f, 0.0f);
|
||||
break;
|
||||
case 5331:
|
||||
player->NearTeleportTo(1332.50f, 790.9f, 3.16f, 3.14f);
|
||||
break;
|
||||
case 5326: // -10
|
||||
case 5343: // -40
|
||||
case 5344: // -60
|
||||
player->NearTeleportTo(1330.0f, 800.0f, 3.16f, player->GetOrientation());
|
||||
break;
|
||||
// OUTSIDE OF ARENA, TELEPORT!
|
||||
case 5328:
|
||||
player->NearTeleportTo(1290.44f, 744.96f, 3.16f, 1.6f);
|
||||
break;
|
||||
case 5329:
|
||||
player->NearTeleportTo(1292.6f, 837.07f, 3.161f, 4.7f);
|
||||
break;
|
||||
case 5330:
|
||||
player->NearTeleportTo(1250.68f, 790.86f, 3.16f, 0.0f);
|
||||
break;
|
||||
case 5331:
|
||||
player->NearTeleportTo(1332.50f, 790.9f, 3.16f, 3.14f);
|
||||
break;
|
||||
case 5326: // -10
|
||||
case 5343: // -40
|
||||
case 5344: // -60
|
||||
player->NearTeleportTo(1330.0f, 800.0f, 3.16f, player->GetOrientation());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,8 +29,8 @@ enum BattlegroundDSObjectTypes
|
||||
BG_DS_OBJECT_WATER_2 = 3,
|
||||
BG_DS_OBJECT_BUFF_1 = 4,
|
||||
BG_DS_OBJECT_BUFF_2 = 5,
|
||||
BG_DS_OBJECT_READY_MARKER_1 = 6,
|
||||
BG_DS_OBJECT_READY_MARKER_2 = 7,
|
||||
BG_DS_OBJECT_READY_MARKER_1 = 6,
|
||||
BG_DS_OBJECT_READY_MARKER_2 = 7,
|
||||
BG_DS_OBJECT_MAX = 8
|
||||
};
|
||||
|
||||
|
||||
@@ -16,17 +16,17 @@ REWRITTEN BY XINEF
|
||||
|
||||
BattlegroundEY::BattlegroundEY()
|
||||
{
|
||||
m_BuffChange = true;
|
||||
m_BuffChange = true;
|
||||
BgObjects.resize(BG_EY_OBJECT_MAX);
|
||||
BgCreatures.resize(BG_EY_CREATURES_MAX);
|
||||
|
||||
_capturePointInfo[POINT_FEL_REAVER]._areaTrigger = AT_FEL_REAVER_BUFF;
|
||||
_capturePointInfo[POINT_BLOOD_ELF]._areaTrigger = AT_BLOOD_ELF_BUFF;
|
||||
_capturePointInfo[POINT_DRAENEI_RUINS]._areaTrigger = AT_DRAENEI_RUINS_BUFF;
|
||||
_capturePointInfo[POINT_MAGE_TOWER]._areaTrigger = AT_MAGE_TOWER_BUFF;
|
||||
_honorTics = 0;
|
||||
_ownedPointsCount[TEAM_ALLIANCE] = 0;
|
||||
_ownedPointsCount[TEAM_HORDE] = 0;
|
||||
_capturePointInfo[POINT_FEL_REAVER]._areaTrigger = AT_FEL_REAVER_BUFF;
|
||||
_capturePointInfo[POINT_BLOOD_ELF]._areaTrigger = AT_BLOOD_ELF_BUFF;
|
||||
_capturePointInfo[POINT_DRAENEI_RUINS]._areaTrigger = AT_DRAENEI_RUINS_BUFF;
|
||||
_capturePointInfo[POINT_MAGE_TOWER]._areaTrigger = AT_MAGE_TOWER_BUFF;
|
||||
_honorTics = 0;
|
||||
_ownedPointsCount[TEAM_ALLIANCE] = 0;
|
||||
_ownedPointsCount[TEAM_HORDE] = 0;
|
||||
_flagKeeperGUID = 0;
|
||||
_droppedFlagGUID = 0;
|
||||
_flagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
@@ -46,28 +46,28 @@ void BattlegroundEY::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
_bgEvents.Update(diff);
|
||||
while (uint32 eventId = _bgEvents.ExecuteEvent())
|
||||
switch (eventId)
|
||||
{
|
||||
case BG_EY_EVENT_ADD_POINTS:
|
||||
if (_ownedPointsCount[TEAM_ALLIANCE] > 0)
|
||||
AddPoints(TEAM_ALLIANCE, BG_EY_TickPoints[_ownedPointsCount[TEAM_ALLIANCE] - 1]);
|
||||
if (_ownedPointsCount[TEAM_HORDE] > 0)
|
||||
AddPoints(TEAM_HORDE, BG_EY_TickPoints[_ownedPointsCount[TEAM_HORDE] - 1]);
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, BG_EY_FPOINTS_TICK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_TICK_TIME));
|
||||
break;
|
||||
case BG_EY_EVENT_FLAG_ON_GROUND:
|
||||
RespawnFlagAfterDrop();
|
||||
break;
|
||||
case BG_EY_EVENT_RESPAWN_FLAG:
|
||||
RespawnFlag();
|
||||
break;
|
||||
case BG_EY_EVENT_CHECK_CPOINTS:
|
||||
UpdatePointsState();
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, BG_EY_FPOINTS_CHECK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_CHECK_TIME));
|
||||
break;
|
||||
}
|
||||
_bgEvents.Update(diff);
|
||||
while (uint32 eventId = _bgEvents.ExecuteEvent())
|
||||
switch (eventId)
|
||||
{
|
||||
case BG_EY_EVENT_ADD_POINTS:
|
||||
if (_ownedPointsCount[TEAM_ALLIANCE] > 0)
|
||||
AddPoints(TEAM_ALLIANCE, BG_EY_TickPoints[_ownedPointsCount[TEAM_ALLIANCE] - 1]);
|
||||
if (_ownedPointsCount[TEAM_HORDE] > 0)
|
||||
AddPoints(TEAM_HORDE, BG_EY_TickPoints[_ownedPointsCount[TEAM_HORDE] - 1]);
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, BG_EY_FPOINTS_TICK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_TICK_TIME));
|
||||
break;
|
||||
case BG_EY_EVENT_FLAG_ON_GROUND:
|
||||
RespawnFlagAfterDrop();
|
||||
break;
|
||||
case BG_EY_EVENT_RESPAWN_FLAG:
|
||||
RespawnFlag();
|
||||
break;
|
||||
case BG_EY_EVENT_CHECK_CPOINTS:
|
||||
UpdatePointsState();
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, BG_EY_FPOINTS_CHECK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_CHECK_TIME));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,69 +93,69 @@ void BattlegroundEY::StartingEventOpenDoors()
|
||||
|
||||
// Achievement: Flurry
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, BG_EY_EVENT_START_BATTLE);
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, 0);
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, 0);
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, 0);
|
||||
_bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, 0);
|
||||
}
|
||||
|
||||
void BattlegroundEY::AddPoints(TeamId teamId, uint32 points)
|
||||
{
|
||||
uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics);
|
||||
uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics);
|
||||
m_TeamScores[teamId] += points;
|
||||
|
||||
for (; honorRewards < uint8(m_TeamScores[teamId] / _honorTics); ++honorRewards)
|
||||
for (; honorRewards < uint8(m_TeamScores[teamId] / _honorTics); ++honorRewards)
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(1), teamId);
|
||||
|
||||
UpdateWorldState(teamId == TEAM_ALLIANCE ? EY_ALLIANCE_RESOURCES : EY_HORDE_RESOURCES, std::min<uint32>(m_TeamScores[teamId], BG_EY_MAX_TEAM_SCORE));
|
||||
UpdateWorldState(teamId == TEAM_ALLIANCE ? EY_ALLIANCE_RESOURCES : EY_HORDE_RESOURCES, std::min<uint32>(m_TeamScores[teamId], BG_EY_MAX_TEAM_SCORE));
|
||||
if (m_TeamScores[teamId] >= BG_EY_MAX_TEAM_SCORE)
|
||||
EndBattleground(teamId);
|
||||
EndBattleground(teamId);
|
||||
}
|
||||
|
||||
void BattlegroundEY::UpdatePointsState()
|
||||
{
|
||||
std::vector<GameObject*> pointsVec;
|
||||
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
|
||||
{
|
||||
pointsVec.push_back(GetBGObject(BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + point));
|
||||
_capturePointInfo[point]._playersCount[TEAM_ALLIANCE] = 0;
|
||||
_capturePointInfo[point]._playersCount[TEAM_HORDE] = 0;
|
||||
}
|
||||
std::vector<GameObject*> pointsVec;
|
||||
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
|
||||
{
|
||||
pointsVec.push_back(GetBGObject(BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + point));
|
||||
_capturePointInfo[point]._playersCount[TEAM_ALLIANCE] = 0;
|
||||
_capturePointInfo[point]._playersCount[TEAM_HORDE] = 0;
|
||||
}
|
||||
|
||||
const BattlegroundPlayerMap& bgPlayerMap = GetPlayers();
|
||||
for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr)
|
||||
{
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, itr->second);
|
||||
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
|
||||
if (GameObject* pointObject = pointsVec[point])
|
||||
if (itr->second->CanCaptureTowerPoint() && itr->second->IsWithinDistInMap(pointObject, BG_EY_POINT_RADIUS))
|
||||
{
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, itr->second);
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, itr->second);
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, _capturePointInfo[point]._barStatus, itr->second);
|
||||
++_capturePointInfo[point]._playersCount[itr->second->GetTeamId()];
|
||||
const BattlegroundPlayerMap& bgPlayerMap = GetPlayers();
|
||||
for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr)
|
||||
{
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, itr->second);
|
||||
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
|
||||
if (GameObject* pointObject = pointsVec[point])
|
||||
if (itr->second->CanCaptureTowerPoint() && itr->second->IsWithinDistInMap(pointObject, BG_EY_POINT_RADIUS))
|
||||
{
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, itr->second);
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, itr->second);
|
||||
UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, _capturePointInfo[point]._barStatus, itr->second);
|
||||
++_capturePointInfo[point]._playersCount[itr->second->GetTeamId()];
|
||||
|
||||
// Xinef: ugly hax... area trigger is no longer called by client...
|
||||
if (pointObject->GetEntry() == BG_OBJECT_FR_TOWER_CAP_EY_ENTRY && itr->second->GetDistance2d(2043.96f, 1729.68f) < 3.0f)
|
||||
HandleAreaTrigger(itr->second, AT_FEL_REAVER_POINT);
|
||||
}
|
||||
// Xinef: ugly hax... area trigger is no longer called by client...
|
||||
if (pointObject->GetEntry() == BG_OBJECT_FR_TOWER_CAP_EY_ENTRY && itr->second->GetDistance2d(2043.96f, 1729.68f) < 3.0f)
|
||||
HandleAreaTrigger(itr->second, AT_FEL_REAVER_POINT);
|
||||
}
|
||||
}
|
||||
|
||||
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
|
||||
{
|
||||
_capturePointInfo[point]._barStatus += std::max<int8>(std::min<int8>(_capturePointInfo[point]._playersCount[TEAM_ALLIANCE] - _capturePointInfo[point]._playersCount[TEAM_HORDE], BG_EY_POINT_MAX_CAPTURERS_COUNT), -BG_EY_POINT_MAX_CAPTURERS_COUNT);
|
||||
_capturePointInfo[point]._barStatus = std::max<int8>(std::min<int8>(_capturePointInfo[point]._barStatus, BG_EY_PROGRESS_BAR_ALI_CONTROLLED), BG_EY_PROGRESS_BAR_HORDE_CONTROLLED);
|
||||
_capturePointInfo[point]._barStatus += std::max<int8>(std::min<int8>(_capturePointInfo[point]._playersCount[TEAM_ALLIANCE] - _capturePointInfo[point]._playersCount[TEAM_HORDE], BG_EY_POINT_MAX_CAPTURERS_COUNT), -BG_EY_POINT_MAX_CAPTURERS_COUNT);
|
||||
_capturePointInfo[point]._barStatus = std::max<int8>(std::min<int8>(_capturePointInfo[point]._barStatus, BG_EY_PROGRESS_BAR_ALI_CONTROLLED), BG_EY_PROGRESS_BAR_HORDE_CONTROLLED);
|
||||
|
||||
TeamId pointOwnerTeamId = TEAM_NEUTRAL;
|
||||
if (_capturePointInfo[point]._barStatus <= BG_EY_PROGRESS_BAR_NEUTRAL_LOW)
|
||||
if (_capturePointInfo[point]._barStatus <= BG_EY_PROGRESS_BAR_NEUTRAL_LOW)
|
||||
pointOwnerTeamId = TEAM_HORDE;
|
||||
else if (_capturePointInfo[point]._barStatus >= BG_EY_PROGRESS_BAR_NEUTRAL_HIGH)
|
||||
else if (_capturePointInfo[point]._barStatus >= BG_EY_PROGRESS_BAR_NEUTRAL_HIGH)
|
||||
pointOwnerTeamId = TEAM_ALLIANCE;
|
||||
|
||||
|
||||
if (pointOwnerTeamId != _capturePointInfo[point]._ownerTeamId)
|
||||
{
|
||||
if (_capturePointInfo[point].IsUncontrolled())
|
||||
EventTeamCapturedPoint(pointOwnerTeamId, point);
|
||||
|
||||
if (pointOwnerTeamId == TEAM_NEUTRAL && _capturePointInfo[point].IsUnderControl())
|
||||
if (pointOwnerTeamId == TEAM_NEUTRAL && _capturePointInfo[point].IsUnderControl())
|
||||
EventTeamLostPoint(pointOwnerTeamId, point);
|
||||
}
|
||||
}
|
||||
@@ -177,11 +177,11 @@ void BattlegroundEY::UpdatePointsCount()
|
||||
|
||||
void BattlegroundEY::UpdatePointsIcons(uint32 point)
|
||||
{
|
||||
if (_capturePointInfo[point].IsUnderControl())
|
||||
if (_capturePointInfo[point].IsUnderControl())
|
||||
{
|
||||
UpdateWorldState(m_PointsIconStruct[point].WorldStateControlIndex, 0);
|
||||
UpdateWorldState(m_PointsIconStruct[point].WorldStateAllianceControlledIndex, _capturePointInfo[point].IsUnderControl(TEAM_ALLIANCE));
|
||||
UpdateWorldState(m_PointsIconStruct[point].WorldStateHordeControlledIndex, _capturePointInfo[point].IsUnderControl(TEAM_HORDE));
|
||||
UpdateWorldState(m_PointsIconStruct[point].WorldStateAllianceControlledIndex, _capturePointInfo[point].IsUnderControl(TEAM_ALLIANCE));
|
||||
UpdateWorldState(m_PointsIconStruct[point].WorldStateHordeControlledIndex, _capturePointInfo[point].IsUnderControl(TEAM_HORDE));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -199,7 +199,7 @@ void BattlegroundEY::AddPlayer(Player* player)
|
||||
|
||||
void BattlegroundEY::RemovePlayer(Player* player)
|
||||
{
|
||||
if (GetFlagPickerGUID() == player->GetGUID())
|
||||
if (GetFlagPickerGUID() == player->GetGUID())
|
||||
EventPlayerDroppedFlag(player);
|
||||
}
|
||||
|
||||
@@ -211,22 +211,22 @@ void BattlegroundEY::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
switch (trigger)
|
||||
{
|
||||
case AT_BLOOD_ELF_POINT:
|
||||
if (_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(player->GetTeamId()))
|
||||
if (_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(player->GetTeamId()))
|
||||
if (_flagState == BG_EY_FLAG_STATE_ON_PLAYER && GetFlagPickerGUID() == player->GetGUID())
|
||||
EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_BLOOD_ELF);
|
||||
break;
|
||||
case AT_FEL_REAVER_POINT:
|
||||
if (_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(player->GetTeamId()))
|
||||
if (_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(player->GetTeamId()))
|
||||
if (_flagState == BG_EY_FLAG_STATE_ON_PLAYER && GetFlagPickerGUID() == player->GetGUID())
|
||||
EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_FEL_REAVER);
|
||||
break;
|
||||
case AT_MAGE_TOWER_POINT:
|
||||
if (_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(player->GetTeamId()))
|
||||
if (_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(player->GetTeamId()))
|
||||
if (_flagState == BG_EY_FLAG_STATE_ON_PLAYER && GetFlagPickerGUID() == player->GetGUID())
|
||||
EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_MAGE_TOWER);
|
||||
break;
|
||||
case AT_DRAENEI_RUINS_POINT:
|
||||
if (_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(player->GetTeamId()))
|
||||
if (_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(player->GetTeamId()))
|
||||
if (_flagState == BG_EY_FLAG_STATE_ON_PLAYER && GetFlagPickerGUID() == player->GetGUID())
|
||||
EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_DRAENEI_RUINS);
|
||||
break;
|
||||
@@ -237,10 +237,10 @@ void BattlegroundEY::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
case 4530:
|
||||
case 4531:
|
||||
case 5866:
|
||||
case AT_BLOOD_ELF_BUFF:
|
||||
case AT_FEL_REAVER_BUFF:
|
||||
case AT_MAGE_TOWER_BUFF:
|
||||
case AT_DRAENEI_RUINS_BUFF:
|
||||
case AT_BLOOD_ELF_BUFF:
|
||||
case AT_FEL_REAVER_BUFF:
|
||||
case AT_MAGE_TOWER_BUFF:
|
||||
case AT_DRAENEI_RUINS_BUFF:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -303,7 +303,7 @@ bool BattlegroundEY::SetupBattleground()
|
||||
|
||||
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
{
|
||||
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(_capturePointInfo[i]._areaTrigger);
|
||||
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(_capturePointInfo[i]._areaTrigger);
|
||||
AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 0, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY);
|
||||
AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY);
|
||||
@@ -316,19 +316,19 @@ bool BattlegroundEY::SetupBattleground()
|
||||
sg = sWorldSafeLocsStore.LookupEntry(BG_EY_GRAVEYARD_MAIN_HORDE);
|
||||
AddSpiritGuide(BG_EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, TEAM_HORDE);
|
||||
|
||||
for (uint32 i = BG_EY_OBJECT_DOOR_A; i < BG_EY_OBJECT_MAX; ++i)
|
||||
if (BgObjects[i] == 0)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundEY: Failed to spawn some object Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
for (uint32 i = BG_EY_OBJECT_DOOR_A; i < BG_EY_OBJECT_MAX; ++i)
|
||||
if (BgObjects[i] == 0)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundEY: Failed to spawn some object Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32 i = BG_EY_SPIRIT_MAIN_ALLIANCE; i <= BG_EY_SPIRIT_MAIN_HORDE; ++i)
|
||||
if (BgCreatures[i] == 0)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guides Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
for (uint32 i = BG_EY_SPIRIT_MAIN_ALLIANCE; i <= BG_EY_SPIRIT_MAIN_HORDE; ++i)
|
||||
if (BgCreatures[i] == 0)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guides Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -338,10 +338,10 @@ void BattlegroundEY::Init()
|
||||
//call parent's class reset
|
||||
Battleground::Init();
|
||||
|
||||
_bgEvents.Reset();
|
||||
_honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_EY_HONOR_TICK_WEEKEND : BG_EY_HONOR_TICK_NORMAL;
|
||||
_ownedPointsCount[TEAM_ALLIANCE] = 0;
|
||||
_ownedPointsCount[TEAM_HORDE] = 0;
|
||||
_bgEvents.Reset();
|
||||
_honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_EY_HONOR_TICK_WEEKEND : BG_EY_HONOR_TICK_NORMAL;
|
||||
_ownedPointsCount[TEAM_ALLIANCE] = 0;
|
||||
_ownedPointsCount[TEAM_HORDE] = 0;
|
||||
_flagKeeperGUID = 0;
|
||||
_droppedFlagGUID = 0;
|
||||
_flagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
@@ -350,8 +350,8 @@ void BattlegroundEY::Init()
|
||||
|
||||
void BattlegroundEY::RespawnFlag()
|
||||
{
|
||||
if (_flagState != BG_EY_FLAG_STATE_ON_BASE)
|
||||
return;
|
||||
if (_flagState != BG_EY_FLAG_STATE_ON_BASE)
|
||||
return;
|
||||
|
||||
if (_flagCapturedObject > 0)
|
||||
SpawnBGObject(_flagCapturedObject, RESPAWN_ONE_DAY);
|
||||
@@ -366,12 +366,12 @@ void BattlegroundEY::RespawnFlag()
|
||||
|
||||
void BattlegroundEY::RespawnFlagAfterDrop()
|
||||
{
|
||||
if (_flagState != BG_EY_FLAG_STATE_ON_GROUND)
|
||||
return;
|
||||
if (_flagState != BG_EY_FLAG_STATE_ON_GROUND)
|
||||
return;
|
||||
|
||||
_flagState = BG_EY_FLAG_STATE_ON_BASE;
|
||||
RespawnFlag();
|
||||
if (GameObject* flag = ObjectAccessor::GetObjectInMap(GetDroppedFlagGUID(), FindBgMap(), (GameObject*)NULL))
|
||||
if (GameObject* flag = ObjectAccessor::GetObjectInMap(GetDroppedFlagGUID(), FindBgMap(), (GameObject*)NULL))
|
||||
flag->Delete();
|
||||
SetDroppedFlagGUID(0);
|
||||
}
|
||||
@@ -387,8 +387,8 @@ void BattlegroundEY::HandleKillPlayer(Player* player, Player* killer)
|
||||
|
||||
void BattlegroundEY::EventPlayerDroppedFlag(Player* player)
|
||||
{
|
||||
if (GetFlagPickerGUID() != player->GetGUID())
|
||||
return;
|
||||
if (GetFlagPickerGUID() != player->GetGUID())
|
||||
return;
|
||||
|
||||
SetFlagPicker(0);
|
||||
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
|
||||
@@ -396,12 +396,12 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player)
|
||||
return;
|
||||
|
||||
_flagState = BG_EY_FLAG_STATE_ON_GROUND;
|
||||
_bgEvents.RescheduleEvent(BG_EY_EVENT_FLAG_ON_GROUND, BG_EY_FLAG_ON_GROUND_TIME);
|
||||
_bgEvents.RescheduleEvent(BG_EY_EVENT_FLAG_ON_GROUND, BG_EY_FLAG_ON_GROUND_TIME);
|
||||
|
||||
player->CastSpell(player, SPELL_RECENTLY_DROPPED_FLAG, true);
|
||||
player->CastSpell(player, BG_EY_PLAYER_DROPPED_FLAG_SPELL, true);
|
||||
|
||||
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE);
|
||||
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE);
|
||||
}
|
||||
|
||||
void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* gameObject)
|
||||
@@ -412,19 +412,19 @@ void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
_flagState = BG_EY_FLAG_STATE_ON_PLAYER;
|
||||
SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_ONE_DAY);
|
||||
SetFlagPicker(player->GetGUID());
|
||||
SetDroppedFlagGUID(0);
|
||||
SetDroppedFlagGUID(0);
|
||||
|
||||
player->CastSpell(player, BG_EY_NETHERSTORM_FLAG_SPELL, true);
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, player->GetName().c_str());
|
||||
PlaySoundToAll(player->GetTeamId() == TEAM_ALLIANCE ? BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE : BG_EY_SOUND_FLAG_PICKED_UP_HORDE);
|
||||
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, player->GetName().c_str());
|
||||
PlaySoundToAll(player->GetTeamId() == TEAM_ALLIANCE ? BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE : BG_EY_SOUND_FLAG_PICKED_UP_HORDE);
|
||||
UpdateWorldState(NETHERSTORM_FLAG, 0);
|
||||
}
|
||||
|
||||
void BattlegroundEY::EventTeamLostPoint(TeamId teamId, uint32 point)
|
||||
{
|
||||
TeamId oldTeamId = _capturePointInfo[point]._ownerTeamId;
|
||||
TeamId oldTeamId = _capturePointInfo[point]._ownerTeamId;
|
||||
if (oldTeamId == TEAM_ALLIANCE)
|
||||
{
|
||||
_ownedPointsCount[TEAM_ALLIANCE]--;
|
||||
@@ -446,7 +446,7 @@ void BattlegroundEY::EventTeamLostPoint(TeamId teamId, uint32 point)
|
||||
SpawnBGObject(m_LosingPointTypes[point].SpawnNeutralObjectType + 1, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(m_LosingPointTypes[point].SpawnNeutralObjectType + 2, RESPAWN_IMMEDIATELY);
|
||||
|
||||
_capturePointInfo[point]._ownerTeamId = TEAM_NEUTRAL;
|
||||
_capturePointInfo[point]._ownerTeamId = TEAM_NEUTRAL;
|
||||
|
||||
UpdatePointsIcons(point);
|
||||
UpdatePointsCount();
|
||||
@@ -476,7 +476,7 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point)
|
||||
SendMessageToAll(m_CapturingPointTypes[point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE);
|
||||
}
|
||||
|
||||
_capturePointInfo[point]._ownerTeamId = teamId;
|
||||
_capturePointInfo[point]._ownerTeamId = teamId;
|
||||
if (BgCreatures[point])
|
||||
DelCreature(point);
|
||||
|
||||
@@ -486,8 +486,8 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point)
|
||||
UpdatePointsIcons(point);
|
||||
UpdatePointsCount();
|
||||
|
||||
// Xinef: done this way to avoid errors in console
|
||||
Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_EY_TRIGGER_FEL_REAVER + point]);
|
||||
// Xinef: done this way to avoid errors in console
|
||||
Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_EY_TRIGGER_FEL_REAVER + point]);
|
||||
if (!trigger)
|
||||
trigger = AddCreature(WORLD_TRIGGER, BG_EY_TRIGGER_FEL_REAVER + point, BG_EY_TriggerPositions[point][0], BG_EY_TriggerPositions[point][1], BG_EY_TriggerPositions[point][2], BG_EY_TriggerPositions[point][3]);
|
||||
|
||||
@@ -506,19 +506,19 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
|
||||
SpawnBGObject(BgObjectType, RESPAWN_IMMEDIATELY);
|
||||
_bgEvents.RescheduleEvent(BG_EY_EVENT_RESPAWN_FLAG, BG_EY_FLAG_RESPAWN_TIME);
|
||||
_bgEvents.RescheduleEvent(BG_EY_EVENT_RESPAWN_FLAG, BG_EY_FLAG_RESPAWN_TIME);
|
||||
_flagCapturedObject = BgObjectType;
|
||||
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
{
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
{
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE);
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE);
|
||||
{
|
||||
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE);
|
||||
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
}
|
||||
}
|
||||
|
||||
UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1);
|
||||
if (_ownedPointsCount[player->GetTeamId()] > 0)
|
||||
@@ -528,41 +528,41 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType
|
||||
void BattlegroundEY::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
|
||||
{
|
||||
if (type == SCORE_FLAG_CAPTURES)
|
||||
{
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(player->GetGUID());
|
||||
if (itr != PlayerScores.end())
|
||||
((BattlegroundEYScore*)itr->second)->FlagCaptures += value;
|
||||
{
|
||||
BattlegroundScoreMap::iterator itr = PlayerScores.find(player->GetGUID());
|
||||
if (itr != PlayerScores.end())
|
||||
((BattlegroundEYScore*)itr->second)->FlagCaptures += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, BG_EY_OBJECTIVE_CAPTURE_FLAG);
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
|
||||
}
|
||||
|
||||
void BattlegroundEY::FillInitialWorldStates(WorldPacket& data)
|
||||
{
|
||||
data << uint32(EY_HORDE_BASE) << uint32(_ownedPointsCount[TEAM_HORDE]);
|
||||
data << uint32(EY_ALLIANCE_BASE) << uint32(_ownedPointsCount[TEAM_ALLIANCE]);
|
||||
data << uint32(DRAENEI_RUINS_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_HORDE));
|
||||
data << uint32(DRAENEI_RUINS_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_ALLIANCE));
|
||||
data << uint32(DRAENEI_RUINS_UNCONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUncontrolled());
|
||||
data << uint32(MAGE_TOWER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_HORDE));
|
||||
data << uint32(MAGE_TOWER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_ALLIANCE));
|
||||
data << uint32(MAGE_TOWER_UNCONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUncontrolled());
|
||||
data << uint32(FEL_REAVER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_HORDE));
|
||||
data << uint32(FEL_REAVER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_ALLIANCE));
|
||||
data << uint32(FEL_REAVER_UNCONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUncontrolled());
|
||||
data << uint32(BLOOD_ELF_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_HORDE));
|
||||
data << uint32(BLOOD_ELF_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_ALLIANCE));
|
||||
data << uint32(BLOOD_ELF_UNCONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUncontrolled());
|
||||
data << uint32(EY_HORDE_BASE) << uint32(_ownedPointsCount[TEAM_HORDE]);
|
||||
data << uint32(EY_ALLIANCE_BASE) << uint32(_ownedPointsCount[TEAM_ALLIANCE]);
|
||||
data << uint32(DRAENEI_RUINS_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_HORDE));
|
||||
data << uint32(DRAENEI_RUINS_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_ALLIANCE));
|
||||
data << uint32(DRAENEI_RUINS_UNCONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUncontrolled());
|
||||
data << uint32(MAGE_TOWER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_HORDE));
|
||||
data << uint32(MAGE_TOWER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_ALLIANCE));
|
||||
data << uint32(MAGE_TOWER_UNCONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUncontrolled());
|
||||
data << uint32(FEL_REAVER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_HORDE));
|
||||
data << uint32(FEL_REAVER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_ALLIANCE));
|
||||
data << uint32(FEL_REAVER_UNCONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUncontrolled());
|
||||
data << uint32(BLOOD_ELF_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_HORDE));
|
||||
data << uint32(BLOOD_ELF_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_ALLIANCE));
|
||||
data << uint32(BLOOD_ELF_UNCONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUncontrolled());
|
||||
data << uint32(NETHERSTORM_FLAG) << uint32(_flagState == BG_EY_FLAG_STATE_ON_BASE);
|
||||
data << uint32(NETHERSTORM_FLAG_STATE_HORDE) << uint32(1);
|
||||
data << uint32(NETHERSTORM_FLAG_STATE_HORDE) << uint32(1);
|
||||
data << uint32(NETHERSTORM_FLAG_STATE_ALLIANCE) << uint32(1);
|
||||
data << uint32(EY_HORDE_RESOURCES) << uint32(GetTeamScore(TEAM_HORDE));
|
||||
data << uint32(EY_ALLIANCE_RESOURCES) << uint32(GetTeamScore(TEAM_ALLIANCE));
|
||||
data << uint32(PROGRESS_BAR_SHOW) << uint32(0);
|
||||
data << uint32(PROGRESS_BAR_PERCENT_GREY) << uint32(0);
|
||||
data << uint32(PROGRESS_BAR_STATUS) << uint32(0);
|
||||
data << uint32(EY_HORDE_RESOURCES) << uint32(GetTeamScore(TEAM_HORDE));
|
||||
data << uint32(EY_ALLIANCE_RESOURCES) << uint32(GetTeamScore(TEAM_ALLIANCE));
|
||||
data << uint32(PROGRESS_BAR_SHOW) << uint32(0);
|
||||
data << uint32(PROGRESS_BAR_PERCENT_GREY) << uint32(0);
|
||||
data << uint32(PROGRESS_BAR_STATUS) << uint32(0);
|
||||
}
|
||||
|
||||
WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveyard(Player* player)
|
||||
@@ -574,10 +574,10 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveyard(Player* player)
|
||||
float pY = player->GetPositionY();
|
||||
float pZ = player->GetPositionZ();
|
||||
float dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY) + (entry->z - pZ)*(entry->z - pZ);
|
||||
float minDist = dist;
|
||||
float minDist = dist;
|
||||
|
||||
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
if (_capturePointInfo[i].IsUnderControl(player->GetTeamId()))
|
||||
if (_capturePointInfo[i].IsUnderControl(player->GetTeamId()))
|
||||
{
|
||||
entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId);
|
||||
dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY) + (entry->z - pZ)*(entry->z - pZ);
|
||||
@@ -595,7 +595,7 @@ bool BattlegroundEY::AllNodesConrolledByTeam(TeamId teamId) const
|
||||
{
|
||||
uint32 count = 0;
|
||||
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
|
||||
if (_capturePointInfo[i].IsUnderControl(teamId))
|
||||
if (_capturePointInfo[i].IsUnderControl(teamId))
|
||||
++count;
|
||||
|
||||
return count == EY_POINTS_MAX;
|
||||
@@ -603,8 +603,8 @@ bool BattlegroundEY::AllNodesConrolledByTeam(TeamId teamId) const
|
||||
|
||||
TeamId BattlegroundEY::GetPrematureWinner()
|
||||
{
|
||||
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
|
||||
return TEAM_ALLIANCE;
|
||||
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
|
||||
return TEAM_ALLIANCE;
|
||||
|
||||
return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner();
|
||||
return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner();
|
||||
}
|
||||
|
||||
@@ -10,16 +10,16 @@ REWRITTEN BY XINEF
|
||||
|
||||
enum BG_EY_Events
|
||||
{
|
||||
BG_EY_EVENT_ADD_POINTS = 1,
|
||||
BG_EY_EVENT_FLAG_ON_GROUND = 2,
|
||||
BG_EY_EVENT_RESPAWN_FLAG = 3,
|
||||
BG_EY_EVENT_CHECK_CPOINTS = 4
|
||||
BG_EY_EVENT_ADD_POINTS = 1,
|
||||
BG_EY_EVENT_FLAG_ON_GROUND = 2,
|
||||
BG_EY_EVENT_RESPAWN_FLAG = 3,
|
||||
BG_EY_EVENT_CHECK_CPOINTS = 4
|
||||
};
|
||||
|
||||
enum BG_EY_Timers
|
||||
{
|
||||
BG_EY_FLAG_RESPAWN_TIME = 20*IN_MILLISECONDS,
|
||||
BG_EY_FLAG_ON_GROUND_TIME = 10*IN_MILLISECONDS,
|
||||
BG_EY_FLAG_ON_GROUND_TIME = 10*IN_MILLISECONDS,
|
||||
BG_EY_FPOINTS_CHECK_TIME = 2*IN_MILLISECONDS,
|
||||
BG_EY_FPOINTS_TICK_TIME = 1*IN_MILLISECONDS
|
||||
};
|
||||
@@ -98,14 +98,14 @@ enum BG_EY_ObjectEntry
|
||||
|
||||
enum BG_EY_AreaTriggers
|
||||
{
|
||||
AT_BLOOD_ELF_POINT = 4476,
|
||||
AT_FEL_REAVER_POINT = 4514,
|
||||
AT_MAGE_TOWER_POINT = 4516,
|
||||
AT_DRAENEI_RUINS_POINT = 4518,
|
||||
AT_BLOOD_ELF_BUFF = 4568,
|
||||
AT_FEL_REAVER_BUFF = 4569,
|
||||
AT_MAGE_TOWER_BUFF = 4570,
|
||||
AT_DRAENEI_RUINS_BUFF = 4571
|
||||
AT_BLOOD_ELF_POINT = 4476,
|
||||
AT_FEL_REAVER_POINT = 4514,
|
||||
AT_MAGE_TOWER_POINT = 4516,
|
||||
AT_DRAENEI_RUINS_POINT = 4518,
|
||||
AT_BLOOD_ELF_BUFF = 4568,
|
||||
AT_FEL_REAVER_BUFF = 4569,
|
||||
AT_MAGE_TOWER_BUFF = 4570,
|
||||
AT_DRAENEI_RUINS_BUFF = 4571
|
||||
};
|
||||
|
||||
enum BG_EY_Graveyards
|
||||
@@ -120,11 +120,11 @@ enum BG_EY_Graveyards
|
||||
|
||||
enum BG_EY_Points
|
||||
{
|
||||
POINT_FEL_REAVER = 0,
|
||||
POINT_BLOOD_ELF = 1,
|
||||
POINT_DRAENEI_RUINS = 2,
|
||||
POINT_MAGE_TOWER = 3,
|
||||
EY_POINTS_MAX = 4
|
||||
POINT_FEL_REAVER = 0,
|
||||
POINT_BLOOD_ELF = 1,
|
||||
POINT_DRAENEI_RUINS = 2,
|
||||
POINT_MAGE_TOWER = 3,
|
||||
EY_POINTS_MAX = 4
|
||||
};
|
||||
|
||||
enum BG_EY_CreatureTypes
|
||||
@@ -214,11 +214,11 @@ enum BG_EY_Score
|
||||
BG_EY_WARNING_NEAR_VICTORY_SCORE = 1400,
|
||||
BG_EY_MAX_TEAM_SCORE = 1600,
|
||||
|
||||
BG_EY_HONOR_TICK_WEEKEND = 160,
|
||||
BG_EY_HONOR_TICK_NORMAL = 260,
|
||||
BG_EY_HONOR_TICK_WEEKEND = 160,
|
||||
BG_EY_HONOR_TICK_NORMAL = 260,
|
||||
|
||||
BG_EY_EVENT_START_BATTLE = 13180, // Achievement: Flurry
|
||||
BG_EY_OBJECTIVE_CAPTURE_FLAG = 183
|
||||
BG_EY_EVENT_START_BATTLE = 13180, // Achievement: Flurry
|
||||
BG_EY_OBJECTIVE_CAPTURE_FLAG = 183
|
||||
};
|
||||
|
||||
enum BG_EY_FlagState
|
||||
@@ -366,26 +366,26 @@ class BattlegroundEY : public Battleground
|
||||
/* Scorekeeping */
|
||||
void AddPoints(TeamId teamId, uint32 points);
|
||||
|
||||
struct CapturePointInfo
|
||||
{
|
||||
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _barStatus(BG_EY_PROGRESS_BAR_STATE_MIDDLE), _areaTrigger(0)
|
||||
{
|
||||
_playersCount[TEAM_ALLIANCE] = 0;
|
||||
_playersCount[TEAM_HORDE] = 0;
|
||||
}
|
||||
struct CapturePointInfo
|
||||
{
|
||||
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _barStatus(BG_EY_PROGRESS_BAR_STATE_MIDDLE), _areaTrigger(0)
|
||||
{
|
||||
_playersCount[TEAM_ALLIANCE] = 0;
|
||||
_playersCount[TEAM_HORDE] = 0;
|
||||
}
|
||||
|
||||
TeamId _ownerTeamId;
|
||||
uint32 _areaTrigger;
|
||||
int8 _barStatus;
|
||||
int8 _playersCount[BG_TEAMS_COUNT];
|
||||
TeamId _ownerTeamId;
|
||||
uint32 _areaTrigger;
|
||||
int8 _barStatus;
|
||||
int8 _playersCount[BG_TEAMS_COUNT];
|
||||
|
||||
bool IsUnderControl(TeamId teamId) const { return _ownerTeamId == teamId; }
|
||||
bool IsUnderControl() const { return _ownerTeamId != TEAM_NEUTRAL; }
|
||||
bool IsUncontrolled() const { return _ownerTeamId == TEAM_NEUTRAL; }
|
||||
};
|
||||
bool IsUnderControl(TeamId teamId) const { return _ownerTeamId == teamId; }
|
||||
bool IsUnderControl() const { return _ownerTeamId != TEAM_NEUTRAL; }
|
||||
bool IsUncontrolled() const { return _ownerTeamId == TEAM_NEUTRAL; }
|
||||
};
|
||||
|
||||
CapturePointInfo _capturePointInfo[EY_POINTS_MAX];
|
||||
EventMap _bgEvents;
|
||||
CapturePointInfo _capturePointInfo[EY_POINTS_MAX];
|
||||
EventMap _bgEvents;
|
||||
uint32 _honorTics;
|
||||
uint8 _ownedPointsCount[BG_TEAMS_COUNT];
|
||||
uint64 _flagKeeperGUID;
|
||||
|
||||
@@ -56,7 +56,7 @@ BattlegroundIC::BattlegroundIC()
|
||||
|
||||
gunshipHorde = NULL;
|
||||
gunshipAlliance = NULL;
|
||||
respawnMap.clear();
|
||||
respawnMap.clear();
|
||||
}
|
||||
|
||||
BattlegroundIC::~BattlegroundIC()
|
||||
@@ -71,14 +71,14 @@ void BattlegroundIC::DoAction(uint32 action, uint64 guid)
|
||||
if (!gunshipAlliance || !gunshipHorde)
|
||||
return;
|
||||
|
||||
Player* player = ObjectAccessor::GetPlayer(*gunshipAlliance, guid);
|
||||
Player* player = ObjectAccessor::GetPlayer(*gunshipAlliance, guid);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
MotionTransport* transport = player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde;
|
||||
float x = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionX();
|
||||
float y = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionY();
|
||||
float z = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionZ();
|
||||
MotionTransport* transport = player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde;
|
||||
float x = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionX();
|
||||
float y = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionY();
|
||||
float z = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionZ();
|
||||
transport->CalculatePassengerPosition(x, y, z);
|
||||
|
||||
player->TeleportTo(GetMapId(), x, y, z, player->GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
|
||||
@@ -129,46 +129,46 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
if (nodePoint[i].timer <= diff)
|
||||
{
|
||||
// we need to confirm this, i am not sure if this every 3 minutes
|
||||
for (uint8 j = 0; j < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++j)
|
||||
{
|
||||
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+j;
|
||||
// we need to confirm this, i am not sure if this every 3 minutes
|
||||
for (uint8 j = 0; j < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++j)
|
||||
{
|
||||
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+j;
|
||||
if (Creature* catapult = GetBGCreature(type))
|
||||
if (!catapult->IsAlive())
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(catapult->GetGUIDLow());
|
||||
if (itr == respawnMap.end() || time(NULL) < itr->second)
|
||||
continue;
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(catapult->GetGUIDLow());
|
||||
if (itr == respawnMap.end() || time(NULL) < itr->second)
|
||||
continue;
|
||||
|
||||
catapult->Relocate(BG_IC_DocksVehiclesCatapults[j].GetPositionX(), BG_IC_DocksVehiclesCatapults[j].GetPositionY(), BG_IC_DocksVehiclesCatapults[j].GetPositionZ(), BG_IC_DocksVehiclesCatapults[j].GetOrientation());
|
||||
catapult->Respawn(true);
|
||||
respawnMap.erase(itr);
|
||||
}
|
||||
catapult->Relocate(BG_IC_DocksVehiclesCatapults[j].GetPositionX(), BG_IC_DocksVehiclesCatapults[j].GetPositionY(), BG_IC_DocksVehiclesCatapults[j].GetPositionZ(), BG_IC_DocksVehiclesCatapults[j].GetOrientation());
|
||||
catapult->Respawn(true);
|
||||
respawnMap.erase(itr);
|
||||
}
|
||||
}
|
||||
|
||||
// we need to confirm this is blizzlike, not sure if it is every 3 minutes
|
||||
for (uint8 j = 0; j < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++j)
|
||||
{
|
||||
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+j;
|
||||
// we need to confirm this is blizzlike, not sure if it is every 3 minutes
|
||||
for (uint8 j = 0; j < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++j)
|
||||
{
|
||||
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+j;
|
||||
if (Creature* glaiveThrower = GetBGCreature(type))
|
||||
if (!glaiveThrower->IsAlive())
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUIDLow());
|
||||
if (itr == respawnMap.end() || time(NULL) < itr->second)
|
||||
continue;
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUIDLow());
|
||||
if (itr == respawnMap.end() || time(NULL) < itr->second)
|
||||
continue;
|
||||
|
||||
glaiveThrower->Relocate(BG_IC_DocksVehiclesGlaives[j].GetPositionX(), BG_IC_DocksVehiclesGlaives[j].GetPositionY(), BG_IC_DocksVehiclesGlaives[j].GetPositionZ(), BG_IC_DocksVehiclesGlaives[j].GetOrientation());
|
||||
glaiveThrower->Relocate(BG_IC_DocksVehiclesGlaives[j].GetPositionX(), BG_IC_DocksVehiclesGlaives[j].GetPositionY(), BG_IC_DocksVehiclesGlaives[j].GetPositionZ(), BG_IC_DocksVehiclesGlaives[j].GetOrientation());
|
||||
glaiveThrower->Respawn(true);
|
||||
respawnMap.erase(itr);
|
||||
}
|
||||
respawnMap.erase(itr);
|
||||
}
|
||||
}
|
||||
|
||||
docksTimer = DOCKS_UPDATE_TIME;
|
||||
}
|
||||
else
|
||||
nodePoint[i].timer -= diff;
|
||||
else
|
||||
nodePoint[i].timer -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -183,39 +183,39 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
||||
if (Creature* siege = GetBGCreature(siegeType)) // this always should be true
|
||||
if (!siege->IsAlive())
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(siege->GetGUIDLow());
|
||||
if (itr == respawnMap.end() || time(NULL) < itr->second)
|
||||
continue;
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(siege->GetGUIDLow());
|
||||
if (itr == respawnMap.end() || time(NULL) < itr->second)
|
||||
continue;
|
||||
|
||||
siege->Relocate(BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation());
|
||||
siege->Relocate(BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation());
|
||||
siege->Respawn(true);
|
||||
respawnMap.erase(itr);
|
||||
}
|
||||
respawnMap.erase(itr);
|
||||
}
|
||||
|
||||
// we need to confirm this, i am not sure if this every 3 minutes
|
||||
for (uint8 u = 0; u < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++u)
|
||||
{
|
||||
|
||||
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+u;
|
||||
if (Creature* demolisher = GetBGCreature(type))
|
||||
// we need to confirm this, i am not sure if this every 3 minutes
|
||||
for (uint8 u = 0; u < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++u)
|
||||
{
|
||||
|
||||
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+u;
|
||||
if (Creature* demolisher = GetBGCreature(type))
|
||||
if (!demolisher->IsAlive())
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(demolisher->GetGUIDLow());
|
||||
if (itr == respawnMap.end() || time(NULL) < itr->second)
|
||||
continue;
|
||||
{
|
||||
// Check if creature respawn time is properly saved
|
||||
RespawnMap::iterator itr = respawnMap.find(demolisher->GetGUIDLow());
|
||||
if (itr == respawnMap.end() || time(NULL) < itr->second)
|
||||
continue;
|
||||
|
||||
demolisher->Relocate(BG_IC_WorkshopVehicles[u].GetPositionX(), BG_IC_WorkshopVehicles[u].GetPositionY(), BG_IC_WorkshopVehicles[u].GetPositionZ(), BG_IC_WorkshopVehicles[u].GetOrientation());
|
||||
demolisher->Respawn(true);
|
||||
respawnMap.erase(itr);
|
||||
}
|
||||
demolisher->Relocate(BG_IC_WorkshopVehicles[u].GetPositionX(), BG_IC_WorkshopVehicles[u].GetPositionY(), BG_IC_WorkshopVehicles[u].GetPositionZ(), BG_IC_WorkshopVehicles[u].GetOrientation());
|
||||
demolisher->Respawn(true);
|
||||
respawnMap.erase(itr);
|
||||
}
|
||||
}
|
||||
|
||||
siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
|
||||
}
|
||||
else
|
||||
siegeEngineWorkshopTimer -= diff;
|
||||
else
|
||||
siegeEngineWorkshopTimer -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,27 +339,27 @@ void BattlegroundIC::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS)
|
||||
return;
|
||||
|
||||
switch (trigger)
|
||||
{
|
||||
case AREA_TRIGGER_HORDE_KEEP:
|
||||
if (player->GetTeamId() != TEAM_ALLIANCE)
|
||||
return;
|
||||
for (uint8 i = BG_IC_H_FRONT; i < BG_IC_A_FRONT; ++i)
|
||||
if (GateStatus[i] == BG_IC_GATE_DESTROYED)
|
||||
return;
|
||||
if (!player->HasAchieved(3854)) // ACHIEVEMENT_BACK_DOOR_JOB
|
||||
player->CastSpell(player, SPELL_BACK_DOOR_JOB, true);
|
||||
break;
|
||||
case AREA_TRIGGER_ALLIANCE_KEEP:
|
||||
if (player->GetTeamId() != TEAM_HORDE)
|
||||
return;
|
||||
for (uint8 i = BG_IC_A_FRONT; i < BG_IC_MAXDOOR; ++i)
|
||||
if (GateStatus[i] == BG_IC_GATE_DESTROYED)
|
||||
return;
|
||||
if (!player->HasAchieved(3854)) // ACHIEVEMENT_BACK_DOOR_JOB
|
||||
player->CastSpell(player, SPELL_BACK_DOOR_JOB, true);
|
||||
break;
|
||||
}
|
||||
switch (trigger)
|
||||
{
|
||||
case AREA_TRIGGER_HORDE_KEEP:
|
||||
if (player->GetTeamId() != TEAM_ALLIANCE)
|
||||
return;
|
||||
for (uint8 i = BG_IC_H_FRONT; i < BG_IC_A_FRONT; ++i)
|
||||
if (GateStatus[i] == BG_IC_GATE_DESTROYED)
|
||||
return;
|
||||
if (!player->HasAchieved(3854)) // ACHIEVEMENT_BACK_DOOR_JOB
|
||||
player->CastSpell(player, SPELL_BACK_DOOR_JOB, true);
|
||||
break;
|
||||
case AREA_TRIGGER_ALLIANCE_KEEP:
|
||||
if (player->GetTeamId() != TEAM_HORDE)
|
||||
return;
|
||||
for (uint8 i = BG_IC_A_FRONT; i < BG_IC_MAXDOOR; ++i)
|
||||
if (GateStatus[i] == BG_IC_GATE_DESTROYED)
|
||||
return;
|
||||
if (!player->HasAchieved(3854)) // ACHIEVEMENT_BACK_DOOR_JOB
|
||||
player->CastSpell(player, SPELL_BACK_DOOR_JOB, true);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -373,11 +373,11 @@ void BattlegroundIC::UpdatePlayerScore(Player* player, uint32 type, uint32 value
|
||||
{
|
||||
case SCORE_BASES_ASSAULTED:
|
||||
((BattlegroundICScore*)itr->second)->BasesAssaulted += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_ASSAULT_BASE);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_ASSAULT_BASE);
|
||||
break;
|
||||
case SCORE_BASES_DEFENDED:
|
||||
((BattlegroundICScore*)itr->second)->BasesDefended += value;
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_DEFEND_BASE);
|
||||
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_DEFEND_BASE);
|
||||
break;
|
||||
default:
|
||||
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
|
||||
@@ -412,9 +412,9 @@ bool BattlegroundIC::SetupBattleground()
|
||||
return false;
|
||||
}
|
||||
|
||||
// Horde / Alliance gates, set active
|
||||
if (i < 6)
|
||||
GetBGObject(BG_IC_ObjSpawnlocs[i].type)->setActive(true);
|
||||
// Horde / Alliance gates, set active
|
||||
if (i < 6)
|
||||
GetBGObject(BG_IC_ObjSpawnlocs[i].type)->setActive(true);
|
||||
}
|
||||
|
||||
for (uint8 i = 0; i < MAX_FORTRESS_TELEPORTERS_SPAWNS; ++i)
|
||||
@@ -470,40 +470,40 @@ bool BattlegroundIC::SetupBattleground()
|
||||
GetBGCreature(i)->setFaction(BG_IC_Factions[0]);
|
||||
for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i <= BG_IC_NPC_KEEP_CANNON_25; ++i)
|
||||
GetBGCreature(i)->setFaction(BG_IC_Factions[1]);
|
||||
// Flags
|
||||
if (GameObject* go = GetBGObject(BG_IC_GO_ALLIANCE_BANNER))
|
||||
{
|
||||
go->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[1]);
|
||||
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
if (GameObject* go = GetBGObject(BG_IC_GO_HORDE_BANNER))
|
||||
{
|
||||
go->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[0]);
|
||||
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
// Flags
|
||||
if (GameObject* go = GetBGObject(BG_IC_GO_ALLIANCE_BANNER))
|
||||
{
|
||||
go->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[1]);
|
||||
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
if (GameObject* go = GetBGObject(BG_IC_GO_HORDE_BANNER))
|
||||
{
|
||||
go->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[0]);
|
||||
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
|
||||
// correcting spawn time for keeps bombs
|
||||
for (uint8 i = BG_IC_GO_HUGE_SEAFORIUM_BOMBS_A_1; i < BG_IC_GO_HUGE_SEAFORIUM_BOMBS_H_4; ++i)
|
||||
GetBGObject(i)->SetRespawnTime(10);
|
||||
|
||||
TurnBosses(false);
|
||||
TurnBosses(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
void BattlegroundIC::TurnBosses(bool on)
|
||||
{
|
||||
// Make Bosses invisible and passive
|
||||
// or visible and active
|
||||
if (Creature* boss = GetBGCreature(BG_IC_NPC_OVERLORD_AGMAR))
|
||||
{
|
||||
boss->SetVisible(on);
|
||||
boss->SetReactState(on ? REACT_AGGRESSIVE : REACT_PASSIVE);
|
||||
}
|
||||
if (Creature* boss = GetBGCreature(BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE))
|
||||
{
|
||||
boss->SetVisible(on);
|
||||
boss->SetReactState(on ? REACT_AGGRESSIVE : REACT_PASSIVE);
|
||||
}
|
||||
// Make Bosses invisible and passive
|
||||
// or visible and active
|
||||
if (Creature* boss = GetBGCreature(BG_IC_NPC_OVERLORD_AGMAR))
|
||||
{
|
||||
boss->SetVisible(on);
|
||||
boss->SetReactState(on ? REACT_AGGRESSIVE : REACT_PASSIVE);
|
||||
}
|
||||
if (Creature* boss = GetBGCreature(BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE))
|
||||
{
|
||||
boss->SetVisible(on);
|
||||
boss->SetReactState(on ? REACT_AGGRESSIVE : REACT_PASSIVE);
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer)
|
||||
@@ -526,14 +526,14 @@ void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer)
|
||||
//Achievement Mowed Down
|
||||
// TO-DO: This should be done on the script of each vehicle of the BG.
|
||||
if (unit->IsVehicle())
|
||||
{
|
||||
{
|
||||
killer->CastSpell(killer, SPELL_DESTROYED_VEHICLE_ACHIEVEMENT, true);
|
||||
|
||||
// Xinef: Add to respawn list
|
||||
if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A ||
|
||||
entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT)
|
||||
respawnMap[unit->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME;
|
||||
}
|
||||
|
||||
// Xinef: Add to respawn list
|
||||
if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A ||
|
||||
entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT)
|
||||
respawnMap[unit->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundIC::HandleKillPlayer(Player* player, Player* killer)
|
||||
@@ -572,21 +572,21 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
if (nodePoint[i].faction == player->GetTeamId())
|
||||
return;
|
||||
|
||||
// Prevent capturing of keep if none of gates was destroyed
|
||||
if (nodePoint[i].gameobject_entry == GO_ALLIANCE_BANNER)
|
||||
{
|
||||
if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED)
|
||||
return;
|
||||
}
|
||||
else if (nodePoint[i].gameobject_entry == GO_HORDE_BANNER)
|
||||
{
|
||||
if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED)
|
||||
return;
|
||||
}
|
||||
// Prevent capturing of keep if none of gates was destroyed
|
||||
if (nodePoint[i].gameobject_entry == GO_ALLIANCE_BANNER)
|
||||
{
|
||||
if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED)
|
||||
return;
|
||||
}
|
||||
else if (nodePoint[i].gameobject_entry == GO_HORDE_BANNER)
|
||||
{
|
||||
if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED &&
|
||||
GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 nextBanner = GetNextBanner(&nodePoint[i], player->GetTeamId(), false);
|
||||
|
||||
@@ -601,7 +601,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; // 1 minute for last change (real faction banner)
|
||||
nodePoint[i].needChange = true;
|
||||
|
||||
RelocateDeadPlayers(BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + nodePoint[i].nodeType - 2]);
|
||||
RelocateDeadPlayers(BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + nodePoint[i].nodeType - 2]);
|
||||
|
||||
// if we are here means that the point has been lost, or it is the first capture
|
||||
|
||||
@@ -615,7 +615,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_2, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE));
|
||||
HandleContestedNodes(&nodePoint[i]);
|
||||
}
|
||||
else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] || nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED])
|
||||
else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] || nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED])
|
||||
// if we are going to spawn the definitve faction banner, we dont need the timer anymore
|
||||
{
|
||||
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME;
|
||||
@@ -718,7 +718,7 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
|
||||
else
|
||||
gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f);
|
||||
|
||||
for (std::list<Creature*>::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr)
|
||||
for (std::list<Creature*>::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr)
|
||||
{
|
||||
(*itr)->GetVehicleKit()->RemoveAllPassengers();
|
||||
(*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
@@ -755,26 +755,26 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
else
|
||||
gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f);
|
||||
|
||||
for (std::list<Creature*>::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr)
|
||||
for (std::list<Creature*>::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr)
|
||||
(*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
|
||||
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; ++u)
|
||||
{
|
||||
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1 + u;
|
||||
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(), BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(), BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY))
|
||||
sLog->outError("Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
|
||||
}
|
||||
|
||||
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS; ++u)
|
||||
{
|
||||
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_EFFECT_1 + u;
|
||||
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u].GetPositionX(), BG_IC_HangarTeleporterEffects[u].GetPositionY(), BG_IC_HangarTeleporterEffects[u].GetPositionZ(), BG_IC_HangarTeleporterEffects[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE))
|
||||
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u].GetPositionX(), BG_IC_HangarTeleporterEffects[u].GetPositionY(), BG_IC_HangarTeleporterEffects[u].GetPositionZ(), BG_IC_HangarTeleporterEffects[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE))
|
||||
sLog->outError("Isle of Conquest: There was an error spawning a gunship portal effects. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
|
||||
}
|
||||
|
||||
for (uint8 u = 0; u < MAX_TRIGGER_SPAWNS_PER_FACTION; ++u)
|
||||
{
|
||||
if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[nodePoint->faction].GetPositionX(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionY(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionZ(), BG_IC_HangarTrigger[nodePoint->faction].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
|
||||
if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[nodePoint->faction].GetPositionX(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionY(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionZ(), BG_IC_HangarTrigger[nodePoint->faction].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
|
||||
sLog->outError("Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING);
|
||||
}
|
||||
|
||||
@@ -783,11 +783,11 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
uint8 type = BG_IC_NPC_GUNSHIP_CAPTAIN_1 + u;
|
||||
|
||||
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_1)
|
||||
if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetOrientation(), RESPAWN_ONE_DAY))
|
||||
if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetOrientation(), RESPAWN_ONE_DAY))
|
||||
GetBGCreature(BG_IC_NPC_GUNSHIP_CAPTAIN_1)->GetAI()->DoAction(ACTION_GUNSHIP_READY);
|
||||
|
||||
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_2)
|
||||
if (!AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
|
||||
if (!AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
|
||||
sLog->outError("Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_GUNSHIP_CAPTAIN_2);
|
||||
}
|
||||
|
||||
@@ -869,17 +869,17 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
||||
RESPAWN_ONE_DAY);
|
||||
}
|
||||
|
||||
if (Creature* siegeEngine = GetBGCreature(siegeType))
|
||||
if (Creature* siegeEngine = GetBGCreature(siegeType))
|
||||
{
|
||||
siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
|
||||
siegeEngine->SetCorpseDelay(5*MINUTE);
|
||||
siegeEngine->SetCorpseDelay(5*MINUTE);
|
||||
|
||||
if (siegeEngine->IsAlive())
|
||||
if (Vehicle* siegeVehicle = siegeEngine->GetVehicleKit())
|
||||
if (!siegeVehicle->IsVehicleInUse())
|
||||
Unit::Kill(siegeEngine, siegeEngine);
|
||||
if (siegeEngine->IsAlive())
|
||||
if (Vehicle* siegeVehicle = siegeEngine->GetVehicleKit())
|
||||
if (!siegeVehicle->IsVehicleInUse())
|
||||
Unit::Kill(siegeEngine, siegeEngine);
|
||||
|
||||
respawnMap[siegeEngine->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME;
|
||||
respawnMap[siegeEngine->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -914,33 +914,33 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
|
||||
UpdateWorldState(uws_open, 1);
|
||||
}
|
||||
|
||||
TeamId teamId = TEAM_ALLIANCE;
|
||||
TeamId teamId = TEAM_ALLIANCE;
|
||||
uint32 lang_entry = 0;
|
||||
switch (go->GetEntry())
|
||||
{
|
||||
case GO_HORDE_GATE_1:
|
||||
lang_entry = LANG_BG_IC_NORTH_GATE_DESTROYED;
|
||||
break;
|
||||
case GO_HORDE_GATE_2:
|
||||
break;
|
||||
case GO_HORDE_GATE_2:
|
||||
lang_entry = LANG_BG_IC_EAST_GATE_DESTROYED;
|
||||
break;
|
||||
case GO_HORDE_GATE_3:
|
||||
lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED;
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_1:
|
||||
teamId = TEAM_HORDE;
|
||||
teamId = TEAM_HORDE;
|
||||
lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED;
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_2:
|
||||
teamId = TEAM_HORDE;
|
||||
teamId = TEAM_HORDE;
|
||||
lang_entry = LANG_BG_IC_EAST_GATE_DESTROYED;
|
||||
break;
|
||||
case GO_ALLIANCE_GATE_3:
|
||||
teamId = TEAM_HORDE;
|
||||
teamId = TEAM_HORDE;
|
||||
lang_entry = LANG_BG_IC_SOUTH_GATE_DESTROYED;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (teamId == TEAM_ALLIANCE)
|
||||
@@ -954,7 +954,7 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
|
||||
GetBGObject(BG_IC_GO_ALLIANCE_BANNER)->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
|
||||
TurnBosses(true);
|
||||
TurnBosses(true);
|
||||
SendMessage2ToAll(lang_entry, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (teamId == TEAM_ALLIANCE ? LANG_BG_IC_HORDE_KEEP : LANG_BG_IC_ALLIANCE_KEEP));
|
||||
}
|
||||
|
||||
@@ -968,7 +968,7 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player)
|
||||
// Is there any occupied node for this team?
|
||||
std::vector<uint8> nodes;
|
||||
for (uint8 i = 0; i < MAX_NODE_TYPES; ++i)
|
||||
if (nodePoint[i].faction == player->GetTeamId() && !nodePoint[i].needChange) // xinef: controlled by faction and not contested!
|
||||
if (nodePoint[i].faction == player->GetTeamId() && !nodePoint[i].needChange) // xinef: controlled by faction and not contested!
|
||||
nodes.push_back(i);
|
||||
|
||||
WorldSafeLocsEntry const* good_entry = NULL;
|
||||
@@ -995,7 +995,7 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player)
|
||||
}
|
||||
// If not, place ghost on starting location
|
||||
if (!good_entry)
|
||||
good_entry = sWorldSafeLocsStore.LookupEntry(BG_IC_GraveyardIds[player->GetTeamId()+MAX_NODE_TYPES]);
|
||||
good_entry = sWorldSafeLocsStore.LookupEntry(BG_IC_GraveyardIds[player->GetTeamId()+MAX_NODE_TYPES]);
|
||||
|
||||
return good_entry;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ enum creaturesIC
|
||||
NPC_KOR_KRON_GUARD = 34918, // horde guard
|
||||
NPC_SEVEN_TH_LEGION_INFANTRY = 34919, // alliance guard
|
||||
NPC_KEEP_CANNON = 34944,
|
||||
NPC_BROKEN_KEEP_CANNON = 35819,
|
||||
NPC_BROKEN_KEEP_CANNON = 35819,
|
||||
NPC_DEMOLISHER = 34775,
|
||||
NPC_SIEGE_ENGINE_H = 35069,
|
||||
NPC_SIEGE_ENGINE_A = 34776,
|
||||
@@ -194,7 +194,7 @@ enum Times
|
||||
{
|
||||
WORKSHOP_UPDATE_TIME = 10000, // 10 seconds
|
||||
DOCKS_UPDATE_TIME = 10000, // 10 seconds
|
||||
VEHICLE_RESPAWN_TIME = 180, // 3 minutes, not sure
|
||||
VEHICLE_RESPAWN_TIME = 180, // 3 minutes, not sure
|
||||
IC_RESOURCE_TIME = 45000, // not sure, need more research
|
||||
CLOSE_DOORS_TIME = 20000,
|
||||
BANNER_STATE_CHANGE_TIME = 60000,
|
||||
@@ -203,11 +203,11 @@ enum Times
|
||||
|
||||
enum Actions
|
||||
{
|
||||
ACTION_GUNSHIP_READY = 1,
|
||||
ACTION_TELEPORT_PLAYER_TO_TRANSPORT = 2,
|
||||
ACTION_GUNSHIP_READY = 1,
|
||||
ACTION_TELEPORT_PLAYER_TO_TRANSPORT = 2,
|
||||
|
||||
AREA_TRIGGER_HORDE_KEEP = 5535,
|
||||
AREA_TRIGGER_ALLIANCE_KEEP = 5536
|
||||
AREA_TRIGGER_HORDE_KEEP = 5535,
|
||||
AREA_TRIGGER_ALLIANCE_KEEP = 5536
|
||||
};
|
||||
|
||||
struct ICNpc
|
||||
@@ -710,19 +710,19 @@ const Position workshopBombs[2] =
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_OIL_REFINERY = 68719,
|
||||
SPELL_QUARRY = 68720,
|
||||
SPELL_OIL_REFINERY = 68719,
|
||||
SPELL_QUARRY = 68720,
|
||||
|
||||
SPELL_DESTROYED_VEHICLE_ACHIEVEMENT = 68357,
|
||||
SPELL_BACK_DOOR_JOB = 68502,
|
||||
SPELL_DESTROYED_VEHICLE_ACHIEVEMENT = 68357,
|
||||
SPELL_BACK_DOOR_JOB = 68502,
|
||||
|
||||
SPELL_DRIVING_CREDIT_DEMOLISHER = 68365,
|
||||
SPELL_DRIVING_CREDIT_GLAIVE = 68363,
|
||||
SPELL_DRIVING_CREDIT_SIEGE = 68364,
|
||||
SPELL_DRIVING_CREDIT_CATAPULT = 68362,
|
||||
SPELL_DRIVING_CREDIT_DEMOLISHER = 68365,
|
||||
SPELL_DRIVING_CREDIT_GLAIVE = 68363,
|
||||
SPELL_DRIVING_CREDIT_SIEGE = 68364,
|
||||
SPELL_DRIVING_CREDIT_CATAPULT = 68362,
|
||||
|
||||
SPELL_REPAIR_TURRET_CHANNEL = 68077,
|
||||
SPELL_REPAIR_TURRET_DUMMY = 68078,
|
||||
SPELL_REPAIR_TURRET_CHANNEL = 68077,
|
||||
SPELL_REPAIR_TURRET_DUMMY = 68078,
|
||||
|
||||
SPELL_SIMPLE_TELEPORT = 12980,
|
||||
SPELL_TELEPORT_VISUAL_ONLY = 51347,
|
||||
@@ -932,8 +932,8 @@ class BattlegroundIC : public Battleground
|
||||
uint32 GetNodeState(uint8 nodeType) const { return (uint8)nodePoint[nodeType].nodeState; }
|
||||
|
||||
bool AllNodesConrolledByTeam(TeamId teamId) const; // overwrited
|
||||
bool IsResourceGlutAllowed(TeamId teamId) const;
|
||||
void DoAction(uint32 action, uint64 guid);
|
||||
bool IsResourceGlutAllowed(TeamId teamId) const;
|
||||
void DoAction(uint32 action, uint64 guid);
|
||||
private:
|
||||
uint32 closeFortressDoorsTimer;
|
||||
bool doorsClosed;
|
||||
@@ -944,8 +944,8 @@ class BattlegroundIC : public Battleground
|
||||
BG_IC_GateState GateStatus[6];
|
||||
ICNodePoint nodePoint[7];
|
||||
|
||||
typedef std::map<uint32, uint32> RespawnMap;
|
||||
RespawnMap respawnMap;
|
||||
typedef std::map<uint32, uint32> RespawnMap;
|
||||
RespawnMap respawnMap;
|
||||
|
||||
MotionTransport* gunshipAlliance;
|
||||
MotionTransport* gunshipHorde;
|
||||
@@ -998,7 +998,7 @@ class BattlegroundIC : public Battleground
|
||||
void UpdateNodeWorldState(ICNodePoint* nodePoint);
|
||||
void HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture);
|
||||
void HandleContestedNodes(ICNodePoint* nodePoint);
|
||||
void TurnBosses(bool on);
|
||||
void TurnBosses(bool on);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -108,12 +108,12 @@ void BattlegroundNA::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
case 4536: // buff trigger?
|
||||
case 4537: // buff trigger?
|
||||
break;
|
||||
// OUTSIDE OF ARENA, TELEPORT!
|
||||
case 4917:
|
||||
case 5006:
|
||||
case 5008:
|
||||
player->NearTeleportTo(4054.15f, 2923.7f, 13.4f, player->GetOrientation());
|
||||
break;
|
||||
// OUTSIDE OF ARENA, TELEPORT!
|
||||
case 4917:
|
||||
case 5006:
|
||||
case 5008:
|
||||
player->NearTeleportTo(4054.15f, 2923.7f, 13.4f, player->GetOrientation());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,8 +28,8 @@ enum BattlegroundNAObjectTypes
|
||||
BG_NA_OBJECT_DOOR_4 = 3,
|
||||
BG_NA_OBJECT_BUFF_1 = 4,
|
||||
BG_NA_OBJECT_BUFF_2 = 5,
|
||||
BG_NA_OBJECT_READY_MARKER_1 = 6,
|
||||
BG_NA_OBJECT_READY_MARKER_2 = 7,
|
||||
BG_NA_OBJECT_READY_MARKER_1 = 6,
|
||||
BG_NA_OBJECT_READY_MARKER_2 = 7,
|
||||
BG_NA_OBJECT_MAX = 8
|
||||
};
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ void BattlegroundRL::AddPlayer(Player* player)
|
||||
{
|
||||
Battleground::AddPlayer(player);
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore(player);
|
||||
Battleground::UpdateArenaWorldState();
|
||||
Battleground::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundRL::RemovePlayer(Player* /*player*/)
|
||||
@@ -108,38 +108,38 @@ void BattlegroundRL::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
case 4696: // buff trigger?
|
||||
case 4697: // buff trigger?
|
||||
break;
|
||||
// OUTSIDE OF ARENA, TELEPORT!
|
||||
case 4927:
|
||||
case 4928:
|
||||
player->NearTeleportTo(1230.77f, 1662.42f, 34.56f, 0.0f);
|
||||
break;
|
||||
case 4929:
|
||||
case 4930:
|
||||
player->NearTeleportTo(1341.16f, 1673.52f, 34.43f, 3.5f);
|
||||
break;
|
||||
case 4931:
|
||||
player->NearTeleportTo(1294.74f, 1584.5f, 31.62f, 1.66f);
|
||||
break;
|
||||
case 4932:
|
||||
player->NearTeleportTo(1277.5f, 1751.07f, 31.61f, 4.7f);
|
||||
break;
|
||||
case 4933:
|
||||
player->NearTeleportTo(1269.14f, 1713.85f, 34.46f, 5.23f);
|
||||
break;
|
||||
case 4934:
|
||||
player->NearTeleportTo(1298.14f, 1713.8f, 33.58f, 4.55f);
|
||||
break;
|
||||
case 4935:
|
||||
player->NearTeleportTo(1306.32f, 1620.75f, 34.25f, 1.97f);
|
||||
break;
|
||||
case 4936:
|
||||
player->NearTeleportTo(1277.97f, 1615.51f, 34.56f, 1.15f);
|
||||
break;
|
||||
case 4941: // under arena +10
|
||||
case 5041: // under arena -10
|
||||
case 5042: // under arena -30
|
||||
player->NearTeleportTo(1285.810547f, 1667.896851f, 39.957642f, player->GetOrientation());
|
||||
break;
|
||||
// OUTSIDE OF ARENA, TELEPORT!
|
||||
case 4927:
|
||||
case 4928:
|
||||
player->NearTeleportTo(1230.77f, 1662.42f, 34.56f, 0.0f);
|
||||
break;
|
||||
case 4929:
|
||||
case 4930:
|
||||
player->NearTeleportTo(1341.16f, 1673.52f, 34.43f, 3.5f);
|
||||
break;
|
||||
case 4931:
|
||||
player->NearTeleportTo(1294.74f, 1584.5f, 31.62f, 1.66f);
|
||||
break;
|
||||
case 4932:
|
||||
player->NearTeleportTo(1277.5f, 1751.07f, 31.61f, 4.7f);
|
||||
break;
|
||||
case 4933:
|
||||
player->NearTeleportTo(1269.14f, 1713.85f, 34.46f, 5.23f);
|
||||
break;
|
||||
case 4934:
|
||||
player->NearTeleportTo(1298.14f, 1713.8f, 33.58f, 4.55f);
|
||||
break;
|
||||
case 4935:
|
||||
player->NearTeleportTo(1306.32f, 1620.75f, 34.25f, 1.97f);
|
||||
break;
|
||||
case 4936:
|
||||
player->NearTeleportTo(1277.97f, 1615.51f, 34.56f, 1.15f);
|
||||
break;
|
||||
case 4941: // under arena +10
|
||||
case 5041: // under arena -10
|
||||
case 5042: // under arena -30
|
||||
player->NearTeleportTo(1285.810547f, 1667.896851f, 39.957642f, player->GetOrientation());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ enum BattlegroundRLObjectTypes
|
||||
BG_RL_OBJECT_DOOR_2 = 1,
|
||||
BG_RL_OBJECT_BUFF_1 = 2,
|
||||
BG_RL_OBJECT_BUFF_2 = 3,
|
||||
BG_RL_OBJECT_READY_MARKER_1 = 4,
|
||||
BG_RL_OBJECT_READY_MARKER_2 = 5,
|
||||
BG_RL_OBJECT_READY_MARKER_1 = 4,
|
||||
BG_RL_OBJECT_READY_MARKER_2 = 5,
|
||||
BG_RL_OBJECT_MAX = 6
|
||||
};
|
||||
|
||||
|
||||
@@ -46,26 +46,26 @@ BattlegroundRV::~BattlegroundRV() { }
|
||||
|
||||
void BattlegroundRV::TeleportUnitToNewZ(Unit* unit, float newZ, bool casting)
|
||||
{
|
||||
if (!unit->IsAlive())
|
||||
return;
|
||||
if (!unit->IsAlive())
|
||||
return;
|
||||
unit->NearTeleportTo(unit->GetPositionX(), unit->GetPositionY(), newZ, unit->GetOrientation(), casting);
|
||||
unit->m_positionZ = newZ;
|
||||
}
|
||||
|
||||
void BattlegroundRV::CheckPositionForUnit(Unit* unit)
|
||||
{
|
||||
// get height at current pos, if something is wrong (below or high above) - teleport
|
||||
if (!unit->IsFalling() && unit->IsAlive())
|
||||
{
|
||||
float groundZ_vmap = unit->GetMap()->GetHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, true, 50.0f);
|
||||
float groundZ_dyntree = unit->GetMap()->GetDynamicMapTree().getHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, 50.0f, unit->GetPhaseMask());
|
||||
if (groundZ_vmap > 28.0f && groundZ_vmap < 29.0f || groundZ_dyntree > 28.0f && groundZ_dyntree < 37.0f)
|
||||
{
|
||||
float groundZ = std::max<float>(groundZ_vmap, groundZ_dyntree);
|
||||
if (unit->GetPositionZ() < groundZ - 0.2f || unit->GetPositionZ() > groundZ + 3.5f)
|
||||
TeleportUnitToNewZ(unit, groundZ+1.0f, true);
|
||||
}
|
||||
}
|
||||
// get height at current pos, if something is wrong (below or high above) - teleport
|
||||
if (!unit->IsFalling() && unit->IsAlive())
|
||||
{
|
||||
float groundZ_vmap = unit->GetMap()->GetHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, true, 50.0f);
|
||||
float groundZ_dyntree = unit->GetMap()->GetDynamicMapTree().getHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, 50.0f, unit->GetPhaseMask());
|
||||
if (groundZ_vmap > 28.0f && groundZ_vmap < 29.0f || groundZ_dyntree > 28.0f && groundZ_dyntree < 37.0f)
|
||||
{
|
||||
float groundZ = std::max<float>(groundZ_vmap, groundZ_dyntree);
|
||||
if (unit->GetPositionZ() < groundZ - 0.2f || unit->GetPositionZ() > groundZ + 3.5f)
|
||||
TeleportUnitToNewZ(unit, groundZ+1.0f, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundRV::PostUpdateImpl(uint32 diff)
|
||||
@@ -87,11 +87,11 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff)
|
||||
if (Player* player = itr->second)
|
||||
{
|
||||
// Demonic Circle Summon
|
||||
if (GameObject* gObj = player->GetGameObject(48018))
|
||||
{
|
||||
gObj->Relocate(gObj->GetPositionX(), gObj->GetPositionY(), 28.28f);
|
||||
gObj->UpdateObjectVisibility(true);
|
||||
}
|
||||
if (GameObject* gObj = player->GetGameObject(48018))
|
||||
{
|
||||
gObj->Relocate(gObj->GetPositionX(), gObj->GetPositionY(), 28.28f);
|
||||
gObj->UpdateObjectVisibility(true);
|
||||
}
|
||||
|
||||
if (player->GetPositionZ() < 27.0f)
|
||||
TeleportUnitToNewZ(player, 28.28f, true);
|
||||
@@ -103,18 +103,18 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff)
|
||||
TeleportUnitToNewZ(totem, 28.28f, true);
|
||||
|
||||
for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
|
||||
{
|
||||
{
|
||||
if ((*itr)->GetPositionZ() < 28.0f)
|
||||
TeleportUnitToNewZ((*itr), 28.28f, true);
|
||||
|
||||
// Xinef: override stay position
|
||||
if (CharmInfo* charmInfo = (*itr)->GetCharmInfo())
|
||||
if (charmInfo->IsAtStay())
|
||||
{
|
||||
(*itr)->StopMovingOnCurrentPos();
|
||||
charmInfo->SaveStayPosition(false);
|
||||
}
|
||||
}
|
||||
// Xinef: override stay position
|
||||
if (CharmInfo* charmInfo = (*itr)->GetCharmInfo())
|
||||
if (charmInfo->IsAtStay())
|
||||
{
|
||||
(*itr)->StopMovingOnCurrentPos();
|
||||
charmInfo->SaveStayPosition(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// fix ground on elevators (so aoe spells can be casted there)
|
||||
@@ -141,8 +141,8 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff)
|
||||
else
|
||||
setTimer(getTimer() - diff);
|
||||
|
||||
if (getState() == BG_RV_STATE_OPEN_FENCES)
|
||||
return;
|
||||
if (getState() == BG_RV_STATE_OPEN_FENCES)
|
||||
return;
|
||||
|
||||
if (CheckPlayersTimer <= diff)
|
||||
{
|
||||
@@ -150,7 +150,7 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff)
|
||||
for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
|
||||
CheckPositionForUnit(itr->second);
|
||||
|
||||
// maybe for pets and m_Controlled also, but not really necessary
|
||||
// maybe for pets and m_Controlled also, but not really necessary
|
||||
}
|
||||
else
|
||||
CheckPlayersTimer -= diff;
|
||||
@@ -179,12 +179,12 @@ void BattlegroundRV::StartingEventOpenDoors()
|
||||
|
||||
void BattlegroundRV::AddPlayer(Player* player)
|
||||
{
|
||||
if (GetStatus() == STATUS_WAIT_JOIN && player->GetBgTeamId() == TEAM_HORDE)
|
||||
if (GetStatus() == STATUS_WAIT_JOIN && player->GetBgTeamId() == TEAM_HORDE)
|
||||
player->SetPhaseMask(2, true);
|
||||
|
||||
Battleground::AddPlayer(player);
|
||||
PlayerScores[player->GetGUID()] = new BattlegroundScore(player);
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundRV::RemovePlayer(Player* player)
|
||||
@@ -195,7 +195,7 @@ void BattlegroundRV::RemovePlayer(Player* player)
|
||||
if (GetStatus() == STATUS_WAIT_JOIN)
|
||||
player->SetPhaseMask(1, true);
|
||||
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ void BattlegroundRV::HandleKillPlayer(Player* player, Player* killer)
|
||||
return;
|
||||
|
||||
Battleground::HandleKillPlayer(player, killer);
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
|
||||
CheckArenaWinConditions();
|
||||
}
|
||||
@@ -246,7 +246,7 @@ void BattlegroundRV::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
void BattlegroundRV::FillInitialWorldStates(WorldPacket &data)
|
||||
{
|
||||
data << uint32(BG_RV_WORLD_STATE) << uint32(1);
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
BattlegroundRV::UpdateArenaWorldState();
|
||||
}
|
||||
|
||||
void BattlegroundRV::UpdateArenaWorldState()
|
||||
@@ -304,27 +304,27 @@ bool BattlegroundRV::SetupBattleground()
|
||||
|
||||
void BattlegroundRV::UpdatePillars()
|
||||
{
|
||||
GameObject* test = GetBgMap()->GetGameObject(BgObjects[BG_RV_OBJECT_PILAR_1]);
|
||||
if (!test)
|
||||
return;
|
||||
GameObject* test = GetBgMap()->GetGameObject(BgObjects[BG_RV_OBJECT_PILAR_1]);
|
||||
if (!test)
|
||||
return;
|
||||
|
||||
if (test->GetGoState() == GO_STATE_READY)
|
||||
if (test->GetGoState() == GO_STATE_READY)
|
||||
{
|
||||
for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_GEAR_2; ++i)
|
||||
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
|
||||
go->SetGoState(GO_STATE_ACTIVE);
|
||||
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
|
||||
go->SetGoState(GO_STATE_ACTIVE);
|
||||
for (uint8 i = BG_RV_OBJECT_PILAR_2; i <= BG_RV_OBJECT_PULLEY_2; ++i)
|
||||
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
}
|
||||
else
|
||||
{
|
||||
for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_GEAR_2; ++i)
|
||||
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
|
||||
go->SetGoState(GO_STATE_READY);
|
||||
for (uint8 i = BG_RV_OBJECT_PILAR_2; i <= BG_RV_OBJECT_PULLEY_2; ++i)
|
||||
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
|
||||
go->SetGoState(GO_STATE_ACTIVE);
|
||||
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
|
||||
go->SetGoState(GO_STATE_ACTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -42,8 +42,8 @@ enum BattlegroundRVObjectTypes
|
||||
BG_RV_OBJECT_ELEVATOR_1,
|
||||
BG_RV_OBJECT_ELEVATOR_2,
|
||||
|
||||
BG_RV_OBJECT_READY_MARKER_1,
|
||||
BG_RV_OBJECT_READY_MARKER_2,
|
||||
BG_RV_OBJECT_READY_MARKER_1,
|
||||
BG_RV_OBJECT_READY_MARKER_2,
|
||||
|
||||
BG_RV_OBJECT_MAX,
|
||||
};
|
||||
@@ -99,7 +99,7 @@ class BattlegroundRV : public Battleground
|
||||
void StartingEventOpenDoors();
|
||||
void Init();
|
||||
void FillInitialWorldStates(WorldPacket &d);
|
||||
void UpdateArenaWorldState();
|
||||
void UpdateArenaWorldState();
|
||||
void HandleAreaTrigger(Player* player, uint32 trigger);
|
||||
bool SetupBattleground();
|
||||
void HandleKillPlayer(Player* player, Player* killer);
|
||||
|
||||
@@ -64,7 +64,7 @@ BattlegroundSA::~BattlegroundSA()
|
||||
|
||||
void BattlegroundSA::Init()
|
||||
{
|
||||
Battleground::Init();
|
||||
Battleground::Init();
|
||||
|
||||
TotalTime = 0;
|
||||
Attackers = ((urand(0, 1)) ? TEAM_ALLIANCE : TEAM_HORDE);
|
||||
@@ -74,7 +74,7 @@ void BattlegroundSA::Init()
|
||||
_notEvenAScratch[TEAM_ALLIANCE] = true;
|
||||
_notEvenAScratch[TEAM_HORDE] = true;
|
||||
Status = BG_SA_WARMUP;
|
||||
_relicClicked = false;
|
||||
_relicClicked = false;
|
||||
}
|
||||
|
||||
bool BattlegroundSA::SetupBattleground()
|
||||
@@ -159,11 +159,11 @@ bool BattlegroundSA::ResetObjs()
|
||||
{
|
||||
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
|
||||
if (GameObject* go = GetBGObject(i))
|
||||
{
|
||||
go->setActive(true);
|
||||
go->SetUInt32Value(GAMEOBJECT_FACTION, defF);
|
||||
go->SetDestructibleBuildingModifyState(false);
|
||||
}
|
||||
{
|
||||
go->setActive(true);
|
||||
go->SetUInt32Value(GAMEOBJECT_FACTION, defF);
|
||||
go->SetDestructibleBuildingModifyState(false);
|
||||
}
|
||||
}
|
||||
|
||||
GetBGObject(BG_SA_TITAN_RELIC)->SetUInt32Value(GAMEOBJECT_FACTION, atF);
|
||||
@@ -316,7 +316,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
|
||||
SendMessageToAll(LANG_BG_SA_ROUND_TWO_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
UpdateWaitTimer -= diff;
|
||||
return;
|
||||
@@ -354,7 +354,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
|
||||
DemolisherStartState(false);
|
||||
Status = BG_SA_ROUND_TWO;
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE)?23748:21702);
|
||||
|
||||
|
||||
// status was set to STATUS_WAIT_JOIN manually for Preparation, set it back now
|
||||
SetStatus(STATUS_IN_PROGRESS);
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
@@ -377,27 +377,27 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
if (TotalTime >= BG_SA_ROUNDLENGTH || _relicClicked)
|
||||
{
|
||||
if (_relicClicked)
|
||||
{
|
||||
RoundScores[0].winner = Attackers;
|
||||
RoundScores[0].time = TotalTime;
|
||||
//Achievement Storm the Beach (1310)
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (itr->second->GetTeamId() == Attackers)
|
||||
itr->second->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
|
||||
}
|
||||
else
|
||||
{
|
||||
// cast this before Attackers variable is switched
|
||||
// cast this spell only upon timer end, no other ability for defenders to win :)
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
itr->second->CastSpell(itr->second, SPELL_SA_END_OF_ROUND, true);
|
||||
if (_relicClicked)
|
||||
{
|
||||
RoundScores[0].winner = Attackers;
|
||||
RoundScores[0].time = TotalTime;
|
||||
//Achievement Storm the Beach (1310)
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
if (itr->second->GetTeamId() == Attackers)
|
||||
itr->second->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
|
||||
}
|
||||
else
|
||||
{
|
||||
// cast this before Attackers variable is switched
|
||||
// cast this spell only upon timer end, no other ability for defenders to win :)
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
itr->second->CastSpell(itr->second, SPELL_SA_END_OF_ROUND, true);
|
||||
|
||||
RoundScores[0].winner = Attackers;
|
||||
RoundScores[0].time = BG_SA_ROUNDLENGTH;
|
||||
}
|
||||
RoundScores[0].winner = Attackers;
|
||||
RoundScores[0].time = BG_SA_ROUNDLENGTH;
|
||||
}
|
||||
|
||||
_relicClicked = false;
|
||||
_relicClicked = false;
|
||||
Attackers = (Attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
|
||||
Status = BG_SA_SECOND_WARMUP;
|
||||
TotalTime = 0;
|
||||
@@ -416,9 +416,9 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
if (TotalTime >= EndRoundTimer)
|
||||
{
|
||||
// cast this spell only upon timer end, no other ability for defenders to win :)
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
itr->second->CastSpell(itr->second, SPELL_SA_END_OF_ROUND, true);
|
||||
// cast this spell only upon timer end, no other ability for defenders to win :)
|
||||
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
|
||||
itr->second->CastSpell(itr->second, SPELL_SA_END_OF_ROUND, true);
|
||||
|
||||
RoundScores[1].time = BG_SA_ROUNDLENGTH;
|
||||
RoundScores[1].winner = GetOtherTeamId(Attackers);
|
||||
@@ -496,7 +496,7 @@ void BattlegroundSA::AddPlayer(Player* player)
|
||||
|
||||
SendTransportInit(player);
|
||||
PlayerScores[player->GetGUID()] = sc;
|
||||
TeleportToEntrancePosition(player);
|
||||
TeleportToEntrancePosition(player);
|
||||
}
|
||||
|
||||
void BattlegroundSA::RemovePlayer(Player* /*player*/)
|
||||
@@ -540,49 +540,49 @@ void BattlegroundSA::TeleportPlayers()
|
||||
player->SpawnCorpseBones();
|
||||
}
|
||||
|
||||
if (Status == BG_SA_SECOND_WARMUP)
|
||||
{
|
||||
player->CastSpell(player, SPELL_PREPARATION, true);
|
||||
player->GetMotionMaster()->MovementExpired();
|
||||
}
|
||||
if (Status == BG_SA_SECOND_WARMUP)
|
||||
{
|
||||
player->CastSpell(player, SPELL_PREPARATION, true);
|
||||
player->GetMotionMaster()->MovementExpired();
|
||||
}
|
||||
|
||||
player->ResetAllPowers();
|
||||
player->CombatStopWithPets(true);
|
||||
|
||||
TeleportToEntrancePosition(player);
|
||||
TeleportToEntrancePosition(player);
|
||||
|
||||
// xinef: one more time, just to be sure
|
||||
if (Status == BG_SA_SECOND_WARMUP)
|
||||
player->GetMotionMaster()->Clear(false);
|
||||
// xinef: one more time, just to be sure
|
||||
if (Status == BG_SA_SECOND_WARMUP)
|
||||
player->GetMotionMaster()->Clear(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundSA::TeleportToEntrancePosition(Player* player)
|
||||
{
|
||||
if (player->GetTeamId() != Attackers)
|
||||
{
|
||||
player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ShipsStarted)
|
||||
{
|
||||
player->CastSpell(player, 12438, true);//Without this player falls before boat loads...
|
||||
if (urand(0, 1))
|
||||
player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0);
|
||||
else
|
||||
player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0);
|
||||
}
|
||||
else
|
||||
player->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
|
||||
}
|
||||
if (player->GetTeamId() != Attackers)
|
||||
{
|
||||
player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!ShipsStarted)
|
||||
{
|
||||
player->CastSpell(player, 12438, true);//Without this player falls before boat loads...
|
||||
if (urand(0, 1))
|
||||
player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0);
|
||||
else
|
||||
player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0);
|
||||
}
|
||||
else
|
||||
player->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void BattlegroundSA::DefendersPortalTeleport(GameObject* portal, Player* plr)
|
||||
{
|
||||
if (plr->GetTeamId() == Attackers)
|
||||
return;
|
||||
return;
|
||||
|
||||
uint32 portal_num = 0;
|
||||
//get it via X
|
||||
@@ -629,29 +629,29 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui
|
||||
else
|
||||
SendWarningToAll(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name.c_str());
|
||||
|
||||
uint32 i = GetGateIDFromEntry(go->GetEntry());
|
||||
switch (i)
|
||||
{
|
||||
case BG_SA_BLUE_GATE:
|
||||
case BG_SA_GREEN_GATE:
|
||||
{
|
||||
GameObject* go = NULL;
|
||||
if (go = GetBGObject(BG_SA_RED_GATE))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
if (go = GetBGObject(BG_SA_PURPLE_GATE))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
break;
|
||||
}
|
||||
case BG_SA_RED_GATE:
|
||||
case BG_SA_PURPLE_GATE:
|
||||
if (GameObject* go = GetBGObject(BG_SA_YELLOW_GATE))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
break;
|
||||
case BG_SA_YELLOW_GATE:
|
||||
if (GameObject* go = GetBGObject(BG_SA_ANCIENT_GATE))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
break;
|
||||
}
|
||||
uint32 i = GetGateIDFromEntry(go->GetEntry());
|
||||
switch (i)
|
||||
{
|
||||
case BG_SA_BLUE_GATE:
|
||||
case BG_SA_GREEN_GATE:
|
||||
{
|
||||
GameObject* go = NULL;
|
||||
if (go = GetBGObject(BG_SA_RED_GATE))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
if (go = GetBGObject(BG_SA_PURPLE_GATE))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
break;
|
||||
}
|
||||
case BG_SA_RED_GATE:
|
||||
case BG_SA_PURPLE_GATE:
|
||||
if (GameObject* go = GetBGObject(BG_SA_YELLOW_GATE))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
break;
|
||||
case BG_SA_YELLOW_GATE:
|
||||
if (GameObject* go = GetBGObject(BG_SA_ANCIENT_GATE))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (eventType == go->GetGOInfo()->building.damageEvent)
|
||||
@@ -704,7 +704,7 @@ void BattlegroundSA::DemolisherStartState(bool start)
|
||||
dem->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
|
||||
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++)
|
||||
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++)
|
||||
if (Creature* gun = GetBGCreature(i))
|
||||
{
|
||||
if (start)
|
||||
@@ -713,13 +713,13 @@ void BattlegroundSA::DemolisherStartState(bool start)
|
||||
gun->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
|
||||
// xinef: enable first gates damaging at start
|
||||
if (!start)
|
||||
{
|
||||
// xinef: enable first gates damaging at start
|
||||
if (!start)
|
||||
{
|
||||
if (GameObject* go = GetBGObject(BG_SA_GREEN_GATE))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
if (GameObject* go = GetBGObject(BG_SA_BLUE_GATE))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
if (GameObject* go = GetBGObject(BG_SA_BLUE_GATE))
|
||||
go->SetDestructibleBuildingModifyState(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -758,17 +758,17 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go)
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateObjectInteractionFlags();
|
||||
UpdateObjectInteractionFlags();
|
||||
|
||||
if (i < 5)
|
||||
DelObject(i+9);
|
||||
|
||||
if (player)
|
||||
{
|
||||
UpdatePlayerScore(player, SCORE_DESTROYED_WALL, 1);
|
||||
if (rewardHonor)
|
||||
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(1));
|
||||
}
|
||||
if (player)
|
||||
{
|
||||
UpdatePlayerScore(player, SCORE_DESTROYED_WALL, 1);
|
||||
if (rewardHonor)
|
||||
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -788,24 +788,24 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveyard(Player* player)
|
||||
continue;
|
||||
|
||||
WorldSafeLocsEntry const* ret = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
|
||||
|
||||
// if on beach
|
||||
if (i == BG_SA_BEACH_GY)
|
||||
{
|
||||
if (x > 1400)
|
||||
return ret;
|
||||
continue;
|
||||
}
|
||||
|
||||
// if on beach
|
||||
if (i == BG_SA_BEACH_GY)
|
||||
{
|
||||
if (x > 1400)
|
||||
return ret;
|
||||
continue;
|
||||
}
|
||||
|
||||
float dist = sqrt(pow(ret->x - x, 2) * pow(ret->y - y, 2));
|
||||
float dist = sqrt(pow(ret->x - x, 2) * pow(ret->y - y, 2));
|
||||
if (dist < mindist)
|
||||
{
|
||||
{
|
||||
mindist = dist;
|
||||
closest = ret;
|
||||
}
|
||||
closest = ret;
|
||||
}
|
||||
}
|
||||
if (!closest && GraveyardStatus[BG_SA_BEACH_GY] == player->GetTeamId())
|
||||
return sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[BG_SA_BEACH_GY]);
|
||||
if (!closest && GraveyardStatus[BG_SA_BEACH_GY] == player->GetTeamId())
|
||||
return sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[BG_SA_BEACH_GY]);
|
||||
|
||||
|
||||
return closest;
|
||||
@@ -891,7 +891,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
|
||||
if (GraveyardStatus[i] == Attackers || Source->GetTeamId() != Attackers)
|
||||
return;
|
||||
|
||||
GraveyardStatus[i] = Source->GetTeamId();
|
||||
GraveyardStatus[i] = Source->GetTeamId();
|
||||
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
|
||||
std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]];
|
||||
if (!ghost_list.empty())
|
||||
@@ -909,8 +909,8 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
|
||||
if (ClosestGrave)
|
||||
player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
|
||||
}
|
||||
// xinef: clear resurrect queue for this creature
|
||||
m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]].clear();
|
||||
// xinef: clear resurrect queue for this creature
|
||||
m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]].clear();
|
||||
}
|
||||
|
||||
DelCreature(BG_SA_MAXNPC + i);
|
||||
@@ -1017,7 +1017,7 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
|
||||
|
||||
if (Status == BG_SA_ROUND_ONE)
|
||||
{
|
||||
_relicClicked = true;
|
||||
_relicClicked = true;
|
||||
}
|
||||
else if (Status == BG_SA_ROUND_TWO)
|
||||
{
|
||||
@@ -1123,14 +1123,14 @@ void BattlegroundSA::SendTransportsRemove(Player* player)
|
||||
|
||||
bool BattlegroundSA::AllowDefenseOfTheAncients(Player* source)
|
||||
{
|
||||
if (source->GetTeamId() == Attackers)
|
||||
return false;
|
||||
if (source->GetTeamId() == Attackers)
|
||||
return false;
|
||||
|
||||
for (uint8 i = 0; i <= 5; i++)
|
||||
{
|
||||
for (uint8 i = 0; i <= 5; i++)
|
||||
{
|
||||
if (GateStatus[i] == BG_SA_GATE_DESTROYED)
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -487,18 +487,18 @@ class BattlegroundSA : public Battleground
|
||||
/// Update score board
|
||||
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
|
||||
|
||||
// Teleporters
|
||||
void DefendersPortalTeleport(GameObject* portal, Player* plr);
|
||||
// Teleporters
|
||||
void DefendersPortalTeleport(GameObject* portal, Player* plr);
|
||||
|
||||
// Achievements
|
||||
bool AllowDefenseOfTheAncients(Player* source);
|
||||
// Achievements
|
||||
bool AllowDefenseOfTheAncients(Player* source);
|
||||
|
||||
// Achievement: Not Even a Scratch
|
||||
bool notEvenAScratch(TeamId teamId) const { return _notEvenAScratch[teamId]; }
|
||||
|
||||
private:
|
||||
|
||||
/// Return gate id, relative to bg data, according to gameobject id
|
||||
/// Return gate id, relative to bg data, according to gameobject id
|
||||
uint32 GetGateIDFromEntry(uint32 id)
|
||||
{
|
||||
uint32 i = 0;
|
||||
@@ -597,8 +597,8 @@ class BattlegroundSA : public Battleground
|
||||
bool InitSecondRound;
|
||||
std::map<uint32/*id*/, uint32/*timer*/> DemoliserRespawnList;
|
||||
|
||||
// xinef:
|
||||
bool _relicClicked;
|
||||
// xinef:
|
||||
bool _relicClicked;
|
||||
|
||||
// Achievement: Not Even a Scratch
|
||||
bool _notEvenAScratch[BG_TEAMS_COUNT];
|
||||
|
||||
@@ -43,49 +43,49 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
|
||||
{
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
{
|
||||
_bgEvents.Update(diff);
|
||||
switch (_bgEvents.ExecuteEvent())
|
||||
{
|
||||
case BG_WS_EVENT_UPDATE_GAME_TIME:
|
||||
UpdateWorldState(BG_WS_STATE_TIMER, GetMatchTime());
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, ((BG_WS_TOTAL_GAME_TIME - GetStartTime()) % (MINUTE*IN_MILLISECONDS)) + 1);
|
||||
break;
|
||||
case BG_WS_EVENT_NO_TIME_LEFT:
|
||||
if (GetTeamScore(TEAM_ALLIANCE) == GetTeamScore(TEAM_HORDE))
|
||||
EndBattleground(_lastFlagCaptureTeam);
|
||||
else
|
||||
EndBattleground(GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE);
|
||||
break;
|
||||
case BG_WS_EVENT_RESPAWN_BOTH_FLAGS:
|
||||
_bgEvents.Update(diff);
|
||||
switch (_bgEvents.ExecuteEvent())
|
||||
{
|
||||
case BG_WS_EVENT_UPDATE_GAME_TIME:
|
||||
UpdateWorldState(BG_WS_STATE_TIMER, GetMatchTime());
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, ((BG_WS_TOTAL_GAME_TIME - GetStartTime()) % (MINUTE*IN_MILLISECONDS)) + 1);
|
||||
break;
|
||||
case BG_WS_EVENT_NO_TIME_LEFT:
|
||||
if (GetTeamScore(TEAM_ALLIANCE) == GetTeamScore(TEAM_HORDE))
|
||||
EndBattleground(_lastFlagCaptureTeam);
|
||||
else
|
||||
EndBattleground(GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE);
|
||||
break;
|
||||
case BG_WS_EVENT_RESPAWN_BOTH_FLAGS:
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||
break;
|
||||
case BG_WS_EVENT_ALLIANCE_DROP_FLAG:
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||
break;
|
||||
case BG_WS_EVENT_ALLIANCE_DROP_FLAG:
|
||||
RespawnFlagAfterDrop(TEAM_ALLIANCE);
|
||||
break;
|
||||
case BG_WS_EVENT_HORDE_DROP_FLAG:
|
||||
break;
|
||||
case BG_WS_EVENT_HORDE_DROP_FLAG:
|
||||
RespawnFlagAfterDrop(TEAM_HORDE);
|
||||
break;
|
||||
case BG_WS_EVENT_BOTH_FLAGS_KEPT10:
|
||||
break;
|
||||
case BG_WS_EVENT_BOTH_FLAGS_KEPT10:
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL))
|
||||
player->CastSpell(player, BG_WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_HORDE), this->FindBgMap(), (Player*)NULL))
|
||||
player->CastSpell(player, BG_WS_SPELL_FOCUSED_ASSAULT, true);
|
||||
break;
|
||||
case BG_WS_EVENT_BOTH_FLAGS_KEPT15:
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
break;
|
||||
case BG_WS_EVENT_BOTH_FLAGS_KEPT15:
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->CastSpell(player, BG_WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
}
|
||||
}
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_HORDE), this->FindBgMap(), (Player*)NULL))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->CastSpell(player, BG_WS_SPELL_BRUTAL_ASSAULT, true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -117,9 +117,9 @@ void BattlegroundWS::StartingEventOpenDoors()
|
||||
SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY);
|
||||
|
||||
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, WS_EVENT_START_BATTLE);
|
||||
UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1);
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, 0);
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_NO_TIME_LEFT, BG_WS_TOTAL_GAME_TIME - 2*MINUTE*IN_MILLISECONDS); // 27 - 2 = 25 minutes
|
||||
UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1);
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, 0);
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_NO_TIME_LEFT, BG_WS_TOTAL_GAME_TIME - 2*MINUTE*IN_MILLISECONDS); // 27 - 2 = 25 minutes
|
||||
}
|
||||
|
||||
void BattlegroundWS::AddPlayer(Player* player)
|
||||
@@ -133,18 +133,18 @@ void BattlegroundWS::RespawnFlagAfterDrop(TeamId teamId)
|
||||
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagState(teamId) != BG_WS_FLAG_STATE_ON_GROUND)
|
||||
return;
|
||||
|
||||
UpdateFlagState(teamId, BG_WS_FLAG_STATE_ON_BASE);
|
||||
SpawnBGObject(teamId == TEAM_ALLIANCE ? BG_WS_OBJECT_A_FLAG : BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED : LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
UpdateFlagState(teamId, BG_WS_FLAG_STATE_ON_BASE);
|
||||
SpawnBGObject(teamId == TEAM_ALLIANCE ? BG_WS_OBJECT_A_FLAG : BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED : LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
|
||||
|
||||
if (GameObject* flag = GetBgMap()->GetGameObject(GetDroppedFlagGUID(teamId)))
|
||||
flag->Delete();
|
||||
|
||||
SetDroppedFlagGUID(0, teamId);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
|
||||
RemoveAssaultAuras();
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
|
||||
RemoveAssaultAuras();
|
||||
}
|
||||
|
||||
void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
|
||||
@@ -153,11 +153,11 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
|
||||
return;
|
||||
|
||||
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
|
||||
RemoveAssaultAuras();
|
||||
RemoveAssaultAuras();
|
||||
|
||||
AddPoints(player->GetTeamId(), 1);
|
||||
SetFlagPicker(0, GetOtherTeamId(player->GetTeamId()));
|
||||
UpdateFlagState(GetOtherTeamId(player->GetTeamId()), BG_WS_FLAG_STATE_ON_BASE);
|
||||
SetFlagPicker(0, GetOtherTeamId(player->GetTeamId()));
|
||||
UpdateFlagState(GetOtherTeamId(player->GetTeamId()), BG_WS_FLAG_STATE_ON_BASE);
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
@@ -176,30 +176,30 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME);
|
||||
|
||||
UpdateWorldState(player->GetTeamId() == TEAM_ALLIANCE ? BG_WS_FLAG_CAPTURES_ALLIANCE : BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(player->GetTeamId()));
|
||||
UpdateWorldState(player->GetTeamId() == TEAM_ALLIANCE ? BG_WS_FLAG_CAPTURES_ALLIANCE : BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(player->GetTeamId()));
|
||||
UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
|
||||
_lastFlagCaptureTeam = player->GetTeamId();
|
||||
_lastFlagCaptureTeam = player->GetTeamId();
|
||||
|
||||
RewardHonorToTeam(GetBonusHonorFromKill(2), player->GetTeamId());
|
||||
|
||||
if (GetTeamScore(TEAM_ALLIANCE) == BG_WS_MAX_TEAM_SCORE || GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE)
|
||||
{
|
||||
UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 0);
|
||||
EndBattleground(GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE ? TEAM_HORDE : TEAM_ALLIANCE);
|
||||
EndBattleground(GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE ? TEAM_HORDE : TEAM_ALLIANCE);
|
||||
}
|
||||
else
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_RESPAWN_BOTH_FLAGS, BG_WS_FLAG_RESPAWN_TIME);
|
||||
_bgEvents.ScheduleEvent(BG_WS_EVENT_RESPAWN_BOTH_FLAGS, BG_WS_FLAG_RESPAWN_TIME);
|
||||
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
|
||||
}
|
||||
|
||||
void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
|
||||
{
|
||||
if (GetFlagPickerGUID(TEAM_HORDE) != player->GetGUID() && GetFlagPickerGUID(TEAM_ALLIANCE) != player->GetGUID())
|
||||
return;
|
||||
if (GetFlagPickerGUID(TEAM_HORDE) != player->GetGUID() && GetFlagPickerGUID(TEAM_ALLIANCE) != player->GetGUID())
|
||||
return;
|
||||
|
||||
SetFlagPicker(0, GetOtherTeamId(player->GetTeamId()));
|
||||
SetFlagPicker(0, GetOtherTeamId(player->GetTeamId()));
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT);
|
||||
@@ -210,17 +210,17 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
|
||||
player->CastSpell(player, SPELL_RECENTLY_DROPPED_FLAG, true);
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
{
|
||||
UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_GROUND);
|
||||
UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_GROUND);
|
||||
player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
|
||||
SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_HORDE_DROP_FLAG, BG_WS_FLAG_DROP_TIME);
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_HORDE_DROP_FLAG, BG_WS_FLAG_DROP_TIME);
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_GROUND);
|
||||
UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_GROUND);
|
||||
player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
|
||||
SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_ALLIANCE_DROP_FLAG, BG_WS_FLAG_DROP_TIME);
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_ALLIANCE_DROP_FLAG, BG_WS_FLAG_DROP_TIME);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -243,14 +243,14 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
|
||||
if (GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_BASE)
|
||||
{
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10, BG_WS_SPELL_FORCE_TIME);
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15, BG_WS_SPELL_BRUTAL_TIME);
|
||||
}
|
||||
return;
|
||||
if (GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_BASE)
|
||||
{
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10, BG_WS_SPELL_FORCE_TIME);
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15, BG_WS_SPELL_BRUTAL_TIME);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Horde Flag picked up from base
|
||||
@@ -263,75 +263,75 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
|
||||
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
|
||||
if (GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_BASE)
|
||||
{
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10, BG_WS_SPELL_FORCE_TIME);
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15, BG_WS_SPELL_BRUTAL_TIME);
|
||||
}
|
||||
return;
|
||||
if (GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_BASE)
|
||||
{
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10, BG_WS_SPELL_FORCE_TIME);
|
||||
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15, BG_WS_SPELL_BRUTAL_TIME);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Alliance Flag on ground
|
||||
if (GetFlagState(TEAM_ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && player->IsWithinDistInMap(gameObject, 10.0f) && gameObject->GetEntry() == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY)
|
||||
{
|
||||
SetDroppedFlagGUID(0, TEAM_ALLIANCE);
|
||||
SetDroppedFlagGUID(0, TEAM_ALLIANCE);
|
||||
if (player->GetTeamId() == TEAM_ALLIANCE)
|
||||
{
|
||||
UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_BASE);
|
||||
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
|
||||
UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
|
||||
SendMessageToAll(LANG_BG_WS_RETURNED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
|
||||
RemoveAssaultAuras();
|
||||
return;
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
|
||||
SendMessageToAll(LANG_BG_WS_RETURNED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
|
||||
RemoveAssaultAuras();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFlagPicker(player->GetGUID(), TEAM_ALLIANCE);
|
||||
SetFlagPicker(player->GetGUID(), TEAM_ALLIANCE);
|
||||
UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG, true);
|
||||
if (uint32 assaultSpellId = GetAssaultSpellId())
|
||||
if (uint32 assaultSpellId = GetAssaultSpellId())
|
||||
player->CastSpell(player, assaultSpellId, true);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
return;
|
||||
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Horde Flag on ground
|
||||
if (GetFlagState(TEAM_HORDE) == BG_WS_FLAG_STATE_ON_GROUND && player->IsWithinDistInMap(gameObject, 10.0f) && gameObject->GetEntry() == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY)
|
||||
{
|
||||
SetDroppedFlagGUID(0, TEAM_HORDE);
|
||||
SetDroppedFlagGUID(0, TEAM_HORDE);
|
||||
if (player->GetTeamId() == TEAM_HORDE)
|
||||
{
|
||||
UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_BASE);
|
||||
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
|
||||
UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
|
||||
SendMessageToAll(LANG_BG_WS_RETURNED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
|
||||
RemoveAssaultAuras();
|
||||
return;
|
||||
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
|
||||
SendMessageToAll(LANG_BG_WS_RETURNED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
|
||||
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
|
||||
RemoveAssaultAuras();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
SetFlagPicker(player->GetGUID(), TEAM_HORDE);
|
||||
SetFlagPicker(player->GetGUID(), TEAM_HORDE);
|
||||
UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
|
||||
player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG, true);
|
||||
if (uint32 assaultSpellId = GetAssaultSpellId())
|
||||
if (uint32 assaultSpellId = GetAssaultSpellId())
|
||||
player->CastSpell(player, assaultSpellId, true);
|
||||
|
||||
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
return;
|
||||
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
|
||||
SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -344,8 +344,8 @@ void BattlegroundWS::RemovePlayer(Player* player)
|
||||
|
||||
void BattlegroundWS::UpdateFlagState(TeamId teamId, uint32 value)
|
||||
{
|
||||
_flagState[teamId] = value;
|
||||
UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_WS_FLAG_STATE_HORDE : BG_WS_FLAG_STATE_ALLIANCE, value);
|
||||
_flagState[teamId] = value;
|
||||
UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_WS_FLAG_STATE_HORDE : BG_WS_FLAG_STATE_ALLIANCE, value);
|
||||
}
|
||||
|
||||
void BattlegroundWS::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
@@ -367,13 +367,13 @@ void BattlegroundWS::HandleAreaTrigger(Player* player, uint32 trigger)
|
||||
case 3688: // Not used
|
||||
case 4628: // Not used
|
||||
case 4629: // Not used
|
||||
case 3686: // Alliance elixir of speed spawn
|
||||
case 3686: // Alliance elixir of speed spawn
|
||||
case 3687: // Horde elixir of speed spawn
|
||||
case 3706: // Alliance elixir of regeneration spawn
|
||||
case 3708: // Horde elixir of regeneration spawn
|
||||
case 3707: // Alliance elixir of berserk spawn
|
||||
case 3709: // Horde elixir of berserk spawn
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -409,19 +409,19 @@ bool BattlegroundWS::SetupBattleground()
|
||||
sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
|
||||
AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, TEAM_HORDE);
|
||||
|
||||
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i < BG_WS_OBJECT_MAX; ++i)
|
||||
if (BgObjects[i] == 0)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundWS: Failed to spawn some object Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i < BG_WS_OBJECT_MAX; ++i)
|
||||
if (BgObjects[i] == 0)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundWS: Failed to spawn some object Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32 i = WS_SPIRIT_MAIN_ALLIANCE; i < BG_CREATURES_MAX_WS; ++i)
|
||||
if (BgCreatures[i] == 0)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundWS: Failed to spawn spirit guides Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
for (uint32 i = WS_SPIRIT_MAIN_ALLIANCE; i < BG_CREATURES_MAX_WS; ++i)
|
||||
if (BgCreatures[i] == 0)
|
||||
{
|
||||
sLog->outErrorDb("BatteGroundWS: Failed to spawn spirit guides Battleground not created!");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -431,7 +431,7 @@ void BattlegroundWS::Init()
|
||||
//call parent's class reset
|
||||
Battleground::Init();
|
||||
|
||||
_bgEvents.Reset();
|
||||
_bgEvents.Reset();
|
||||
_flagKeepers[TEAM_ALLIANCE] = 0;
|
||||
_flagKeepers[TEAM_HORDE] = 0;
|
||||
_droppedFlagGUID[TEAM_ALLIANCE] = 0;
|
||||
@@ -440,7 +440,7 @@ void BattlegroundWS::Init()
|
||||
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
|
||||
_lastFlagCaptureTeam = TEAM_NEUTRAL;
|
||||
|
||||
if (sBattlegroundMgr->IsBGWeekend(GetBgTypeID()))
|
||||
if (sBattlegroundMgr->IsBGWeekend(GetBgTypeID()))
|
||||
{
|
||||
_reputationCapture = 45;
|
||||
_honorWinKills = 3;
|
||||
@@ -500,9 +500,9 @@ void BattlegroundWS::UpdatePlayerScore(Player* player, uint32 type, uint32 value
|
||||
WorldSafeLocsEntry const* BattlegroundWS::GetClosestGraveyard(Player* player)
|
||||
{
|
||||
if (GetStatus() == STATUS_IN_PROGRESS)
|
||||
return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_MAIN_ALLIANCE : WS_GRAVEYARD_MAIN_HORDE);
|
||||
return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_MAIN_ALLIANCE : WS_GRAVEYARD_MAIN_HORDE);
|
||||
else
|
||||
return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_FLAGROOM_ALLIANCE : WS_GRAVEYARD_FLAGROOM_HORDE);
|
||||
return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_FLAGROOM_ALLIANCE : WS_GRAVEYARD_FLAGROOM_HORDE);
|
||||
}
|
||||
|
||||
void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
|
||||
@@ -520,32 +520,32 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
|
||||
|
||||
TeamId BattlegroundWS::GetPrematureWinner()
|
||||
{
|
||||
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
|
||||
return TEAM_ALLIANCE;
|
||||
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
|
||||
return TEAM_ALLIANCE;
|
||||
|
||||
return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner();
|
||||
return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner();
|
||||
}
|
||||
|
||||
uint32 BattlegroundWS::GetAssaultSpellId() const
|
||||
{
|
||||
if ((GetFlagPickerGUID(TEAM_ALLIANCE) == 0 && GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_GROUND) ||
|
||||
(GetFlagPickerGUID(TEAM_HORDE) == 0 && GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_GROUND) ||
|
||||
_bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT10) > 0)
|
||||
return 0;
|
||||
if ((GetFlagPickerGUID(TEAM_ALLIANCE) == 0 && GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_GROUND) ||
|
||||
(GetFlagPickerGUID(TEAM_HORDE) == 0 && GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_GROUND) ||
|
||||
_bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT10) > 0)
|
||||
return 0;
|
||||
|
||||
return _bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT15) > 0 ? BG_WS_SPELL_FOCUSED_ASSAULT : BG_WS_SPELL_BRUTAL_ASSAULT;
|
||||
return _bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT15) > 0 ? BG_WS_SPELL_FOCUSED_ASSAULT : BG_WS_SPELL_BRUTAL_ASSAULT;
|
||||
}
|
||||
|
||||
void BattlegroundWS::RemoveAssaultAuras()
|
||||
{
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT);
|
||||
}
|
||||
}
|
||||
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_HORDE), this->FindBgMap(), (Player*)NULL))
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
{
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
|
||||
player->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,24 +9,24 @@ REWRITTEN BY XINEF
|
||||
|
||||
enum BG_WS_Events
|
||||
{
|
||||
BG_WS_EVENT_UPDATE_GAME_TIME = 1,
|
||||
BG_WS_EVENT_NO_TIME_LEFT = 2,
|
||||
BG_WS_EVENT_RESPAWN_BOTH_FLAGS = 3,
|
||||
BG_WS_EVENT_ALLIANCE_DROP_FLAG = 4,
|
||||
BG_WS_EVENT_HORDE_DROP_FLAG = 5,
|
||||
BG_WS_EVENT_BOTH_FLAGS_KEPT10 = 6,
|
||||
BG_WS_EVENT_BOTH_FLAGS_KEPT15 = 7
|
||||
BG_WS_EVENT_UPDATE_GAME_TIME = 1,
|
||||
BG_WS_EVENT_NO_TIME_LEFT = 2,
|
||||
BG_WS_EVENT_RESPAWN_BOTH_FLAGS = 3,
|
||||
BG_WS_EVENT_ALLIANCE_DROP_FLAG = 4,
|
||||
BG_WS_EVENT_HORDE_DROP_FLAG = 5,
|
||||
BG_WS_EVENT_BOTH_FLAGS_KEPT10 = 6,
|
||||
BG_WS_EVENT_BOTH_FLAGS_KEPT15 = 7
|
||||
};
|
||||
|
||||
enum BG_WS_TimerOrScore
|
||||
{
|
||||
BG_WS_MAX_TEAM_SCORE = 3,
|
||||
BG_WS_MAX_TEAM_SCORE = 3,
|
||||
|
||||
BG_WS_TOTAL_GAME_TIME = 27*MINUTE*IN_MILLISECONDS,
|
||||
BG_WS_FLAG_RESPAWN_TIME = 23*IN_MILLISECONDS,
|
||||
BG_WS_FLAG_DROP_TIME = 10*IN_MILLISECONDS,
|
||||
BG_WS_SPELL_FORCE_TIME = 10*MINUTE*IN_MILLISECONDS,
|
||||
BG_WS_SPELL_BRUTAL_TIME = 15*MINUTE*IN_MILLISECONDS
|
||||
BG_WS_TOTAL_GAME_TIME = 27*MINUTE*IN_MILLISECONDS,
|
||||
BG_WS_FLAG_RESPAWN_TIME = 23*IN_MILLISECONDS,
|
||||
BG_WS_FLAG_DROP_TIME = 10*IN_MILLISECONDS,
|
||||
BG_WS_SPELL_FORCE_TIME = 10*MINUTE*IN_MILLISECONDS,
|
||||
BG_WS_SPELL_BRUTAL_TIME = 15*MINUTE*IN_MILLISECONDS
|
||||
};
|
||||
|
||||
enum BG_WS_Sound
|
||||
@@ -133,7 +133,7 @@ enum BG_WS_Objectives
|
||||
WS_OBJECTIVE_CAPTURE_FLAG = 42,
|
||||
WS_OBJECTIVE_RETURN_FLAG = 44,
|
||||
|
||||
WS_EVENT_START_BATTLE = 8563
|
||||
WS_EVENT_START_BATTLE = 8563
|
||||
};
|
||||
|
||||
struct BattlegroundWGScore : public BattlegroundScore
|
||||
@@ -185,12 +185,12 @@ class BattlegroundWS : public Battleground
|
||||
void AddPoints(TeamId teamId, uint32 points) { m_TeamScores[teamId] += points; }
|
||||
|
||||
TeamId GetPrematureWinner();
|
||||
uint32 GetMatchTime() const { return 1 + (BG_WS_TOTAL_GAME_TIME - GetStartTime()) / (MINUTE*IN_MILLISECONDS); }
|
||||
uint32 GetAssaultSpellId() const;
|
||||
void RemoveAssaultAuras();
|
||||
uint32 GetMatchTime() const { return 1 + (BG_WS_TOTAL_GAME_TIME - GetStartTime()) / (MINUTE*IN_MILLISECONDS); }
|
||||
uint32 GetAssaultSpellId() const;
|
||||
void RemoveAssaultAuras();
|
||||
|
||||
private:
|
||||
EventMap _bgEvents;
|
||||
EventMap _bgEvents;
|
||||
|
||||
uint64 _flagKeepers[2];
|
||||
uint64 _droppedFlagGUID[2];
|
||||
|
||||
Reference in New Issue
Block a user