bool OutdoorPvPEP::SetupOutdoorPvP() { for (uint8 i = 0; i < EPBuffZonesNum; ++i) RegisterZone(EPBuffZones[i]); AddCapturePoint(new OPvPCapturePointEP_EWT(this)); AddCapturePoint(new OPvPCapturePointEP_PWT(this)); AddCapturePoint(new OPvPCapturePointEP_CGT(this)); AddCapturePoint(new OPvPCapturePointEP_NPT(this)); return true; }
bool OutdoorPvPHP::SetupOutdoorPvP() { m_AllianceTowersControlled = 0; m_HordeTowersControlled = 0; // add the zones affected by the pvp buff for (int i = 0; i < OutdoorPvPHPBuffZonesNum; ++i) RegisterZone(OutdoorPvPHPBuffZones[i]); AddCapturePoint(new OPvPCapturePointHP(this, HP_TOWER_BROKEN_HILL)); AddCapturePoint(new OPvPCapturePointHP(this, HP_TOWER_OVERLOOK)); AddCapturePoint(new OPvPCapturePointHP(this, HP_TOWER_STADIUM)); return true; }
bool OutdoorPvPAzshara::SetupOutdoorPvP() { m_AllianceTowersControlled = 0; m_HordeTowersControlled = 0; // add the zones affected by the pvp buff for (int i = 0; i < OutdoorPvPAzsharaBuffZonesNum; ++i) RegisterZone(OutdoorPvPAzsharaBuffZones[i]); AddCapturePoint(new OPvPCapturePointAzshara(this, Azshara_TOWER_ALLIANCE)); AddCapturePoint(new OPvPCapturePointAzshara(this, Azshara_TOWER_HORDE)); AddCapturePoint(new OPvPCapturePointAzshara(this, Azshara_TOWER_NEUTRAL)); return true; }
OutdoorPvPObjectiveNA::OutdoorPvPObjectiveNA(OutdoorPvP *pvp) : OutdoorPvPObjective(pvp), m_capturable(true), m_GuardsAlive(0), m_ControllingFaction(0), m_HalaaState(HALAA_N), m_WyvernStateSouth(0), m_WyvernStateNorth(0), m_WyvernStateWest(0), m_WyvernStateEast(0), m_RespawnTimer(NA_RESPAWN_TIME), m_GuardCheckTimer(NA_GUARD_CHECK_TIME) { AddCapturePoint(182210,530,-1572.57,7945.3,-22.475,2.05949,0,0,0.857167,0.515038); }
OutdoorPvPObjectiveHP::OutdoorPvPObjectiveHP(OutdoorPvP *pvp,OutdoorPvPHPTowerType type) : OutdoorPvPObjective(pvp), m_TowerType(type) { AddCapturePoint(HPCapturePoints[type].entry, HPCapturePoints[type].map, HPCapturePoints[type].x, HPCapturePoints[type].y, HPCapturePoints[type].z, HPCapturePoints[type].o, HPCapturePoints[type].rot0, HPCapturePoints[type].rot1, HPCapturePoints[type].rot2, HPCapturePoints[type].rot3); AddObject(type, HPTowerFlags[type].entry, HPTowerFlags[type].map, HPTowerFlags[type].x, HPTowerFlags[type].y, HPTowerFlags[type].z, HPTowerFlags[type].o, HPTowerFlags[type].rot0, HPTowerFlags[type].rot1, HPTowerFlags[type].rot2, HPTowerFlags[type].rot3); }
bool OutdoorPvPEP::SetupOutdoorPvP() { m_AllianceTowersControlled = 0; m_HordeTowersControlled = 0; // add the zones affected by the pvp buff for (uint8 i = 0; i < OutdoorPvPEPBuffZonesNum; ++i) RegisterZone(OutdoorPvPEPBuffZones[i]); AddCapturePoint(new OPvPCapturePointEP(this,EP_TOWER_CROWNGUARD)); AddCapturePoint(new OPvPCapturePointEP(this,EP_TOWER_EASTWALL)); AddCapturePoint(new OPvPCapturePointEP(this,EP_TOWER_NORTHPASS)); AddCapturePoint(new OPvPCapturePointEP(this,EP_TOWER_PLAGUEWOOD)); return true; }
bool OutdoorPvPZM::SetupOutdoorPvP() { m_AllianceTowersControlled = 0; m_HordeTowersControlled = 0; // add the zones affected by the pvp buff for (uint8 i = 0; i < OutdoorPvPZMBuffZonesNum; ++i) RegisterZone(OutdoorPvPZMBuffZones[i]); AddCapturePoint(new OPvPCapturePointZM_Beacon(this, ZM_BEACON_WEST)); AddCapturePoint(new OPvPCapturePointZM_Beacon(this, ZM_BEACON_EAST)); m_GraveYard = new OPvPCapturePointZM_GraveYard(this); AddCapturePoint(m_GraveYard); // though the update function isn't used, the handleusego is! return true; }
bool OutdoorPvPGH::SetupOutdoorPvP() { RegisterZone(GH_OUTDOORPVP_ZONE); m_obj = new OPvPCapturePointGH(this); if (!m_obj) return false; AddCapturePoint(m_obj); return true; }
bool OutdoorPvPGH::SetupOutdoorPvP() { RegisterZone(GH_ZONE); if (m_obj = new OPvPCapturePointGH(this)) { AddCapturePoint(m_obj); return true; } return false; }
// PWT OutdoorPvPObjectiveEP_PWT::OutdoorPvPObjectiveEP_PWT(OutdoorPvP *pvp) : OutdoorPvPObjective(pvp), m_TowerState(EP_TS_N) { AddCapturePoint(EPCapturePoints[EP_PWT].entry,EPCapturePoints[EP_PWT].map,EPCapturePoints[EP_PWT].x,EPCapturePoints[EP_PWT].y,EPCapturePoints[EP_PWT].z,EPCapturePoints[EP_PWT].o,EPCapturePoints[EP_PWT].rot0,EPCapturePoints[EP_PWT].rot1,EPCapturePoints[EP_PWT].rot2,EPCapturePoints[EP_PWT].rot3); AddObject(EP_PWT_FLAGS,EPTowerFlags[EP_PWT].entry,EPTowerFlags[EP_PWT].map,EPTowerFlags[EP_PWT].x,EPTowerFlags[EP_PWT].y,EPTowerFlags[EP_PWT].z,EPTowerFlags[EP_PWT].o,EPTowerFlags[EP_PWT].rot0,EPTowerFlags[EP_PWT].rot1,EPTowerFlags[EP_PWT].rot2,EPTowerFlags[EP_PWT].rot3); memset(m_taximask, 0, sizeof(m_taximask)); SetTaximaskNode(EP_PWT_Taxi); SetTaximaskNode(EP_CGT_Taxi); SetTaximaskNode(EP_EWT_Taxi); SetTaximaskNode(EP_NPT_Taxi); }
bool OutdoorPvPNA::SetupOutdoorPvP() { // m_TypeId = OUTDOOR_PVP_NA; _MUST_ be set in ctor, because of spawns cleanup // add the zones affected by the pvp buff RegisterZone(NA_BUFF_ZONE); // halaa m_obj = new OPvPCapturePointNA(this); AddCapturePoint(m_obj); return true; }
bool OutdoorPvPTF::SetupOutdoorPvP() { m_AllianceTowersControlled = 0; m_HordeTowersControlled = 0; m_IsLocked = false; m_LockTimer = TF_LOCK_TIME; m_LockTimerUpdate = 0; hours_left = 6; second_digit = 0; first_digit = 0; // add the zones affected by the pvp buff for (uint8 i = 0; i < OutdoorPvPTFBuffZonesNum; ++i) RegisterZone(OutdoorPvPTFBuffZones[i]); AddCapturePoint(new OPvPCapturePointTF(this, TF_TOWER_NW)); AddCapturePoint(new OPvPCapturePointTF(this, TF_TOWER_N)); AddCapturePoint(new OPvPCapturePointTF(this, TF_TOWER_NE)); AddCapturePoint(new OPvPCapturePointTF(this, TF_TOWER_SE)); AddCapturePoint(new OPvPCapturePointTF(this, TF_TOWER_S)); return true; }
bool OutdoorPvPHS::SetupOutdoorPvP() { m_PlayerCount = 0; m_HordeCount = 0; m_AllianceCount = 0; m_HordeBuff = 0; m_AllianceBuff = 0; m_ChestTimer = HS_FFA_CHEST_TIMER; m_ChestAnnounceTimer = HS_FFA_CHEST_ANNOUNCE_TIMER; m_ChestDebugTimer = 60000; m_ChestGUID = 0; m_TenacityTimer = HS_TENACITY_TIME; m_LastResurrectTime = 0; m_DurnholdeOwner = 0; m_DurnholdeLockout = 0; m_TowerStateEast = 0; m_TowerStateWest = 0; m_TowerStateMain = 0; RegisterZone(HS_ZONE); AddCapturePoint(new OPvPCapturePointHS(this,HS_TOWER_LOWER)); AddCapturePoint(new OPvPCapturePointHS(this,HS_TOWER_LOWER_EAST)); AddCapturePoint(new OPvPCapturePointHS(this,HS_TOWER_MAIN)); sLog->outString("HillsbradMGR : Loaded."); return true; }
void BattlefieldWG::OnGameObjectCreate(GameObject* go) { bool isWorkshop = false; uint8 workshopId = 0; switch (go->GetEntry()) { case GO_WINTERGRASP_FACTORY_BANNER_NE: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_NE; break; case GO_WINTERGRASP_FACTORY_BANNER_NW: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_NW; break; case GO_WINTERGRASP_FACTORY_BANNER_SE: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_SE; break; case GO_WINTERGRASP_FACTORY_BANNER_SW: isWorkshop = true; workshopId = BATTLEFIELD_WG_WORKSHOP_SW; break; } if (!isWorkshop) return; for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr) { if (WGWorkshop* workshop = (*itr)) { if (workshop->workshopId == workshopId) { WintergraspCapturePoint* capturePoint = new WintergraspCapturePoint(this, GetAttackerTeam()); capturePoint->SetCapturePointData(go); capturePoint->LinkToWorkshop(workshop); AddCapturePoint(capturePoint); break; } } } }
// PWT OutdoorPvPObjectiveEP_PWT::OutdoorPvPObjectiveEP_PWT(OutdoorPvP *pvp) : OutdoorPvPObjective(pvp), m_TowerState(EP_TS_N), m_FlightMasterSpawned(0) { AddCapturePoint(EPCapturePoints[EP_PWT].entry,EPCapturePoints[EP_PWT].map,EPCapturePoints[EP_PWT].x,EPCapturePoints[EP_PWT].y,EPCapturePoints[EP_PWT].z,EPCapturePoints[EP_PWT].o,EPCapturePoints[EP_PWT].rot0,EPCapturePoints[EP_PWT].rot1,EPCapturePoints[EP_PWT].rot2,EPCapturePoints[EP_PWT].rot3); AddObject(EP_PWT_FLAGS,EPTowerFlags[EP_PWT].entry,EPTowerFlags[EP_PWT].map,EPTowerFlags[EP_PWT].x,EPTowerFlags[EP_PWT].y,EPTowerFlags[EP_PWT].z,EPTowerFlags[EP_PWT].o,EPTowerFlags[EP_PWT].rot0,EPTowerFlags[EP_PWT].rot1,EPTowerFlags[EP_PWT].rot2,EPTowerFlags[EP_PWT].rot3); }
// CGT OutdoorPvPObjectiveEP_CGT::OutdoorPvPObjectiveEP_CGT(OutdoorPvP *pvp) : OutdoorPvPObjective(pvp), m_TowerState(EP_TS_N), m_GraveyardSide(0) { AddCapturePoint(EPCapturePoints[EP_CGT].entry,EPCapturePoints[EP_CGT].map,EPCapturePoints[EP_CGT].x,EPCapturePoints[EP_CGT].y,EPCapturePoints[EP_CGT].z,EPCapturePoints[EP_CGT].o,EPCapturePoints[EP_CGT].rot0,EPCapturePoints[EP_CGT].rot1,EPCapturePoints[EP_CGT].rot2,EPCapturePoints[EP_CGT].rot3); AddObject(EP_CGT_FLAGS,EPTowerFlags[EP_CGT].entry,EPTowerFlags[EP_CGT].map,EPTowerFlags[EP_CGT].x,EPTowerFlags[EP_CGT].y,EPTowerFlags[EP_CGT].z,EPTowerFlags[EP_CGT].o,EPTowerFlags[EP_CGT].rot0,EPTowerFlags[EP_CGT].rot1,EPTowerFlags[EP_CGT].rot2,EPTowerFlags[EP_CGT].rot3); }
OutdoorPvPObjectiveEP_EWT::OutdoorPvPObjectiveEP_EWT(OutdoorPvP *pvp) : OutdoorPvPObjective(pvp), m_TowerState(EP_TS_N), m_UnitsSummonedSide(0) { AddCapturePoint(EPCapturePoints[EP_EWT].entry,EPCapturePoints[EP_EWT].map,EPCapturePoints[EP_EWT].x,EPCapturePoints[EP_EWT].y,EPCapturePoints[EP_EWT].z,EPCapturePoints[EP_EWT].o,EPCapturePoints[EP_EWT].rot0,EPCapturePoints[EP_EWT].rot1,EPCapturePoints[EP_EWT].rot2,EPCapturePoints[EP_EWT].rot3); AddObject(EP_EWT_FLAGS,EPTowerFlags[EP_EWT].entry,EPTowerFlags[EP_EWT].map,EPTowerFlags[EP_EWT].x,EPTowerFlags[EP_EWT].y,EPTowerFlags[EP_EWT].z,EPTowerFlags[EP_EWT].o,EPTowerFlags[EP_EWT].rot0,EPTowerFlags[EP_EWT].rot1,EPTowerFlags[EP_EWT].rot2,EPTowerFlags[EP_EWT].rot3); }
bool OPvPWintergrasp::SetupOutdoorPvP() { m_defender = TeamId(rand()%2); // Load buildings AreaPOIList areaPOIs; float minX = 9999, minY = 9999, maxX = -9999, maxY = -9999; for(uint32 i = 0; i < sAreaPOIStore.GetNumRows(); ++i) { const AreaPOIEntry * poiInfo = sAreaPOIStore.LookupEntry(i); if(poiInfo && poiInfo->zoneId == ZONE_WINTERGRASP) { areaPOIs.push_back(poiInfo); if(minX > poiInfo->x) minX = poiInfo->x; if(minY > poiInfo->y) minY = poiInfo->y; if(maxX < poiInfo->x) maxX = poiInfo->x; if(maxY < poiInfo->y) maxY = poiInfo->y; } } minX -= 20; minY -= 20; maxX += 20; maxY += 20; QueryResult *result = WorldDatabase.PQuery("SELECT `guid` FROM `gameobject`,`gameobject_template`" " WHERE `gameobject`.`map`=571" " AND `gameobject`.`position_x`>%f AND `gameobject`.`position_y`>%f" " AND `gameobject`.`position_x`<%f AND `gameobject`.`position_y`<%f" " AND `gameobject_template`.`type`=33" " AND `gameobject`.`id`=`gameobject_template`.`entry`", minX, minY, maxX, maxY); if(!result) return false; do { Field *fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); GameObjectData const * goData = objmgr.GetGOData(guid); if(!goData) // this should not happen continue; float x = goData->posX, y = goData->posY; float minDist = 100; AreaPOIList::iterator poi = areaPOIs.end(); for(AreaPOIList::iterator itr = areaPOIs.begin(); itr != areaPOIs.end(); ++itr) { if(!(*itr)->icon[1]) // note: may for other use continue; float dist = (abs((*itr)->x - x) + abs((*itr)->y - y)); if(minDist > dist) { minDist = dist; poi = itr; } } if(poi == areaPOIs.end()) continue; // add building to the list TeamId teamId = x > POS_X_CENTER ? m_defender : OTHER_TEAM(m_defender); m_buildingStates[guid] = new BuildingState((*poi)->worldState, teamId, m_defender != TEAM_ALLIANCE); areaPOIs.erase(poi); //disable for now //continue; // add capture point uint32 capturePointEntry = 0; //192028 192029 //192030 192031 //192032 192033 //190475 190487 not sure //192626 192627 //194959 194960 switch(goData->id) { case 192028: capturePointEntry = 190475; break; case 192029: capturePointEntry = 190487; break; case 192030: capturePointEntry = 190475; break; case 192031: capturePointEntry = 190487; break; case 192032: capturePointEntry = 190475; break; case 192033: capturePointEntry = 190487; break; } if(capturePointEntry) { uint32 engGuid = 0; QueryResult *result = WorldDatabase.PQuery("SELECT `guid` FROM `creature`" " WHERE `creature`.`map`=571" " AND `creature`.`id` IN (%u, %u);", CRE_ENG_A, CRE_ENG_H); if(!result) { sLog.outError("Cannot find siege workshop master in creature!"); continue; } float minDist = 100; do { Field *fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); const CreatureData *creData = objmgr.GetCreatureData(guid); if(!creData) continue; float dist = (abs(creData->posX - x) + abs(creData->posY - y)); if(minDist > dist) { minDist = dist; engGuid = guid; } }while(result->NextRow()); delete result; if(!engGuid) { sLog.outError("Cannot find nearby siege workshop master!"); continue; } SiegeWorkshop *workshop = new SiegeWorkshop(this, m_buildingStates[guid]); if(!workshop->SetCapturePointData(capturePointEntry, goData->mapid, goData->posX, goData->posY, goData->posZ)) { delete workshop; sLog.outError("Cannot add capture point!"); continue; } const CreatureData *creData = objmgr.GetCreatureData(engGuid); if(!creData) continue; workshop->m_engEntry = const_cast<uint32*>(&creData->id); const_cast<CreatureData*>(creData)->displayid = 0; workshop->m_workshopGuid = guid; workshop->m_engGuid = engGuid; //workshop->AddGO(0, guid, goData->id); //workshop->AddCre(0, engGuid, creData->id); //sLog.outDebug("Demolisher Engineerer lowguid %u is linked to workshop lowguid %u.", engGuid, guid); AddCapturePoint(workshop); m_buildingStates[guid]->type = BUILDING_WORKSHOP; workshop->SetStateByBuildingState(); } }while(result->NextRow()); delete result; //for(AreaPOIList::iterator itr = areaPOIs.begin(); itr != areaPOIs.end(); ++itr) // sLog.outError("not assigned %u %f %f", (*itr)->id, (*itr)->x, (*itr)->y); //gameeventmgr.StartInternalEvent(GameEventWintergraspDefender[m_defender]); //Titan Relic eventid = 19982 objmgr.AddGOData(192829, 571, 5440, 2840.8, 420.43, 0); LoadTeamPair(m_goDisplayPair, GODisplayPair); LoadTeamPair(m_creEntryPair, CreatureEntryPair); m_wartime = false; m_timer = sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_START_TIME) * MINUTE * IN_MILISECONDS; RegisterZone(ZONE_WINTERGRASP); return true; }
bool BattlefieldTB::SetupBattlefield() { m_TypeId = BATTLEFIELD_TB; //View enum BattlefieldTypes m_BattleId = BATTLEFIELD_BATTLEID_TB; m_ZoneId = 5095; // Tol Barad _MapId = 732; // Map X m_MaxPlayer = sWorld->getIntConfig(CONFIG_TOL_BARAD_PLR_MAX); m_enable = sWorld->getBoolConfig(CONFIG_TOL_BARAD_ENABLE); m_MinPlayer = sWorld->getIntConfig(CONFIG_TOL_BARAD_PLR_MIN); m_MinLevel = sWorld->getIntConfig(CONFIG_TOL_BARAD_PLR_MIN_LVL); m_BattleTime = sWorld->getIntConfig(CONFIG_TOL_BARAD_BATTLETIME)*60*1000; // Time of battle (in ms) m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_TOL_BARAD_NOBATTLETIME)*60*1000; // Time between to battle (in ms) m_TimeForAcceptInvite = 20; // in second m_StartGroupingTimer = 15*60*1000; // in ms m_StartGrouping=false; KickPositionA.Relocate(-363.897f, 1047.931f, 22, 0); KickPositionA.m_mapId = _MapId; KickPositionH.Relocate(-609.336f, 1392.194f, 21.5f, 0); KickPositionH.m_mapId = _MapId; RegisterZone(m_ZoneId); m_Data32.resize(BATTLEFIELD_TB_DATA_MAX); m_saveTimer = 60000; // Init GraveYards SetGraveyardNumber(BATTLEFIELD_TB_GY_MAX); //Load from db if(( sWorld->getWorldState(5387) == 0 ) && (sWorld->getWorldState(5384) == 0) && (sWorld->getWorldState(TBClockWorldState[0]) == 0 )) { sWorld->setWorldState(5387, false); sWorld->setWorldState(5384, urand(0, 1)); sWorld->setWorldState(TBClockWorldState[0], m_NoWarBattleTime); } m_WarTime = sWorld->getWorldState(5387); m_DefenderTeam = (TeamId)sWorld->getWorldState(5384); m_Timer = sWorld->getWorldState(TBClockWorldState[0]); if (m_WarTime) { m_WarTime = false; m_Timer = 10 * 60 * 1000; } for (uint8 i=0; i<BATTLEFIELD_TB_GY_MAX; i++) { BfGraveYardTB* gy = new BfGraveYardTB(this); if (TBGraveYard[i].startcontrol == TEAM_NEUTRAL) { // In no war time Gy is control by defender gy->Init(45079, 45066, TBGraveYard[i].x, TBGraveYard[i].y, TBGraveYard[i].z, TBGraveYard[i].o, m_DefenderTeam, TBGraveYard[i].guid); } else gy->Init(45079, 45066, TBGraveYard[i].x, TBGraveYard[i].y, TBGraveYard[i].z, TBGraveYard[i].o, TBGraveYard[i].startcontrol, TBGraveYard[i].guid); gy->SetTextId(TBGraveYard[i].textid); m_GraveYardList[i] = gy; } // Pop des gameobject et creature du TBWorkShop for (uint8 i = 0; i<TB_MAX_WORKSHOP; i++) { BfTBWorkShopData* ws = new BfTBWorkShopData(this); // Create new object // Init:setup variable ws->Init(TBCapturePointDataBase[i].worldstate, TBCapturePointDataBase[i].type, TBCapturePointDataBase[i].nameid); // Spawn associate gameobject on this point (Horde/Alliance flags) for (int g = 0; g<TBCapturePointDataBase[i].nbgob; g++) { ws->AddGameObject(TBCapturePointDataBase[i].GameObjectData[g]); } // Create PvPCapturePoint if (TBCapturePointDataBase[i].type < BATTLEFIELD_TB_FORT_MAX) { ws->ChangeControl(GetAttackerTeam(), true); // Update control of this point m_Data32[BATTLEFIELD_TB_DATA_CAPTURED_FORT_ATT]++; m_Data32[BATTLEFIELD_TB_DATA_CAPTURED_FORT_DEF]--; // Create Object BfCapturePointTB* TBWorkShop = new BfCapturePointTB(this, GetAttackerTeam()); // Spawn gameobject associate (see in OnGameObjectCreate, of OutdoorPvP for see association) if (TBWorkShop->SetCapturePointData(TBCapturePointDataBase[i].CapturePoint.entryh, 732, TBCapturePointDataBase[i].CapturePoint.x, TBCapturePointDataBase[i].CapturePoint.y, TBCapturePointDataBase[i].CapturePoint.z, 0)) { TBWorkShop->LinkToWorkShop(ws); // Link our point to the capture point (for faction changement) AddCapturePoint(TBWorkShop); // Add this capture point to list for update this (view in Update() of OutdoorPvP) } } else { m_Data32[BATTLEFIELD_TB_DATA_CAPTURED_FORT_ATT]--; m_Data32[BATTLEFIELD_TB_DATA_CAPTURED_FORT_DEF]++; ws->ChangeControl(GetDefenderTeam(), true); // Update control of this point (Keep TBWorkShop= to deffender team) } WorkShopList.insert(ws); } // Spawning npc in keep for (uint8 i = 0; i<TB_MAX_KEEP_NPC; i++) { // Horde npc if (Creature* creature = SpawnCreature(TBKeepNPC[i].entryh, TBKeepNPC[i].x, TBKeepNPC[i].y, TBKeepNPC[i].z, TBKeepNPC[i].o, TEAM_HORDE)) KeepCreature[TEAM_HORDE].insert(creature->GetGUID()); // Alliance npc if (Creature* creature = SpawnCreature(TBKeepNPC[i].entrya, TBKeepNPC[i].x, TBKeepNPC[i].y, TBKeepNPC[i].z, TBKeepNPC[i].o, TEAM_ALLIANCE)) KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); } // Hide keep npc for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) if (Unit* unit = ObjectAccessor::FindUnit((*itr))) if (Creature* creature = unit->ToCreature()) HideNpc(creature); // Spawning battle npcs for (uint8 i = 0; i<TB_MAX_KEEP_NPC; i++) { // Horde npc if (Creature* creature = SpawnCreature(TBWarNPC[i].entryh, TBWarNPC[i].x, TBWarNPC[i].y, TBWarNPC[i].z, TBWarNPC[i].o, TEAM_HORDE)) WarCreature[TEAM_HORDE].insert(creature->GetGUID()); // Alliance npc if (Creature* creature = SpawnCreature(TBWarNPC[i].entrya, TBWarNPC[i].x, TBWarNPC[i].y, TBWarNPC[i].z, TBWarNPC[i].o, TEAM_ALLIANCE)) WarCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); } // Hide battle npcs for (GuidSet::const_iterator itr = WarCreature[GetDefenderTeam()].begin(); itr != WarCreature[GetDefenderTeam()].end(); ++itr) if (Unit* unit = ObjectAccessor::FindUnit((*itr))) if (Creature* creature = unit->ToCreature()) HideNpc(creature); for (GuidSet::const_iterator itr = WarCreature[GetAttackerTeam()].begin(); itr != WarCreature[GetAttackerTeam()].end(); ++itr) if (Unit* unit = ObjectAccessor::FindUnit((*itr))) if (Creature* creature = unit->ToCreature()) HideNpc(creature); //Spawning Buiding for (uint8 i = 0; i<TB_MAX_OBJ; i++) { GameObject* go = SpawnGameObject(TBGameObjectBuillding[i].entry, TBGameObjectBuillding[i].x, TBGameObjectBuillding[i].y, TBGameObjectBuillding[i].z, TBGameObjectBuillding[i].o); if (go) { BfTBGameObjectBuilding* b = new BfTBGameObjectBuilding(this); b->Init(go, TBGameObjectBuillding[i].type, TBGameObjectBuillding[i].WorldState, TBGameObjectBuillding[i].nameid); BuildingsInZone.insert(b); } } return true; }
// NPT OPvPCapturePointEP_NPT::OPvPCapturePointEP_NPT(OutdoorPvP *pvp) : OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_SummonedGOSide(0) { AddCapturePoint(EPCapturePoints[EP_NPT].entry,EPCapturePoints[EP_NPT].map,EPCapturePoints[EP_NPT].x,EPCapturePoints[EP_NPT].y,EPCapturePoints[EP_NPT].z,EPCapturePoints[EP_NPT].o,EPCapturePoints[EP_NPT].rot0,EPCapturePoints[EP_NPT].rot1,EPCapturePoints[EP_NPT].rot2,EPCapturePoints[EP_NPT].rot3); AddObject(EP_NPT_FLAGS,EPTowerFlags[EP_NPT].entry,EPTowerFlags[EP_NPT].map,EPTowerFlags[EP_NPT].x,EPTowerFlags[EP_NPT].y,EPTowerFlags[EP_NPT].z,EPTowerFlags[EP_NPT].o,EPTowerFlags[EP_NPT].rot0,EPTowerFlags[EP_NPT].rot1,EPTowerFlags[EP_NPT].rot2,EPTowerFlags[EP_NPT].rot3); }
void BattlefieldTB::UpdateNPCsAndGameObjects() { for (ObjectGuid guid : BattleInactiveNPCs) if (Creature* creature = GetCreature(guid)) HideNpc(creature); for (ObjectGuid guid : BattleInactiveGOs) if (GameObject* gameobject = GetGameObject(guid)) gameobject->SetRespawnTime(RESPAWN_ONE_DAY); for (ObjectGuid guid : TemporaryNPCs) if (Creature* creature = GetCreature(guid)) creature->RemoveFromWorld(); TemporaryNPCs.clear(); for (ObjectGuid guid : TemporaryGOs) if (GameObject* gameobject = GetGameObject(guid)) gameobject->Delete(); TemporaryGOs.clear(); // Tol Barad gates - closed during warmup if (GameObject* gates = GetGameObject(TBGatesGUID)) gates->SetGoState(GetState() == BATTLEFIELD_WARMUP ? GO_STATE_READY : GO_STATE_ACTIVE); // Baradin Hold door - open when inactive if (GameObject* door = GetGameObject(TBDoorGUID)) door->SetGoState(GetState() == BATTLEFIELD_INACTIVE ? GO_STATE_ACTIVE : GO_STATE_READY); // Decide which cellblock and questgiver will be active. m_iCellblockRandom = GetState() == BATTLEFIELD_INACTIVE ? urand(CELLBLOCK_THE_HOLE, CELLBLOCK_CURSED_DEPTHS) : uint8(CELLBLOCK_NONE); // To The Hole gate if (GameObject* door = GetGameObject(m_gateToTheHoleGUID)) door->SetGoState(m_iCellblockRandom == CELLBLOCK_THE_HOLE ? GO_STATE_ACTIVE : GO_STATE_READY); // D-Block gate if (GameObject* door = GetGameObject(m_gateDBlockGUID)) door->SetGoState(m_iCellblockRandom == CELLBLOCK_D_BLOCK ? GO_STATE_ACTIVE : GO_STATE_READY); // Cursed Depths gate if (GameObject* door = GetGameObject(m_gateCursedDepthsGUID)) door->SetGoState(m_iCellblockRandom == CELLBLOCK_CURSED_DEPTHS ? GO_STATE_ACTIVE : GO_STATE_READY); if (GetState() == BATTLEFIELD_INACTIVE) { // Delete capture points for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) itr->second->DelCapturePoint(); m_capturePoints.clear(); // Create capture points for (uint8 i = 0; i < TB_BASE_COUNT; i++) { TolBaradCapturePoint* capturePoint = new TolBaradCapturePoint(this, GetDefenderTeam()); //Spawn flag pole if (GameObject* go = SpawnGameObject(TBCapturePoints[i].entryFlagPole[GetDefenderTeam()], TBCapturePoints[i].pos, QuaternionData())) { go->SetGoArtKit(GetDefenderTeam() == TEAM_ALLIANCE ? TB_GO_ARTKIT_FLAG_ALLIANCE : TB_GO_ARTKIT_FLAG_HORDE); capturePoint->SetCapturePointData(go); } AddCapturePoint(capturePoint); } for (ObjectGuid guid : BattleInactiveNPCs) if (Creature* creature = GetCreature(guid)) ShowNpc(creature, true); for (ObjectGuid guid : BattleInactiveGOs) if (GameObject* gameobject = GetGameObject(guid)) gameobject->SetRespawnTime(RESPAWN_IMMEDIATELY); for (uint8 i = 0; i < TB_QUEST_INFANTRY_MAX; i++) { uint32 entry = TB_QUEST_INFANTRY[GetDefenderTeam()][urand(0,3)]; if (Creature* creature = SpawnCreature(entry, TBQuestInfantrySpawnData[i])) TemporaryNPCs.insert(creature->GetGUID()); } for (uint8 i = 0; i < TB_GUARDS_MAX; i++) if (Creature* creature = SpawnCreature(GetDefenderTeam() == TEAM_ALLIANCE ? NPC_BARADIN_GUARD : NPC_HELLSCREAMS_SENTRY, GuardNPCSpawns[i])) TemporaryNPCs.insert(creature->GetGUID()); for (uint8 i = 0; i < TB_FACTION_NPC_MAX; i++) if (Creature* creature = SpawnCreature(GetDefenderTeam() == TEAM_ALLIANCE ? FactionNPCSpawns[i].entryAlliance : FactionNPCSpawns[i].entryHorde, FactionNPCSpawns[i].pos)) TemporaryNPCs.insert(creature->GetGUID()); if (Creature* creature = SpawnCreature(RandomQuestgivers[GetDefenderTeam()][m_iCellblockRandom], RandomQuestgiverPos)) TemporaryNPCs.insert(creature->GetGUID()); // Spawn portals for (uint8 i = 0; i < TB_PORTAL_MAX; i++) if (GameObject* go = SpawnGameObject(TBPortalEntry[GetDefenderTeam()], TBPortals[i], QuaternionData())) TemporaryGOs.insert(go->GetGUID()); // Update towers for (ObjectGuid guid : Towers) if (GameObject* go = GetGameObject(guid)) go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING); } else if (GetState() == BATTLEFIELD_IN_PROGRESS) { for (uint8 i = 0; i < TB_ABANDONED_SIEGE_ENGINE_COUNT; i++) if (Creature* creature = SpawnCreature(NPC_ABANDONED_SIEGE_ENGINE, TBAbandonedSiegeEngineSpawnData[i])) TemporaryNPCs.insert(creature->GetGUID()); for (ObjectGuid guid : Towers) { if (GameObject* go = GetGameObject(guid)) { go->SetDestructibleState(GO_DESTRUCTIBLE_INTACT); go->ModifyHealth(go->GetGOValue()->Building.MaxHealth); } } } // Spawn banners for (uint8 i = 0; i < TB_BANNER_MAX; i++) if (GameObject* go = SpawnGameObject(TBBannerEntry[GetDefenderTeam()], TBBanners[i], QuaternionData())) TemporaryGOs.insert(go->GetGUID()); // Set graveyard controls for (uint8 i = 0; i < BATTLEFIELD_TB_GRAVEYARD_MAX; i++) if (BfGraveyard* graveyard = GetGraveyardById(i)) graveyard->GiveControlTo(!IsWarTime() || TBGraveyards[i].defenderControls ? GetDefenderTeam() : GetAttackerTeam()); };
OutdoorPvPObjectiveZM_Beacon::OutdoorPvPObjectiveZM_Beacon(OutdoorPvP *pvp, ZM_BeaconType type) : OutdoorPvPObjective(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N) { AddCapturePoint(ZMCapturePoints[type].entry,ZMCapturePoints[type].map,ZMCapturePoints[type].x,ZMCapturePoints[type].y,ZMCapturePoints[type].z,ZMCapturePoints[type].o,ZMCapturePoints[type].rot0,ZMCapturePoints[type].rot1,ZMCapturePoints[type].rot2,ZMCapturePoints[type].rot3); }
bool OPvPWintergrasp::SetupOutdoorPvP() { if(!sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_ENABLED)) return false; m_defender = TeamId(rand()%2); m_changeDefender = false; m_workshopCount[TEAM_ALLIANCE] = 0; m_workshopCount[TEAM_HORDE] = 0; m_towerCount = 3; // Select POI AreaPOIList areaPOIs; float minX = 9999, minY = 9999, maxX = -9999, maxY = -9999; for (uint32 i = 0; i < sAreaPOIStore.GetNumRows(); ++i) { const AreaPOIEntry * poiInfo = sAreaPOIStore.LookupEntry(i); if (poiInfo && poiInfo->zoneId == ZONE_WINTERGRASP) { areaPOIs.push_back(poiInfo); if (minX > poiInfo->x) minX = poiInfo->x; if (minY > poiInfo->y) minY = poiInfo->y; if (maxX < poiInfo->x) maxX = poiInfo->x; if (maxY < poiInfo->y) maxY = poiInfo->y; } } minX -= 20; minY -= 20; maxX += 20; maxY += 20; QueryResult *result = WorldDatabase.PQuery("SELECT guid FROM gameobject,gameobject_template" " WHERE gameobject.map=571" " AND gameobject.position_x>%f AND gameobject.position_y>%f" " AND gameobject.position_x<%f AND gameobject.position_y<%f" " AND gameobject_template.type=33" " AND gameobject.id=gameobject_template.entry", minX, minY, maxX, maxY); if (!result) return false; do { Field *fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); GameObjectData const * goData = objmgr.GetGOData(guid); if (!goData) // this should not happen continue; float x = goData->posX, y = goData->posY; float minDist = 100; AreaPOIList::iterator poi = areaPOIs.end(); for (AreaPOIList::iterator itr = areaPOIs.begin(); itr != areaPOIs.end(); ++itr) { if (!(*itr)->icon[1]) // note: may for other use continue; float dist = (abs((*itr)->x - x) + abs((*itr)->y - y)); if (minDist > dist) { minDist = dist; poi = itr; } } if (poi == areaPOIs.end()) continue; // add building to the list TeamId teamId = x > POS_X_CENTER ? m_defender : OTHER_TEAM(m_defender); m_buildingStates[guid] = new BuildingState((*poi)->worldState, teamId, m_defender != TEAM_ALLIANCE); if ((*poi)->id == 2246) { m_gate = m_buildingStates[guid]; } areaPOIs.erase(poi); // add capture point uint32 capturePointEntry = 0; switch(goData->id) { case 192028: capturePointEntry = 190475; break; case 192029: capturePointEntry = 190487; break; // not sure case 192030: capturePointEntry = 190475; break; case 192031: capturePointEntry = 190487; break; case 192032: capturePointEntry = 190475; break; case 192033: capturePointEntry = 190487; break; } if (capturePointEntry) { uint32 engGuid = 0; QueryResult *result = WorldDatabase.PQuery("SELECT guid FROM creature" " WHERE creature.map=571" " AND creature.id IN (%u, %u);", CRE_ENG_A, CRE_ENG_H); if (!result) { sLog.outError("Cannot find siege workshop master in creature!"); continue; } float minDist = 100; do { Field *fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); const CreatureData *creData = objmgr.GetCreatureData(guid); if (!creData) continue; float dist = (abs(creData->posX - x) + abs(creData->posY - y)); if (minDist > dist) { minDist = dist; engGuid = guid; } }while(result->NextRow()); delete result; if (!engGuid) { sLog.outError("Cannot find nearby siege workshop master!"); continue; } SiegeWorkshop *workshop = new SiegeWorkshop(this, m_buildingStates[guid]); if (!workshop->SetCapturePointData(capturePointEntry, goData->mapid, goData->posX + 40 * cos(goData->orientation + M_PI / 2), goData->posY + 40 * sin(goData->orientation + M_PI / 2), goData->posZ)) { delete workshop; sLog.outError("Cannot add capture point!"); continue; } const CreatureData *creData = objmgr.GetCreatureData(engGuid); if (!creData) continue; workshop->m_engEntry = const_cast<uint32*>(&creData->id); const_cast<CreatureData*>(creData)->displayid = 0; workshop->m_workshopGuid = guid; workshop->m_engGuid = engGuid; //workshop->AddGO(0, guid, goData->id); //workshop->AddCre(0, engGuid, creData->id); //sLog.outDebug("Demolisher Engineerer lowguid %u is linked to workshop lowguid %u.", engGuid, guid); AddCapturePoint(workshop); m_buildingStates[guid]->type = BUILDING_WORKSHOP; workshop->SetTeamByBuildingState(); } }while(result->NextRow()); delete result; if (!m_gate) { sLog.outError("Cannot find wintergrasp fortress gate!"); return false; } // Load Graveyard GraveYardMap::const_iterator graveLow = objmgr.mGraveYardMap.lower_bound(ZONE_WINTERGRASP); GraveYardMap::const_iterator graveUp = objmgr.mGraveYardMap.upper_bound(ZONE_WINTERGRASP); for (AreaPOIList::iterator itr = areaPOIs.begin(); itr != areaPOIs.end();) { if ((*itr)->icon[1] == 8) { // find or create grave yard const WorldSafeLocsEntry *loc = objmgr.GetClosestGraveYard((*itr)->x, (*itr)->y, (*itr)->z, (*itr)->mapId, 0); if (!loc) { ++itr; continue; } GraveYardMap::const_iterator graveItr; for (graveItr = graveLow; graveItr != graveUp; ++graveItr) if (graveItr->second.safeLocId == loc->ID) break; if (graveItr == graveUp) { GraveYardData graveData; graveData.safeLocId = loc->ID; graveData.team = 0; graveItr = objmgr.mGraveYardMap.insert(std::make_pair(ZONE_WINTERGRASP, graveData)); } for (BuildingStateMap::iterator stateItr = m_buildingStates.begin(); stateItr != m_buildingStates.end(); ++stateItr) { if (stateItr->second->worldState == (*itr)->worldState) { stateItr->second->graveTeam = const_cast<uint32*>(&graveItr->second.team); break; } } areaPOIs.erase(itr++); } else ++itr; } //for (AreaPOIList::iterator itr = areaPOIs.begin(); itr != areaPOIs.end(); ++itr) // sLog.outError("not assigned %u %f %f", (*itr)->id, (*itr)->x, (*itr)->y); //gameeventmgr.StartInternalEvent(GameEventWintergraspDefender[m_defender]); //Titan Relic eventid = 19982 objmgr.AddGOData(192829, 571, 5440, 2840.8, 420.43 + 10, 0); LoadTeamPair(m_goDisplayPair, GODisplayPair); LoadTeamPair(m_creEntryPair, CreatureEntryPair); m_wartime = false; m_timer = sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_START_TIME) * MINUTE * IN_MILISECONDS; // Load custom rewards if (sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR)) for (int i = 0; i < WG_REWARD_EVENT_MAX; ++i) m_customHonorReward[i] = sWorld.getConfig(CONFIG_OUTDOORPVP_WINTERGRASP_CUSTOM_HONOR_0 + i); RemoveOfflinePlayerWGAuras(); RegisterZone(ZONE_WINTERGRASP); return true; }
OutdoorPvPObjectiveTF::OutdoorPvPObjectiveTF(OutdoorPvP *pvp, OutdoorPvPTF_TowerType type) : OutdoorPvPObjective(pvp), m_TowerType(type), m_TowerState(TF_TOWERSTATE_N) { AddCapturePoint(TFCapturePoints[type].entry,TFCapturePoints[type].map,TFCapturePoints[type].x,TFCapturePoints[type].y,TFCapturePoints[type].z,TFCapturePoints[type].o,TFCapturePoints[type].rot0,TFCapturePoints[type].rot1,TFCapturePoints[type].rot2,TFCapturePoints[type].rot3); }
bool BattlefieldTB::SetupBattlefield() { m_TypeId = BATTLEFIELD_TB; m_BattleId = BATTLEFIELD_BATTLEID_TB; m_ZoneId = BATTLEFIELD_TB_ZONEID; m_MapId = BATTLEFIELD_TB_MAPID; m_MaxPlayer = sWorld->getIntConfig(CONFIG_TOL_BARAD_PLR_MAX); m_IsEnabled = sWorld->getBoolConfig(CONFIG_TOL_BARAD_ENABLE); m_MinPlayer = sWorld->getIntConfig(CONFIG_TOL_BARAD_PLR_MIN); m_MinLevel = sWorld->getIntConfig(CONFIG_TOL_BARAD_PLR_MIN_LVL); m_BattleTime = sWorld->getIntConfig(CONFIG_TOL_BARAD_BATTLETIME) * MINUTE * IN_MILLISECONDS; m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_TOL_BARAD_NOBATTLETIME) * MINUTE * IN_MILLISECONDS; m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_TOL_BARAD_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS; m_TimeForAcceptInvite = 20; m_StartGroupingTimer = 15 * MINUTE * IN_MILLISECONDS; m_StartGrouping = false; KickPosition.Relocate(-630.460f, 1184.504f, 95.766f, 0); KickPosition.m_mapId = m_MapId; RegisterZone(m_ZoneId); m_Data32.resize(BATTLEFIELD_TB_DATA_MAX); m_Data32[BATTLEFIELD_TB_DATA_CAPTURED] = 0; m_saveTimer = 60000; SetGraveyardNumber(BATTLEFIELD_TB_GY_MAX); if ((sWorld->getWorldState(WS_TB_NEXT_BATTLE_TIMER_ENABLED) == 0) && (sWorld->getWorldState(WS_TB_HORDE_DEFENCE) == 0) && (sWorld->getWorldState(ClockBTWorldState[0]) == 0)) { sWorld->setWorldState(WS_TB_NEXT_BATTLE_TIMER_ENABLED, uint64(false)); sWorld->setWorldState(WS_TB_HORDE_DEFENCE, uint64(urand(0, 1))); sWorld->setWorldState(ClockBTWorldState[0], uint64(m_NoWarBattleTime)); } if (sWorld->getWorldState(WS_TB_UNK) == 0) sWorld->setWorldState(WS_TB_UNK, urand(1, 3)); if (sWorld->getWorldState(WS_TB_UNK_2) == 0) sWorld->setWorldState(WS_TB_UNK_2, time(NULL) + 86400); m_isActive = bool(sWorld->getWorldState(WS_TB_NEXT_BATTLE_TIMER_ENABLED)); m_DefenderTeam = (TeamId)sWorld->getWorldState(WS_TB_HORDE_DEFENCE); m_Timer = sWorld->getWorldState(ClockBTWorldState[0]); if (m_isActive) { m_isActive = false; m_Timer = m_RestartAfterCrash; } for (uint8 i = 0; i < BATTLEFIELD_TB_GY_MAX; i++) { BfGraveyardTB* graveyard = new BfGraveyardTB(this); graveyard->Initialize(TBGraveYard[i].entryh, TBGraveYard[i].entrya, TBGraveYard[i].x, TBGraveYard[i].y, TBGraveYard[i].z, TBGraveYard[i].o, m_DefenderTeam, TBGraveYard[i].gyid); m_GraveyardList[i] = graveyard; } for (uint8 i = 0; i < TB_MAX_WORKSHOP; i++) { BfTBWorkShopData* workshop = new BfTBWorkShopData(this); workshop->Init(TBWorkShopDataBase[i].worldstate, TBWorkShopDataBase[i].type, TBWorkShopDataBase[i].nameid); workshop->ChangeControl(GetDefenderTeam(),true); BfCapturePointTB* point = new BfCapturePointTB(this, GetDefenderTeam()); point->SetCapturePointData(GetDefenderTeam() == TEAM_ALLIANCE ? TBWorkShopDataBase[i].CapturePoint.entrya : TBWorkShopDataBase[i].CapturePoint.entryh, BATTLEFIELD_TB_MAPID, TBWorkShopDataBase[i].CapturePoint.x, TBWorkShopDataBase[i].CapturePoint.y, TBWorkShopDataBase[i].CapturePoint.z, 0); point->LinkToWorkShop(workshop); AddCapturePoint(point); CapturePoints.insert(point); WorkShopList.insert(workshop); } for (uint8 i = 0; i < TB_MAX_DESTROY_MACHINE_NPC; i++) { if (Creature* creature = SpawnCreature(TBDestroyMachineNPC[i].entrya, TBDestroyMachineNPC[i].x, TBDestroyMachineNPC[i].y, TBDestroyMachineNPC[i].z, TBDestroyMachineNPC[i].o, GetAttackerTeam())) { HideNpc(creature); Vehicles.insert(creature->GetGUID()); } } for (uint8 i = 0; i < TB_MAX_OBJ; i++) { GameObject* go = SpawnGameObject(TBGameObjectBuillding[i].entry, BATTLEFIELD_TB_MAPID, TBGameObjectBuillding[i].x, TBGameObjectBuillding[i].y, TBGameObjectBuillding[i].z, TBGameObjectBuillding[i].o); BfTBGameObjectBuilding* b = new BfTBGameObjectBuilding(this); b->Init(go,TBGameObjectBuillding[i].type,TBGameObjectBuillding[i].WorldState,TBGameObjectBuillding[i].nameid); b->m_State = BATTLEFIELD_TB_OBJECTSTATE_ALLIANCE_INTACT - (GetDefenderTeam() * 3); BuildingsInZone.insert(b); } for (uint8 i = 0; i < 4; i++) { if (Creature* creature = SpawnCreature(QuestGivers[i].entrya, QuestGivers[i].x, QuestGivers[i].y, QuestGivers[i].z, QuestGivers[i].o, TEAM_ALLIANCE)) { HideNpc(creature); creature->setFaction(TolBaradFaction[TEAM_ALLIANCE]); questgiversA.insert(creature->GetGUID()); } } for (uint8 i = 0; i < 4; i++) { if (Creature* creature = SpawnCreature(QuestGivers[i].entryh, QuestGivers[i].x, QuestGivers[i].y, QuestGivers[i].z, QuestGivers[i].o, TEAM_HORDE)) { HideNpc(creature); creature->setFaction(TolBaradFaction[TEAM_HORDE]); questgiversH.insert(creature->GetGUID()); } } { int i = 0; GuidSet questgivers = (GetDefenderTeam() == TEAM_ALLIANCE ? questgiversA : questgiversH); for (GuidSet::const_iterator itr = questgivers.begin(); itr != questgivers.end(); ++itr) { if (Unit* unit = sObjectAccessor->FindUnit((*itr))) { if (Creature* creature = unit->ToCreature()) { if (!i || i == sWorld->getWorldState(WS_TB_UNK)) if (!m_isActive) ShowNpc(creature, true); i++; } } } } for (uint8 i = 0; i < 23; i++) { if (Creature* creature = SpawnCreature(AllianceSpawnNPC[i].entrya, AllianceSpawnNPC[i].x, AllianceSpawnNPC[i].y, AllianceSpawnNPC[i].z, AllianceSpawnNPC[i].o, TEAM_ALLIANCE)) { creature->setFaction(TolBaradFaction[TEAM_ALLIANCE]); npcAlliance.insert(creature->GetGUID()); } } for (uint8 i = 0; i < 23; i++) { if (Creature* creature = SpawnCreature(HordeSpawnNPC[i].entrya, HordeSpawnNPC[i].x, HordeSpawnNPC[i].y, HordeSpawnNPC[i].z, HordeSpawnNPC[i].o, TEAM_HORDE)) { creature->setFaction(TolBaradFaction[TEAM_HORDE]); npcHorde.insert(creature->GetGUID()); } } for (uint8 i = 0; i < 130; i++) { if (Creature* creature = SpawnCreature(TbOldNpcStructure[i].entrya, TbOldNpcStructure[i].x, TbOldNpcStructure[i].y, TbOldNpcStructure[i].z, TbOldNpcStructure[i].o, TEAM_NEUTRAL)) { creature->SetRespawnRadius(15.0f); creature->SetDefaultMovementType(RANDOM_MOTION_TYPE); creature->GetMotionMaster()->Initialize(); npcOld.insert(creature->GetGUID()); } } for (uint8 i = 0; i < 4; i++) { if (GameObject* go = SpawnGameObject(TBGameobjectsDoor[i].entrya, BATTLEFIELD_TB_MAPID, TBGameobjectsDoor[i].x, TBGameobjectsDoor[i].y, TBGameobjectsDoor[i].z, TBGameobjectsDoor[i].o)) { go->ToGameObject()->SetLootState(GO_READY); go->ToGameObject()->UseDoorOrButton(); goDoors.insert(go); } } return true; }
bool BattlefieldTB::SetupBattlefield() { m_TypeId = BATTLEFIELD_TB; // See enum BattlefieldTypes m_BattleId = BATTLEFIELD_BATTLEID_TB; m_ZoneId = BATTLEFIELD_TB_ZONEID; m_MapId = BATTLEFIELD_TB_MAPID; m_Map = sMapMgr->CreateBaseMap(m_MapId); InitStalker(NPC_DEBUG_ANNOUNCER, TolBaradDebugAnnouncerPos); m_MaxPlayer = sWorld->getIntConfig(CONFIG_TOLBARAD_PLR_MAX); m_IsEnabled = sWorld->getBoolConfig(CONFIG_TOLBARAD_ENABLE); m_MinPlayer = sWorld->getIntConfig(CONFIG_TOLBARAD_PLR_MIN); m_MinLevel = sWorld->getIntConfig(CONFIG_TOLBARAD_PLR_MIN_LVL); m_BattleTime = sWorld->getIntConfig(CONFIG_TOLBARAD_BATTLETIME) * MINUTE * IN_MILLISECONDS; m_BonusTime = sWorld->getIntConfig(CONFIG_TOLBARAD_BONUSTIME) * MINUTE * IN_MILLISECONDS; m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_TOLBARAD_NOBATTLETIME) * MINUTE * IN_MILLISECONDS; m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_TOLBARAD_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS; m_TimeForAcceptInvite = 20; m_StartGroupingTimer = 15 * MINUTE * IN_MILLISECONDS; m_StartGrouping = false; m_isActive = false; KickPosition.Relocate(-605.5f, 1181.31f, 95.96f, 6.177155f); KickPosition.m_mapId = m_MapId; RegisterZone(m_ZoneId); m_Data32.resize(BATTLEFIELD_TB_DATA_MAX); m_saveTimer = 5 * MINUTE * IN_MILLISECONDS; updatedNPCAndObjects = true; m_updateObjectsTimer = 0; // Was there a battle going on or time isn't set yet? Then use m_RestartAfterCrash if (sWorld->getWorldState(TB_WS_STATE_BATTLE) == 1 || sWorld->getWorldState(TB_WS_TIME_NEXT_BATTLE) == 0) sWorld->setWorldState(TB_WS_TIME_NEXT_BATTLE, m_RestartAfterCrash); // Set timer m_Timer = sWorld->getWorldState(TB_WS_TIME_NEXT_BATTLE); // Defending team isn't set yet? Choose randomly. if (sWorld->getWorldState(TB_WS_FACTION_CONTROLLING) == 0) sWorld->setWorldState(TB_WS_FACTION_CONTROLLING, uint32(urand(1, 2))); // Set defender team SetDefenderTeam(TeamId(sWorld->getWorldState(TB_WS_FACTION_CONTROLLING) - 1)); // Just to save world states SendInitWorldStatesToAll(); // Create capture points for (uint8 i = 0; i < TB_BASE_COUNT; i++) { TolBaradCapturePoint* capturePoint = new TolBaradCapturePoint(this, GetDefenderTeam()); //Spawn flag pole if (GameObject* go = SpawnGameObject(TBCapturePoints[i].entryFlagPole[GetDefenderTeam()], TBCapturePoints[i].pos, QuaternionData())) { go->SetGoArtKit(GetDefenderTeam() == TEAM_ALLIANCE ? TB_GO_ARTKIT_FLAG_ALLIANCE : TB_GO_ARTKIT_FLAG_HORDE); capturePoint->SetCapturePointData(go); } AddCapturePoint(capturePoint); } // Spawn towers for (uint8 i = 0; i < TB_TOWERS_COUNT; i++) if (GameObject* go = SpawnGameObject(TBTowers[i].entry, TBTowers[i].pos, QuaternionData())) Towers.insert(go->GetGUID()); // Init Graveyards SetGraveyardNumber(BATTLEFIELD_TB_GRAVEYARD_MAX); // Graveyards for (uint8 i = 0; i < BATTLEFIELD_TB_GRAVEYARD_MAX; i++) { BfGraveyard* graveyard = new BfGraveyard(this); // When between games, the graveyard is controlled by the defending team graveyard->Initialize(GetDefenderTeam(), TBGraveyards[i].gyid); // Spawn spirits for (uint8 team = 0; team < 2; team++) if (Creature* creature = SpawnCreature(TBGraveyards[i].spiritEntry[team], TBGraveyards[i].pos)) graveyard->SetSpirit(creature, TeamId(team)); m_GraveyardList[i] = graveyard; } // Time warning vars warnedFiveMinutes = false; warnedTwoMinutes = false; warnedOneMinute = false; UpdateNPCsAndGameObjects(); return true; }
bool BattlefieldWG::SetupBattlefield() { InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]); m_TypeId = BATTLEFIELD_WG; // See enum BattlefieldTypes m_BattleId = BATTLEFIELD_BATTLEID_WG; m_ZoneId = BATTLEFIELD_WG_ZONEID; _MapId = BATTLEFIELD_WG_MAPID; m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLAYER_MAX); m_enable = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE); m_MinPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLAYER_MIN); m_MinLevel = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLAYER_MIN_LVL); m_BattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_BATTLETIME) * MINUTE * IN_MILLISECONDS; m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_WINTERGRASP_NOBATTLETIME) * MINUTE * IN_MILLISECONDS; m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_WINTERGRASP_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS; m_TimeForAcceptInvite = 20; m_StartGroupingTimer = 15 * MINUTE * IN_MILLISECONDS; m_StartGrouping = false; m_tenacityStack = 0; KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0); KickPosition.m_mapId = _MapId; RegisterZone(m_ZoneId); m_Data32.resize(BATTLEFIELD_WG_DATA_MAX); m_saveTimer = 60000; // Init GraveYards SetGraveyardNumber(BATTLEFIELD_WG_GY_MAX); // Load from db if ((sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE) == 0) && (sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER) == 0) && (sWorld->getWorldState(ClockWorldState[0]) == 0)) { sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE, false); sWorld->setWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER, urand(0, 1)); sWorld->setWorldState(ClockWorldState[0], m_NoWarBattleTime); } m_BattlefieldActive = sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_ACTIVE); m_DefenderTeam = TeamId(sWorld->getWorldState(BATTLEFIELD_WG_WORLD_STATE_DEFENDER)); m_Timer = sWorld->getWorldState(ClockWorldState[0]); if (m_BattlefieldActive) { m_BattlefieldActive = false; m_Timer = m_RestartAfterCrash; } for (uint8 i = 0; i < BATTLEFIELD_WG_GY_MAX; i++) { BfGraveYardWG *gy = new BfGraveYardWG(this); if (WGGraveYard[i].startcontrol == TEAM_NEUTRAL) // When between games, the graveyard is controlled by the defending team gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, m_DefenderTeam, WGGraveYard[i].gyid); else gy->Init(NPC_TAUNKA_SPIRIT_GUIDE, NPC_DWARVEN_SPIRIT_GUIDE, WGGraveYard[i].x, WGGraveYard[i].y, WGGraveYard[i].z, WGGraveYard[i].o, WGGraveYard[i].startcontrol, WGGraveYard[i].gyid); gy->SetTextId(WGGraveYard[i].textid); m_GraveYardList[i] = gy; } // Spawn workshop creatures and gameobjects for (uint8 i = 0; i < WG_MAX_WORKSHOP; i++) { BfWGWorkShopData *ws = new BfWGWorkShopData(this); // Create new object // Init:setup variable ws->Init(WGWorkShopDataBase[i].worldstate, WGWorkShopDataBase[i].type, WGWorkShopDataBase[i].nameid); // Spawn associate npc on this point (Guard/Engineer) for (uint8 c = 0; c < WGWorkShopDataBase[i].nbcreature; c++) ws->AddCreature(WGWorkShopDataBase[i].CreatureData[c]); // Spawn associate gameobject on this point (Horde/Alliance flags) for (uint8 g = 0; g < WGWorkShopDataBase[i].nbgob; g++) ws->AddGameObject(WGWorkShopDataBase[i].GameObjectData[g]); // Create PvPCapturePoint if (WGWorkShopDataBase[i].type < BATTLEFIELD_WG_WORKSHOP_KEEP_WEST) { ws->ChangeControl(GetAttackerTeam(), true); // Update control of this point // Create Object BfCapturePointWG *workshop = new BfCapturePointWG(this, GetAttackerTeam()); // Spawn gameobject associate (see in OnGameObjectCreate, of OutdoorPvP for see association) workshop->SetCapturePointData(WGWorkShopDataBase[i].CapturePoint.entryh, 571, WGWorkShopDataBase[i].CapturePoint.x, WGWorkShopDataBase[i].CapturePoint.y, WGWorkShopDataBase[i].CapturePoint.z, 0); workshop->LinkToWorkShop(ws); // Link our point to the capture point (for faction changement) AddCapturePoint(workshop); // Add this capture point to list for update this (view in Update() of OutdoorPvP) } else ws->ChangeControl(GetDefenderTeam(), true); // Update control of this point (Keep workshop= to deffender team) WorkShopList.insert(ws); } // Spawning npc in keep for (uint8 i = 0; i < WG_MAX_KEEP_NPC; i++) { // Horde npc if (Creature* creature = SpawnCreature(WGKeepNPC[i].entryh, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_HORDE)) KeepCreature[TEAM_HORDE].insert(creature->GetGUID()); // Alliance npc if (Creature* creature = SpawnCreature(WGKeepNPC[i].entrya, WGKeepNPC[i].x, WGKeepNPC[i].y, WGKeepNPC[i].z, WGKeepNPC[i].o, TEAM_ALLIANCE)) KeepCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); } // Hide keep npc for (GuidSet::const_iterator itr = KeepCreature[GetAttackerTeam()].begin(); itr != KeepCreature[GetAttackerTeam()].end(); ++itr) if (Unit* unit = ObjectAccessor::FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); // Spawn out of keep npc // Horde npc for (uint8 i = 0; i < WG_OUTSIDE_ALLIANCE_NPC; i++) if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entryh, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_HORDE)) OutsideCreature[TEAM_HORDE].insert(creature->GetGUID()); // Alliance npc for (uint8 i = WG_OUTSIDE_ALLIANCE_NPC; i < WG_MAX_OUTSIDE_NPC; i++) if (Creature* creature = SpawnCreature(WGOutsideNPC[i].entrya, WGOutsideNPC[i].x, WGOutsideNPC[i].y, WGOutsideNPC[i].z, WGOutsideNPC[i].o, TEAM_ALLIANCE)) OutsideCreature[TEAM_ALLIANCE].insert(creature->GetGUID()); // Hide outside npc for (GuidSet::const_iterator itr = OutsideCreature[GetDefenderTeam()].begin(); itr != OutsideCreature[GetDefenderTeam()].end(); ++itr) if (Unit* unit = ObjectAccessor::FindUnit(*itr)) if (Creature* creature = unit->ToCreature()) HideNpc(creature); for (uint8 i = 0; i < WG_MAX_TURRET; i++) { if (Creature* creature = SpawnCreature(28366, WGTurret[i].x, WGTurret[i].y, WGTurret[i].z, WGTurret[i].o, TeamId(0))) { CanonList.insert(creature->GetGUID()); HideNpc(creature); } } // Spawning Buiding for (uint8 i = 0; i < WG_MAX_OBJ; i++) { GameObject* go = SpawnGameObject(WGGameObjectBuillding[i].entry, WGGameObjectBuillding[i].x, WGGameObjectBuillding[i].y, WGGameObjectBuillding[i].z, WGGameObjectBuillding[i].o); BfWGGameObjectBuilding *b = new BfWGGameObjectBuilding(this); b->Init(go, WGGameObjectBuillding[i].type, WGGameObjectBuillding[i].WorldState, WGGameObjectBuillding[i].nameid); BuildingsInZone.insert(b); } // Spawning portal defender for (uint8 i = 0; i < WG_MAX_TELEPORTER; i++) { GameObject* go = SpawnGameObject(WGPortalDefenderData[i].entry, WGPortalDefenderData[i].x, WGPortalDefenderData[i].y, WGPortalDefenderData[i].z, WGPortalDefenderData[i].o); DefenderPortalList.insert(go); go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[GetDefenderTeam()]); } // Spawn banner in keep for (uint8 i = 0; i < WG_KEEPGAMEOBJECT_MAX; i++) { if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entryh, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) { go->SetRespawnTime(GetDefenderTeam()? RESPAWN_ONE_DAY : RESPAWN_IMMEDIATELY); m_KeepGameObject[1].insert(go); } if (GameObject* go = SpawnGameObject(WGKeepGameObject[i].entrya, WGKeepGameObject[i].x, WGKeepGameObject[i].y, WGKeepGameObject[i].z, WGKeepGameObject[i].o)) { go->SetRespawnTime(GetDefenderTeam()? RESPAWN_IMMEDIATELY : RESPAWN_ONE_DAY); m_KeepGameObject[0].insert(go); } } // Show defender banner in keep for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetDefenderTeam()].begin(); itr != m_KeepGameObject[GetDefenderTeam()].end(); ++itr) (*itr)->SetRespawnTime(RESPAWN_IMMEDIATELY); // Hide attackant banner in keep for (GameObjectSet::const_iterator itr = m_KeepGameObject[GetAttackerTeam()].begin(); itr != m_KeepGameObject[GetAttackerTeam()].end(); ++itr) (*itr)->SetRespawnTime(RESPAWN_ONE_DAY); UpdateCounterVehicle(true); return true; }