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 == TEAM_INDEX_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); } // gunship starting if (node == BG_IC_NODE_HANGAR) (teamIndex == TEAM_INDEX_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(TeamIndex(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(); }
bool OutdoorPvPBT::Update(uint32 diff) { OutdoorPvP::Update(diff); if(m_FirstLoad == false) { if(m_LastWin == ALLIANCE) sLog->outInfo(LOG_FILTER_GENERAL, "|cffEE9A00A[OutdoorPvPBT]: Borean Tundra has started! Last Winner: Alliance(%u)", ALLIANCE); else if(m_LastWin == HORDE) sLog->outInfo(LOG_FILTER_GENERAL, "|cffEE9A00A[OutdoorPvPBT]: Borean Tundra has started! Last Winner: Horde(%u)", HORDE); else if(m_LastWin == 0) sLog->outInfo(LOG_FILTER_GENERAL, "|cffEE9A00A[OutdoorPvPBT]: Borean Tundra has started! Last Winner: Neutral(0)"); m_FirstLoad = true; } if(m_ally_gathered <= 50 && limit_A == 0) { IS_ABLE_TO_SHOW_MESSAGE = true; // We allow the message to pass IS_RESOURCE_MESSAGE_A = true; // We allow the message to be shown limit_A = 1; // We set this to one to stop the spamming PlaySounds(false); } else if(m_horde_gathered <= 50 && limit_H == 0) { IS_ABLE_TO_SHOW_MESSAGE = true; // We allow the message to pass IS_RESOURCE_MESSAGE_H = true; // We allow the message to be shown limit_H = 1; // Same as above PlaySounds(true); } else if(m_ally_gathered <= 0 && limit_A == 1) { IS_ABLE_TO_SHOW_MESSAGE = true; // We allow the message to pass IS_RESOURCE_MESSAGE_A = true; // We allow the message to be shown limit_A = 2; PlaySounds(false); } else if(m_horde_gathered <= 0 && limit_H == 1) { IS_ABLE_TO_SHOW_MESSAGE = true; // We allow the message to pass IS_RESOURCE_MESSAGE_H = true; // We allow the message to be shown limit_H = 2; PlaySounds(true); } else if(m_ally_gathered <= 300 && limit_resources_message_A == 0) { IS_ABLE_TO_SHOW_MESSAGE = true; limit_resources_message_A = 1; PlaySounds(false); } else if(m_horde_gathered <= 300 && limit_resources_message_H == 0) { IS_ABLE_TO_SHOW_MESSAGE = true; limit_resources_message_H = 1; PlaySounds(true); } else if(m_ally_gathered <= 200 && limit_resources_message_A == 1) { IS_ABLE_TO_SHOW_MESSAGE = true; limit_resources_message_A = 2; PlaySounds(false); } else if(m_horde_gathered <= 200 && limit_resources_message_H == 1) { IS_ABLE_TO_SHOW_MESSAGE = true; limit_resources_message_H = 2; PlaySounds(true); } else if(m_ally_gathered <= 100 && limit_resources_message_A == 2) { IS_ABLE_TO_SHOW_MESSAGE = true; limit_resources_message_A = 3; PlaySounds(false); } else if(m_horde_gathered <= 100 && limit_resources_message_H == 2) { IS_ABLE_TO_SHOW_MESSAGE = true; limit_resources_message_H = 3; PlaySounds(true); } if(IS_ABLE_TO_SHOW_MESSAGE == true) // This will limit the spam { SessionMap m_sessions = sWorld->GetAllSessions(); for(SessionMap::iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) // We're searching for all the sessions(Players) { if(!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld() || itr->second->GetPlayer()->GetZoneId() != 3537) continue; if(itr->second->GetPlayer()->GetZoneId() == 3537) { char msg[250]; if(limit_resources_message_A == 1 || limit_resources_message_A == 2 || limit_resources_message_A == 3) { snprintf(msg, 250, "|cffEE9A00A[Borean Tundra Defense]: Alliance has %u resources remaining!", m_ally_gathered); itr->second->GetPlayer()->MonsterTextEmote(msg, itr->second->GetPlayer()->GetGUID()); } else if(limit_resources_message_H == 1 || limit_resources_message_H == 2 || limit_resources_message_H == 3) { snprintf(msg, 250, "|cffEE9A00A[Borean Tundra Defense]: Horde has %u resources remaining!", m_horde_gathered); itr->second->GetPlayer()->MonsterTextEmote(msg, itr->second->GetPlayer()->GetGUID()); } if(IS_RESOURCE_MESSAGE_A == true) { if(limit_A == 1) { snprintf(msg, 250, "|cffEE9A00A[Borean Tundra Defense]: Alliance has %u resources remaining!", m_ally_gathered); itr->second->GetPlayer()->MonsterTextEmote(msg, itr->second->GetPlayer()->GetGUID()); IS_RESOURCE_MESSAGE_A = false; // Reset } else if(limit_A == 2) { itr->second->GetPlayer()->MonsterTextEmote("|cffEE9A00A[Borean Tundra Defense]: Alliance has 0 resources! Horde wins!", itr->second->GetPlayer()->GetGUID()); HandleWinMessage("|cffEE9A00AHorde Wins!"); HandleRewards(itr->second->GetPlayer(), 1500, true, false, false); switch(itr->second->GetPlayer()->GetTeam()) { case ALLIANCE: HandleBuffs(itr->second->GetPlayer(), true); break; case HORDE: HandleBuffs(itr->second->GetPlayer(), false); break; } m_LastWin = HORDE; IS_RESOURCE_MESSAGE_A = false; // Reset } } else if(IS_RESOURCE_MESSAGE_H == true) { if(limit_H == 1) { snprintf(msg, 250, "|cffEE9A00A[Borean Tundra Defense]: Horde has %u resources remaining!", m_horde_gathered); itr->second->GetPlayer()->MonsterTextEmote(msg, itr->second->GetPlayer()->GetGUID()); IS_RESOURCE_MESSAGE_H = false; // Reset } else if(limit_H == 2) { itr->second->GetPlayer()->MonsterTextEmote("|cffEE9A00A[Borean Tundra Defense]: Horde has 0 resources! Alliance wins!", itr->second->GetPlayer()->GetGUID()); HandleWinMessage("Alliance Wins!"); HandleRewards(itr->second->GetPlayer(), 1500, true, false, false); switch(itr->second->GetPlayer()->GetTeam()) { case ALLIANCE: HandleBuffs(itr->second->GetPlayer(), false); break; case HORDE: HandleBuffs(itr->second->GetPlayer(), true); break; } m_LastWin = ALLIANCE; IS_RESOURCE_MESSAGE_H = false; // Reset } } } else { // Don't send anything } } } IS_ABLE_TO_SHOW_MESSAGE = false; // Reset return false; }