/* Invoked if a player used a banner as a gameobject */ void BattleGroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) { if (GetStatus() != STATUS_IN_PROGRESS) return; uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1; if (event >= BG_AB_NODES_MAX) // not a node return; BG_AB_Nodes node = BG_AB_Nodes(event); BattleGroundTeamIndex teamIndex = GetTeamIndexByTeamId(source->GetTeam()); // Check if player really could use this banner, not cheated if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node] % 2)) return; source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); uint32 sound = 0; // TODO in the following code we should restructure a bit to avoid // duplication (or maybe write functions?) // If node is neutral, change to contested if (m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL) { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + 1; // create new contested banner _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; if (teamIndex == 0) SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_ALLY); else SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_HORDE); sound = BG_AB_SOUND_NODE_CLAIMED; } // If node is contested else if ((m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED)) { // If last state is NOT occupied, change node to enemy-contested if (m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED) { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED; // create new contested banner _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); } // If contested, change back to occupied else { UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_OCCUPIED; // create new occupied banner _CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = 0; _NodeOccupied(node, (teamIndex == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE); if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); } sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; } // If node is occupied, change to enemy-contested else { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED; // create new contested banner _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; } // If node is occupied again, send "X has taken the Y" msg. if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED) { if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_ALLY, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_HORDE, _GetNodeNameId(node)); } PlaySoundToAll(sound); }
/* Invoked if a player used a banner as a gameobject */ void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*target_obj*/) { if (GetStatus() != STATUS_IN_PROGRESS) return; uint8 node = BG_AB_NODE_STABLES; GameObject* obj = GetBgMap()->GetGameObject(BgObjects[node*8+7]); while ((node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj, 10)))) { ++node; obj = GetBgMap()->GetGameObject(BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]); } if (node == BG_AB_DYNAMIC_NODES_COUNT) { // this means our player isn't close to any of banners - maybe cheater ?? return; } TeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam()); // Check if player really could use this banner, not cheated if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2)) return; source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); uint32 sound = 0; // If node is neutral, change to contested if (m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL) { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + 1; // burn current neutral banner _DelBanner(node, BG_AB_NODE_TYPE_NEUTRAL, 0); // create new contested banner _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; // FIXME: team and node names not localized if (teamIndex == 0) SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_AB_ALLY); else SendMessage2ToAll(LANG_BG_AB_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_AB_HORDE); sound = BG_AB_SOUND_NODE_CLAIMED; } // If node is contested else if ((m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED)) { // If last state is NOT occupied, change node to enemy-contested if (m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED) { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED; // burn current contested banner _DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex); // create new contested banner _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; // FIXME: node names not localized if (teamIndex == TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); } // If contested, change back to occupied else { UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_OCCUPIED; // burn current contested banner _DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex); // create new occupied banner _CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = 0; _NodeOccupied(node, (teamIndex == TEAM_ALLIANCE) ? ALLIANCE:HORDE); // FIXME: node names not localized if (teamIndex == TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_AB_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); } sound = (teamIndex == TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; } // If node is occupied, change to enemy-contested else { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED; // burn current occupied banner _DelBanner(node, BG_AB_NODE_TYPE_OCCUPIED, !teamIndex); // create new contested banner _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); _NodeDeOccupied(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; // FIXME: node names not localized if (teamIndex == TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_AB_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); sound = (teamIndex == TEAM_ALLIANCE) ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE; } // If node is occupied again, send "X has taken the Y" msg. if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED) { // FIXME: team and node names not localized if (teamIndex == TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_AB_ALLY, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_AB_HORDE, _GetNodeNameId(node)); } PlaySoundToAll(sound); }
void BattleGroundAV::HandleQuestComplete(uint32 questid, Player *player) { if (GetStatus() != STATUS_IN_PROGRESS) return; uint8 team = GetTeamIndexByTeamId(player->GetTeam()); uint32 reputation = 0; // reputation for the whole team (other reputation must be done in db) // TODO add events (including quest not available anymore, next quest availabe, go/npc de/spawning) sLog.outError("BattleGroundAV: Quest %i completed", questid); switch(questid) { case BG_AV_QUEST_A_SCRAPS1: case BG_AV_QUEST_A_SCRAPS2: case BG_AV_QUEST_H_SCRAPS1: case BG_AV_QUEST_H_SCRAPS2: m_Team_QuestStatus[team][0] += 20; reputation = 1; if( m_Team_QuestStatus[team][0] == 500 || m_Team_QuestStatus[team][0] == 1000 || m_Team_QuestStatus[team][0] == 1500 ) //25,50,75 turn ins { sLog.outDebug("BattleGroundAV: Quest %i completed starting with unit upgrading..", questid); for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i <= BG_AV_NODES_FROSTWOLF_HUT; ++i) if (m_Nodes[i].Owner == team && m_Nodes[i].State == POINT_CONTROLLED) PopulateNode(i); } break; case BG_AV_QUEST_A_COMMANDER1: case BG_AV_QUEST_H_COMMANDER1: m_Team_QuestStatus[team][1]++; reputation = 1; if (m_Team_QuestStatus[team][1] == 120) sLog.outDebug("BattleGroundAV: Quest %i completed (need to implement some events here", questid); break; case BG_AV_QUEST_A_COMMANDER2: case BG_AV_QUEST_H_COMMANDER2: m_Team_QuestStatus[team][2]++; reputation = 2; if (m_Team_QuestStatus[team][2] == 60) sLog.outDebug("BattleGroundAV: Quest %i completed (need to implement some events here", questid); break; case BG_AV_QUEST_A_COMMANDER3: case BG_AV_QUEST_H_COMMANDER3: m_Team_QuestStatus[team][3]++; reputation = 5; RewardReputationToTeam(team, 1, player->GetTeam()); if (m_Team_QuestStatus[team][1] == 30) sLog.outDebug("BattleGroundAV: Quest %i completed (need to implement some events here", questid); break; case BG_AV_QUEST_A_BOSS1: case BG_AV_QUEST_H_BOSS1: m_Team_QuestStatus[team][4] += 4; // there are 2 quests where you can turn in 5 or 1 item.. ( + 4 cause +1 will be done some lines below) reputation = 4; case BG_AV_QUEST_A_BOSS2: case BG_AV_QUEST_H_BOSS2: m_Team_QuestStatus[team][4]++; reputation += 1; if (m_Team_QuestStatus[team][4] >= 200) sLog.outDebug("BattleGroundAV: Quest %i completed (need to implement some events here", questid); break; case BG_AV_QUEST_A_NEAR_MINE: case BG_AV_QUEST_H_NEAR_MINE: m_Team_QuestStatus[team][5]++; reputation = 2; if (m_Team_QuestStatus[team][5] == 28) { sLog.outDebug("BattleGroundAV: Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[team][6] == 7) sLog.outDebug("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid); } break; case BG_AV_QUEST_A_OTHER_MINE: case BG_AV_QUEST_H_OTHER_MINE: m_Team_QuestStatus[team][6]++; reputation = 3; if (m_Team_QuestStatus[team][6] == 7) { sLog.outDebug("BattleGroundAV: Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[team][5] == 20) sLog.outDebug("BattleGroundAV: Quest %i completed (need to implement some events here - ground assault ready", questid); } break; case BG_AV_QUEST_A_RIDER_HIDE: case BG_AV_QUEST_H_RIDER_HIDE: m_Team_QuestStatus[team][7]++; reputation = 1; if (m_Team_QuestStatus[team][7] == 25) { sLog.outDebug("BattleGroundAV: Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[team][8] == 25) sLog.outDebug("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid); } break; case BG_AV_QUEST_A_RIDER_TAME: case BG_AV_QUEST_H_RIDER_TAME: m_Team_QuestStatus[team][8]++; reputation = 1; if (m_Team_QuestStatus[team][8] == 25) { sLog.outDebug("BattleGroundAV: Quest %i completed (need to implement some events here", questid); if (m_Team_QuestStatus[team][7] == 25) sLog.outDebug("BattleGroundAV: Quest %i completed (need to implement some events here - rider assault ready", questid); } break; default: sLog.outDebug("BattleGroundAV: Quest %i completed but is not interesting for us", questid); return; break; } if (reputation) RewardReputationToTeam((player->GetTeam() == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, reputation, player->GetTeam()); }
void BattleGroundSA::EventPlayerDamageGO(Player *player, GameObject* target_obj, uint32 eventId) { BattleGroundTeamIndex teamIndex = GetTeamIndexByTeamId(player->GetTeam()); uint32 type = NULL; switch (target_obj->GetEntry()) { case BG_SA_GO_GATES_ROOM_ANCIENT_SHRINE: { type = BG_SA_GO_GATES_T_ROOM_ANCIENT_SHRINE; switch (eventId) { case 21630: if (!GateRoomAncientShrineDamaged) { SendMessageSA(player, BG_SA_ATTACK, _GatesName(target_obj)); GateRoomAncientShrineDamaged = true; } break; case 19836: // SendMessageSA(player, BG_SA_DAMAGE, _GatesName(target_obj)); SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type); UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DAMAGE); break; case 19837: // SendMessageSA(player, BG_SA_DESTROY, _GatesName(target_obj)); SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type, true); UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DESTROY); UpdatePlayerScore(player, SCORE_GATES_DESTROYED, 1); RewardHonorToTeam(100, (teamIndex == 0) ? ALLIANCE:HORDE); RewardReputationToTeam((teamIndex == 0) ? 1050:1085, 75, (teamIndex == 0) ? ALLIANCE:HORDE); relicGateDestroyed = true; break; } break; } case BG_SA_GO_GATES_GREEN_EMERALD: { type = BG_SA_GO_GATES_T_GREEN_EMERALD; switch (eventId) { case 21630: if (!GateGreenEmeraldDamaged) { SendMessageSA(player, BG_SA_ATTACK, _GatesName(target_obj)); GateGreenEmeraldDamaged = true; } break; case 19041: // SendMessageSA(player, BG_SA_DAMAGE, _GatesName(target_obj)); SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type); UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DAMAGE); break; case 19046: // SendMessageSA(player, BG_SA_DESTROY, _GatesName(target_obj)); SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type, true); UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DESTROY); UpdatePlayerScore(player, SCORE_GATES_DESTROYED, 1); RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE); RewardReputationToTeam((teamIndex == 0) ? 1050:1085, 65, (teamIndex == 0) ? ALLIANCE:HORDE); break; } break; } case BG_SA_GO_GATES_BLUE_SAPHIRE: { type = BG_SA_GO_GATES_T_BLUE_SAPHIRE; switch (eventId) { case 21630: if (!GateBlueSaphireDamaged) { SendMessageSA(player, BG_SA_ATTACK, _GatesName(target_obj)); GateBlueSaphireDamaged = true; } break; case 19040: // SendMessageSA(player, BG_SA_DAMAGE, _GatesName(target_obj)); SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type); UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DAMAGE); break; case 19045: // SendMessageSA(player, BG_SA_DESTROY, _GatesName(target_obj)); SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type, true); UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DESTROY); UpdatePlayerScore(player, SCORE_GATES_DESTROYED, 1); RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE); RewardReputationToTeam((teamIndex == 0) ? 1050:1085, 65, (teamIndex == 0) ? ALLIANCE:HORDE); break; } break; } case BG_SA_GO_GATES_MAUVE_AMETHYST: { type = BG_SA_GO_GATES_T_MAUVE_AMETHYST; switch (eventId) { case 21630: if (!GateMauveAmethystDamaged) { SendMessageSA(player, BG_SA_ATTACK, _GatesName(target_obj)); GateMauveAmethystDamaged = true; } break; case 19043: // SendMessageSA(player, BG_SA_DAMAGE, _GatesName(target_obj)); SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type); UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DAMAGE); break; case 19048: // SendMessageSA(player, BG_SA_DESTROY, _GatesName(target_obj)); SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type, true); UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DESTROY); UpdatePlayerScore(player, SCORE_GATES_DESTROYED, 1); RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE); RewardReputationToTeam((teamIndex == 0) ? 1050:1085, 65, (teamIndex == 0) ? ALLIANCE:HORDE); break; } break; } case BG_SA_GO_GATES_RED_SUN: { type = BG_SA_GO_GATES_T_RED_SUN; switch (eventId) { case 21630: if (!GateRedSunDamaged) { SendMessageSA(player, BG_SA_ATTACK, _GatesName(target_obj)); GateRedSunDamaged = true; } break; case 19042: // SendMessageSA(player, BG_SA_DAMAGE, _GatesName(target_obj)); SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type); UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DAMAGE); break; case 19047: // SendMessageSA(player, BG_SA_DESTROY, _GatesName(target_obj)); SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type, true); UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DESTROY); UpdatePlayerScore(player, SCORE_GATES_DESTROYED, 1); RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE); RewardReputationToTeam((teamIndex == 0) ? 1050:1085, 65, (teamIndex == 0) ? ALLIANCE:HORDE); break; } break; } case BG_SA_GO_GATES_YELLOW_MOON: { type = BG_SA_GO_GATES_T_YELLOW_MOON; switch (eventId) { case 21630: if (!GateYellowMoonDamaged) { SendMessageSA(player, BG_SA_ATTACK, _GatesName(target_obj)); GateYellowMoonDamaged = true; } break; case 19044: // SendMessageSA(player, BG_SA_DAMAGE, _GatesName(target_obj)); SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type); UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DAMAGE); break; case 19049: // SendMessageSA(player, BG_SA_DESTROY, _GatesName(target_obj)); SendWarningToAllSA(NULL, NULL, TEAM_NONE, true, type, true); UpdateWorldState(BG_SA_GateStatus[type], GateStatus[type] = BG_SA_GO_GATES_DESTROY); UpdatePlayerScore(player, SCORE_GATES_DESTROYED, 1); RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE); RewardReputationToTeam((teamIndex == 0) ? 1050:1085, 65, (teamIndex == 0) ? ALLIANCE:HORDE); break; } break; } case BG_SA_GO_TITAN_RELIC: { if (eventId == 22097 && player->GetTeam() != GetDefender()) { if(!relicGateDestroyed) { player->GetSession()->KickPlayer(); sLog.outError("Player %s has clicked SOTA Relic without Relic gate being destroyed", player->GetName()); return; } if(Phase == SA_ROUND_ONE) // Victory at first round { RoundScores[0].winner = GetDefender() == ALLIANCE ? HORDE : ALLIANCE; RoundScores[0].time = Round_timer; PlaySoundToAll(BG_SA_SOUND_GYD_VICTORY); SendMessageToAll(defender == HORDE ? LANG_BG_SA_ALLIANCE_END_1ROUND : LANG_BG_SA_HORDE_END_1ROUND, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL); RewardHonorToTeam(150, (teamIndex == 0) ? ALLIANCE:HORDE); RewardReputationToTeam((teamIndex == 0) ? 1050:1085, 100, (teamIndex == 0) ? ALLIANCE:HORDE); player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246); // Storm the Beach in first round ResetBattle(player->GetTeam(), GetDefender()); } else // Victory at second round { RoundScores[1].winner = GetDefender() == ALLIANCE ? HORDE : ALLIANCE; RoundScores[1].time = Round_timer; SendMessageToAll(defender == HORDE ? LANG_BG_SA_ALLIANCE_END_2ROUND : LANG_BG_SA_HORDE_END_2ROUND, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL); RewardHonorToTeam(150, (teamIndex == 0) ? ALLIANCE:HORDE); RewardReputationToTeam((teamIndex == 0) ? 1050:1085, 100, (teamIndex == 0) ? ALLIANCE:HORDE); player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246); BattleGroundSA::EndBattleGround(player->GetTeam()); } } break; } } }
void BattlegroundEY::EventTeamCapturedPoint(Player* player, uint32 Point) { if (GetStatus() != STATUS_IN_PROGRESS) return; uint32 Team = player->GetTeam(); SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType, RESPAWN_ONE_DAY); SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType + 1, RESPAWN_ONE_DAY); SpawnBGObject(m_CapturingPointTypes[Point].DespawnNeutralObjectType + 2, RESPAWN_ONE_DAY); if (Team == ALLIANCE) { m_TeamPointsCount[TEAM_ALLIANCE]++; SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance, RESPAWN_IMMEDIATELY); SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 1, RESPAWN_IMMEDIATELY); SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeAlliance + 2, RESPAWN_IMMEDIATELY); } else { m_TeamPointsCount[TEAM_HORDE]++; SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde, RESPAWN_IMMEDIATELY); SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 1, RESPAWN_IMMEDIATELY); SpawnBGObject(m_CapturingPointTypes[Point].SpawnObjectTypeHorde + 2, RESPAWN_IMMEDIATELY); } //buff isn't respawned m_PointOwnedByTeam[Point] = Team; m_PointState[Point] = EY_POINT_UNDER_CONTROL; if (Team == ALLIANCE) SendMessageToAll(m_CapturingPointTypes[Point].MessageIdAlliance, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); else SendMessageToAll(m_CapturingPointTypes[Point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE, player); if (BgCreatures[Point]) DelCreature(Point); WorldSafeLocsEntry const* sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId); if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, GetTeamIndexByTeamId(Team))) TC_LOG_ERROR("bg.battleground", "BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u", Point, Team, m_CapturingPointTypes[Point].GraveYardId); // SpawnBGCreature(Point, RESPAWN_IMMEDIATELY); UpdatePointsIcons(Team, Point); UpdatePointsCount(Team); if (Point >= EY_POINTS_MAX) return; Creature* trigger = GetBGCreature(Point + 6, false);//0-5 spirit guides if (!trigger) trigger = AddCreature(WORLD_TRIGGER, Point+6, BG_EY_TriggerPositions[Point], GetTeamIndexByTeamId(Team)); //add bonus honor aura trigger creature when node is accupied //cast bonus aura (+50% honor in 25yards) //aura should only apply to players who have accupied the node, set correct faction for trigger if (trigger) { trigger->setFaction(Team == ALLIANCE ? 84 : 83); trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false); } }
void BattleGroundWS::EventPlayerCapturedFlag(Player* source) { if (GetStatus() != STATUS_IN_PROGRESS) return; m_LastCapturedFlagTeam = source->GetTeam(); source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if (source->GetTeam() == ALLIANCE) { if (!IsHordeFlagPickedUp()) return; ClearHordeFlagCarrier(); // must be before aura remove to prevent 2 events (drop+capture) at the same time // horde flag in base (but not respawned yet) m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Horde Flag from Player source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); if (m_TeamScores[BG_TEAM_ALLIANCE] < BG_WS_MAX_TEAM_SCORE) m_TeamScores[BG_TEAM_ALLIANCE] += 1; PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE); RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE); } else { if (!IsAllianceFlagPickedUp()) return; ClearAllianceFlagCarrier(); // must be before aura remove to prevent 2 events (drop+capture) at the same time // alliance flag in base (but not respawned yet) m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Alliance Flag from Player source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); if (m_TeamScores[BG_TEAM_HORDE] < BG_WS_MAX_TEAM_SCORE) m_TeamScores[BG_TEAM_HORDE] += 1; PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE); RewardReputationToTeam(889, m_ReputationCapture, HORDE); } // for flag capture is reward 2 honorable kills RewardHonorToTeam(GetBonusHonorFromKill(2), source->GetTeam()); // despawn flags SpawnEvent(WS_EVENT_FLAG_A, 0, false); SpawnEvent(WS_EVENT_FLAG_H, 0, false); if (source->GetTeam() == ALLIANCE) SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, source); else SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, source); UpdateFlagState(source->GetTeam(), 1); // flag state none UpdateTeamScore(source->GetTeam()); // only flag capture should be updated UpdatePlayerScore(source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures Team winner = TEAM_NONE; if (m_TeamScores[BG_TEAM_ALLIANCE] == BG_WS_MAX_TEAM_SCORE) winner = ALLIANCE; else if (m_TeamScores[BG_TEAM_HORDE] == BG_WS_MAX_TEAM_SCORE) winner = HORDE; if (winner) { UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0); UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1); UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1); EndBattleGround(winner); } else { m_FlagsTimer[GetOtherTeamIndex(GetTeamIndexByTeamId(source->GetTeam()))] = BG_WS_FLAG_RESPAWN_TIME; } }
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) { if (GetStatus() != STATUS_IN_PROGRESS) return; m_LastCapturedFlagTeam = Source->GetTeam(); uint32 winner = 0; Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if(Source->HasAura(BG_WS_FOCUSED_ASSAULT)) Source->RemoveAurasDueToSpell(BG_WS_FOCUSED_ASSAULT); if (Source->GetTeam() == ALLIANCE) { if (!IsHordeFlagPickedup()) return; SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time // horde flag in base (but not respawned yet) m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Horde Flag from Player Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); if (GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE) AddPoint(ALLIANCE, 1); PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE); RewardReputationToTeam(890, m_ReputationCapture, ALLIANCE); } else { if (!IsAllianceFlagPickedup()) return; SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time // alliance flag in base (but not respawned yet) m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Alliance Flag from Player Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); if (GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE) AddPoint(HORDE, 1); PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE); RewardReputationToTeam(889, m_ReputationCapture, HORDE); } //for flag capture is reward 2 honorable kills RewardHonorToTeam(GetBonusHonorFromKill(sWorld.getConfig(CONFIG_UINT32_BONUS_HONOR_FLAG_WSG)), Source->GetTeam()); //flag carrier gets another 2 honorable kills Source->RewardHonor(NULL, 0, GetBonusHonorFromKill(sWorld.getConfig(CONFIG_UINT32_BONUS_HONOR_FLAG_WSG))); // despawn flags SpawnEvent(WS_EVENT_FLAG_A, 0, false); SpawnEvent(WS_EVENT_FLAG_H, 0, false); if (Source->GetTeam() == ALLIANCE) SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source); else SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, Source); UpdateFlagState(Source->GetTeam(), 1); // flag state none UpdateTeamScore(Source->GetTeam()); // only flag capture should be updated UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures if (GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE) winner = ALLIANCE; if (GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE) winner = HORDE; if (winner) { UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0); UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1); UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1); EndBattleGround(winner); } else { m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME; } }
void BattleGroundIC::EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/) { if (GetStatus() != STATUS_IN_PROGRESS) return; uint8 node = BG_IC_NODE_WORKSHOP; GameObject* obj=GetBgMap()->GetGameObject(m_BgObjects[node*8+7]); while ( (node < BG_IC_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj,10)))) { ++node; obj=GetBgMap()->GetGameObject(m_BgObjects[node*8+BG_IC_OBJECT_AURA_CONTESTED]); } if (node == BG_IC_DYNAMIC_NODES_COUNT) { return; } BattleGroundTeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam()); if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2)) return; source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); uint32 sound = 0; if (m_Nodes[node] == BG_IC_NODE_TYPE_NEUTRAL) { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + 1; _DelBanner(node, BG_IC_NODE_TYPE_NEUTRAL, 0); _CreateBanner(node, BG_IC_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_IC_FLAG_CAPTURING_TIME; if (teamIndex == 0) SendMessage2ToAll(LANG_BG_IC_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANG_BG_IC_ALLY); else SendMessage2ToAll(LANG_BG_IC_NODE_CLAIMED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANG_BG_IC_HORDE); sound = BG_IC_SOUND_NODE_CLAIMED; } else if ((m_Nodes[node] == BG_IC_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_IC_NODE_STATUS_HORDE_CONTESTED)) { if (m_prevNodes[node] < BG_IC_NODE_TYPE_OCCUPIED) { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + BG_IC_NODE_TYPE_CONTESTED; _DelBanner(node, BG_IC_NODE_TYPE_CONTESTED, !teamIndex); _CreateBanner(node, BG_IC_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_IC_FLAG_CAPTURING_TIME; if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_IC_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_IC_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); } else { UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + BG_IC_NODE_TYPE_OCCUPIED; _DelBanner(node, BG_IC_NODE_TYPE_CONTESTED, !teamIndex); _CreateBanner(node, BG_IC_NODE_TYPE_OCCUPIED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = 0; _NodeOccupied(node,(teamIndex == BG_TEAM_ALLIANCE) ? ALLIANCE:HORDE); if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_IC_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_IC_NODE_DEFENDED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); } sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_IC_SOUND_NODE_ASSAULTED_ALLIANCE : BG_IC_SOUND_NODE_ASSAULTED_HORDE; } else { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + BG_IC_NODE_TYPE_CONTESTED; _DelBanner(node, BG_IC_NODE_TYPE_OCCUPIED, !teamIndex); _CreateBanner(node, BG_IC_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); _NodeDeOccupied(node); m_NodeTimers[node] = BG_IC_FLAG_CAPTURING_TIME; if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_IC_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_IC_NODE_ASSAULTED,CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_IC_SOUND_NODE_ASSAULTED_ALLIANCE : BG_IC_SOUND_NODE_ASSAULTED_HORDE; } if (m_Nodes[node] >= BG_IC_NODE_TYPE_OCCUPIED) { if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_IC_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANG_BG_IC_ALLY, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_IC_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANG_BG_IC_HORDE, _GetNodeNameId(node)); } PlaySoundToAll(sound); }
void BattleGroundWS::EventPlayerCapturedFlag(Player *Source) { if(GetStatus() != STATUS_IN_PROGRESS) return; uint8 type = 0; uint32 winner = 0; const char *message = ""; //TODO FIX reputation and honor gains for low level players! Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if(Source->GetTeam() == ALLIANCE) { if (!this->IsHordeFlagPickedup()) return; SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time // horde flag in base (but not respawned yet) m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Horde Flag from Player Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); if(m_FlagDebuffState == 1) Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); if(m_FlagDebuffState == 2) Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); message = GetTrinityString(LANG_BG_WS_CAPTURED_HF); type = CHAT_MSG_BG_SYSTEM_ALLIANCE; if(GetTeamScore(ALLIANCE) < BG_WS_MAX_TEAM_SCORE) AddPoint(ALLIANCE, 1); PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE); RewardReputationToTeam(890, BG_WSG_Reputation[m_HonorMode][BG_WSG_FLAG_CAP], ALLIANCE); // +35 reputation RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_FLAG_CAP], ALLIANCE); // +40 bonushonor } else { if (!this->IsAllianceFlagPickedup()) return; SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time // alliance flag in base (but not respawned yet) m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Alliance Flag from Player Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); if(m_FlagDebuffState == 1) Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); if(m_FlagDebuffState == 2) Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); message = GetTrinityString(LANG_BG_WS_CAPTURED_AF); type = CHAT_MSG_BG_SYSTEM_HORDE; if(GetTeamScore(HORDE) < BG_WS_MAX_TEAM_SCORE) AddPoint(HORDE, 1); PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE); RewardReputationToTeam(889, BG_WSG_Reputation[m_HonorMode][BG_WSG_FLAG_CAP], HORDE); // +35 reputation RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_FLAG_CAP], HORDE); // +40 bonushonor } SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME); SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME); WorldPacket data; ChatHandler::FillMessageData(&data, Source->GetSession(), type, LANG_UNIVERSAL, NULL, Source->GetGUID(), message, NULL); SendPacketToAll(&data); UpdateFlagState(Source->GetTeam(), 1); // flag state none UpdateTeamScore(Source->GetTeam()); // only flag capture should be updated UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); // +1 flag captures... if(GetTeamScore(ALLIANCE) == BG_WS_MAX_TEAM_SCORE) winner = ALLIANCE; if(GetTeamScore(HORDE) == BG_WS_MAX_TEAM_SCORE) winner = HORDE; if(winner) { UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0); UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1); UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1); RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_WIN], winner); EndBattleGround(winner); } else { m_FlagsTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME; } }
void BattlegroundTP::EventPlayerDroppedFlag(Player *Source) { if (GetStatus() != STATUS_IN_PROGRESS) { // if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages // just take off the aura if (Source->GetTeam() == ALLIANCE) { if (!this->IsHordeFlagPickedup()) return; if (GetHordeFlagPickerGUID() == Source->GetGUID()) { SetHordeFlagPicker(0); Source->RemoveAurasDueToSpell(BG_TP_SPELL_HORDE_FLAG); } } else { if (!this->IsAllianceFlagPickedup()) return; if (GetAllianceFlagPickerGUID() == Source->GetGUID()) { SetAllianceFlagPicker(0); Source->RemoveAurasDueToSpell(BG_TP_SPELL_ALLIANCE_FLAG); } } return; } bool set = false; if (Source->GetTeam() == ALLIANCE) { if (!IsHordeFlagPickedup()) return; if (GetHordeFlagPickerGUID() == Source->GetGUID()) { SetHordeFlagPicker(0); Source->RemoveAurasDueToSpell(BG_TP_SPELL_HORDE_FLAG); if (m_FlagDebuffState == 1) Source->RemoveAurasDueToSpell(TP_SPELL_FOCUSED_ASSAULT); if (m_FlagDebuffState == 2) Source->RemoveAurasDueToSpell(TP_SPELL_BRUTAL_ASSAULT); m_FlagState[BG_TEAM_HORDE] = BG_TP_FLAG_STATE_ON_GROUND; Source->CastSpell(Source, BG_TP_SPELL_HORDE_FLAG_DROPPED, true); set = true; } } else { if (!IsAllianceFlagPickedup()) return; if (GetAllianceFlagPickerGUID() == Source->GetGUID()) { SetAllianceFlagPicker(0); Source->RemoveAurasDueToSpell(BG_TP_SPELL_ALLIANCE_FLAG); if (m_FlagDebuffState == 1) Source->RemoveAurasDueToSpell(TP_SPELL_FOCUSED_ASSAULT); if (m_FlagDebuffState == 2) Source->RemoveAurasDueToSpell(TP_SPELL_BRUTAL_ASSAULT); m_FlagState[BG_TEAM_ALLIANCE] = BG_TP_FLAG_STATE_ON_GROUND; Source->CastSpell(Source, BG_TP_SPELL_ALLIANCE_FLAG_DROPPED, true); set = true; } } if (set) { Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true); UpdateFlagState(Source->GetTeam(), 1); if (Source->GetTeam() == ALLIANCE) { SendMessageToAll(LANG_BG_TP_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, Source); UpdateWorldState(BG_TP_FLAG_UNK_HORDE, uint32(-1)); } else { SendMessageToAll(LANG_BG_TP_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, Source); UpdateWorldState(BG_TP_FLAG_UNK_ALLIANCE, uint32(-1)); } m_FlagsDropTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_TP_FLAG_DROP_TIME; } }
void BattleGroundIC::EventPlayerDamageGO(Player *player, GameObject* target_obj, uint32 eventId, uint32 doneBy) { BattleGroundTeamIndex teamIndex = GetTeamIndexByTeamId(player->GetTeam()); // Seaforium Charge Explosion (A-bomb-inable) if (doneBy == 66676) player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, 68366); // Huge Seaforium Charge Explosion (A-bomb-ination) if (doneBy == 66672) player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL, 68367); uint32 type = NULL; switch (target_obj->GetEntry()) { case BG_IC_GO_ALLIANCE_GATE_1: { type = BG_IC_GO_T_ALLIANCE_GATE_1; if (eventId == 22082) { SendMessage2ToAll(LANG_BG_IC_A_WEST_GATE_DESTROYED, CHAT_MSG_BG_SYSTEM_ALLIANCE, player, doneBy); UpdateWorldState(BG_IC_GateStatus[type][0], 0); // needed for removing the old icon UpdateWorldState(BG_IC_GateStatus[type][1], 1); GateStatus[type] = BG_IC_GO_GATES_DAMAGE; // correct icon is at "damage" state (not flag), not "destroy" RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE); SpawnEvent(IC_EVENT_ADD_A_BOSS, 0, true); SpawnEvent(IC_EVENT_ADD_A_GUARDS, 0, true); // prevent closing of the boss gates by destroying another wall gate if (aOpen == false) { OpenDoorEvent(IC_EVENT_BOSS_A); aOpen = true; } } break; } case BG_IC_GO_ALLIANCE_GATE_2: { type = BG_IC_GO_T_ALLIANCE_GATE_2; if (eventId == 22078) { SendMessage2ToAll(LANG_BG_IC_A_EAST_GATE_DESTROYED, CHAT_MSG_BG_SYSTEM_ALLIANCE, player, doneBy); UpdateWorldState(BG_IC_GateStatus[type][0], 0); UpdateWorldState(BG_IC_GateStatus[type][1], 1); GateStatus[type] = BG_IC_GO_GATES_DAMAGE; RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE); SpawnEvent(IC_EVENT_ADD_A_BOSS, 0, true); SpawnEvent(IC_EVENT_ADD_A_GUARDS, 0, true); if (aOpen == false) { OpenDoorEvent(IC_EVENT_BOSS_A); aOpen = true; } } break; } case BG_IC_GO_ALLIANCE_GATE_3: { type = BG_IC_GO_T_ALLIANCE_GATE_3; if (eventId == 22080) { SendMessage2ToAll(LANG_BG_IC_A_FRONT_GATE_DESTROYED, CHAT_MSG_BG_SYSTEM_ALLIANCE, player, doneBy); UpdateWorldState(BG_IC_GateStatus[type][0], 0); UpdateWorldState(BG_IC_GateStatus[type][1], 1); GateStatus[type] = BG_IC_GO_GATES_DAMAGE; RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE); SpawnEvent(IC_EVENT_ADD_A_BOSS, 0, true); SpawnEvent(IC_EVENT_ADD_A_GUARDS, 0, true); if (aOpen == false) { OpenDoorEvent(IC_EVENT_BOSS_A); aOpen = true; } } break; } case BG_IC_GO_HORDE_GATE_1: { type = BG_IC_GO_T_HORDE_GATE_1; if (eventId == 22081) { SendMessage2ToAll(LANG_BG_IC_H_WEST_GATE_DESTROYED, CHAT_MSG_BG_SYSTEM_HORDE, player, doneBy); UpdateWorldState(BG_IC_GateStatus[type][0], 0); UpdateWorldState(BG_IC_GateStatus[type][1], 1); GateStatus[type] = BG_IC_GO_GATES_DAMAGE; RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE); SpawnEvent(IC_EVENT_ADD_H_BOSS, 0, true); SpawnEvent(IC_EVENT_ADD_H_GUARDS, 0, true); if (hOpen == false) { OpenDoorEvent(IC_EVENT_BOSS_H); hOpen = true; } } break; } case BG_IC_GO_HORDE_GATE_2: { type = BG_IC_GO_T_HORDE_GATE_2; if (eventId == 22083) { SendMessage2ToAll(LANG_BG_IC_H_EAST_GATE_DESTROYED, CHAT_MSG_BG_SYSTEM_HORDE, player, doneBy); UpdateWorldState(BG_IC_GateStatus[type][0], 0); UpdateWorldState(BG_IC_GateStatus[type][1], 1); GateStatus[type] = BG_IC_GO_GATES_DAMAGE; RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE); SpawnEvent(IC_EVENT_ADD_H_BOSS, 0, true); SpawnEvent(IC_EVENT_ADD_H_GUARDS, 0, true); if (hOpen == false) { OpenDoorEvent(IC_EVENT_BOSS_H); hOpen = true; } } break; } case BG_IC_GO_HORDE_GATE_3: { type = BG_IC_GO_T_HORDE_GATE_3; if (eventId == 22079) { SendMessage2ToAll(LANG_BG_IC_H_FRONT_GATE_DESTROYED, CHAT_MSG_BG_SYSTEM_HORDE, player, doneBy); UpdateWorldState(BG_IC_GateStatus[type][0], 0); UpdateWorldState(BG_IC_GateStatus[type][1], 1); GateStatus[type] = BG_IC_GO_GATES_DAMAGE; RewardHonorToTeam(85, (teamIndex == 0) ? ALLIANCE:HORDE); SpawnEvent(IC_EVENT_ADD_H_BOSS, 0, true); SpawnEvent(IC_EVENT_ADD_H_GUARDS, 0, true); if (hOpen == false) { OpenDoorEvent(IC_EVENT_BOSS_H); hOpen = true; } } break; } } }
/* Invoked if a player used a banner as a gameobject */ void BattleGroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/) { if (GetStatus() != STATUS_IN_PROGRESS) return; uint8 node = BG_AB_NODE_STABLES; Map * tmpMap = source->GetMap(); GameObject* obj = tmpMap->GetGameObject(m_BgObjects[node*8+7]); while ((node < BG_AB_DYNAMIC_NODES_COUNT) && ((!obj) || (!source->IsWithinDistInMap(obj,10)))) { ++node; obj = tmpMap->GetGameObject(m_BgObjects[node*8+BG_AB_OBJECT_AURA_CONTESTED]); } if (node == BG_AB_DYNAMIC_NODES_COUNT) { // this means our player isn't close to any of banners - maybe cheater ?? return; } uint8 teamIndex = GetTeamIndexByTeamId(source->GetBGTeam()); // Message to chatlog char buf[256]; uint8 type = (teamIndex == 0) ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE; // Check if player really could use this banner, not cheated if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node]%2)) return; source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); uint32 sound = 0; // If node is neutral, change to contested if (m_Nodes[node] == BG_AB_NODE_TYPE_NEUTRAL) { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + 1; // burn current neutral banner _DelBanner(node, BG_AB_NODE_TYPE_NEUTRAL, 0); // create new contested banner _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_CLAIMED), _GetNodeName(node), (teamIndex == 0) ? GetTrinityString(LANG_BG_AB_ALLY) : GetTrinityString(LANG_BG_AB_HORDE)); sound = SOUND_NODE_CLAIMED; SendObjectiveComplete(BG_AB_CREDITMARKER[node], teamIndex,BG_AB_NodePositions[node][1],BG_AB_NodePositions[node][2]); } // If node is contested else if ((m_Nodes[node] == BG_AB_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == BG_AB_NODE_STATUS_HORDE_CONTESTED)) { // If last state is NOT occupied, change node to enemy-contested if (m_prevNodes[node] < BG_AB_NODE_TYPE_OCCUPIED) { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED; // burn current contested banner _DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex); // create new contested banner _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_ASSAULTED), _GetNodeName(node)); SendObjectiveComplete(BG_AB_CREDITMARKER[node], teamIndex,BG_AB_NodePositions[node][1],BG_AB_NodePositions[node][2]); } // If contested, change back to occupied else { UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_OCCUPIED; // burn current contested banner _DelBanner(node, BG_AB_NODE_TYPE_CONTESTED, !teamIndex); // create new occupied banner _CreateBanner(node, BG_AB_NODE_TYPE_OCCUPIED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = 0; _NodeOccupied(node,(teamIndex == 0) ? ALLIANCE:HORDE); sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_DEFENDED), _GetNodeName(node)); } sound = (teamIndex == 0) ? SOUND_NODE_ASSAULTED_ALLIANCE : SOUND_NODE_ASSAULTED_HORDE; } // If node is occupied, change to enemy-contested else { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + BG_AB_NODE_TYPE_CONTESTED; // burn current occupied banner _DelBanner(node, BG_AB_NODE_TYPE_OCCUPIED, !teamIndex); // create new contested banner _CreateBanner(node, BG_AB_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); _NodeDeOccupied(node); m_NodeTimers[node] = BG_AB_FLAG_CAPTURING_TIME; sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_ASSAULTED), _GetNodeName(node)); sound = (teamIndex == 0) ? SOUND_NODE_ASSAULTED_ALLIANCE : SOUND_NODE_ASSAULTED_HORDE; SendObjectiveComplete(BG_AB_CREDITMARKER[node], teamIndex,BG_AB_NodePositions[node][1],BG_AB_NodePositions[node][2]); } WorldPacket data; ChatHandler::FillMessageData(&data, source->GetSession(), type, LANG_UNIVERSAL, NULL, source->GetGUID(), buf, NULL); SendPacketToAll(&data); // If node is occupied again, send "X has taken the Y" msg. if (m_Nodes[node] >= BG_AB_NODE_TYPE_OCCUPIED) { sprintf(buf, GetTrinityString(LANG_BG_AB_NODE_TAKEN), (teamIndex == 0) ? GetTrinityString(LANG_BG_AB_ALLY) : GetTrinityString(LANG_BG_AB_HORDE), _GetNodeName(node)); ChatHandler::FillMessageData(&data, NULL, type, LANG_UNIVERSAL, NULL, 0, buf, NULL); SendPacketToAll(&data); } PlaySoundToAll(sound); }
/* Invoked if a player used a banner as a GameObject */ void BattlegroundBG::EventPlayerClickedOnFlag(Player* source, GameObject* /*target_obj*/) { if (GetStatus() != STATUS_IN_PROGRESS) return; uint8 node = GILNEAS_BG_NODE_LIGHTHOUSE; GameObject* object = GetBgMap()->GetGameObject(BgObjects[node*8+7]); while ((node < GILNEAS_BG_DYNAMIC_NODES_COUNT) && ((!object) || (!source->IsWithinDistInMap(object, 10)))) { ++node; object = GetBgMap()->GetGameObject(BgObjects[node*8+GILNEAS_BG_OBJECT_AURA_CONTESTED]); } if (node == GILNEAS_BG_DYNAMIC_NODES_COUNT) { sLog->outString("Player %s (GUID: %u) in Battle for Gilneas initiated EventPlayerClickedOnFlag() but is not near of any flag", source->GetName(), source->GetGUIDLow()); // this means our player isn't close to any of banners - maybe cheater ?? return; } BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(source->GetTeam()); // Check if player really could use this banner, and has not cheated if (!(_Nodes[node] == 0 || teamIndex == _Nodes[node]%2)) return; source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); uint32 sound = 0; // If node is neutral, change to contested if (_Nodes[node] == GILNEAS_BG_NODE_TYPE_NEUTRAL) { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); _prevNodes[node] = _Nodes[node]; _Nodes[node] = teamIndex + 1; // burn current neutral banner _DelBanner(node, GILNEAS_BG_NODE_TYPE_NEUTRAL, 0); // create new contested banner _CreateBanner(node, GILNEAS_BG_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); _NodeTimers[node] = GILNEAS_BG_FLAG_CAPTURING_TIME; // FIXME: need to fix Locales for team and node names. if (teamIndex == 0) SendMessage2ToAll(LANGUAGE_BG_BG_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node), LANGUAGE_BG_BG_ALLY); else SendMessage2ToAll(LANGUAGE_BG_BG_NODE_CLAIMED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node), LANGUAGE_BG_BG_HORDE); sound = GILNEAS_BG_SOUND_NODE_CLAIMED; } // If node is contested else if ((_Nodes[node] == GILNEAS_BG_NODE_STATUS_ALLY_CONTESTED) || (_Nodes[node] == GILNEAS_BG_NODE_STATUS_HORDE_CONTESTED)) { // If last state is NOT occupied, change node to enemy-contested if (_prevNodes[node] < GILNEAS_BG_NODE_TYPE_OCCUPIED) { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); _prevNodes[node] = _Nodes[node]; _Nodes[node] = teamIndex + GILNEAS_BG_NODE_TYPE_CONTESTED; // burn current contested banner _DelBanner(node, GILNEAS_BG_NODE_TYPE_CONTESTED, !teamIndex); // create new contested banner _CreateBanner(node, GILNEAS_BG_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); _NodeTimers[node] = GILNEAS_BG_FLAG_CAPTURING_TIME; // FIXME: need to fix Locales for team and node names. if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANGUAGE_BG_BG_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANGUAGE_BG_BG_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); } // If contested, change back to occupied else { UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1); _prevNodes[node] = _Nodes[node]; _Nodes[node] = teamIndex + GILNEAS_BG_NODE_TYPE_OCCUPIED; // burn current contested banner _DelBanner(node, GILNEAS_BG_NODE_TYPE_CONTESTED, !teamIndex); // create new occupied banner _CreateBanner(node, GILNEAS_BG_NODE_TYPE_OCCUPIED, teamIndex, true); _SendNodeUpdate(node); _NodeTimers[node] = 0; _NodeOccupied(node, (teamIndex == BG_TEAM_ALLIANCE) ? ALLIANCE:HORDE); // FIXME: need to fix Locales for team and node names. if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANGUAGE_BG_BG_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANGUAGE_BG_BG_NODE_DEFENDED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); } sound = (teamIndex == BG_TEAM_ALLIANCE) ? GILNEAS_BG_SOUND_NODE_ASSAULTED_ALLIANCE : GILNEAS_BG_SOUND_NODE_ASSAULTED_HORDE; } // If node is occupied, change to enemy-contested else { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); _prevNodes[node] = _Nodes[node]; _Nodes[node] = teamIndex + GILNEAS_BG_NODE_TYPE_CONTESTED; // burn current occupied banner _DelBanner(node, GILNEAS_BG_NODE_TYPE_OCCUPIED, !teamIndex); // create new contested banner _CreateBanner(node, GILNEAS_BG_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); _NodeDeOccupied(node); _NodeTimers[node] = GILNEAS_BG_FLAG_CAPTURING_TIME; // FIXME: need to fix Locales for team and node names. if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANGUAGE_BG_BG_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_ALLIANCE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANGUAGE_BG_BG_NODE_ASSAULTED, CHAT_MSG_BG_SYSTEM_HORDE, source, _GetNodeNameId(node)); sound = (teamIndex == BG_TEAM_ALLIANCE) ? GILNEAS_BG_SOUND_NODE_ASSAULTED_ALLIANCE : GILNEAS_BG_SOUND_NODE_ASSAULTED_HORDE; } // If node is occupied again, send "X has taken the Y" msg. if (_Nodes[node] >= GILNEAS_BG_NODE_TYPE_OCCUPIED) { // FIXME: need to fix Locales for team and node names. if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANGUAGE_BG_BG_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_ALLIANCE, NULL, LANGUAGE_BG_BG_ALLY, _GetNodeNameId(node)); else SendMessage2ToAll(LANGUAGE_BG_BG_NODE_TAKEN, CHAT_MSG_BG_SYSTEM_HORDE, NULL, LANGUAGE_BG_BG_HORDE, _GetNodeNameId(node)); } PlaySoundToAll(sound); }
void BattleGroundAV::EndBattleGround(Team winner) { // calculate bonuskills for both teams: uint32 tower_survived[BG_TEAMS_COUNT] = {0, 0}; uint32 graves_owned[BG_TEAMS_COUNT] = {0, 0}; uint32 mines_owned[BG_TEAMS_COUNT] = {0, 0}; // towers all not destroyed: for (BG_AV_Nodes i = BG_AV_NODES_DUNBALDAR_SOUTH; i <= BG_AV_NODES_STONEHEART_BUNKER; ++i) if (m_Nodes[i].State == POINT_CONTROLLED) if (m_Nodes[i].TotalOwner == BG_AV_TEAM_ALLIANCE) { ++tower_survived[BG_TEAM_ALLIANCE]; } for (BG_AV_Nodes i = BG_AV_NODES_ICEBLOOD_TOWER; i <= BG_AV_NODES_FROSTWOLF_WTOWER; ++i) if (m_Nodes[i].State == POINT_CONTROLLED) if (m_Nodes[i].TotalOwner == BG_AV_TEAM_HORDE) { ++tower_survived[BG_TEAM_HORDE]; } // graves all controlled for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) if (m_Nodes[i].State == POINT_CONTROLLED && m_Nodes[i].Owner != BG_AV_TEAM_NEUTRAL) { ++graves_owned[m_Nodes[i].Owner]; } for (uint8 i = 0; i < BG_AV_MAX_MINES; ++i) if (m_Mine_Owner[i] != BG_AV_TEAM_NEUTRAL) { ++mines_owned[m_Mine_Owner[i]]; } // now we have the values give the honor/reputation to the teams: Team team[BG_TEAMS_COUNT] = { ALLIANCE, HORDE }; uint32 faction[BG_TEAMS_COUNT] = { BG_AV_FACTION_A, BG_AV_FACTION_H }; for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i) { if (tower_survived[i]) { RewardReputationToTeam(faction[i], tower_survived[i] * m_RepSurviveTower, team[i]); RewardHonorToTeam(GetBonusHonorFromKill(tower_survived[i] * BG_AV_KILL_SURVIVING_TOWER), team[i]); } DEBUG_LOG("BattleGroundAV: EndbattleGround: bgteam: %u towers:%u honor:%u rep:%u", i, tower_survived[i], GetBonusHonorFromKill(tower_survived[i] * BG_AV_KILL_SURVIVING_TOWER), tower_survived[i] * BG_AV_REP_SURVIVING_TOWER); if (graves_owned[i]) { RewardReputationToTeam(faction[i], graves_owned[i] * m_RepOwnedGrave, team[i]); } if (mines_owned[i]) { RewardReputationToTeam(faction[i], mines_owned[i] * m_RepOwnedMine, team[i]); } // captain survived?: if (!IsActiveEvent(BG_AV_NodeEventCaptainDead_A + GetTeamIndexByTeamId(team[i]), 0)) { RewardReputationToTeam(faction[i], m_RepSurviveCaptain, team[i]); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_SURVIVING_CAPTAIN), team[i]); } } // both teams: if (m_HonorMapComplete) { RewardHonorToTeam(m_HonorMapComplete, ALLIANCE); RewardHonorToTeam(m_HonorMapComplete, HORDE); } BattleGround::EndBattleGround(winner); }
void BattlegroundWS::EventPlayerCapturedFlag(Player* player) { if (GetStatus() != STATUS_IN_PROGRESS) return; uint32 winner = 0; player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); if (player->GetTeam() == ALLIANCE) { if (!IsHordeFlagPickedup()) return; SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time // horde flag in base (but not respawned yet) _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Horde Flag from Player player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); if (_flagDebuffState == 1) player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); else if (_flagDebuffState == 2) player->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); if (GetTeamScore(TEAM_ALLIANCE) < BG_WS_MAX_TEAM_SCORE) AddPoint(ALLIANCE, 1); PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_ALLIANCE); } else { if (!IsAllianceFlagPickedup()) return; SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time // alliance flag in base (but not respawned yet) _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_WAIT_RESPAWN; // Drop Alliance Flag from Player player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); if (_flagDebuffState == 1) player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); else if (_flagDebuffState == 2) player->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); if (GetTeamScore(TEAM_HORDE) < BG_WS_MAX_TEAM_SCORE) AddPoint(HORDE, 1); PlaySoundToAll(BG_WS_SOUND_FLAG_CAPTURED_HORDE); } RewardReputationToTeam(890, 889, m_ReputationCapture, player->GetTeam()); //for flag capture is reward 2 honorable kills RewardHonorToTeam(GetBonusHonorFromKill(2), player->GetTeam()); SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME); SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME); if (player->GetTeam() == ALLIANCE) SendMessageToAll(LANG_BG_WS_CAPTURED_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); else SendMessageToAll(LANG_BG_WS_CAPTURED_AF, CHAT_MSG_BG_SYSTEM_HORDE, player); UpdateFlagState(player->GetTeam(), 1); // flag state none UpdateTeamScore(player->GetTeamId()); // only flag capture should be updated UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1); // +1 flag captures // update last flag capture to be used if teamscore is equal SetLastFlagCapture(player->GetTeam()); if (GetTeamScore(TEAM_ALLIANCE) == BG_WS_MAX_TEAM_SCORE) winner = ALLIANCE; if (GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE) winner = HORDE; if (winner) { UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 0); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 0); UpdateWorldState(BG_WS_FLAG_STATE_ALLIANCE, 1); UpdateWorldState(BG_WS_FLAG_STATE_HORDE, 1); UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 0); RewardHonorToTeam(BG_WSG_Honor[m_HonorMode][BG_WSG_WIN], winner); EndBattleground(winner); } else { _flagsTimer[GetTeamIndexByTeamId(player->GetTeam()) ? 0 : 1] = BG_WS_FLAG_RESPAWN_TIME; } }
void BattleGroundWS::EventPlayerDroppedFlag(Player *Source) { if(GetStatus() != STATUS_IN_PROGRESS) { // if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages // just take off the aura if(Source->GetTeam() == ALLIANCE) { if(!this->IsHordeFlagPickedup()) return; if(GetHordeFlagPickerGUID() == Source->GetGUID()) { SetHordeFlagPicker(0); Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); } } else { if(!this->IsAllianceFlagPickedup()) return; if(GetAllianceFlagPickerGUID() == Source->GetGUID()) { SetAllianceFlagPicker(0); Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); } } return; } const char *message = ""; uint8 type = 0; bool set = false; if(Source->GetTeam() == ALLIANCE) { if(!this->IsHordeFlagPickedup()) return; if(GetHordeFlagPickerGUID() == Source->GetGUID()) { SetHordeFlagPicker(0); Source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); if(m_FlagDebuffState == 1) Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); if(m_FlagDebuffState == 2) Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND; message = GetTrinityString(LANG_BG_WS_DROPPED_HF); type = CHAT_MSG_BG_SYSTEM_HORDE; Source->CastSpell(Source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true); set = true; } } else { if(!this->IsAllianceFlagPickedup()) return; if(GetAllianceFlagPickerGUID() == Source->GetGUID()) { SetAllianceFlagPicker(0); Source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); if(m_FlagDebuffState == 1) Source->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); if(m_FlagDebuffState == 2) Source->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND; message = GetTrinityString(LANG_BG_WS_DROPPED_AF); type = CHAT_MSG_BG_SYSTEM_ALLIANCE; Source->CastSpell(Source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true); set = true; } } if (set) { Source->CastSpell(Source, SPELL_RECENTLY_DROPPED_FLAG, true); UpdateFlagState(Source->GetTeam(), 1); WorldPacket data; ChatHandler::FillMessageData(&data, Source->GetSession(), type, LANG_UNIVERSAL, NULL, Source->GetGUID(), message, NULL); SendPacketToAll(&data); if(Source->GetTeam() == ALLIANCE) UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1)); else UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); m_FlagsDropTimer[GetTeamIndexByTeamId(Source->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME; } }
void BattlegroundWS::EventPlayerDroppedFlag(Player* player) { if (GetStatus() != STATUS_IN_PROGRESS) { // if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages // just take off the aura if (player->GetTeam() == ALLIANCE) { if (!IsHordeFlagPickedup()) return; if (GetFlagPickerGUID(TEAM_HORDE) == player->GetGUID()) { SetHordeFlagPicker(0); player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); } } else { if (!IsAllianceFlagPickedup()) return; if (GetFlagPickerGUID(TEAM_ALLIANCE) == player->GetGUID()) { SetAllianceFlagPicker(0); player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); } } return; } bool set = false; if (player->GetTeam() == ALLIANCE) { if (!IsHordeFlagPickedup()) return; if (GetFlagPickerGUID(TEAM_HORDE) == player->GetGUID()) { SetHordeFlagPicker(0); player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); if (_flagDebuffState == 1) player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); else if (_flagDebuffState == 2) player->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); _flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND; player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true); set = true; } } else { if (!IsAllianceFlagPickedup()) return; if (GetFlagPickerGUID(TEAM_ALLIANCE) == player->GetGUID()) { SetAllianceFlagPicker(0); player->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); if (_flagDebuffState == 1) player->RemoveAurasDueToSpell(WS_SPELL_FOCUSED_ASSAULT); else if (_flagDebuffState == 2) player->RemoveAurasDueToSpell(WS_SPELL_BRUTAL_ASSAULT); _flagState[TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND; player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true); set = true; } } if (set) { player->CastSpell(player, SPELL_RECENTLY_DROPPED_FLAG, true); UpdateFlagState(player->GetTeam(), 1); if (player->GetTeam() == ALLIANCE) { SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1)); } else { SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player); UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); } _flagsDropTimer[GetTeamIndexByTeamId(player->GetTeam()) ? 0 : 1] = BG_WS_FLAG_DROP_TIME; } }
void BattleGroundSA::EventPlayerClickedOnFlag(Player *source, GameObject* target_obj) { if (GetStatus() != STATUS_IN_PROGRESS) return; uint8 event = (sBattleGroundMgr.GetGameObjectEventIndex(target_obj->GetGUIDLow())).event1; if (event >= BG_SA_GRY_MAX) // not a node return; BG_SA_GraveYard gyd = BG_SA_GraveYard(event); BattleGroundTeamIndex teamIndex = GetTeamIndexByTeamId(source->GetTeam()); // Check if player really could use this banner, not cheated if (!(m_Gyd[gyd] == 0 || teamIndex == m_Gyd[gyd] % 2)) return; uint32 sound = 0; if ((m_Gyd[gyd] == BG_SA_GARVE_STATUS_ALLY_CONTESTED) || (m_Gyd[gyd] == BG_SA_GARVE_STATUS_HORDE_CONTESTED)) { // If last state is NOT occupied, change node to enemy-contested if (m_prevGyd[gyd] < BG_SA_GARVE_TYPE_OCCUPIED) { //UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevGyd[gyd] = m_Gyd[gyd]; m_Gyd[gyd] = teamIndex + BG_SA_GARVE_TYPE_CONTESTED; // create new contested banner _CreateBanner(gyd, BG_SA_GARVE_TYPE_CONTESTED, teamIndex, true); //_SendNodeUpdate(node); m_GydTimers[gyd] = BG_SA_FLAG_CAPTURING_TIME; if (teamIndex == BG_TEAM_ALLIANCE) { // SendMessage2ToAll(LANG_BG_SA_AH_PRECIPITATES_GRAVEYARD,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, LANG_BG_ALLY, _GydName(gyd)); SendWarningToAllSA(gyd, STATUS_CLAIMED, ALLIANCE); } else { // SendMessage2ToAll(LANG_BG_SA_AH_PRECIPITATES_GRAVEYARD,CHAT_MSG_BG_SYSTEM_HORDE, source, LANG_BG_HORDE, _GydName(gyd)); SendWarningToAllSA(gyd, STATUS_CLAIMED, HORDE); } } // If contested, change back to occupied else { UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1); m_prevGyd[gyd] = m_Gyd[gyd]; m_Gyd[gyd] = teamIndex + BG_SA_GARVE_TYPE_OCCUPIED; // create new occupied banner _CreateBanner(gyd, BG_SA_GARVE_TYPE_OCCUPIED, teamIndex, true); //_SendNodeUpdate(node); m_GydTimers[gyd] = 0; //_NodeOccupied(node,(teamIndex == BG_TEAM_ALLIANCE) ? ALLIANCE:HORDE); if (teamIndex == BG_TEAM_ALLIANCE) { // SendMessage2ToAll(LANG_BG_SA_AH_PRECIPITATES_GRAVEYARD,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, LANG_BG_ALLY, _GydName(gyd)); SendWarningToAllSA(gyd, STATUS_CLAIMED, ALLIANCE); } else { // SendMessage2ToAll(LANG_BG_SA_AH_PRECIPITATES_GRAVEYARD,CHAT_MSG_BG_SYSTEM_HORDE, source, LANG_BG_HORDE, _GydName(gyd)); SendWarningToAllSA(gyd, STATUS_CLAIMED, HORDE); } } sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_SA_SOUND_GYD_ASSAULTED_ALLIANCE : BG_SA_SOUND_GYD_ASSAULTED_HORDE; } // If node is occupied, change to enemy-contested else if (defender == HORDE) { if (m_Gyd[gyd] == BG_SA_GARVE_STATUS_HORDE_OCCUPIED) { //UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevGyd[gyd] = m_Gyd[gyd]; m_Gyd[gyd] = teamIndex + BG_SA_GARVE_TYPE_CONTESTED; // create new contested banner _CreateBanner(gyd, BG_SA_GARVE_TYPE_CONTESTED, teamIndex, true); //_SendNodeUpdate(node); m_GydTimers[gyd] = BG_SA_FLAG_CAPTURING_TIME; if (teamIndex == BG_TEAM_ALLIANCE) { // SendMessage2ToAll(LANG_BG_SA_AH_PRECIPITATES_GRAVEYARD,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, LANG_BG_ALLY, _GydName(gyd)); SendWarningToAllSA(gyd, STATUS_CLAIMED, ALLIANCE); } else { // SendMessage2ToAll(LANG_BG_SA_AH_PRECIPITATES_GRAVEYARD,CHAT_MSG_BG_SYSTEM_HORDE, source, LANG_BG_HORDE, _GydName(gyd)); SendWarningToAllSA(gyd, STATUS_CLAIMED, HORDE); } sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_SA_SOUND_GYD_ASSAULTED_ALLIANCE : BG_SA_SOUND_GYD_ASSAULTED_HORDE; } } else if (defender == ALLIANCE) { if (m_Gyd[gyd] == BG_SA_GARVE_STATUS_ALLY_OCCUPIED) { //UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevGyd[gyd] = m_Gyd[gyd]; m_Gyd[gyd] = teamIndex + BG_SA_GARVE_TYPE_CONTESTED; // create new contested banner _CreateBanner(gyd, BG_SA_GARVE_TYPE_CONTESTED, teamIndex, true); //_SendNodeUpdate(node); m_GydTimers[gyd] = BG_SA_FLAG_CAPTURING_TIME; if (teamIndex == BG_TEAM_ALLIANCE) { // SendMessage2ToAll(LANG_BG_SA_AH_PRECIPITATES_GRAVEYARD,CHAT_MSG_BG_SYSTEM_ALLIANCE, source, LANG_BG_ALLY, _GydName(gyd)); SendWarningToAllSA(gyd, STATUS_CLAIMED, ALLIANCE); } else { // SendMessage2ToAll(LANG_BG_SA_AH_PRECIPITATES_GRAVEYARD,CHAT_MSG_BG_SYSTEM_HORDE, source, LANG_BG_HORDE, _GydName(gyd)); SendWarningToAllSA(gyd, STATUS_CLAIMED, HORDE); } sound = (teamIndex == BG_TEAM_ALLIANCE) ? BG_SA_SOUND_GYD_ASSAULTED_ALLIANCE : BG_SA_SOUND_GYD_ASSAULTED_HORDE; } } PlaySoundToAll(sound); }
void BattleGroundWS::EventPlayerDroppedFlag(Player* source) { if (GetStatus() != STATUS_IN_PROGRESS) { // if not running, do not cast things at the dropper player (prevent spawning the "dropped" flag), neither send unnecessary messages // just take off the aura if (source->GetTeam() == ALLIANCE) { if (!IsHordeFlagPickedUp()) return; if (GetHordeFlagCarrierGuid() == source->GetObjectGuid()) { ClearHordeFlagCarrier(); source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); } } else { if (!IsAllianceFlagPickedUp()) return; if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid()) { ClearAllianceFlagCarrier(); source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); } } return; } bool set = false; if (source->GetTeam() == ALLIANCE) { if (!IsHordeFlagPickedUp()) return; if (GetHordeFlagCarrierGuid() == source->GetObjectGuid()) { ClearHordeFlagCarrier(); source->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG); m_FlagState[BG_TEAM_HORDE] = BG_WS_FLAG_STATE_ON_GROUND; source->CastSpell(source, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true); set = true; } } else { if (!IsAllianceFlagPickedUp()) return; if (GetAllianceFlagCarrierGuid() == source->GetObjectGuid()) { ClearAllianceFlagCarrier(); source->RemoveAurasDueToSpell(BG_WS_SPELL_SILVERWING_FLAG); m_FlagState[BG_TEAM_ALLIANCE] = BG_WS_FLAG_STATE_ON_GROUND; source->CastSpell(source, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true); set = true; } } if (set) { source->CastSpell(source, SPELL_RECENTLY_DROPPED_FLAG, true); UpdateFlagState(source->GetTeam(), 1); if (source->GetTeam() == ALLIANCE) { SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, source); UpdateWorldState(BG_WS_FLAG_UNK_HORDE, uint32(-1)); } else { SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, source); UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, uint32(-1)); } m_FlagsDropTimer[GetOtherTeamIndex(GetTeamIndexByTeamId(source->GetTeam()))] = BG_WS_FLAG_DROP_TIME; } }
/* Invoked if a player used a banner as a GameObject. */ void BattlegroundBFG::EventPlayerClickedOnFlag(Player* source, GameObject* /*target_obj*/) { if (GetStatus() != STATUS_IN_PROGRESS) return; uint8 node = GILNEAS_BG_NODE_LIGHTHOUSE; GameObject* object = GetBgMap()->GetGameObject(BgObjects[node * 8 + 5]); while ((node < GILNEAS_BG_DYNAMIC_NODES_COUNT) && ((!object) || (!source->IsWithinDistInMap(object, 10)))) { ++node; object = GetBgMap()->GetGameObject(BgObjects[node * 8 + GILNEAS_BG_OBJECT_AURA_CONTESTED]); } if (node == GILNEAS_BG_DYNAMIC_NODES_COUNT) { // This means our player isn't close to any of the banners - maybe a cheater ?? return; } BattlegroundTeamId teamIndex = GetTeamIndexByTeamId(source->GetBGTeam()); // Check if player really could use this banner, and has not cheated. if (!(m_Nodes[node] == 0 || teamIndex == m_Nodes[node] % 2)) return; source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); uint32 sound = 0; // If the node is Neutral, change to Contested. if (m_Nodes[node] == GILNEAS_BG_NODE_TYPE_NEUTRAL) { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + 1; // Burn current Neutral banner. _DelBanner(node, GILNEAS_BG_NODE_TYPE_NEUTRAL, 0); // Create new Contested banner. _CreateBanner(node, GILNEAS_BG_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = GILNEAS_BG_FLAG_CAPTURING_TIME; if (teamIndex == 0) SendMessage2ToAll(LANG_BG_BFG_NODE_CLAIMED, CHAT_MSG_RAID_BOSS_EMOTE, source, _GetNodeNameId(node), LANG_BG_BFG_ALLY); else SendMessage2ToAll(LANG_BG_BFG_NODE_CLAIMED, CHAT_MSG_RAID_BOSS_EMOTE, source, _GetNodeNameId(node), LANG_BG_BFG_HORDE); sound = GILNEAS_BG_SOUND_NODE_CLAIMED; } // If the node is Contested. else if ((m_Nodes[node] == GILNEAS_BG_NODE_STATUS_ALLY_CONTESTED) || (m_Nodes[node] == GILNEAS_BG_NODE_STATUS_HORDE_CONTESTED)) { // If the last state is NOT Occupied, change node to Enemy - Contested. if (m_prevNodes[node] < GILNEAS_BG_NODE_TYPE_OCCUPIED) { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + GILNEAS_BG_NODE_TYPE_CONTESTED; // Burn current Contested banner. _DelBanner(node, GILNEAS_BG_NODE_TYPE_CONTESTED, !teamIndex); // Create new Contested banner. _CreateBanner(node, GILNEAS_BG_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = GILNEAS_BG_FLAG_CAPTURING_TIME; if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_BFG_NODE_ASSAULTED, CHAT_MSG_RAID_BOSS_EMOTE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_BFG_NODE_ASSAULTED, CHAT_MSG_RAID_BOSS_EMOTE, source, _GetNodeNameId(node)); } // If the node was already Contested, change back to Occupied. else { UpdatePlayerScore(source, SCORE_BASES_DEFENDED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + GILNEAS_BG_NODE_TYPE_OCCUPIED; // Burn current Contested banner. _DelBanner(node, GILNEAS_BG_NODE_TYPE_CONTESTED, !teamIndex); // Create new Occupied banner. _CreateBanner(node, GILNEAS_BG_NODE_TYPE_OCCUPIED, teamIndex, true); _SendNodeUpdate(node); m_NodeTimers[node] = 0; _NodeOccupied(node, (teamIndex == BG_TEAM_ALLIANCE) ? ALLIANCE : HORDE); if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_BFG_NODE_DEFENDED, CHAT_MSG_RAID_BOSS_EMOTE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_BFG_NODE_DEFENDED, CHAT_MSG_RAID_BOSS_EMOTE, source, _GetNodeNameId(node)); } sound = (teamIndex == BG_TEAM_ALLIANCE) ? GILNEAS_BG_SOUND_NODE_ASSAULTED_ALLIANCE : GILNEAS_BG_SOUND_NODE_ASSAULTED_HORDE; } // If the node is Occupied, change to Enemy - Contested. else { UpdatePlayerScore(source, SCORE_BASES_ASSAULTED, 1); m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] = teamIndex + GILNEAS_BG_NODE_TYPE_CONTESTED; // Burn current Occupied banner. _DelBanner(node, GILNEAS_BG_NODE_TYPE_OCCUPIED, !teamIndex); // Create new Contested banner. _CreateBanner(node, GILNEAS_BG_NODE_TYPE_CONTESTED, teamIndex, true); _SendNodeUpdate(node); _NodeDeOccupied(node); m_NodeTimers[node] = GILNEAS_BG_FLAG_CAPTURING_TIME; if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_BFG_NODE_ASSAULTED, CHAT_MSG_RAID_BOSS_EMOTE, source, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_BFG_NODE_ASSAULTED, CHAT_MSG_RAID_BOSS_EMOTE, source, _GetNodeNameId(node)); sound = (teamIndex == BG_TEAM_ALLIANCE) ? GILNEAS_BG_SOUND_NODE_ASSAULTED_ALLIANCE : GILNEAS_BG_SOUND_NODE_ASSAULTED_HORDE; } // If the node is Occupied again, send "X has taken the Y" msg. if (m_Nodes[node] >= GILNEAS_BG_NODE_TYPE_OCCUPIED) { if (teamIndex == BG_TEAM_ALLIANCE) SendMessage2ToAll(LANG_BG_BFG_NODE_TAKEN, CHAT_MSG_RAID_BOSS_EMOTE, NULL, LANG_BG_BFG_ALLY, _GetNodeNameId(node)); else SendMessage2ToAll(LANG_BG_BFG_NODE_TAKEN, CHAT_MSG_RAID_BOSS_EMOTE, NULL, LANG_BG_BFG_HORDE, _GetNodeNameId(node)); } PlaySoundToAll(sound); }