void StrandOfTheAncient::OnStart() { sLog.outDebug("OnStart: SOTA Battleground\n"); LocationVector dest; m_started = true; for(list<Player*>::iterator itr = sota_players.begin(); itr != sota_players.end(); ++itr) { Player *plr = *itr; dest.ChangeCoords(sotaStopBoatsPlayer[plr->GetTeam()][0], sotaStopBoatsPlayer[plr->GetTeam()][1], sotaStopBoatsPlayer[plr->GetTeam()][2], sotaStopBoatsPlayer[plr->GetTeam()][3]); plr->SafeTeleport(plr->GetMapId(), plr->GetInstanceID(), dest); } SetWorldState(WORLDSTATE_SOTA_CAPTURE_BAR_DISPLAY, (uint32)-1); SetWorldState(WORLDSTATE_SOTA_CAPTURE_BAR_VALUE, (uint32)-1); SetWorldState(WORLDSTATE_SOTA_BONUS_TIME, 1); SetWorldState(WORLDSTATE_SOTA_TIMER_1, 10); // 10 Minute Timer //SetTime(ROUND_LENGTH, 0); sEventMgr.AddEvent( this, &StrandOfTheAncient::TimeTick, EVENT_SOTA_TIMER, MSTIME_SECOND * 5, 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT ); UpdatePvPData(); }
void StrandOfTheAncient::PrepareRound() { //SetWorldState( WORLDSTATE_SOTA_ALLIANCE_DEFENDER, Attackers == HORDE ? 1 : 0 ); //SetWorldState( WORLDSTATE_SOTA_ALLIANCE_ATTACKER, Attackers == HORDE ? 0 : 1 ); SetWorldState( WORLDSTATE_SOTA_ALLIANCE_DEFENDER, 1); SetWorldState( WORLDSTATE_SOTA_ALLIANCE_ATTACKER, 0); };
void Arena::UpdatePlayerCounts() { if(m_ended) return; uint32 players[2] = {0,0}; for(uint32 i = 0; i < 2; ++i) { for(set<uint32>::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr) { Player *plr = objmgr.GetPlayer(*itr); if ( plr != NULL && plr->isAlive() ) players[i]++; } } SetWorldState(ARENA_WORLD_STATE_A_PLAYER_COUNT, players[0]); SetWorldState(ARENA_WORLD_STATE_H_PLAYER_COUNT, players[1]); if(!m_started) return; if(players[1] == 0) m_winningteam = 0; else if(players[0] == 0) m_winningteam = 1; else return; Finish(); }
void WarsongGulch::HookFlagDrop(Player * plr, GameObject * obj) { /* picking up a dropped flag */ if(m_dropFlags[plr->GetTeam()] != obj) { /* are we returning it? */ if( (obj->GetEntry() == 179785 && plr->GetTeam() == 0) || (obj->GetEntry() == 179786 && plr->GetTeam() == 1) ) { uint32 x = plr->GetTeam() ? 0 : 1; sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + plr->GetTeam()); if( m_dropFlags[x]->IsInWorld() ) m_dropFlags[x]->RemoveFromWorld(false); if(m_homeFlags[x]->IsInWorld() == false) m_homeFlags[x]->PushToWorld(m_mapMgr); plr->m_bgScore.Misc2++; UpdatePvPData(); if( plr->GetTeam() == 1 ) SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Horde flag was returned to its base by %s!", plr->GetName() ); else SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Alliance flag was returned to its base by %s!", plr->GetName() ); SetWorldState(plr->GetTeam() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 1); PlaySoundToAll(plr->GetTeam() ? SOUND_HORDE_RETURNED : SOUND_ALLIANCE_RETURNED); } return; } if( plr->GetTeam() == 0 ) sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG); else sEventMgr.RemoveEvents(this, EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + 1); if( m_dropFlags[plr->GetTeam()]->IsInWorld() ) m_dropFlags[plr->GetTeam()]->RemoveFromWorld(false); m_flagHolders[plr->GetTeam()] = plr->GetLowGUID(); plr->m_bgHasFlag = true; /* This is *really* strange. Even though the A9 create sent to the client is exactly the same as the first one, if * you spawn and despawn it, then spawn it again it will not show. So we'll assign it a new guid, hopefully that * will work. * - Burlex */ m_dropFlags[plr->GetTeam()]->SetNewGuid(m_mapMgr->GenerateGameobjectGuid()); SpellEntry * pSp = dbcSpell.LookupEntry(23333 + (plr->GetTeam() * 2)); Spell * sp = new Spell(plr, pSp, true, 0); SpellCastTargets targets(plr->GetGUID()); sp->prepare(&targets); SetWorldState(plr->GetTeam() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 2); }
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_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_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]); // update the overhead display on the clients (world states) m_capturedBases[Team]++; SetWorldState(Team ? AB_HORDE_CAPTUREBASE : 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 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]]); } }
bool EyeOfTheStorm::GivePoints(uint32 team, uint32 points) { //printf("EOTS: Give team %u %u points.\n", team, points); m_points[team] += points; if((m_points[team] - m_lastHonorGainPoints[team]) >= resourcesToGainBH) { uint32 honorToAdd = m_honorPerKill; m_mainLock.Acquire(); for(set<Player*>::iterator itr = m_players[team].begin(); itr != m_players[team].end(); ++itr) { (*itr)->m_bgScore.BonusHonor += honorToAdd; HonorHandler::AddHonorPointsToPlayer((*itr), honorToAdd); } UpdatePvPData(); m_mainLock.Release(); m_lastHonorGainPoints[team] += resourcesToGainBH; } if(m_points[team] >= 1600) { m_points[team] = 1600; m_ended = true; m_winningteam = static_cast<uint8>(team); m_nextPvPUpdateTime = 0; sEventMgr.RemoveEvents(this); sEventMgr.AddEvent(TO< CBattleground* >(this), &CBattleground::Close, EVENT_BATTLEGROUND_CLOSE, 120000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); m_mainLock.Acquire(); AddHonorToTeam( m_winningteam, 3 * 185 ); CastSpellOnTeam( m_winningteam, 43477 ); CastSpellOnTeam( m_winningteam, 69156 ); if( m_winningteam == TEAM_ALLIANCE ) AddHonorToTeam( TEAM_HORDE, 1 * 185 ); else AddHonorToTeam( TEAM_ALLIANCE, 1 * 185 ); m_mainLock.Release(); SetWorldState(WORLDSTATE_EOTS_ALLIANCE_VICTORYPOINTS + team, m_points[team]); UpdatePvPData(); return true; } SetWorldState(WORLDSTATE_EOTS_ALLIANCE_VICTORYPOINTS + team, m_points[team]); return false; }
void StrandOfTheAncient::SpawnControlPoint(SOTAControlPoints point, SOTACPStates state) { if (state >= MAX_SOTA_CP_STATES) return; SOTAControlPoint &cp = controlpoint[point]; if (cp.worldstate != 0) SetWorldState(cp.worldstate, 0); uint32 team = TEAM_ALLIANCE; uint32 faction = 0; switch (state) { case SOTA_CP_STATE_ALLY_CONTROL: team = TEAM_ALLIANCE; faction = 2; break; case SOTA_CP_STATE_HORDE_CONTROL: team = TEAM_HORDE; faction = 1; break; default: return; break; } // First time spawning if (cp.pole == NULL) { cp.pole = SpawnGameObject(SOTA_FLAGPOLE_ID, FlagPolePositions[point], 0, 35, 1.0f); cp.pole->PushToWorld(m_mapMgr); } else { if (cp.banner->IsInWorld()) cp.banner->RemoveFromWorld(false); } cp.banner = SpawnGameObject(FlagIDs[point][team], FlagPositions[point], 0, faction, 1.0f); cp.banner->PushToWorld(m_mapMgr); cp.state = state; cp.worldstate = CPWorldstates[point][team]; SetWorldState(cp.worldstate, 1); //Spawn graveyard SpawnGraveyard(SOTAGraveyards(uint32(point)), team); }
// time in seconds void StrandOfTheAncient::SetTime( uint32 secs ){ uint32 minutes = secs / TIME_MINUTE; uint32 seconds = secs % TIME_MINUTE; uint32 digits[3]; digits[0] = minutes; digits[1] = seconds / 10; digits[2] = seconds % 10; SetWorldState(WORLDSTATE_SOTA_TIMER_1, digits[0]); SetWorldState(WORLDSTATE_SOTA_TIMER_2, digits[1]); SetWorldState(WORLDSTATE_SOTA_TIMER_3, digits[2]); SetRoundTime(secs); }
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); }
// time in seconds void StrandOfTheAncient::SetTime(uint32 secs, uint32 WorldState) { uint32 minutes = secs / TIME_MINUTE; uint32 seconds = secs % TIME_MINUTE; uint32 digits[3]; digits[0] = minutes; digits[1] = seconds / 10; digits[2] = seconds % 10; //m_mapMgr->GetStateManager().UpdateWorldState( WorldState, 1 ); SetWorldState( WORLDSTATE_SOTA_TIMER_1, digits[0] ); SetWorldState( WORLDSTATE_SOTA_TIMER_2, digits[1] ); SetWorldState( WORLDSTATE_SOTA_TIMER_3, digits[2] ); SetRoundTime( secs ); }
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 WarsongGulch::HookOnFlagDrop(Player* plr) { if (!plr->m_bgHasFlag || m_dropFlags[plr->GetTeam()]->IsInWorld()) return; // drop the flag! m_dropFlags[plr->GetTeam()]->SetPosition(plr->GetPosition()); // m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_X, plr->GetPositionX()); // m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_Y, plr->GetPositionY()); // m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_Z, plr->GetPositionZ()); // m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_FACING, plr->GetOrientation()); m_dropFlags[plr->GetTeam()]->PushToWorld(m_mapMgr); m_flagHolders[plr->GetTeam()] = 0; plr->m_bgHasFlag = false; plr->RemoveAura(23333 + (plr->GetTeam() * 2)); SetWorldState(plr->IsTeamHorde() ? WORLDSTATE_WSG_ALLIANCE_FLAG_DISPLAY : WORLDSTATE_WSG_HORDE_FLAG_DISPLAY, 1); sEventMgr.AddEvent(this, &WarsongGulch::ReturnFlag, plr->GetTeamReal(), EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + plr->GetTeam(), 5000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT); PlaySoundToAll(SOUND_FLAG_RETURNED); if (plr->IsTeamHorde()) SendChatMessage(CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Alliance flag was dropped by %s!", plr->GetName()); else SendChatMessage(CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Horde flag was dropped by %s!", plr->GetName()); }
void WarsongGulch::DropFlag(Player * plr) { if(!plr->m_bgHasFlag || m_dropFlags[plr->GetTeam()]->IsInWorld()) return; /* drop the flag! */ m_dropFlags[plr->GetTeam()]->SetPosition(plr->GetPosition()); m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_X, plr->GetPositionX()); m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_Y, plr->GetPositionY()); m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_POS_Z, plr->GetPositionZ()); m_dropFlags[plr->GetTeam()]->SetFloatValue(GAMEOBJECT_FACING, plr->GetOrientation()); m_dropFlags[plr->GetTeam()]->PushToWorld(m_mapMgr); m_flagHolders[plr->GetTeam()] = 0; SetWorldState(plr->GetTeam() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 1); plr->m_bgHasFlag = false; plr->CastSpell(plr, 42792, true); sEventMgr.AddEvent( this, &WarsongGulch::ReturnFlag, plr->GetTeam(), EVENT_BATTLEGROUND_WSG_AUTO_RETURN_FLAG + plr->GetTeam(), 5000, 1, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT ); if( plr->GetTeam() == 1 ) SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Alliance flag was dropped by %s!", plr->GetName() ); else SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Horde flag was dropped by %s!", plr->GetName() ); }
void IsleOfConquest::RemoveReinforcements( uint32 team, uint32 amount ){ m_reinforcements[ team ] -= amount; SetWorldState( WORLDSTATE_IOC_ALLY_SCORE_VALUE + team, m_reinforcements[ team ] ); if( m_reinforcements[ team ] == 0 ) Finish( team ); }
void EyeOfTheStorm::EventResetFlag() { if(!m_dropFlag->IsInWorld()) return; m_dropFlag->RemoveFromWorld(false); m_standFlag->PushToWorld(m_mapMgr); SetWorldState( 2757, 1 ); PlaySoundToAll( 8192 ); SendChatMessage( CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The flag has been reset." ); m_flagHolder = 0; }
void Arena::UpdatePlayerCounts() { if(m_ended) return; SetWorldState(WORLDSTATE_ARENA__GREEN_PLAYER_COUNT, m_playersCount[0]); SetWorldState(WORLDSTATE_ARENA__GOLD_PLAYER_COUNT, m_playersCount[1]); if(!m_started) return; return; if(m_playersCount[1] == 0) m_winningteam = 0; else if(m_playersCount[0] == 0) m_winningteam = 1; else return; Finish(); }
void WarsongGulch::OnCreate() { /* add the buffs to the world */ for(int i = 0; i < 6; ++i) { if(!m_buffs[i]->IsInWorld()) m_buffs[i]->PushToWorld(m_mapMgr); } // Alliance Gates GameObject* gate = SpawnGameObject(179921, 489, 1471.554688f, 1458.778076f, 362.633240f, 0, 33, 114, 2.33271f); gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100); gate->PushToWorld(m_mapMgr); m_gates.push_back(gate); gate = SpawnGameObject(179919, 489, 1492.477783f, 1457.912354f, 342.968933f, 0, 33, 114, 2.68149f); gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100); gate->PushToWorld(m_mapMgr); m_gates.push_back(gate); gate = SpawnGameObject(179918, 489, 1503.335327f, 1493.465820f, 352.188843f, 0, 33, 114, 2.26f); gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100); gate->PushToWorld(m_mapMgr); m_gates.push_back(gate); // Horde Gates gate = SpawnGameObject(179916, 489, 949.1663208f, 1423.7717285f, 345.6241455f, -0.5756807f, 32, 114, 0.900901f); gate->SetParentRotation(0, -0.0167336f); gate->SetParentRotation(1, -0.004956f); gate->SetParentRotation(2, -0.283972f); gate->SetParentRotation(3, 0.9586736f); gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100); gate->PushToWorld(m_mapMgr); m_gates.push_back(gate); gate = SpawnGameObject(179917, 489, 953.0507202f, 1459.8424072f, 340.6525573f, -1.9966197f, 32, 114, 0.854700f); gate->SetParentRotation(0, -0.1971825f); gate->SetParentRotation(1, 0.1575096f); gate->SetParentRotation(2, -0.8239487f); gate->SetParentRotation(3, 0.5073640f); gate->SetByte(GAMEOBJECT_BYTES_1, 3, 100); gate->PushToWorld(m_mapMgr); m_gates.push_back(gate); // Should be set from config SetWorldState( WORLDSTATE_WSG_MAX_SCORE, 3 ); /* spawn spirit guides */ AddSpiritGuide(SpawnSpiritGuide(1423.218872f, 1554.663574f, 342.833801f, 3.124139f, 0)); AddSpiritGuide(SpawnSpiritGuide(1032.644775f, 1388.316040f, 340.559937f, 0.043200f, 1)); }
void EyeOfTheStorm::EventResetFlag() { if(!m_dropFlag->IsInWorld()) return; m_dropFlag->RemoveFromWorld(false); m_dropFlag->SetUInt32Value(GAMEOBJECT_FLAGS, 0); m_standFlag->PushToWorld(m_mapMgr); SetWorldState(2757, 1); PlaySoundToAll(SOUND_ALLIANCE_RETURNED); SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, 0, "The flag has been reset."); m_flagHolder = 0; }
bool EyeOfTheStorm::HookSlowLockOpen(GameObject* pGo, Player* pPlayer, Spell* pSpell) { if(m_flagHolder != 0) return false; m_standFlag->RemoveFromWorld(false); pPlayer->CastSpell(pPlayer->GetGUID(), EOTS_NETHERWING_FLAG_SPELL, true); SetWorldState(2757, 0); PlaySoundToAll(pPlayer->IsTeamHorde() ? SOUND_HORDE_CAPTURE : SOUND_ALLIANCE_CAPTURE); SendChatMessage(CHAT_MSG_BG_EVENT_ALLIANCE + pPlayer->GetTeam(), pPlayer->GetGUID(), "$N has taken the flag!"); m_flagHolder = pPlayer->GetLowGUID(); return true; }
void EyeOfTheStorm::HookFlagDrop(Player * plr, GameObject * obj) { if( !m_dropFlag->IsInWorld() ) return; m_dropFlag->RemoveFromWorld(false); plr->CastSpell( plr->GetGUID(), EOTS_NETHERWING_FLAG_SPELL, true ); SetWorldState( EOTS_WORLDSTATE_FLAG_STATE, 0 ); PlaySoundToAll( 8212 ); SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE + plr->GetTeam(), plr->GetGUID(), "$N has taken the flag!" ); m_flagHolder = plr->GetLowGUID(); event_RemoveEvents( EVENT_EOTS_RESET_FLAG ); }
void IsleOfConquest::RemoveReinforcements(uint32 teamId, uint32 amt) { if( ((int32)( m_reinforcements[teamId] - amt )) < 0 ) m_reinforcements[teamId] = 0; else m_reinforcements[teamId] -= amt; SetWorldState(WORLDSTATE_IOC_ALLIANCE_SCORE + teamId, m_reinforcements[teamId]); /* No resources just means no vehicles. if( m_reinforcements[teamId] == 0 ) { Finish( teamId ); }*/ }
void StrandOfTheAncient::OnCreate() { sLog.outDebug("OnCreate: SOTA Battleground\n"); SetWorldState(WORLDSTATE_SOTA_CAPTURE_BAR_DISPLAY, 0); SetWorldState(WORLDSTATE_SOTA_CAPTURE_BAR_VALUE, 0); PrepareRound(); SetWorldState(WORLDSTATE_SOTA_BONUS_TIME, 0); SetWorldState(WORLDSTATE_SOTA_TIMER_1, 0); SetWorldState(WORLDSTATE_SOTA_TIMER_2, 0); SetWorldState(WORLDSTATE_SOTA_TIMER_3, 0); }
void WarsongGulch::HookFlagStand(Player* plr, GameObject* obj) { #ifdef ANTI_CHEAT if (!m_started) { Anticheat_Log->writefromsession(plr->GetSession(), "%s tryed to hook the flag in warsong gluch before battleground (ID %u) started.", plr->GetName(), this->m_id); SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, plr->GetGUID(), "%s will be removed from the game for cheating.", plr->GetName()); // Remove player from battleground. this->RemovePlayer(plr, false); // Kick player from server. plr->Kick(6000); return; } #endif if (m_flagHolders[plr->GetTeam()] || m_homeFlags[plr->GetTeam()] != obj || m_dropFlags[plr->GetTeam()]->IsInWorld()) { // cheater! return; } std::map<uint32, uint32>::iterator itr = plr->m_forcedReactions.find(1059); if (itr != plr->m_forcedReactions.end()) { return; } SpellInfo* pSp = sSpellCustomizations.GetSpellInfo(23333 + (plr->GetTeam() * 2)); Spell* sp = sSpellFactoryMgr.NewSpell(plr, pSp, true, 0); SpellCastTargets targets(plr->GetGUID()); sp->prepare(&targets); // set the flag holder plr->m_bgHasFlag = true; m_flagHolders[plr->GetTeam()] = plr->GetLowGUID(); if (m_homeFlags[plr->GetTeam()]->IsInWorld()) m_homeFlags[plr->GetTeam()]->RemoveFromWorld(false); PlaySoundToAll(plr->IsTeamHorde() ? SOUND_HORDE_CAPTURE : SOUND_ALLIANCE_CAPTURE); SetWorldState(plr->IsTeamHorde() ? WORLDSTATE_WSG_ALLIANCE_FLAG_DISPLAY : WORLDSTATE_WSG_HORDE_FLAG_DISPLAY, 2); if (plr->IsTeamHorde()) SendChatMessage(CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Alliance's flag has been taken by %s !", plr->GetName()); else SendChatMessage(CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Horde's flag has been taken by %s !", plr->GetName()); }
void EyeOfTheStorm::UpdateIcons() { for(uint32 i = 0; i < 4; i++) { if(m_CPStatus[i] == 0) { SetWorldState(m_iconsStates[i][0], 0); SetWorldState(m_iconsStates[i][1], 0); SetWorldState(m_iconsStates[i][2], 1); } else if(m_CPStatus[i] == 100) { SetWorldState(m_iconsStates[i][0], 0); SetWorldState(m_iconsStates[i][1], 1); SetWorldState(m_iconsStates[i][2], 0); } else { SetWorldState(m_iconsStates[i][0], 1); SetWorldState(m_iconsStates[i][1], 0); SetWorldState(m_iconsStates[i][2], 0); } } }
void EyeOfTheStorm::HookFlagDrop(Player * plr, GameObject * obj) { if( !m_dropFlag->IsInWorld() ) return; map<uint32,uint32>::iterator itr = plr->m_forcedReactions.find(1059); if (itr != plr->m_forcedReactions.end()) { return; } m_dropFlag->RemoveFromWorld(false); plr->CastSpell( plr->GetGUID(), EOTS_NETHERWING_FLAG_SPELL, true ); SetWorldState( 2757, 0 ); PlaySoundToAll((plr->GetTeam()) ? SOUND_HORDE_CAPTURE : SOUND_ALLIANCE_CAPTURE); SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE + plr->GetTeam(), plr->GetGUID(), "$N has taken the flag!" ); m_flagHolder = plr->GetLowGUID(); event_RemoveEvents( EVENT_EOTS_RESET_FLAG ); }
void StrandOfTheAncient::StartRound(){ roundprogress = SOTA_ROUND_STARTED; 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[ SOTA_ROUND_STARTED ] ); p->RemoveAura( BG_PREPARATION ); } m_mainLock.Release(); RemoveAuraFromTeam( Defenders, BG_PREPARATION ); SetWorldState( WORLDSTATE_SOTA_TIMER_1, 10 ); SetTime( ROUND_LENGTH ); sEventMgr.AddEvent( this, &StrandOfTheAncient::TimeTick, EVENT_SOTA_TIMER, MSTIME_SECOND * 5, 0, EVENT_FLAG_DO_NOT_EXECUTE_IN_WORLD_CONTEXT ); UpdatePvPData(); }
void WarsongGulch::HookFlagStand(Player * plr, GameObject * obj) { #ifdef ANTI_CHEAT if(!m_started) { Anticheat_Log->writefromsession(plr->GetSession(), "%s tryed to hook the flag in warsong gluch before battleground (ID %u) started.", plr->GetName(), this->m_id); SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, plr->GetGUID(), "%s will be removed from the game for cheating.", plr->GetName()); // Remove player from battleground. this->RemovePlayer(plr, false); // Kick player from server. plr->Kick(6000); return; } #endif if(m_flagHolders[plr->GetTeam()] || m_homeFlags[plr->GetTeam()] != obj) { // cheater! return; } map<uint32,uint32>::iterator itr = plr->m_forcedReactions.find(1059); if (itr != plr->m_forcedReactions.end()) { return; } SpellEntry * pSp = dbcSpell.LookupEntry(23333 + (plr->GetTeam() * 2)); Spell * sp = SpellPool.PooledNew(); sp->Init(plr, pSp, true, 0); SpellCastTargets targets(plr->GetGUID()); sp->prepare(&targets); /* set the flag holder */ m_flagHolders[plr->GetTeam()] = plr->GetLowGUID(); if(m_homeFlags[plr->GetTeam()]->IsInWorld()) m_homeFlags[plr->GetTeam()]->RemoveFromWorld(false); PlaySoundToAll(plr->GetTeam() ? SOUND_HORDE_CAPTURE : SOUND_ALLIANCE_CAPTURE); SetWorldState(plr->GetTeam() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 2); }
void WarsongGulch::HookFlagStand(Player * plr, GameObject * obj) { #ifdef ANTI_CHEAT if(!m_started) { SendChatMessage(CHAT_MSG_BG_EVENT_NEUTRAL, plr->GetGUID(), "%s has been removed from the game for cheating!", plr->GetName()); plr->SoftDisconnect(); return; } #endif if(m_flagHolders[plr->GetTeam()] || m_homeFlags[plr->GetTeam()] != obj) { // cheater! return; } SpellEntry * pSp = dbcSpell.LookupEntry(23333 + (plr->GetTeam() * 2)); Spell * sp = new Spell(plr, pSp, true, 0); SpellCastTargets targets(plr->GetGUID()); sp->prepare(&targets); /* set the flag holder */ m_flagHolders[plr->GetTeam()] = plr->GetLowGUID(); if(m_homeFlags[plr->GetTeam()]->IsInWorld()) m_homeFlags[plr->GetTeam()]->RemoveFromWorld(false); plr->m_bgHasFlag = true; if( plr->GetTeam() == 1 ) SendChatMessage( CHAT_MSG_BG_EVENT_HORDE, plr->GetGUID(), "The Alliance flag was picked up by %s!", plr->GetName() ); else SendChatMessage( CHAT_MSG_BG_EVENT_ALLIANCE, plr->GetGUID(), "The Horde flag was picked up by %s!", plr->GetName() ); PlaySoundToAll(plr->GetTeam() ? SOUND_HORDE_CAPTURE : SOUND_ALLIANCE_CAPTURE); SetWorldState(plr->GetTeam() ? WSG_ALLIANCE_FLAG_CAPTURED : WSG_HORDE_FLAG_CAPTURED, 2); }
void Arena::UpdatePlayerCounts() { if(m_ended) return; switch(m_mapMgr->GetMapId()) { /* ruins of lordaeron */ case 572: SetWorldState(ARENA_WORLD_STATE_A_PLAYER_COUNT, m_playersCount[0]); SetWorldState(ARENA_WORLD_STATE_H_PLAYER_COUNT, m_playersCount[1]); break; /* blades edge arena */ case 562: SetWorldState(ARENA_WORLD_STATE_A_PLAYER_COUNT, m_playersCount[0]); SetWorldState(ARENA_WORLD_STATE_H_PLAYER_COUNT, m_playersCount[1]); break; /* nagrand arena */ case 559: SetWorldState(ARENA_WORLD_STATE_A_PLAYER_COUNT, m_playersCount[0]); SetWorldState(ARENA_WORLD_STATE_H_PLAYER_COUNT, m_playersCount[1]); break; } if(!m_started) return; if(m_playersCount[1] == 0) m_winningteam = 0; else if(m_playersCount[0] == 0) m_winningteam = 1; else return; Finish(); }
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); } }