// Send by client on clicking in accept or refuse of invitation windows for join game(NEED TEST) void WorldSession::HandleWGEntryInviteResponse(WorldPacket &recv_data) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if(!pvpWG || !_player) return; uint32 BattleId; uint8 Accepted; recv_data >> BattleId >> Accepted; sLog->outError("HandleBattlefieldInviteResponse: BattleID:%u Accepted:%u",BattleId,Accepted); // If player accept invitation if(Accepted) { if (_player->GetSession()) _player->GetSession()->SendWGEntered(pvpWG->GetBattleId()); } else { if(_player->GetZoneId() == 4197) pvpWG->KickPlayerFromWG(_player, false); } _player->WGBattleBox = false; _player->WGBattleBoxTimer = 0; }
void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); Battleground* bg = _player->GetBattleground(); uint64 guid; recv_data >> guid; Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) return; if (!unit->isSpiritService()) // it's not spirit service return; if (bg) bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); else { // Wintergrasp Hack till 3.3.5 and it's implemented as BG if (GetPlayer()->GetZoneId() == 4197) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (pvpWG && pvpWG->isWarTime()) pvpWG->AddPlayerToResurrectQueue(guid, _player->GetGUID()); } } }
void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); Battleground* bg = _player->GetBattleground(); uint64 guid; recv_data >> guid; Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) return; if (!unit->isSpiritService()) // it's not spirit service return; if (bg) sBattlegroundMgr->SendAreaSpiritHealerQueryOpcode(_player, bg, guid); else if (GetPlayer()->GetZoneId() == 4197) { OutdoorPvPWG* pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (pvpWG && pvpWG->isWarTime()) pvpWG->SendAreaSpiritHealerQueryOpcode(_player, guid); } }
void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) { sLog->outDebug("WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); Battleground *bg = _player->GetBattleground(); uint64 guid; recv_data >> guid; Creature* unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) return; if (!unit->isSpiritService()) // it's not spirit service return; if (bg) bg->AddPlayerToResurrectQueue(guid, _player->GetGUID()); else { // Wintergrasp Hack till 3.2 and it's implemented as BG if (GetPlayer()->GetZoneId() == 4197) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (pvpWG && pvpWG != 0) if (QueryResult result = CharacterDatabase.PQuery("SELECT value FROM worldstates WHERE value= '%u' AND entry = '%u'", 1, 31001)) pvpWG->SendAreaSpiritHealerQueryOpcode(_player, guid); } } }
// Send that packet when player click on accept or refuse for queue(NEED TEST) void WorldSession::HandleWGQueueInviteResponse(WorldPacket &recv_data) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if(!pvpWG || !_player) return; pvpWG->QueueBoxSendedToPlayer(_player); uint32 BattleId; uint8 Accepted; _player->WGQueueBox = true; _player->WGQueueBoxTimer = 20000; recv_data >> BattleId >> Accepted; sLog->outError("HandleQueueInviteResponse: BattleID:%u Accepted:%u",BattleId,Accepted); bool Answer; if (Accepted) Answer = true; else Answer = false; _player->WGQueueBox = false; _player->WGQueueBoxTimer = 0; pvpWG->PlayerAnsweredForInviteToQueue(_player, Answer); }
bool GossipHello_npc_demolisher_engineerer(Player* pPlayer, Creature* pCreature) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*) sOutdoorPvPMgr.GetOutdoorPvPToZoneId(NORTHREND_WINTERGRASP); if (!pvpWG) return false; if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); if (pPlayer->isGameMaster() || pCreature->GetZoneScript() && pCreature->GetZoneScript()->GetData(pCreature->GetDBTableGUIDLow())) { if (pPlayer->HasAura(SPELL_CORPORAL)) pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, pvpWG->GetLocaleString(WG_STRING_ENG_GOSSIP_1, sWorld.GetDefaultDbcLocale()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); else if (pPlayer->HasAura(SPELL_LIEUTENANT)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, pvpWG->GetLocaleString(WG_STRING_ENG_GOSSIP_1, sWorld.GetDefaultDbcLocale()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, pvpWG->GetLocaleString(WG_STRING_ENG_GOSSIP_2, sWorld.GetDefaultDbcLocale()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, pvpWG->GetLocaleString(WG_STRING_ENG_GOSSIP_3, sWorld.GetDefaultDbcLocale()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); } } else pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, pvpWG->GetLocaleString(WG_STRING_ENG_GOSSIP_4, sWorld.GetDefaultDbcLocale()), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+9); pPlayer->SEND_GOSSIP_MENU(pPlayer->GetGossipTextId(pCreature), pCreature->GetGUID()); return true; }
bool ChatHandler::HandleWintergraspTimerCommand(const char* args) { if(!*args) return false; OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (!pvpWG) { SendSysMessage(LANG_BG_WG_DISABLE); SetSentErrorMessage(true); return false; } int32 time = atoi (args); // Min value 1 min if (1 > time) time = 1; // Max value during wartime = 60. No wartime = 1440 (day) if (pvpWG->isWarTime()) { if (60 < time) return false; } else if (1440 < time) return false; time *= MINUTE * IN_MILLISECONDS; pvpWG->setTimer((uint32)time); sWorld->SendWintergraspState(); //Update WG time at bg tab PSendSysMessage(LANG_BG_WG_CHANGE_TIMER, secsToTimeString(pvpWG->GetTimer(), true).c_str()); return true; }
void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) { sLog.outDebug("WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); Battleground *bg = _player->GetBattleground(); uint64 guid; recv_data >> guid; Creature *unit = GetPlayer()->GetMap()->GetCreature(guid); if (!unit) return; if (!unit->isSpiritService()) // it's not spirit service return; if (bg) { sBattlegroundMgr.SendAreaSpiritHealerQueryOpcode(_player, bg, guid); } else { // Wintergrasp Hack till 3.2 and it's implemented as BG if (GetPlayer()->GetZoneId() == 4197) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr.GetOutdoorPvPToZoneId(4197); if (pvpWG && pvpWG->isWarTime()) pvpWG->SendAreaSpiritHealerQueryOpcode(_player, guid); } } }
static bool HandleWgTimerCommand(ChatHandler* handler, const char* args) { if (!*args) return false; OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (!pvpWG || !sWorld->getBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) { handler->SendSysMessage(LANG_BG_WG_DISABLE); handler->SetSentErrorMessage(true); return false; } int32 time = atoi (args); if (1 > time) time = 1; if (pvpWG->isWarTime()) { if (60 < time) return false; } else if (1440 < time) return false; time *= MINUTE * IN_MILLISECONDS; pvpWG->setTimer((uint32)time); sWorld->SendWintergraspState(); handler->PSendSysMessage(LANG_BG_WG_CHANGE_TIMER, secsToTimeString(pvpWG->GetTimer(), true).c_str()); return true; }
// Send that packet when player accept to join war(NEED TEST) void WorldSession::SendWGEntered(uint32 BattleId) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if(!pvpWG || !_player || !pvpWG->isWarTime()) return; uint32 team = _player->GetTeamId(); if (pvpWG->m_playersinwar[team].size() < (pvpWG->GetMaximumPlayerLimit()/2)+1){}else return; pvpWG->m_playersinwar[team].insert(_player); uint32 SPELL_TELEPORT_CAMP; if (team == TEAM_ALLIANCE) SPELL_TELEPORT_CAMP = SPELL_TELEPORT_ALLIENCE_CAMP; else SPELL_TELEPORT_CAMP = SPELL_TELEPORT_HORDE_CAMP; if (pvpWG->getAttackerTeam() == team) _player->CastSpell(_player, SPELL_TELEPORT_CAMP, false); else _player->CastSpell(_player, SPELL_TELEPORT_FORTRESS, false); WorldPacket data(SMSG_BATTLEFIELD_MGR_ENTERED, 7); data << uint32(BattleId); // Battle Id of Wintergrasp. data << uint8(1); //unk data << uint8(1); //unk data << uint8(_player->isAFK()?1:0); //Clear AFK SendPacket(&data); }
// Leave Wintergrasp option from minimap (%100 Working) void WorldSession::HandleWGLeaveRequest(WorldPacket &recv_data) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if(!pvpWG || !_player) return; pvpWG->KickPlayerFromWG(_player, true); }
void OnPlayerEnter(Player *player) { if (sWorld->getBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (pvpWG && !player->isGameMaster() && player->GetTeamId() != pvpWG->getDefenderTeam()) player->CastSpell(player, SPELL_TELEPORT_FORTRESS, true); } }
bool OutdoorPvPMgr::CanEnterVaultOfArchavon(Player *plr) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)GetOutdoorPvPToZoneId(NORTHREND_WINTERGRASP); if (!pvpWG) return false; if (pvpWG->getDefenderTeamId() != plr->GetTeamId() || pvpWG->isWarTime()) return false; return true; }
// Leave Queue option while in Queue from minimap(NEED TEST) void WorldSession::HandleWGLeaveQueue(WorldPacket &recv_data) { uint32 BattleId; recv_data >> BattleId; sLog->outError("HandleWGLeaveQueue: BattleID:%u ",BattleId); OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if(!pvpWG) return; pvpWG->KickPlayerFromWG(_player, false); }
bool ChatHandler::HandleWintergraspStopCommand(const char* /*args*/) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (!pvpWG || !sWorld->getBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) { SendSysMessage(LANG_BG_WG_DISABLE); SetSentErrorMessage(true); return false; } pvpWG->forceStopBattle(); PSendSysMessage(LANG_BG_WG_BATTLE_FORCE_STOP); return true; }
// Join Battle button for Wintergrasp from battlegrounds section("H") (%50 Working). // TO DO: Packet sending is not working. We must fix packet sending... void WorldSession::HandleWGJoinBattle(WorldPacket &recv_data) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if(!pvpWG || !_player) return; WorldPacket data(SMSG_BATTLEFIELD_MGR_QUEUE_INVITE, 5); data << uint32(pvpWG->GetBattleId()); data << uint8(1); //warmup ? used ? //Sending packet to player if(_player->GetSession()) _player->GetSession()->SendPacket(&data); }
static bool HandleWgStartCommand(ChatHandler* handler, const char* /*args*/) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (!pvpWG || !sWorld->getBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) { handler->SendSysMessage(LANG_BG_WG_DISABLE); handler->SetSentErrorMessage(true); return false; } pvpWG->forceStartBattle(); handler->PSendSysMessage(LANG_BG_WG_BATTLE_FORCE_START); return true; }
bool OutdoorPvPMgr::CanBeAttacked(Creature *pCreature) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)GetOutdoorPvPToZoneId(NORTHREND_WINTERGRASP); if (!pvpWG) return false; // Toravon if (pCreature->GetEntry() == 38433 && (pvpWG->GetTimer()/60) <= 15) return false; // All if (pvpWG->isWarTime()) return false; return true; }
bool ChatHandler::HandleWintergraspSwitchTeamCommand(const char* /*args*/) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (!pvpWG) { SendSysMessage(LANG_BG_WG_DISABLE); SetSentErrorMessage(true); return false; } uint32 timer = pvpWG->GetTimer(); pvpWG->forceChangeTeam(); pvpWG->setTimer(timer); PSendSysMessage(LANG_BG_WG_SWITCH_FACTION, GetTrinityString(pvpWG->getDefenderTeam() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE)); return true; }
void Reset() { events.Reset(); pvpWG = (OutdoorPvPWG*) sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); switch(me->GetEntry()) { case WG_CREATURE_ENHANCEMENT_A: case WG_CREATURE_ENHANCEMENT_H: case WG_CREATURE_QUESTGIVER_5_A: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); return; } switch(me->GetEntry()) { case WG_CREATURE_CHAMPION_A: case WG_CREATURE_CHAMPION_H: if (pvpWG && !pvpWG->isWarTime()) me->SetVisible(false); else me->SetVisible(true); break; } }
static bool HandleWgSwitchCommand(ChatHandler* handler, const char* /*args*/) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (!pvpWG || !sWorld->getBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) { handler->SendSysMessage(LANG_BG_WG_DISABLE); handler->SetSentErrorMessage(true); return false; } pvpWG->forceChangeTeam(); pvpWG->setTimer(pvpWG->GetTimer()); handler->PSendSysMessage(LANG_BG_WG_SWITCH_FACTION, handler->GetTrinityString(pvpWG->getDefenderTeam() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE)); return true; }
void OutdoorPvPMgr::HandlePlayerEnterZone(Player *plr, uint32 zoneid) { if (zoneid != NORTHREND_WINTERGRASP) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)GetOutdoorPvPToZoneId(NORTHREND_WINTERGRASP); if (pvpWG) pvpWG->HandleEssenceOfWintergrasp(plr, zoneid); } OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid); if (itr == m_OutdoorPvPMap.end()) return; if (itr->second->HasPlayer(plr)) return; itr->second->HandlePlayerEnterZone(plr, zoneid); sLog.outDebug("Player %u entered outdoorpvp id %u", plr->GetGUIDLow(), itr->second->GetTypeId()); }
bool ChatHandler::HandleWintergraspEnableCommand(const char* args) { if(!*args) return false; OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (!pvpWG || !sWorld->getBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) { SendSysMessage(LANG_BG_WG_DISABLE); SetSentErrorMessage(true); return false; } if (!strncmp(args, "on", 3)) { if (!sWorld->getBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) { pvpWG->forceStopBattle(); sWorld->setBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED, true); } PSendSysMessage(LANG_BG_WG_ENABLE); return true; } else if (!strncmp(args, "off", 4)) { if (sWorld->getBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) { pvpWG->forceStopBattle(); sWorld->setBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED, false); } PSendSysMessage(LANG_BG_WG_DISABLE); return true; } else { SendSysMessage(LANG_USE_BOL); SetSentErrorMessage(true); return false; } }
void UpdateAI(const uint32 diff) { if(!(summoned)) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if((pvpWG->getDefenderTeam() == TEAM_HORDE) && (sWorld->GetWintergrapsState() == 1)) SummonNPC(); else return; } if( (summoned) && (sWorld->GetWintergrapsState() == 1) ) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if((pvpWG->getDefenderTeam() != TEAM_HORDE)) UnsummonNPC(); else return; } if((summoned) && (sWorld->GetWintergrapsState() == 0)) UnsummonNPC(); }
bool OnGossipHello(Player* pPlayer, Creature* pCreature) { if (pCreature->isQuestGiver()) pPlayer->PrepareQuestMenu(pCreature->GetGUID()); OutdoorPvPWG *BfWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (BfWG && pPlayer->getLevel() > sWorld->getIntConfig(CONFIG_CONFIG_OUTDOORPVP_WINTERGRASP_MINLEVEL)) { if(BfWG->isWarTime()) { if (!BfWG->isWarForTeamFull(pPlayer)) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); pPlayer->SEND_GOSSIP_MENU(BfWG->getDefenderTeam()?WG_NPCQUEUE_TEXT_H_WAR:WG_NPCQUEUE_TEXT_A_WAR, pCreature->GetGUID()); } else { pPlayer->SEND_GOSSIP_MENU(BfWG->getDefenderTeam()?WG_NPCQUEUE_TEXT_H_NOWAR:WG_NPCQUEUE_TEXT_A_NOWAR, pCreature->GetGUID()); } } else { uint32 uiTime=BfWG->GetTimer(); pPlayer->SendUpdateWorldState(4354,time(NULL)+uiTime); if(uiTime<15*MINUTE) { pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT,sObjectMgr->GetTrinityStringForDBCLocale(WG_NPCQUEUE_TEXTOPTION_JOIN), GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); pPlayer->SEND_GOSSIP_MENU(BfWG->getDefenderTeam()?WG_NPCQUEUE_TEXT_H_QUEUE:WG_NPCQUEUE_TEXT_A_QUEUE, pCreature->GetGUID()); } else { pPlayer->SEND_GOSSIP_MENU(BfWG->getDefenderTeam()?WG_NPCQUEUE_TEXT_H_NOWAR:WG_NPCQUEUE_TEXT_A_NOWAR, pCreature->GetGUID()); } } } return true; }
bool OnGossipSelect(Player *player, Creature *_Creature, uint32 sender, uint32 action ) { if(action == GOSSIP_ACTION_INFO_DEF+1) { player->CLOSE_GOSSIP_MENU(); if (player->getLevel() > 74) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); Group *pGroup = player->GetGroup(); if(pGroup) { for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Member = itr->getSource(); pvpWG->InviteInQueue(Member); } } else pvpWG->InviteInQueue(player); } } if(action == GOSSIP_ACTION_INFO_DEF+2) { player->CLOSE_GOSSIP_MENU(); if (player->getLevel() > 74) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); Group *pGroup = player->GetGroup(); if(pGroup) { for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Member = itr->getSource(); pvpWG->InviteToGame(Member); } } else pvpWG->InviteToGame(player); } } return true; }
void Reset() { events.Reset(); pvpWG = (OutdoorPvPWG*) sOutdoorPvPMgr.GetOutdoorPvPToZoneId(NORTHREND_WINTERGRASP); switch(me->GetEntry()) { case WG_CREATURE_ENHANCEMENT_A: case WG_CREATURE_ENHANCEMENT_H: case WG_CREATURE_QUESTGIVER_5_A: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); return; } switch(me->GetEntry()) { case WG_CREATURE_CHAMPION_A: case WG_CREATURE_CHAMPION_H: if (pvpWG && !pvpWG->isWarTime()) DoCast(me, SPELL_SLEEPING_SLEEP); break; } }
bool ChatHandler::HandleWintergraspStatusCommand(const char* /*args*/) { OutdoorPvPWG *pvpWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (!pvpWG || !sWorld->getBoolConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) { SendSysMessage(LANG_BG_WG_DISABLE); SetSentErrorMessage(true); return false; } PSendSysMessage(LANG_BG_WG_STATUS, sObjectMgr->GetTrinityStringForDBCLocale( pvpWG->getDefenderTeam() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE), secsToTimeString(pvpWG->GetTimer(), true).c_str(), pvpWG->isWarTime() ? "Yes" : "No", pvpWG->GetNumPlayersH(), pvpWG->GetNumPlayersA()); return true; }
bool OnGossipSelect(Player* pPlayer, Creature* /*pCreature*/, uint32 /*uiSender*/, uint32 /*uiAction*/) { pPlayer->CLOSE_GOSSIP_MENU(); OutdoorPvPWG *BfWG = (OutdoorPvPWG*)sOutdoorPvPMgr->GetOutdoorPvPToZoneId(4197); if (BfWG && pPlayer->getLevel() > sWorld->getIntConfig(CONFIG_CONFIG_OUTDOORPVP_WINTERGRASP_MINLEVEL)) { if(BfWG->isWarTime()) { if(!BfWG->isWarForTeamFull(pPlayer)) BfWG->InvitePlayerToWar(pPlayer); } else { uint32 uiTime=BfWG->GetTimer(); if(uiTime<15*MINUTE) BfWG->InvitePlayerToQueue(pPlayer); } } return true; }
void UpdateAI(const uint32 uiDiff) { switch(me->GetEntry()) { case WG_CREATURE_CHAMPION_A: case WG_CREATURE_CHAMPION_H: if (pvpWG && !pvpWG->isWarTime()) me->SetVisible(false); else me->SetVisible(true); break; } if (!UpdateVictim()) return; events.Update(uiDiff); if (me->HasUnitState(UNIT_STAT_CASTING)) return; while(uint32 eventId = events.ExecuteEvent()) { switch(eventId) { case EVENT_STRIKE: switch(me->GetEntry()) { case WG_CREATURE_GUARD_A: case WG_CREATURE_GUARD_H: case WG_CREATURE_CHAMPION_A: case WG_CREATURE_CHAMPION_H: DoCast(me->getVictim(), SPELL_STRIKE); events.ScheduleEvent(EVENT_STRIKE, 5000); return; } case EVENT_ARCANE_MISSILES: switch(me->GetEntry()) { case WG_CREATURE_ENHANCEMENT_A: DoCast(me->getVictim(), SPELL_ARCANE_MISSILES); events.ScheduleEvent(EVENT_ARCANE_MISSILES, 5000); return; } case EVENT_SLOW: switch(me->GetEntry()) { case WG_CREATURE_ENHANCEMENT_A: DoCast(me->getVictim(), SPELL_SLOW); events.ScheduleEvent(EVENT_SLOW, 15000); return; } case EVENT_HEALING_WAVE: switch(me->GetEntry()) { case WG_CREATURE_ENHANCEMENT_H: if (HealthBelowPct(50)) DoCast(me, SPELL_HEALING_WAVE); events.ScheduleEvent(EVENT_HEALING_WAVE, 3000); return; } case EVENT_LIGHTNING_BOLT: switch(me->GetEntry()) { case WG_CREATURE_ENHANCEMENT_H: DoCast(me->getVictim(), SPELL_LIGHTNING_BOLT); events.ScheduleEvent(EVENT_LIGHTNING_BOLT, 5000); return; } case EVENT_QUICK_FLAME_WARD: switch(me->GetEntry()) { case WG_CREATURE_ENHANCEMENT_H: DoCast(me, SPELL_QUICK_FLAME_WARD); events.ScheduleEvent(EVENT_QUICK_FLAME_WARD, 10000); return; } case EVENT_MORTAL_STRIKE: switch(me->GetEntry()) { case WG_CREATURE_QUESTGIVER_1_A: case WG_CREATURE_QUESTGIVER_1_H: case WG_CREATURE_QUESTGIVER_2_A: case WG_CREATURE_QUESTGIVER_2_H: case WG_CREATURE_QUESTGIVER_3_A: case WG_CREATURE_QUESTGIVER_3_H: case WG_CREATURE_QUESTGIVER_4_A: case WG_CREATURE_QUESTGIVER_4_H: DoCast(me->getVictim(), SPELL_MORTAL_STRIKE); events.ScheduleEvent(EVENT_MORTAL_STRIKE, 10000); return; } case EVENT_HEAL: switch(me->GetEntry()) { case WG_CREATURE_QUESTGIVER_5_A: if (HealthBelowPct(50)) DoCast(me, SPELL_HEAL); events.ScheduleEvent(EVENT_HEAL, 5000); return; } case EVENT_HOLY_NOVA: switch(me->GetEntry()) { case WG_CREATURE_QUESTGIVER_5_A: DoCast(me, SPELL_HOLY_NOVA); events.ScheduleEvent(EVENT_HOLY_NOVA, 8000); return; } case EVENT_CLEAVE: switch(me->GetEntry()) { case WG_CREATURE_QUESTGIVER_5_H: case WG_CREATURE_QUESTGIVER_6_A: case WG_CREATURE_QUESTGIVER_6_H: DoCast(me->getVictim(), SPELL_CLEAVE); events.ScheduleEvent(EVENT_CLEAVE, 10000); return; } } } switch(me->GetEntry()) { case WG_CREATURE_ENHANCEMENT_A: case WG_CREATURE_ENHANCEMENT_H: case WG_CREATURE_QUESTGIVER_5_A: return; default: DoMeleeAttackIfReady(); return; } }