void BattleGroundAV::EventPlayerDestroyedPoint(BG_AV_Nodes node) { DEBUG_LOG("BattleGroundAV: player destroyed point node %i", node); MANGOS_ASSERT(m_Nodes[node].Owner != BG_AV_TEAM_NEUTRAL) BattleGroundTeamIndex ownerTeamIdx = BattleGroundTeamIndex(m_Nodes[node].Owner); Team ownerTeam = ownerTeamIdx == BG_TEAM_ALLIANCE ? ALLIANCE : HORDE; // despawn banner DestroyNode(node); PopulateNode(node); UpdateNodeWorldState(node); if (IsTower(node)) { uint8 tmp = node - BG_AV_NODES_DUNBALDAR_SOUTH; // despawn marshal (one of those guys protecting the boss) SpawnEvent(BG_AV_MARSHAL_A_SOUTH + tmp, 0, false); UpdateScore(GetOtherTeamIndex(ownerTeamIdx), (-1) * BG_AV_RES_TOWER); RewardReputationToTeam((ownerTeam == ALLIANCE) ? BG_AV_FACTION_A : BG_AV_FACTION_H, m_RepTowerDestruction, ownerTeam); RewardHonorToTeam(GetBonusHonorFromKill(BG_AV_KILL_TOWER), ownerTeam); SendYell2ToAll(LANG_BG_AV_TOWER_TAKEN, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), (ownerTeam == ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE); } else { SendYell2ToAll(LANG_BG_AV_GRAVE_TAKEN, LANG_UNIVERSAL, GetSingleCreatureGuid(BG_AV_HERALD, 0), GetNodeName(node), (ownerTeam == ALLIANCE) ? LANG_BG_ALLY : LANG_BG_HORDE); } }
void BattleGroundAV::Update(uint32 diff) { BattleGround::Update(diff); if (GetStatus() != STATUS_IN_PROGRESS) { return; } // add points from mine owning, and look if the neutral team can reclaim the mine for (uint8 mine = 0; mine < BG_AV_MAX_MINES; ++mine) { if (m_Mine_Owner[mine] != BG_AV_TEAM_NEUTRAL) { m_Mine_Timer[mine] -= diff; if (m_Mine_Timer[mine] <= 0) { UpdateScore(BattleGroundTeamIndex(m_Mine_Owner[mine]), WORLD_STATE_ADD); m_Mine_Timer[mine] = BG_AV_MINE_TICK_TIMER; } if (m_Mine_Reclaim_Timer[mine] > diff) { m_Mine_Reclaim_Timer[mine] -= diff; } else { ChangeMineOwner(mine, BG_AV_TEAM_NEUTRAL); } } } // looks for all timers of the nodes and destroy the building (for graveyards the building wont get destroyed, it goes just to the other team for (BG_AV_Nodes i = BG_AV_NODES_FIRSTAID_STATION; i < BG_AV_NODES_MAX; ++i) { if (m_Nodes[i].State == POINT_ASSAULTED) { if (m_Nodes[i].Timer > diff) { m_Nodes[i].Timer -= diff; } else { EventPlayerDestroyedPoint(i); } } } }
void BattleGroundIC::Update(uint32 diff) { BattleGround::Update(diff); if (GetStatus() != STATUS_IN_PROGRESS) return; if (!doorsClosed) { if (closeFortressDoorsTimer <= diff) { // correct visual of closed gates is at "damaged" flag for (int i = BG_IC_GO_T_ALLIANCE_GATE_1; i <= BG_IC_GO_T_HORDE_GATE_3; ++i) GetBGObject(i)->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); for (int i = BG_IC_GO_T_ALLIANCE_WEST; i <= BG_IC_GO_T_HORDE_FRONT; ++i) DelObject(i); doorsClosed = true; } else closeFortressDoorsTimer -= diff; } for (int node = 0; node < BG_IC_NODES_MAX; ++node) { // 3 sec delay to spawn new banner instead previous despawned one if (m_BannerTimers[node].timer) { if (m_BannerTimers[node].timer > diff) m_BannerTimers[node].timer -= diff; else { m_BannerTimers[node].timer = 0; _CreateBanner(node, m_BannerTimers[node].type, m_BannerTimers[node].teamIndex, false); } } // 1-minute to occupy a node from contested state if (m_NodeTimers[node]) { if (m_NodeTimers[node] > diff) m_NodeTimers[node] -= diff; else { m_NodeTimers[node] = 0; // Change from contested to occupied ! uint8 teamIndex = m_Nodes[node]-1; m_prevNodes[node] = m_Nodes[node]; m_Nodes[node] += 2; // create new occupied banner _CreateBanner(node, BG_IC_NODE_TYPE_OCCUPIED, teamIndex, true); _SendNodeUpdate(node); // Message to chatlog if (teamIndex == BG_TEAM_ALLIANCE) { SendMessage2ToAll(LANG_BG_IC_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_ALLIANCE,NULL,LANG_BG_ALLY,_GetNodeNameId(node)); PlaySoundToAll(BG_IC_SOUND_NODE_CAPTURED_ALLIANCE); } else { SendMessage2ToAll(LANG_BG_IC_NODE_TAKEN,CHAT_MSG_BG_SYSTEM_HORDE,NULL,LANG_BG_HORDE,_GetNodeNameId(node)); PlaySoundToAll(BG_IC_SOUND_NODE_CAPTURED_HORDE); } // set vehicle faction SetBGFaction(node, (teamIndex == BG_TEAM_ALLIANCE ? BG_IC_NODE_STATUS_ALLY_OCCUPIED : BG_IC_NODE_STATUS_HORDE_OCCUPIED), teamIndex == BG_TEAM_ALLIANCE ? VEHICLE_FACTION_ALLIANCE : VEHICLE_FACTION_HORDE); // gunship starting if (node == BG_IC_NODE_HANGAR) (teamIndex == BG_TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde)->BuildStartMovePacket(GetBgMap()); } } } // add a point every 45 secs to quarry/refinery owner for (uint8 node = BG_IC_NODE_QUARRY; node <= BG_IC_NODE_REFINERY; node++) { if (m_Nodes[node] >= BG_IC_NODE_TYPE_OCCUPIED) { if (m_resource_Timer[node] <= diff) { UpdateScore(BattleGroundTeamIndex(m_Nodes[node] - BG_IC_NODE_TYPE_OCCUPIED) , 1); RewardHonorToTeam(GetBonusHonorFromKill(1), (m_Nodes[node] - BG_IC_NODE_TYPE_OCCUPIED == 0 ? ALLIANCE : HORDE)); m_resource_Timer[node] = BG_IC_RESOURCE_TICK_TIMER; } else m_resource_Timer[node] -= diff; } } HandleBuffs(); }