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; }
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; }
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; }
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; }
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; }
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; }
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; }