void IsleOfConquest::CaptureControlPoint( uint32 id ){ ControlPointTypes state = controlpoint[ id ].state; switch( state ){ case IOC_SPAWN_TYPE_ALLIANCE_ASSAULT: SpawnControlPoint( id, IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED ); PlaySoundToAll( SOUND_ALLIANCE_CAPTURE ); SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, 0, "The Alliance has taken the %s!", ControlPointNames[ id ] ); CALL_CAPTURE_EVENT_FOR( this, id ); break; case IOC_SPAWN_TYPE_HORDE_ASSAULT: SpawnControlPoint( id, IOC_SPAWN_TYPE_HORDE_CONTROLLED ); PlaySoundToAll( SOUND_HORDE_CAPTURE ); SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, 0, "The Horde has taken the %s!", ControlPointNames[ id ] ); CALL_CAPTURE_EVENT_FOR( this, id ); break; default: LOG_ERROR( "IOC control point %u is not in assaulted state, so it cannot be captured.", id ); return; break; } }
void ArathiBasin::OnCreate() { // Alliance Gate GameObject* gate = SpawnGameObject(180255, 529, 1284.597290f, 1281.166626f, -15.977916f, 0.76f, 32, 114, 1.5799990f); gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100); gate->PushToWorld(m_mapMgr); m_gates.push_back(gate); // horde gate gate = SpawnGameObject(180256, 529, 708.0902710f, 708.4479370f, -17.3898964f, 3.92f, 32, 114, 1.5699990f); gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100); gate->PushToWorld(m_mapMgr); m_gates.push_back(gate); // spawn (default) control points SpawnControlPoint(AB_CONTROL_POINT_STABLE, AB_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(AB_CONTROL_POINT_BLACKSMITH, AB_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(AB_CONTROL_POINT_LUMBERMILL, AB_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(AB_CONTROL_POINT_MINE, AB_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(AB_CONTROL_POINT_FARM, AB_SPAWN_TYPE_NEUTRAL); // spawn buffs SpawnBuff(AB_BUFF_STABLES); SpawnBuff(AB_BUFF_BLACKSMITH); SpawnBuff(AB_BUFF_LUMBERMILL); SpawnBuff(AB_BUFF_MINE); SpawnBuff(AB_BUFF_FARM); // spawn the h/a base spirit guides AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[0][0], NoBaseGYLocations[0][1], NoBaseGYLocations[0][2], 0.0f, 0)); AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[1][0], NoBaseGYLocations[1][1], NoBaseGYLocations[1][2], 0.0f, 1)); // Let's set this from the config SetWorldState( WORLDSTATE_AB_MAX_SCORE, RESOURCES_WINVAL ); }
void StrandOfTheAncient::CaptureControlPoint( SOTAControlPoints point ){ if( point >= NUM_SOTA_CONTROL_POINTS ) return; SOTAControlPoint &cp = controlpoint[ point ]; if( cp.banner->GetFaction() == 14 ) return; switch( cp.state ){ case SOTA_CP_STATE_ALLY_CONTROL: SpawnControlPoint( point, SOTA_CP_STATE_HORDE_CONTROL ); PlaySoundToAll( SOUND_HORDE_CAPTURE ); SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, 0, "The horde has captured the %s!", ControlPointNames[ point ] ); break; case SOTA_CP_STATE_HORDE_CONTROL: SpawnControlPoint( point, SOTA_CP_STATE_ALLY_CONTROL ); PlaySoundToAll( SOUND_ALLIANCE_CAPTURE ); SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, 0, "The alliance has captured the %s!", ControlPointNames[ point ] ); break; } cp.banner->SetFaction( 14 ); // So they cannot be recaptured as per SOTA rules //Spawn workshop demolisher switch( point ){ case SOTA_CONTROL_POINT_EAST_GY: demolisher[ SOTA_EAST_WS_DEMOLISHER_INDEX ] = SpawnCreature( 28781, DemolisherLocations[ SOTA_EAST_WS_DEMOLISHER_INDEX ], TeamFactions[ Attackers ] ); break; case SOTA_CONTROL_POINT_WEST_GY: demolisher[ SOTA_WEST_WS_DEMOLISHER_INDEX ] = SpawnCreature( 28781, DemolisherLocations[ SOTA_WEST_WS_DEMOLISHER_INDEX ], TeamFactions[ Attackers ] ); break; } }
void IsleOfConquest::AssaultControlPoint(Player *player, uint32 id) { ControlPointTypes state = controlpoint[id].state; uint32 team = player->GetTeam(); if (state > IOC_SPAWN_TYPE_HORDE_CONTROLLED) { LOG_ERROR("IOC control point %u is in an invalid state, cannot be assaulted.", id); return; } sEventMgr.RemoveEvents(this, EVENT_IOC_CAPTURE_CP_1 + id); switch (state) { case IOC_SPAWN_TYPE_NEUTRAL: if (team == TEAM_ALLIANCE) SpawnControlPoint(id, IOC_SPAWN_TYPE_ALLIANCE_ASSAULT); else SpawnControlPoint(id, IOC_SPAWN_TYPE_HORDE_ASSAULT); break; case IOC_SPAWN_TYPE_ALLIANCE_ASSAULT: case IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED: if (team == TEAM_HORDE) SpawnControlPoint(id, IOC_SPAWN_TYPE_HORDE_ASSAULT); break; case IOC_SPAWN_TYPE_HORDE_ASSAULT: case IOC_SPAWN_TYPE_HORDE_CONTROLLED: if (team == TEAM_ALLIANCE) SpawnControlPoint(id, IOC_SPAWN_TYPE_ALLIANCE_ASSAULT); break; } switch (state) { case IOC_SPAWN_TYPE_NEUTRAL: case IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED: case IOC_SPAWN_TYPE_HORDE_CONTROLLED: player->m_bgScore.MiscData[BG_SCORE_IOC_BASES_ASSAULTED]++; break; case IOC_SPAWN_TYPE_ALLIANCE_ASSAULT: case IOC_SPAWN_TYPE_HORDE_ASSAULT: player->m_bgScore.MiscData[BG_SCORE_IOC_BASES_DEFENDED]++; break; } if (player->GetTeam() == TEAM_ALLIANCE) SendChatMessage(CHAT_MSG_BG_EVENT_ALLIANCE, 0, "%s has assaulted the %s! If it remains uncontested, the alliance will take it within a minute!", player->GetName(), ControlPointNames[id]); else if (player->GetTeam() == TEAM_HORDE) SendChatMessage(CHAT_MSG_BG_EVENT_HORDE, 0, "%s has assaulted the %s! If it remains uncontested, the horde will take it within a minute!", player->GetName(), ControlPointNames[id]); sEventMgr.AddEvent(this, &IsleOfConquest::CaptureControlPoint, id, EVENT_IOC_CAPTURE_CP_1 + id, 60 * 1 * 1000, 1, 0); }
void ArathiBasin::CaptureControlPoint(uint32 Id, uint32 Team) { if(m_basesOwnedBy[Id] != -1) { // there is a very slim chance of this happening, 2 teams evnets could clash.. // just in case... return; } // anticheat, not really necessary because this is a server method but anyway if(m_basesAssaultedBy[Id] != (int32)Team) return; m_basesLastOwnedBy[Id] = Team; m_flagIsVirgin[Id] = false; m_basesOwnedBy[Id] = Team; m_basesAssaultedBy[Id]=-1; // remove the other spirit guide (if it exists) // burlex: shouldnt' happen if(m_spiritGuides[Id] != NULL) { RemoveSpiritGuide(m_spiritGuides[Id]); m_spiritGuides[Id]->Despawn(0,0); } // spawn the spirit guide for our faction m_spiritGuides[Id] = SpawnSpiritGuide(GraveyardLocations[Id][0], GraveyardLocations[Id][1], GraveyardLocations[Id][2], 0.0f, Team); AddSpiritGuide(m_spiritGuides[Id]); // send the chat message/sounds out PlaySoundToAll(Team ? SOUND_HORDE_SCORES : SOUND_ALLIANCE_SCORES); SendChatMessage(Team ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE, 0, "The %s has taken the %s!", Team ? "Horde" : "Alliance", ControlPointNames[Id]); // update the overhead display on the clients (world states) m_capturedBases[Team]++; m_mapMgr->GetStateManager().UpdateWorldState(Team ? WORLDSTATE_AB_HORDE_CAPTUREBASE : WORLDSTATE_AB_ALLIANCE_CAPTUREBASE, m_capturedBases[Team]); // respawn the control point with the correct aura SpawnControlPoint(Id, Team ? AB_SPAWN_TYPE_HORDE_CONTROLLED : AB_SPAWN_TYPE_ALLIANCE_CONTROLLED); // update the map m_mapMgr->GetStateManager().UpdateWorldState(AssaultFields[Id][Team], 0); m_mapMgr->GetStateManager().UpdateWorldState(OwnedFields[Id][Team], 1); // resource update event. :) if(m_capturedBases[Team]==1) { // first sEventMgr.AddEvent(TO_ARATHIBASIN(shared_from_this()),&ArathiBasin::EventUpdateResources, (uint32)Team, EVENT_AB_RESOURCES_UPDATE_TEAM_0+Team, ResourceUpdateIntervals[1], 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); } else { // not first event_ModifyTime(EVENT_AB_RESOURCES_UPDATE_TEAM_0+Team, ResourceUpdateIntervals[m_capturedBases[Team]]); } }
void IsleOfConquest::CaptureControlPoint(uint32 Id, uint32 Team) { if(m_basesOwnedBy[Id] != -1) { // there is a very slim chance of this happening, 2 teams evnets could clash.. // just in case... return; } // anticheat, not really necessary because this is a server method but anyway if(m_basesAssaultedBy[Id] != (int32)Team) return; m_basesLastOwnedBy[Id] = Team; m_flagIsVirgin[Id] = false; m_basesOwnedBy[Id] = Team; m_basesAssaultedBy[Id]=-1; // remove the other spirit guide (if it exists) // burlex: shouldnt' happen if(m_spiritGuides[Id] != NULL) { RemoveSpiritGuide(m_spiritGuides[Id]); m_spiritGuides[Id]->Despawn(0,0); } // spawn the spirit guide for our faction m_spiritGuides[Id] = SpawnSpiritGuide(GraveyardLocations[Id][0], GraveyardLocations[Id][1], GraveyardLocations[Id][2], 0.0f, Team); AddSpiritGuide(m_spiritGuides[Id]); // send the chat message/sounds out PlaySoundToAll(Team ? SOUND_HORDE_SCORES : SOUND_ALLIANCE_SCORES); SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, 0, "The %s has taken the %s!", Team ? "Horde" : "Alliance", ControlPointNames[Id]); // update the overhead display on the clients (world states) m_capturedBases[Team]++; // respawn the control point with the correct aura SpawnControlPoint(Id, Team ? IOC_SPAWN_TYPE_HORDE_CONTROLLED : IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED); // update the map SetWorldState(AssaultFields[Id][Team], 0); SetWorldState(OwnedFields[Id][Team], 1); AddHonorToTeam(5, Team); ApplyCaptureBonus(Id, Team); if(Id == 5) Updateworkshop(Team); }
void SpawnLetter_Z(Creature *spawner,Creature **StoreList,uint32 &index, float cx,float cy, float cz, float scale, float dist, float rot, uint32 color) { if( spawner == NULL || spawner->GetMapMgr() == NULL ) return; float control_points[4][3]={{-1.0f,0.0f,1.0f},{1.0f,0.0f,1.0f},{-1.0f,0.0f,-1.0f},{1.0f,0.0f,-1.0f}}; int i; for(i=0;i<4;i++) { float ldist = dist+control_points[i][0]*scale; float lx = cx + ldist*cos(rot); float ly = cy + ldist*sin(rot); float lz = cz + control_points[i][2]*scale; StoreList[index+i] = SpawnControlPoint( spawner,lx,ly,lz,color); if( i > 0 ) StoreList[index+i-1]->SetUInt64Value( UNIT_FIELD_CHANNEL_OBJECT, StoreList[index+i]->GetGUID() ); } index += i-1; }
void ArathiBasin::AssaultControlPoint(Player* pPlayer, uint32 Id) { #ifdef ANTI_CHEAT if(!m_started) { Anticheat_Log->writefromsession(pPlayer->GetSession(), "%s tried to assault control point in arathi basin before battleground (ID %u) started.", pPlayer->GetName(), this->m_id); SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, pPlayer->GetGUID(), "%s will be removed from the game for cheating.", pPlayer->GetName()); // Remove player from battleground. RemovePlayer(pPlayer, false); // Kick player from server. pPlayer->Kick(6000); return; } #endif uint32 Team = pPlayer->m_bgTeam; uint32 Owner; pPlayer->m_bgScore.MiscData[BG_SCORE_AB_BASES_ASSAULTED]++; if(m_basesOwnedBy[Id] == -1 && m_basesAssaultedBy[Id] == -1) { // omgwtfbbq our flag is a virgin? SetWorldState(NeutralFields[Id], 0); } if(m_basesOwnedBy[Id] != -1) { Owner = m_basesOwnedBy[Id]; // set it to uncontrolled for now m_basesOwnedBy[Id] = -1; m_basesLastOwnedBy[Id] = Owner; // this control point just got taken over by someone! oh noes! if(m_spiritGuides[Id] != NULL) { map<Creature*, set<uint32> >::iterator itr = m_resurrectMap.find(m_spiritGuides[Id]); if(itr != m_resurrectMap.end()) { for(set<uint32>::iterator it2 = itr->second.begin(); it2 != itr->second.end(); ++it2) { Player* r_plr = m_mapMgr->GetPlayer(*it2); if(r_plr != NULL && r_plr->IsDead()) HookHandleRepop(r_plr); } } m_resurrectMap.erase(itr); m_spiritGuides[Id]->Despawn(0, 0); m_spiritGuides[Id] = NULL; } // detract one from the teams controlled points m_capturedBases[Owner] -= 1; SetWorldState(Owner ? WORLDSTATE_AB_HORDE_CAPTUREBASE : WORLDSTATE_AB_ALLIANCE_CAPTUREBASE, m_capturedBases[Owner]); // reset the world states SetWorldState(OwnedFields[Id][Owner], 0); // modify the resource update time period if(m_capturedBases[Owner] == 0) this->event_RemoveEvents(EVENT_AB_RESOURCES_UPDATE_TEAM_0 + Owner); else this->event_ModifyTime(EVENT_AB_RESOURCES_UPDATE_TEAM_0 + Owner, ResourceUpdateIntervals[m_capturedBases[Owner]]); } // n***a stole my flag! if(m_basesAssaultedBy[Id] != -1) { Owner = m_basesAssaultedBy[Id]; // woah! vehicle hijack! m_basesAssaultedBy[Id] = -1; SetWorldState(AssaultFields[Id][Owner], 0); // make sure the event does not trigger sEventMgr.RemoveEvents(this, EVENT_AB_CAPTURE_CP_1 + Id); if(m_basesLastOwnedBy[Id] == (int32)Team) { m_basesAssaultedBy[Id] = (int32)Team; CaptureControlPoint(Id, Team); return; } // no need to remove the spawn, SpawnControlPoint will do this. } m_basesAssaultedBy[Id] = Team; // spawn the new control point gameobject SpawnControlPoint(Id, Team ? AB_SPAWN_TYPE_HORDE_ASSAULT : AB_SPAWN_TYPE_ALLIANCE_ASSAULT); // update the client's map with the new assaulting field SetWorldState(AssaultFields[Id][Team], 1); // Check Assault/Defense, the time of capture is not the same. if(DefFlag[Id][0] && !DefFlag[Id][1]) { DefFlag[Id][0] = false; SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, pPlayer->GetGUID(), "$N defend %s", ControlPointNames[Id]); sEventMgr.AddEvent(this, &ArathiBasin::CaptureControlPoint, Id, Team, EVENT_AB_CAPTURE_CP_1 + Id, 1000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); pPlayer->m_bgScore.MiscData[BG_SCORE_AB_BASES_CAPTURED]++; UpdatePvPData(); } else if(!DefFlag[Id][0] && !DefFlag[Id][1]) { DefFlag[Id][0] = true; SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, pPlayer->GetGUID(), "$N assault %s !", ControlPointNames[Id]); PlaySoundToAll(Team ? 8212 : 8174); if(Team) { QuestLogEntry* en = pPlayer->GetQuestLogForEntry(8120); switch(Id) { case AB_CONTROL_POINT_MINE: { if(en && en->GetMobCount(0) < en->GetQuest()->required_mobcount[0]) { en->SetMobCount(0, en->GetMobCount(0) + 1); en->SendUpdateAddKill(0); en->UpdatePlayerFields(); } } break; case AB_CONTROL_POINT_LUMBERMILL: { if(en && en->GetMobCount(1) < en->GetQuest()->required_mobcount[1]) { en->SetMobCount(1, en->GetMobCount(1) + 1); en->SendUpdateAddKill(1); en->UpdatePlayerFields(); } } break; case AB_CONTROL_POINT_BLACKSMITH: { if(en && en->GetMobCount(2) < en->GetQuest()->required_mobcount[2]) { en->SetMobCount(2, en->GetMobCount(2) + 1); en->SendUpdateAddKill(2); en->UpdatePlayerFields(); } } break; case AB_CONTROL_POINT_STABLE: { if(en && en->GetMobCount(3) < en->GetQuest()->required_mobcount[3]) { en->SetMobCount(3, en->GetMobCount(3) + 1); en->SendUpdateAddKill(3); en->UpdatePlayerFields(); } } break; } } else { QuestLogEntry* en = pPlayer->GetQuestLogForEntry(8105); switch(Id) { case AB_CONTROL_POINT_MINE: { if(en && en->GetMobCount(0) < en->GetQuest()->required_mobcount[0]) { en->SetMobCount(0, en->GetMobCount(0) + 1); en->SendUpdateAddKill(0); en->UpdatePlayerFields(); } } break; case AB_CONTROL_POINT_LUMBERMILL: { if(en && en->GetMobCount(1) < en->GetQuest()->required_mobcount[1]) { en->SetMobCount(1, en->GetMobCount(1) + 1); en->SendUpdateAddKill(1); en->UpdatePlayerFields(); } } break; case AB_CONTROL_POINT_BLACKSMITH: { if(en && en->GetMobCount(2) < en->GetQuest()->required_mobcount[2]) { en->SetMobCount(2, en->GetMobCount(2) + 1); en->SendUpdateAddKill(2); en->UpdatePlayerFields(); } } break; case AB_CONTROL_POINT_FARM: { if(en && en->GetMobCount(3) < en->GetQuest()->required_mobcount[3]) { en->SetMobCount(3, en->GetMobCount(3) + 1); en->SendUpdateAddKill(3); en->UpdatePlayerFields(); } } break; } } sEventMgr.AddEvent(this, &ArathiBasin::CaptureControlPoint, Id, Team, EVENT_AB_CAPTURE_CP_1 + Id, MSTIME_MINUTE, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); pPlayer->m_bgScore.MiscData[BG_SCORE_AB_BASES_ASSAULTED]++; UpdatePvPData(); } else { DefFlag[Id][0] = true; SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, pPlayer->GetGUID(), "$N claims the %s! If left unchallenged, the %s will control it in 1 minute!", ControlPointNames[Id], Team ? "Horde" : "Alliance"); PlaySoundToAll(8192); sEventMgr.AddEvent(this, &ArathiBasin::CaptureControlPoint, Id, Team, EVENT_AB_CAPTURE_CP_1 + Id, MSTIME_MINUTE, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); } }
void IsleOfConquest::OnCreate() { // generals/leaders! SpawnCreature(34924, 214.77f, -830.73f, 60.81f, 0.07f); // High Commander Halford Wyrmbane (ALLIANCE) SpawnCreature(34922, 1296.57f, -765.78f, 69.98f, 6.22f); // Overlord Agmar (HORDE) // Spawn const spiritguides AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[0][0], NoBaseGYLocations[0][1], NoBaseGYLocations[0][2], NoBaseGYLocations[0][3], 0)); AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[1][0], NoBaseGYLocations[1][1], NoBaseGYLocations[1][2], NoBaseGYLocations[1][3], 1)); // Spawn Teleporters for(uint32 i = 0; i < 6; i++) // Alliance { m_teleporters[i] = SpawnGameObject(IOC_TRANSPORTER, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f); m_teleporters[i]->PushToWorld(m_mapMgr); m_teleeffect[i] = SpawnGameObject(TELEPORTER_EFFECT_A, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f); m_teleeffect[i]->PushToWorld(m_mapMgr); } for(uint32 i = 6; i < 12; i++) // Horde { m_teleporters[i] = SpawnGameObject(IOC_TRANSPORTER, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 2, 1.0f); m_teleporters[i]->PushToWorld(m_mapMgr); m_teleeffect[i] = SpawnGameObject(TELEPORTER_EFFECT_H, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f); m_teleeffect[i]->PushToWorld(m_mapMgr); } // Spawn Gates for(uint32 x = 0; x < 3; x++) { m_desgates[x] = SpawnGameObject(gatesIds[x], iocGatesLocation[x][0], iocGatesLocation[x][1], iocGatesLocation[x][2], iocGatesLocation[x][3], 0, 1, 1.0f); m_desgates[x]->PushToWorld(m_mapMgr); m_desgates[x]->bannerslot = x; m_ogates[x] = SpawnGameObject(IOC_DYNAMIC_DOOR_A, iocGatesLocation[x][0], iocGatesLocation[x][1], iocGatesLocation[x][2], iocGatesLocation[x][3], 0, 1, 1.0f); m_ogates[x]->SetUInt32Value(GAMEOBJECT_FLAGS, 32); m_ogates[x]->SetUInt32Value(GAMEOBJECT_DYNAMIC, 4294901760); m_ogates[x]->SetUInt32Value(GAMEOBJECT_FACTION, 1); m_ogates[x]->SetUInt32Value(GAMEOBJECT_BYTES_1, 4278190081); m_ogates[x]->PushToWorld(m_mapMgr); } for(uint32 x = 3; x < 6; x++) { m_desgates[x] = SpawnGameObject(gatesIds[x], iocGatesLocation[x][0], iocGatesLocation[x][1], iocGatesLocation[x][2], iocGatesLocation[x][3], 0, 2, 1.0f); m_desgates[x]->PushToWorld(m_mapMgr); m_desgates[x]->bannerslot = x; m_ogates[x] = SpawnGameObject(IOC_DYNAMIC_DOOR_H, iocGatesLocation[x][0], iocGatesLocation[x][1], iocGatesLocation[x][2], iocGatesLocation[x][3], 0, 2, 1.0f); m_ogates[x]->SetUInt32Value(GAMEOBJECT_FLAGS, 32); m_ogates[x]->SetUInt32Value(GAMEOBJECT_DYNAMIC, 4294901760); m_ogates[x]->SetUInt32Value(GAMEOBJECT_FACTION, 5); m_ogates[x]->SetUInt32Value(GAMEOBJECT_BYTES_1, 4278190081); m_ogates[x]->PushToWorld(m_mapMgr); } // Flagpole for(uint32 i = 0; i < IOC_NUM_CONTROL_POINTS; i++) { m_flagpole[i] = SpawnGameObject(IOC_FLAGPOLE, ControlPointCoordinates[i][0], ControlPointCoordinates[i][1], ControlPointCoordinates[i][2], ControlPointCoordinates[i][3], 0, 35, 1.0f); m_flagpole[i]->PushToWorld(m_mapMgr); } SpawnControlPoint(IOC_CONTROL_POINT_OILDERRICK, IOC_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(IOC_CONTROL_POINT_COBALTMINE, IOC_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(IOC_CONTROL_POINT_DOCKS, IOC_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(IOC_CONTROL_POINT_AIRSHIPHANGAR, IOC_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(IOC_CONTROL_POINT_SIEGEWORKSHOP, IOC_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(IOC_CONTROL_POINT_ALLIANCE_KEEP, IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED); SpawnControlPoint(IOC_CONTROL_POINT_HORDE_KEEP, IOC_SPAWN_TYPE_HORDE_CONTROLLED); }
void ArathiBasin::CaptureControlPoint(uint32 Id, uint32 Team) { if(m_basesOwnedBy[Id] != -1) { // there is a very slim chance of this happening, 2 teams events could clash.. // just in case... return; } // anti cheat, not really necessary because this is a server method but anyway if(m_basesAssaultedBy[Id] != (int32)Team) return; m_basesOwnedBy[Id] = Team; m_basesAssaultedBy[Id] = -1; m_basesLastOwnedBy[Id] = -1; // remove the other spirit guide (if it exists) // burlex: shouldn't' happen if(m_spiritGuides[Id] != NULL) { RemoveSpiritGuide(m_spiritGuides[Id]); m_spiritGuides[Id]->Despawn(0, 0); } // spawn the spirit guide for our faction m_spiritGuides[Id] = SpawnSpiritGuide(GraveyardLocations[Id][0], GraveyardLocations[Id][1], GraveyardLocations[Id][2], 0.0f, Team); AddSpiritGuide(m_spiritGuides[Id]); // send the chat message/sounds out PlaySoundToAll(Team ? SOUND_HORDE_CAPTURE : SOUND_ALLIANCE_CAPTURE); SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, 0, "The %s has taken the %s!", Team ? "Horde" : "Alliance", ControlPointNames[Id]); DefFlag[Id][0] = false; DefFlag[Id][1] = false; // update the overhead display on the clients (world states) m_capturedBases[Team]++; SetWorldState(Team ? WORLDSTATE_AB_HORDE_CAPTUREBASE : WORLDSTATE_AB_ALLIANCE_CAPTUREBASE, m_capturedBases[Team]); if(m_capturedBases[Team] >= 4) { m_mainLock.Acquire(); for(set<Player*>::iterator itr = m_players[Team].begin(); itr != m_players[Team].end(); ++itr) { if(Team) { if(m_capturedBases[Team] >= 4 && (*itr)->GetQuestLogForEntry(8121)) (*itr)->GetQuestLogForEntry(8121)->SendQuestComplete(); if(m_capturedBases[Team] == 5 && (*itr)->GetQuestLogForEntry(8122)) (*itr)->GetQuestLogForEntry(8122)->SendQuestComplete(); } else { if(m_capturedBases[Team] >= 4 && (*itr)->GetQuestLogForEntry(8114)) (*itr)->GetQuestLogForEntry(8114)->SendQuestComplete(); if(m_capturedBases[Team] == 5 && (*itr)->GetQuestLogForEntry(8115)) (*itr)->GetQuestLogForEntry(8115)->SendQuestComplete(); } } m_mainLock.Release(); } // respawn the control point with the correct aura SpawnControlPoint(Id, Team ? AB_SPAWN_TYPE_HORDE_CONTROLLED : AB_SPAWN_TYPE_ALLIANCE_CONTROLLED); // update the map SetWorldState(AssaultFields[Id][Team], 0); SetWorldState(OwnedFields[Id][Team], 1); // resource update event. :) if(m_capturedBases[Team] == 1) { // first sEventMgr.AddEvent(this, &ArathiBasin::EventUpdateResources, (uint32)Team, EVENT_AB_RESOURCES_UPDATE_TEAM_0 + Team, ResourceUpdateIntervals[1], 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); } else { // not first event_ModifyTime(EVENT_AB_RESOURCES_UPDATE_TEAM_0 + Team, ResourceUpdateIntervals[m_capturedBases[Team]]); } }
void ArathiBasin::OnCreate() { // Alliance Gate GameObject *gate = SpawnGameObject(180255, 529, 1284.597290f, 1281.166626f, -15.977916f, 0.706859f, 32, 114, 1.5799990f); gate->SetFloatValue(GAMEOBJECT_ROTATION, 0.0129570f); gate->SetFloatValue(GAMEOBJECT_ROTATION_01, -0.0602880f); gate->SetFloatValue(GAMEOBJECT_ROTATION_02, 0.3449600f); gate->SetFloatValue(GAMEOBJECT_ROTATION_03, 0.9365900f); gate->PushToWorld(m_mapMgr); m_gates.push_back(gate); // horde gate gate = SpawnGameObject(180256, 529, 708.0902710f, 708.4479370f, -17.3898964f, -2.3910990f, 32, 114, 1.5699990f); gate->SetFloatValue(GAMEOBJECT_ROTATION, 0.0502910f); gate->SetFloatValue(GAMEOBJECT_ROTATION_01, 0.0151270f); gate->SetFloatValue(GAMEOBJECT_ROTATION_02, 0.9292169f); gate->SetFloatValue(GAMEOBJECT_ROTATION_03, -0.3657840f); gate->PushToWorld(m_mapMgr); m_gates.push_back(gate); // spawn (default) control points SpawnControlPoint(AB_CONTROL_POINT_STABLE, AB_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(AB_CONTROL_POINT_BLACKSMITH, AB_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(AB_CONTROL_POINT_LUMBERMILL, AB_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(AB_CONTROL_POINT_MINE, AB_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(AB_CONTROL_POINT_FARM, AB_SPAWN_TYPE_NEUTRAL); // spawn buffs SpawnBuff(AB_BUFF_STABLES); SpawnBuff(AB_BUFF_BLACKSMITH); SpawnBuff(AB_BUFF_LUMBERMILL); SpawnBuff(AB_BUFF_MINE); SpawnBuff(AB_BUFF_FARM); // spawn the h/a base spirit guides AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[0][0], NoBaseGYLocations[0][1], NoBaseGYLocations[0][2], 0.0f, 0)); AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[1][0], NoBaseGYLocations[1][1], NoBaseGYLocations[1][2], 0.0f, 1)); // urrrgh worldstates SetWorldState(0x8D8, 0x00); SetWorldState(0x8D7, 0x00); SetWorldState(0x8D6, 0x00); SetWorldState(0x8D5, 0x00); SetWorldState(0x8D4, 0x00); SetWorldState(0x8D3, 0x00); // AB world state's // unknowns, need more research SetWorldState(0x7A3, 1800); // unknown SetWorldState(0x745, 0x02); // unknown // Icon stuff for on the map SetWorldState(AB_SHOW_BACKSMITH_ICON, 0x01); SetWorldState(AB_SHOW_FARM_ICON, 0x01); SetWorldState(AB_SHOW_LUMBERMILL_ICON, 0x01); SetWorldState(AB_SHOW_GOLDMINE_ICON, 0x01); SetWorldState(AB_SHOW_STABLE_ICON, 0x01); // LumberMill SetWorldState(AB_CAPTURING_LUMBERMILL_HORDE, 0x00); SetWorldState(AB_CAPTURING_LUMBERMILL_ALLIANCE, 0x00); SetWorldState(AB_CAPTURED_LUMBERMILL_HORDE, 0x00); SetWorldState(AB_CAPTURED_LUMBERMILL_ALLIANCE, 0x00); // GoldMine SetWorldState(AB_CAPTURING_GOLDMINE_HORDE, 0x00); SetWorldState(AB_CAPTURING_GOLDMINE_ALLIANCE, 0x00); SetWorldState(AB_CAPTURED_GOLDMINE_HORDE, 0x00); SetWorldState(AB_CAPTURED_GOLDMINE_ALLIANCE, 0x00); // BlackSmith SetWorldState(AB_CAPTURING_BLACKSMITH_HORDE, 0x00); SetWorldState(AB_CAPTURING_BLACKSMITH_ALLIANCE, 0x00); SetWorldState(AB_CAPTURED_BLACKSMITH_HORDE, 0x00); SetWorldState(AB_CAPTURED_BLACKSMITH_ALLIANCE, 0x00); SetWorldState(AB_MAX_SCORE, RESOURCES_WINVAL); SetWorldState(AB_ALLIANCE_CAPTUREBASE, 0x00); SetWorldState(AB_HORDE_CAPTUREBASE, 0x00); SetWorldState(AB_HORDE_RESOURCES, 0x00); SetWorldState(AB_ALLIANCE_RESOURCES, 0x00); // Farm SetWorldState(AB_CAPTURING_FARM_ALLIANCE, 0x00); SetWorldState(AB_CAPTURING_FARM_HORDE, 0x00); SetWorldState(AB_CAPTURED_FARM_HORDE, 0x00); SetWorldState(AB_CAPTURED_FARM_ALLIANCE, 0x00); // Stables SetWorldState(AB_CAPTURING_STABLES_HORDE, 0x00); SetWorldState(AB_CAPTURING_STABLES_ALLIANCE, 0x00); SetWorldState(AB_CAPTURED_STABLES_HORDE, 0x00); SetWorldState(AB_CAPTURED_STABLES_ALLIANCE, 0x00); }
void ArathiBasin::AssaultControlPoint(Player * pPlayer, uint32 Id) { #ifdef ANTI_CHEAT if (!m_started) { Anticheat_Log->writefromsession(pPlayer->GetSession(), "%s tryed to assault control point in arathi basin before battleground (ID %u) started.", pPlayer->GetName(), this->m_id); SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, pPlayer->GetGUID(), "%s will be removed from the game for cheating.", pPlayer->GetName()); // Remove player from battleground. this->RemovePlayer(pPlayer, false); // Kick player from server. pPlayer->Kick(6000); return; } #endif uint32 Team = pPlayer->m_bgTeam; uint32 Owner; if (m_basesOwnedBy[Id] == -1 && m_basesAssaultedBy[Id] == -1) { // omgwtfbbq our flag is a virgin? SetWorldState(NeutralFields[Id], 0); } if (m_basesOwnedBy[Id] != -1) { Owner = m_basesOwnedBy[Id]; // set it to uncontrolled for now m_basesOwnedBy[Id] = -1; // this control point just got taken over by someone! oh noes! if (m_spiritGuides[Id] != NULL) { std::map<Creature*, std::set<uint32> >::iterator itr = m_resurrectMap.find(m_spiritGuides[Id]); if (itr != m_resurrectMap.end()) { for (std::set<uint32>::iterator it2 = itr->second.begin(); it2 != itr->second.end(); ++it2) { Player* r_plr = m_mapMgr->GetPlayer(*it2); if (r_plr != NULL && r_plr->isDead()) HookHandleRepop(r_plr); } } m_resurrectMap.erase(itr); m_spiritGuides[Id]->Despawn(0, 0); m_spiritGuides[Id] = NULL; } // detract one from the teams controlled points m_capturedBases[Owner] -= 1; SetWorldState(Owner ? AB_HORDE_CAPTUREBASE : AB_ALLIANCE_CAPTUREBASE, m_capturedBases[Owner]); // reset the world states SetWorldState(OwnedFields[Id][Owner], 0); // modify the resource update time period if (m_capturedBases[Owner] == 0) this->event_RemoveEvents(EVENT_AB_RESOURCES_UPDATE_TEAM_0 + Owner); else this->event_ModifyTime(EVENT_AB_RESOURCES_UPDATE_TEAM_0 + Owner, ResourceUpdateIntervals[m_capturedBases[Owner]]); } // n***a stole my flag! if (m_basesAssaultedBy[Id] != -1) { Owner = m_basesAssaultedBy[Id]; // woah! vehicle hijack! m_basesAssaultedBy[Id] = -1; SetWorldState(AssaultFields[Id][Owner], 0); // make sure the event does not trigger sEventMgr.RemoveEvents(this, EVENT_AB_CAPTURE_CP_1 + Id); // no need to remove the spawn, SpawnControlPoint will do this. } m_basesAssaultedBy[Id] = Team; // spawn the new control point gameobject SpawnControlPoint(Id, Team ? AB_SPAWN_TYPE_HORDE_ASSAULT : AB_SPAWN_TYPE_ALLIANCE_ASSAULT); // send out the chat message and sound SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, pPlayer->GetGUID(), "$N claims the %s! If left unchallenged, the %s will control it in 1 minute!", ControlPointNames[Id], Team ? "Horde" : "Alliance"); //NEED THE SOUND ID //PlaySoundToAll(Team ? SOUND:SOUND); // update the client's map with the new assaulting field SetWorldState(AssaultFields[Id][Team], 1); // create the 60 second event. sEventMgr.AddEvent(this, &ArathiBasin::CaptureControlPoint, Id, Team, EVENT_AB_CAPTURE_CP_1 + Id, 60000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); }
void ArathiBasin::AssaultControlPoint(PlayerPointer pPlayer, uint32 Id) { #if defined(BG_ANTI_CHEAT) && !defined(_DEBUG) if(!m_started) { SendChatMessage(CHAT_MSG_BG_SYSTEM_NEUTRAL, pPlayer->GetGUID(), "%s has been removed from the game for cheating.", pPlayer->GetName()); pPlayer->SoftDisconnect(); return; } #endif bool isVirgin = false; uint32 Team = pPlayer->m_bgTeam; uint32 Owner; if(m_basesOwnedBy[Id]==-1 && m_basesAssaultedBy[Id]==-1) { isVirgin = true; // omgwtfbbq our flag is a virgin? m_mapMgr->GetStateManager().UpdateWorldState(NeutralFields[Id], 0); } if(m_basesOwnedBy[Id] != -1) { Owner = m_basesOwnedBy[Id]; // set it to uncontrolled for now m_basesOwnedBy[Id] = -1; // this control point just got taken over by someone! oh noes! if( m_spiritGuides[Id] != NULL ) { map<CreaturePointer,set<uint32> >::iterator itr = m_resurrectMap.find(m_spiritGuides[Id]); if( itr != m_resurrectMap.end() ) { for( set<uint32>::iterator it2 = itr->second.begin(); it2 != itr->second.end(); ++it2 ) { PlayerPointer r_plr = m_mapMgr->GetPlayer( *it2 ); if( r_plr != NULL && r_plr->isDead() ) { HookHandleRepop( r_plr ); QueueAtNearestSpiritGuide(r_plr, itr->first); } } } m_resurrectMap.erase( itr ); m_spiritGuides[Id]->Despawn( 0, 0 ); m_spiritGuides[Id] = NULLCREATURE; } // detract one from the teams controlled points m_capturedBases[Owner] -= 1; m_mapMgr->GetStateManager().UpdateWorldState(Owner ? WORLDSTATE_AB_HORDE_CAPTUREBASE : WORLDSTATE_AB_ALLIANCE_CAPTUREBASE, m_capturedBases[Owner]); // reset the world states m_mapMgr->GetStateManager().UpdateWorldState(OwnedFields[Id][Owner], 0); // modify the resource update time period if(m_capturedBases[Owner]==0) this->event_RemoveEvents(EVENT_AB_RESOURCES_UPDATE_TEAM_0+Owner); else this->event_ModifyTime(EVENT_AB_RESOURCES_UPDATE_TEAM_0 + Owner, ResourceUpdateIntervals[m_capturedBases[Owner]]); } // Contested Flag, not ours, and is not virgin uint32 otherTeam = Team ? 0 : 1; if( !isVirgin && m_basesLastOwnedBy[Id] == Team && m_basesOwnedBy[Id] == -1 ) { m_mapMgr->GetStateManager().UpdateWorldState(AssaultFields[Id][Team ? 0 : 1], 0); this->event_RemoveEvents(EVENT_AB_CAPTURE_CP_1 + Id); SendChatMessage(Team ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE, pPlayer->GetGUID(), "$N has defended the %s!", ControlPointNames[Id]); m_basesAssaultedBy[Id] = Team; CaptureControlPoint( Id, Team ); return; } // n***a stole my flag! if(m_basesAssaultedBy[Id] != -1) { Owner = m_basesAssaultedBy[Id]; // woah! vehicle hijack! m_basesAssaultedBy[Id] = Team; m_mapMgr->GetStateManager().UpdateWorldState(AssaultFields[Id][Owner], 0); // make sure the event does not trigger sEventMgr.RemoveEvents(shared_from_this(), EVENT_AB_CAPTURE_CP_1 + Id); // no need to remove the spawn, SpawnControlPoint will do this. } m_basesAssaultedBy[Id] = Team; // spawn the new control point gameobject SpawnControlPoint(Id, Team ? AB_SPAWN_TYPE_HORDE_ASSAULT : AB_SPAWN_TYPE_ALLIANCE_ASSAULT); // send out the chat message and sound SendChatMessage(Team ? CHAT_MSG_BG_SYSTEM_HORDE : CHAT_MSG_BG_SYSTEM_ALLIANCE, pPlayer->GetGUID(), "$N claims the %s! If left unchallenged, the %s will control it in 1 minute!", ControlPointNames[Id], Team ? "Horde" : "Alliance"); // guessed PlaySoundToAll(Team ? SOUND_ALLIANCE_CAPTURE : SOUND_HORDE_CAPTURE); // update the client's map with the new assaulting field m_mapMgr->GetStateManager().UpdateWorldState(AssaultFields[Id][Team], 1); // create the 60 second event. sEventMgr.AddEvent(TO_ARATHIBASIN(shared_from_this()), &ArathiBasin::CaptureControlPoint, Id, Team, EVENT_AB_CAPTURE_CP_1 + Id, 60000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); // update players info pPlayer->m_bgScore.MiscData[BG_SCORE_AB_BASE_ASSAULTED]++; UpdatePvPData(); }
void IsleOfConquest::OnCreate(){ // generals/leaders! generals[ TEAM_ALLIANCE ] = SpawnCreature(34924, 214.77f, -830.73f, 60.81f, 0.07f, 1 ); // High Commander Halford Wyrmbane (ALLIANCE) generals[ TEAM_HORDE ] = SpawnCreature(34922, 1296.57f, -765.78f, 69.98f, 6.22f, 2 ); // Overlord Agmar (not sure this is the good general) (HORDE) // Spawn const spiritguides SpawnGraveyard( IOC_GY_ALLIANCE, TEAM_ALLIANCE ); SpawnGraveyard( IOC_GY_HORDE, TEAM_HORDE ); // Spawn Teleporters for( uint32 i = 0; i < 3; i++ ){ teleporter[ i ].teleporter = SpawnGameObject( IOC_TELEPORTER_A_IN, 628, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f); teleporter[ i ].teleporter->PushToWorld(m_mapMgr); } for( uint32 i = 3; i < 6; i++ ){ teleporter[ i ].teleporter = SpawnGameObject( IOC_TELEPORTER_A_OUT, 628, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f); teleporter[ i ].teleporter->PushToWorld(m_mapMgr); } for( uint32 i = 6; i < 9; i++ ){ teleporter[ i ].teleporter = SpawnGameObject( IOC_TELEPORTER_H_IN, 628, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 2, 1.0f); teleporter[ i ].teleporter->PushToWorld(m_mapMgr); } for( uint32 i = 9; i < 12; i++ ){ teleporter[ i ].teleporter = SpawnGameObject( IOC_TELEPORTER_H_OUT, 628, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 2, 1.0f); teleporter[ i ].teleporter->PushToWorld(m_mapMgr); } // spawn teleporter effects for( uint32 i = 0; i < 6; i++ ){ teleporter[ i ].effect = SpawnGameObject(TELEPORTER_EFFECT_A, 628, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f); teleporter[ i ].effect->PushToWorld(m_mapMgr); } for( uint32 i = 6; i < 12; i++ ){ teleporter[ i ].effect = SpawnGameObject(TELEPORTER_EFFECT_H, 628, iocTransporterLocation[i][0], iocTransporterLocation[i][1], iocTransporterLocation[i][2], iocTransporterLocation[i][3], 0, 1, 1.0f); teleporter[ i ].effect->PushToWorld(m_mapMgr); } // Spawn Alliance gates for( uint32 i = 0; i < 3; i++ ){ gates[ TEAM_ALLIANCE ][ i ].gate = SpawnGameObject( allygateids[ i ], 628, allygatelocations[ i ][ 0 ], allygatelocations[ i ][ 1 ], allygatelocations[ i ][ 2 ], allygatelocations[ i ][ 3 ], 0, 1, 1.0f ); gates[ TEAM_ALLIANCE ][ i ].gate->PushToWorld( m_mapMgr ); gates[ TEAM_ALLIANCE ][ i ].dyngate = SpawnGameObject( IOC_DYNAMIC_GATE_ALLY, 628, allygatelocations[ i ][ 0 ], allygatelocations[ i ][ 1 ], allygatelocations[ i ][ 2 ], allygatelocations[ i ][ 3 ], 0, 1, 1.0f ); gates[ TEAM_ALLIANCE ][ i ].dyngate->SetFlags( GAMEOBJECT_FLAG_UNTARGETABLE ); gates[ TEAM_ALLIANCE ][ i ].dyngate->PushToWorld( m_mapMgr ); } //Spawn Horde gates for( uint32 i = 0; i < 3; i++ ){ gates[ TEAM_HORDE ][ i ].gate = SpawnGameObject( hordegateids[ i ], 628, hordegatelocations[ i ][ 0 ], hordegatelocations[ i ][ 1 ], hordegatelocations[ i ][ 2 ], hordegatelocations[ i ][ 3 ], 0, 2, 1.0f ); gates[ TEAM_HORDE ][ i ].gate->PushToWorld( m_mapMgr ); gates[ TEAM_HORDE ][ i ].dyngate = SpawnGameObject( IOC_DYNAMIC_GATE_HORDE, 628, hordegatelocations[ i ][ 0 ], hordegatelocations[ i ][ 1 ], hordegatelocations[ i ][ 2 ], hordegatelocations[ i ][ 3 ], 0, 2, 1.0f ); gates[ TEAM_HORDE ][ i ].dyngate->SetFlags( GAMEOBJECT_FLAG_UNTARGETABLE ); gates[ TEAM_HORDE ][ i ].dyngate->PushToWorld( m_mapMgr ); } //Spawn ally towergates for( uint32 i = 0; i < 2; i++ ){ towergates[ TEAM_ALLIANCE ][ i ] = SpawnGameObject( 195436, AllyTowerGates[ i ], 0, 35, 1.0f ); towergates[ TEAM_ALLIANCE ][ i ]->SetFlags( GAMEOBJECT_FLAG_UNTARGETABLE ); towergates[ TEAM_ALLIANCE ][ i ]->PushToWorld( m_mapMgr ); } //Spawn horde towergates for( uint32 i = 0; i < 2; i++ ){ towergates[ TEAM_HORDE ][ i ] = SpawnGameObject( 195437, HordeTowerGates[ i ], 0, 35, 0.5f ); towergates[ TEAM_HORDE ][ i ]->SetFlags( GAMEOBJECT_FLAG_UNTARGETABLE ); towergates[ TEAM_HORDE ][ i ]->PushToWorld( m_mapMgr ); } //Spawn Alliance keep canons for( uint32 i = 0; i < 12; i++ ) SpawnCreature( 34944, AllyKeepCanons[ i ], 1 ); //Spawn Horde keep canons for( uint32 i = 0; i < 13; i++ ) SpawnCreature( 34944, HordeKeepCanons[ i ], 2 ); //Spawn Alliance Keep guards for( uint32 i = 0; i < 4; i++ ) SpawnCreature( 34919, AllyGuards[ i ], 1 ); //Spawn Horde Keep guards for( uint32 i = 0; i < 4; i++ ) SpawnCreature( 34918, HordeGuards[ i ], 2 ); // Flagpole for( uint32 i = 0; i < IOC_NUM_CONTROL_POINTS; ++i ){ controlpoint[ i ].pole = SpawnGameObject(IOC_FLAGPOLE, 628, ControlPointCoordinates[i][0], ControlPointCoordinates[i][1], ControlPointCoordinates[i][2], ControlPointCoordinates[i][3], 0, 35, 1.0f); controlpoint[ i ].pole->PushToWorld(m_mapMgr); } SpawnControlPoint(IOC_CONTROL_POINT_REFINERY, IOC_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(IOC_CONTROL_POINT_QUARRY, IOC_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(IOC_CONTROL_POINT_DOCKS, IOC_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(IOC_CONTROL_POINT_HANGAR, IOC_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(IOC_CONTROL_POINT_WORKSHOP, IOC_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(IOC_CONTROL_POINT_ALLIANCE_KEEP, IOC_SPAWN_TYPE_ALLIANCE_CONTROLLED); SpawnControlPoint(IOC_CONTROL_POINT_HORDE_KEEP, IOC_SPAWN_TYPE_HORDE_CONTROLLED); }
void ArathiBasin::OnCreate() { // Alliance Gate GameObjectPointer gate = SpawnGameObject(180255, 1284.597290f, 1281.166626f, -15.977916f, 0.76f, 32, 114, 1.5799990f); gate->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100); gate->PushToWorld(m_mapMgr); m_gates.push_back(gate); // horde gate gate = SpawnGameObject(180256, 708.0902710f, 708.4479370f, -17.3898964f, 3.92f, 32, 114, 1.5699990f); gate->SetByte(GAMEOBJECT_BYTES_1,GAMEOBJECT_BYTES_ANIMPROGRESS, 100); gate->PushToWorld(m_mapMgr); m_gates.push_back(gate); // spawn (default) control points SpawnControlPoint(AB_CONTROL_POINT_STABLE, AB_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(AB_CONTROL_POINT_BLACKSMITH, AB_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(AB_CONTROL_POINT_LUMBERMILL, AB_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(AB_CONTROL_POINT_MINE, AB_SPAWN_TYPE_NEUTRAL); SpawnControlPoint(AB_CONTROL_POINT_FARM, AB_SPAWN_TYPE_NEUTRAL); // spawn buffs SpawnBuff(AB_BUFF_STABLES); SpawnBuff(AB_BUFF_BLACKSMITH); SpawnBuff(AB_BUFF_LUMBERMILL); SpawnBuff(AB_BUFF_MINE); SpawnBuff(AB_BUFF_FARM); // spawn the h/a base spirit guides AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[0][0],NoBaseGYLocations[0][1],NoBaseGYLocations[0][2], 0.0f, 0)); AddSpiritGuide(SpawnSpiritGuide(NoBaseGYLocations[1][0],NoBaseGYLocations[1][1],NoBaseGYLocations[1][2], 0.0f, 1)); // w00t WorldStateManager &sm = m_mapMgr->GetStateManager(); // urrrgh worldstates sm.CreateWorldState(0x8D8, 0x00); sm.CreateWorldState(0x8D7, 0x00); sm.CreateWorldState(0x8D6, 0x00); sm.CreateWorldState(0x8D5, 0x00); sm.CreateWorldState(0x8D4, 0x00); sm.CreateWorldState(0x8D3, 0x00); // AB world state's // unknowns, need more research sm.CreateWorldState(0x7A3, 1800); // unknown sm.CreateWorldState(0x745, 0x02); // unknown // Icon stuff for on the map sm.CreateWorldState(WORLDSTATE_AB_SHOW_BACKSMITH_ICON, 0x01); sm.CreateWorldState(WORLDSTATE_AB_SHOW_FARM_ICON, 0x01); sm.CreateWorldState(WORLDSTATE_AB_SHOW_LUMBERMILL_ICON, 0x01); sm.CreateWorldState(WORLDSTATE_AB_SHOW_GOLDMINE_ICON, 0x01); sm.CreateWorldState(WORLDSTATE_AB_SHOW_STABLE_ICON, 0x01); // LumberMill sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_LUMBERMILL_HORDE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_LUMBERMILL_ALLIANCE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_LUMBERMILL_HORDE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_LUMBERMILL_ALLIANCE, 0x00); // GoldMine sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_GOLDMINE_HORDE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_GOLDMINE_ALLIANCE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_GOLDMINE_HORDE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_GOLDMINE_ALLIANCE, 0x00); // BlackSmith sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_BLACKSMITH_HORDE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_BLACKSMITH_ALLIANCE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_BLACKSMITH_HORDE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_BLACKSMITH_ALLIANCE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_MAX_SCORE, RESOURCES_WINVAL); sm.CreateWorldState(WORLDSTATE_AB_ALLIANCE_CAPTUREBASE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_HORDE_CAPTUREBASE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_HORDE_RESOURCES, 0x00); sm.CreateWorldState(WORLDSTATE_AB_ALLIANCE_RESOURCES, 0x00); // Farm sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_FARM_ALLIANCE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_FARM_HORDE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_FARM_HORDE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_FARM_ALLIANCE, 0x00); // Stables sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_STABLES_HORDE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURING_STABLES_ALLIANCE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_STABLES_HORDE, 0x00); sm.CreateWorldState(WORLDSTATE_AB_CAPTURED_STABLES_ALLIANCE, 0x00); }
void IsleOfConquest::AssaultControlPoint(Player* pPlayer, uint32 Id) { if(!m_started) { SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, pPlayer->GetGUID(), "%s has been removed from the game for cheating.", pPlayer->GetName()); pPlayer->SoftDisconnect(); return; } bool isVirgin = false; uint32 Team = pPlayer->m_bgTeam; uint32 Owner; if(m_basesOwnedBy[Id]==-1 && m_basesAssaultedBy[Id]==-1) { isVirgin = true; // omgwtfbbq our flag is a virgin? SetWorldState(NeutralFields[Id], 0); } if(m_basesOwnedBy[Id] != -1) { Owner = m_basesOwnedBy[Id]; // set it to uncontrolled for now m_basesOwnedBy[Id] = -1; // this control point just got taken over by someone! oh noes! if( m_spiritGuides[Id] != NULL ) { map<Creature*,set<uint32> >::iterator itr = m_resurrectMap.find(m_spiritGuides[Id]); if( itr != m_resurrectMap.end() ) { for( set<uint32>::iterator it2 = itr->second.begin(); it2 != itr->second.end(); it2++ ) { Player* r_plr = m_mapMgr->GetPlayer( *it2 ); if( r_plr != NULL && r_plr->IsDead()) { HookHandleRepop( r_plr ); QueueAtNearestSpiritGuide(r_plr, itr->first); } } } m_resurrectMap.erase( itr ); if(m_spiritGuides[Id] && m_spiritGuides[Id]->IsInWorld()) { m_spiritGuides[Id]->Despawn( 0, 0 ); m_spiritGuides[Id] = NULL; } } // reset the world states SetWorldState(OwnedFields[Id][Owner], 0); // modify the resource update time period if(m_capturedBases[Owner]==0) event_RemoveEvents(EVENT_IOC_RESOURCES_UPDATE_TEAM_0+Owner); else event_ModifyTime(EVENT_IOC_RESOURCES_UPDATE_TEAM_0 + Owner, ResourceUpdateIntervals[m_capturedBases[Owner]]); } pPlayer->AddHonor(25); // Contested Flag, not ours, and is not virgin if( !isVirgin && m_basesLastOwnedBy[Id] == int32(Team) && m_basesOwnedBy[Id] == -1 ) { SetWorldState(AssaultFields[Id][Team ? 0 : 1], 0); event_RemoveEvents(EVENT_IOC_CAPTURE_CP_1 + Id); SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, pPlayer->GetGUID(), "$N has defended the %s!", ControlPointNames[Id]); m_basesAssaultedBy[Id] = Team; CaptureControlPoint( Id, Team ); pPlayer->m_bgScore.MiscData[BG_SCORE_IOC_BASE_DEFENDED]++; return; } // n***a stole my flag! if(m_basesAssaultedBy[Id] != -1) { Owner = m_basesAssaultedBy[Id]; m_basesAssaultedBy[Id] = Team; SetWorldState(AssaultFields[Id][Owner], 0); sEventMgr.RemoveEvents(this, EVENT_IOC_CAPTURE_CP_1 + Id); } m_basesAssaultedBy[Id] = Team; // spawn the new control point gameobject SpawnControlPoint(Id, Team ? IOC_SPAWN_TYPE_HORDE_ASSAULT : IOC_SPAWN_TYPE_ALLIANCE_ASSAULT); // send out the chat message and sound SendChatMessage(Team ? CHAT_MSG_BG_EVENT_HORDE : CHAT_MSG_BG_EVENT_ALLIANCE, pPlayer->GetGUID(), "$N claims the %s! If left unchallenged, the %s will control it in 1 minute!", ControlPointNames[Id], Team ? "Horde" : "Alliance"); // guessed PlaySoundToAll(Team ? SOUND_ALLIANCE_CAPTURE : SOUND_HORDE_CAPTURE); // update the client's map with the new assaulting field SetWorldState(AssaultFields[Id][Team], 1); // create the 60 second event. sEventMgr.AddEvent(this, &IsleOfConquest::CaptureControlPoint, Id, Team, EVENT_IOC_CAPTURE_CP_1 + Id, 60000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); // update players info pPlayer->m_bgScore.MiscData[BG_SCORE_IOC_BASE_ASSAULTED]++; UpdatePvPData(); if(Id == 5) { if(m_salesman != NULL) m_salesman->Despawn(0,0); } }
void StrandOfTheAncient::PrepareRound(){ roundprogress = SOTA_ROUND_PREPARATION; if( BattleRound == 1 ){ Attackers = RandomUInt( 1 ); if( Attackers == TEAM_ALLIANCE ) Defenders = TEAM_HORDE; else Defenders = TEAM_ALLIANCE; }else{ std::swap( Attackers, Defenders ); } for( uint32 i = 0; i < GATE_COUNT; i++ ){ m_gates[ i ]->Rebuild(); m_gates[ i ]->SetFaction( TeamFactions[ Defenders ] ); } m_endgate->Rebuild(); m_endgate->SetFaction( TeamFactions[ Defenders ] ); m_relic->SetFaction( TeamFactions[ Attackers ] ); for( uint32 i = 0; i < GATE_COUNT; i++ ) m_gateTransporters[ i ]->SetFaction( TeamFactions[ Defenders ] ); for( uint32 i = 0; i < SOTA_NUM_CANONS; i++ ){ if( canon[ i ] != NULL ) canon[ i ]->Despawn( 0, 0 ); canon[ i ] = SpawnCreature( 27894, CanonLocations[ i ], TeamFactions[ Defenders ] ); } for( uint32 i = 0; i < SOTA_NUM_DOCK_DEMOLISHERS; i++ ){ Creature *c = demolisher[ i ]; demolisher[ i ] = SpawnCreature( 28781, DemolisherLocations[ i ], TeamFactions[ Attackers ] ); if( c != NULL ) c->Despawn( 0, 0 ); } for( uint32 i = SOTA_WEST_WS_DEMOLISHER_INDEX; i < SOTA_NUM_DEMOLISHERS; i++ ){ if( demolisher[ i ] != NULL ){ demolisher[ i ]->Despawn( 0, 0 ); demolisher[ i ] = NULL; } } SOTACPStates state; if( Attackers == TEAM_ALLIANCE ){ state = SOTA_CP_STATE_HORDE_CONTROL; SetWorldState( WORLDSTATE_SOTA_HORDE_ATTACKER, 0 ); SetWorldState( WORLDSTATE_SOTA_ALLIANCE_ATTACKER, 1 ); SetWorldState( WORLDSTATE_SOTA_SHOW_ALLY_ROUND, 1 ); SetWorldState( WORLDSTATE_SOTA_SHOW_HORDE_ROUND, 0 ); SetWorldState( WORLDSTATE_SOTA_SHOW_ALLY_DEFENSE, 0 ); SetWorldState( WORLDSTATE_SOTA_SHOW_HORDE_DEFENSE, 1 ); SetWorldState( WORLDSTATE_SOTA_SHOW_ALLY_BEACHHEAD1, 1 ); SetWorldState( WORLDSTATE_SOTA_SHOW_ALLY_BEACHHEAD2, 1 ); SetWorldState( WORLDSTATE_SOTA_SHOW_HORDE_BEACHHEAD1, 0 ); SetWorldState( WORLDSTATE_SOTA_SHOW_HORDE_BEACHHEAD2, 0 ); }else{ state = SOTA_CP_STATE_ALLY_CONTROL; SetWorldState( WORLDSTATE_SOTA_HORDE_ATTACKER, 1 ); SetWorldState( WORLDSTATE_SOTA_ALLIANCE_ATTACKER, 0 ); SetWorldState( WORLDSTATE_SOTA_SHOW_ALLY_ROUND, 0 ); SetWorldState( WORLDSTATE_SOTA_SHOW_HORDE_ROUND, 1 ); SetWorldState( WORLDSTATE_SOTA_SHOW_ALLY_DEFENSE, 1 ); SetWorldState( WORLDSTATE_SOTA_SHOW_HORDE_DEFENSE, 0 ); SetWorldState( WORLDSTATE_SOTA_SHOW_ALLY_BEACHHEAD1, 0 ); SetWorldState( WORLDSTATE_SOTA_SHOW_ALLY_BEACHHEAD2, 0 ); SetWorldState( WORLDSTATE_SOTA_SHOW_HORDE_BEACHHEAD1, 1 ); SetWorldState( WORLDSTATE_SOTA_SHOW_HORDE_BEACHHEAD2, 1 ); } SpawnControlPoint( SOTA_CONTROL_POINT_EAST_GY, state ); SpawnControlPoint( SOTA_CONTROL_POINT_WEST_GY, state ); SpawnControlPoint( SOTA_CONTROL_POINT_SOUTH_GY, state ); SpawnGraveyard( SOTA_GY_ATTACKER_BEACH, Attackers ); SpawnGraveyard( SOTA_GY_DEFENDER, Defenders ); if( BattleRound == 2 ){ // Teleport players to their place and cast preparation on them m_mainLock.Acquire(); for( std::set< Player* >::iterator itr = m_players[ Attackers ].begin(); itr != m_players[ Attackers ].end(); ++itr ){ Player *p = *itr; p->SafeTeleport( p->GetMapId(), p->GetInstanceID(), sotaAttackerStartingPosition[ 0 ] ); p->CastSpell( p, BG_PREPARATION, true ); } for( std::set< Player* >::iterator itr = m_players[ Defenders ].begin(); itr != m_players[ Defenders ].end(); ++itr ){ Player *p = *itr; p->SafeTeleport( p->GetMapId(), p->GetInstanceID(), sotaDefenderStartingPosition ); p->CastSpell( p, BG_PREPARATION, true ); } m_mainLock.Release(); sEventMgr.AddEvent( this, &StrandOfTheAncient::StartRound, EVENT_SOTA_START_ROUND, 1 * 10 * 1000, 1, 0 ); } };