void OPvPCapturePointZM_GraveYard::SetBeaconState(uint32 controlling_faction) { // nothing to do here if (m_BothControllingFaction == controlling_faction) return; m_BothControllingFaction = controlling_faction; switch (controlling_faction) { case ALLIANCE: // if ally already controls the gy and taken back both beacons, return, nothing to do for us if (m_GraveYardState & ZM_GRAVEYARD_A) return; // ally doesn't control the gy, but controls the side beacons -> add gossip option, add neutral banner break; case HORDE: // if horde already controls the gy and taken back both beacons, return, nothing to do for us if (m_GraveYardState & ZM_GRAVEYARD_H) return; // horde doesn't control the gy, but controls the side beacons -> add gossip option, add neutral banner break; default: // if the graveyard is not neutral, then leave it that way // if the graveyard is neutral, then we have to dispel the buff from the flag carrier if (m_GraveYardState & ZM_GRAVEYARD_N) { // gy was neutral, thus neutral banner was spawned, it is possible that someone was taking the flag to the gy if (m_FlagCarrierGUID) { // remove flag from carrier, reset flag carrier guid Player* p = ObjectAccessor::FindPlayer(m_FlagCarrierGUID); if (p) { p->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_A); p->RemoveAurasDueToSpell(ZM_BATTLE_STANDARD_H); } m_FlagCarrierGUID.Clear(); } } break; } // send worldstateupdate UpdateTowerState(); }
void OPvPCapturePointZM_Beacon::ChangeState() { // if changing from controlling alliance to horde if (m_OldState == OBJECTIVESTATE_ALLIANCE) { if (((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled) ((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled--; sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetSkyFireStringForDBCLocale(ZMBeaconLooseA[m_TowerType])); } // if changing from controlling horde to alliance else if (m_OldState == OBJECTIVESTATE_HORDE) { if (((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled) ((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled--; sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetSkyFireStringForDBCLocale(ZMBeaconLooseH[m_TowerType])); } switch(m_State) { case OBJECTIVESTATE_ALLIANCE: m_TowerState = ZM_TOWERSTATE_A; if (((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled<ZM_NUM_BEACONS) ((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled++; sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetSkyFireStringForDBCLocale(ZMBeaconCaptureA[m_TowerType])); break; case OBJECTIVESTATE_HORDE: m_TowerState = ZM_TOWERSTATE_H; if (((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled<ZM_NUM_BEACONS) ((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled++; sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetSkyFireStringForDBCLocale(ZMBeaconCaptureH[m_TowerType])); break; case OBJECTIVESTATE_NEUTRAL: case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_TowerState = ZM_TOWERSTATE_N; break; } UpdateTowerState(); }
bool OPvPCapturePointZM_GraveYard::HandleGossipOption(Player* player, Creature* creature, uint32 /*gossipid*/) { std::map<ObjectGuid::LowType, uint32>::iterator itr = m_CreatureTypes.find(creature->GetSpawnId()); if (itr != m_CreatureTypes.end()) { // if the flag is already taken, then return if (!m_FlagCarrierGUID.IsEmpty()) return true; if (itr->second == ZM_ALLIANCE_FIELD_SCOUT) { creature->CastSpell(player, ZM_BATTLE_STANDARD_A, true); m_FlagCarrierGUID = player->GetGUID(); } else if (itr->second == ZM_HORDE_FIELD_SCOUT) { creature->CastSpell(player, ZM_BATTLE_STANDARD_H, true); m_FlagCarrierGUID = player->GetGUID(); } UpdateTowerState(); player->PlayerTalkClass->SendCloseGossip(); return true; } return false; }
void OPvPCapturePointEP_PWT::ChangeState() { if(fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out! { // if changing from controlling alliance to horde or vice versa if( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetCWStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_A)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; } else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetCWStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_H)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; } uint32 artkit = 21; switch(m_State) { case OBJECTIVESTATE_ALLIANCE: if(m_value == m_maxValue) m_TowerState = EP_TS_A; else m_TowerState = EP_TS_A_P; SummonFlightMaster(ALLIANCE); artkit = 2; ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = ALLIANCE; if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetCWStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A)); break; case OBJECTIVESTATE_HORDE: if(m_value == -m_maxValue) m_TowerState = EP_TS_H; else m_TowerState = EP_TS_H_P; SummonFlightMaster(HORDE); artkit = 1; ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = HORDE; if(m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetCWStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; DelCreature(EP_PWT_FLIGHTMASTER); m_FlightMasterSpawned = 0; break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_TowerState = EP_TS_N_A; break; case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: m_TowerState = EP_TS_N_H; break; } GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID); GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_PWT_FLAGS]); if(flag) { flag->SetGoArtKit(artkit); flag->SendUpdateObjectToAllExcept(NULL); } if(flag2) { flag2->SetGoArtKit(artkit); flag2->SendUpdateObjectToAllExcept(NULL); } UpdateTowerState(); // complete quest objective if(m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) SendObjectiveComplete(EP_PWT_CM, 0); } }
bool OutdoorPvPObjectiveEP_PWT::Update(uint32 diff) { if (OutdoorPvPObjective::Update(diff)) { if (m_OldState != m_State || fabs(m_ShiftPhase) == m_ShiftMaxPhase) // state won't change, only phase when maxed out! { // if changing from controlling alliance to horde or vice versa if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetNeoStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_A)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; } else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetNeoStringForDBCLocale(LANG_OPVP_EP_LOOSE_PWT_H)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; } uint32 artkit = 21; switch(m_State) { case OBJECTIVESTATE_ALLIANCE: if (m_ShiftPhase == m_ShiftMaxPhase) m_TowerState = EP_TS_A; else m_TowerState = EP_TS_A_P; SummonFlightMaster(ALLIANCE); artkit = 2; ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = ALLIANCE; if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetNeoStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A)); break; case OBJECTIVESTATE_HORDE: if (m_ShiftPhase == -m_ShiftMaxPhase) m_TowerState = EP_TS_H; else m_TowerState = EP_TS_H_P; SummonFlightMaster(HORDE); artkit = 1; ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = HORDE; if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetNeoStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; DelCreature(EP_PWT_FLIGHTMASTER); m_FlightMasterSpawned = 0; break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_TowerState = EP_TS_N_A; break; case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: m_TowerState = EP_TS_N_H; break; } GameObject* flag = HashMapHolder<GameObject>::Find(m_CapturePoint); GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_PWT_FLAGS]); if (flag) { flag->SetGoArtKit(artkit); flag->SendUpdateObjectToAllExcept(NULL); } if (flag2) { flag2->SetGoArtKit(artkit); flag2->SendUpdateObjectToAllExcept(NULL); } UpdateTowerState(); // complete quest objective if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) SendObjectiveComplete(EP_PWT_CM, 0); } if (m_ShiftPhase != m_OldPhase) { // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); // send these updates to only the ones in this objective uint32 phase = (uint32)ceil((m_ShiftPhase + m_ShiftMaxPhase) / (2 * m_ShiftMaxPhase ) * 100.0f); SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); // send this too, sometimes it resets :S SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue); } return m_OldState != m_State; } return false; }
void OPvPCapturePointEP_EWT::ChangeState() { // if changing from controlling alliance to horde or vice versa if (m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State) { sWorld->SendZoneText( EP_GraveYardZone, sObjectMgr->GetArkCoreStringForDBCLocale( LANG_OPVP_EP_LOOSE_EWT_A)); ((OutdoorPvPEP*) m_PvP)->EP_Controls[EP_EWT] = 0; } else if (m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State) { sWorld->SendZoneText( EP_GraveYardZone, sObjectMgr->GetArkCoreStringForDBCLocale( LANG_OPVP_EP_LOOSE_EWT_H)); ((OutdoorPvPEP*) m_PvP)->EP_Controls[EP_EWT] = 0; } uint32 artkit = 21; switch (m_State) { case OBJECTIVESTATE_ALLIANCE: m_TowerState = EP_TS_A; artkit = 2; SummonSupportUnitAtNorthpassTower(ALLIANCE); ((OutdoorPvPEP*) m_PvP)->EP_Controls[EP_EWT] = ALLIANCE; if (m_OldState != m_State) sWorld->SendZoneText( EP_GraveYardZone, sObjectMgr->GetArkCoreStringForDBCLocale( LANG_OPVP_EP_CAPTURE_EWT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; artkit = 1; SummonSupportUnitAtNorthpassTower(HORDE); ((OutdoorPvPEP*) m_PvP)->EP_Controls[EP_EWT] = HORDE; if (m_OldState != m_State) sWorld->SendZoneText( EP_GraveYardZone, sObjectMgr->GetArkCoreStringForDBCLocale( LANG_OPVP_EP_CAPTURE_EWT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_TowerState = EP_TS_N_A; break; case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: m_TowerState = EP_TS_N_H; break; } GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID); GameObject* flag2 = HashMapHolder<GameObject>::Find( m_Objects[EP_EWT_FLAGS]); if (flag) { flag->SetGoArtKit(artkit); } if (flag2) { flag2->SetGoArtKit(artkit); } UpdateTowerState(); // complete quest objective if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) SendObjectiveComplete(EP_EWT_CM, 0); }
void OPvPCapturePointTF::ChangeState() { // if changing from controlling alliance to horde if (m_OldState == OBJECTIVESTATE_ALLIANCE) { if (uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled()) ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(--alliance_towers); sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOSE_A)); } // if changing from controlling horde to alliance else if (m_OldState == OBJECTIVESTATE_HORDE) { if (uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled()) ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(--horde_towers); sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOSE_H)); } uint32 artkit = 21; switch (m_State) { case OBJECTIVESTATE_ALLIANCE: { m_TowerState = TF_TOWERSTATE_A; artkit = 2; uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled(); if (alliance_towers < TF_TOWER_NUM) ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(++alliance_towers); sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A)); for (PlayerSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) player->AreaExploredOrEventHappens(TF_ALLY_QUEST); break; } case OBJECTIVESTATE_HORDE: { m_TowerState = TF_TOWERSTATE_H; artkit = 1; uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled(); if (horde_towers < TF_TOWER_NUM) ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(++horde_towers); sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H)); for (PlayerSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) player->AreaExploredOrEventHappens(TF_HORDE_QUEST); break; } case OBJECTIVESTATE_NEUTRAL: case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_TowerState = TF_TOWERSTATE_N; break; } GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID); if (flag) flag->SetGoArtKit(artkit); UpdateTowerState(); }
void OPvPCapturePointTF::ChangeState() { // if changing from controlling alliance to horde if (m_OldState == OBJECTIVESTATE_ALLIANCE) { if (uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled()) ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(--alliance_towers); m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_LOSE_ALLIANCE); } // if changing from controlling horde to alliance else if (m_OldState == OBJECTIVESTATE_HORDE) { if (uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled()) ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(--horde_towers); m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_LOSE_HORDE); } uint32 artkit = 21; switch (m_State) { case OBJECTIVESTATE_ALLIANCE: { m_TowerState = TF_TOWERSTATE_A; artkit = 2; uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled(); if (alliance_towers < TF_TOWER_NUM) ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(++alliance_towers); m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_ALLIANCE); for (GuidSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) player->AreaExploredOrEventHappens(TF_ALLY_QUEST); break; } case OBJECTIVESTATE_HORDE: { m_TowerState = TF_TOWERSTATE_H; artkit = 1; uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled(); if (horde_towers < TF_TOWER_NUM) ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(++horde_towers); m_PvP->SendDefenseMessage(OutdoorPvPTFBuffZones[0], TEXT_SPIRIT_TOWER_TAKEN_HORDE); for (GuidSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr) if (Player* player = ObjectAccessor::FindPlayer(*itr)) player->AreaExploredOrEventHappens(TF_HORDE_QUEST); break; } case OBJECTIVESTATE_NEUTRAL: case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_TowerState = TF_TOWERSTATE_N; break; } auto bounds = sMapMgr->FindMap(530, 0)->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId); for (auto itr = bounds.first; itr != bounds.second; ++itr) itr->second->SetGoArtKit(artkit); UpdateTowerState(); }
bool OutdoorPvPObjectiveEP_EWT::Update(uint32 diff) { if(OutdoorPvPObjective::Update(diff)) { if(m_OldState != m_State || fabs(m_ShiftPhase) == m_ShiftMaxPhase) // state won't change, only phase when maxed out! { // if changing from controlling alliance to horde or vice versa if( m_OldState == OBJECTIVESTATE_ALLIANCE ) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetMangosString((LANG_OPVP_EP_LOOSE_EWT_A),-1)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; } else if ( m_OldState == OBJECTIVESTATE_HORDE ) { sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetMangosString((LANG_OPVP_EP_LOOSE_EWT_H),-1)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; } uint8 artkit = 21; switch(m_State) { case OBJECTIVESTATE_ALLIANCE: if(m_ShiftPhase == m_ShiftMaxPhase) { m_TowerState = EP_TS_A; SummonSupportUnitAtNorthpassTower(ALLIANCE); } else m_TowerState = EP_TS_A_P; artkit = 2; ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = ALLIANCE; sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetMangosString(LANG_OPVP_EP_CAPTURE_EWT_A,-1)); break; case OBJECTIVESTATE_HORDE: if(m_ShiftPhase == -m_ShiftMaxPhase) { m_TowerState = EP_TS_H; SummonSupportUnitAtNorthpassTower(HORDE); } else m_TowerState = EP_TS_H_P; artkit = 1; ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = HORDE; sWorld.SendZoneText(EP_GraveYardZone,objmgr.GetMangosString(LANG_OPVP_EP_CAPTURE_EWT_H,-1)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_TowerState = EP_TS_N_A; break; case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: m_TowerState = EP_TS_N_H; break; } Map* map = m_PvP->GetMap(); GameObject* flag = map->GetGameObject(m_CapturePoint); GameObject* flag2 = map->GetGameObject(m_Objects[EP_EWT_FLAGS]); if(flag) flag->SetGoArtKit(artkit); if(flag2) flag2->SetGoArtKit(artkit); UpdateTowerState(); // complete quest objective if(m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) SendObjectiveComplete(EP_EWT_CM, 0); } if(m_ShiftPhase != m_OldPhase) { // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(EP_UI_TOWER_SLIDER_DISPLAY, 1); // send these updates to only the ones in this objective uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); SendUpdateWorldState(EP_UI_TOWER_SLIDER_POS, phase); // send this too, sometimes it resets :S SendUpdateWorldState(EP_UI_TOWER_SLIDER_N, m_NeutralValue); } return true; } return false; }
void OPvPCapturePointEP_PWT::ChangeState() { // if changing from controlling alliance to horde or vice versa if ( m_OldState == OBJECTIVESTATE_ALLIANCE || m_OldState == OBJECTIVESTATE_HORDE) ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, 0); uint32 artkit = 21; switch (m_State) { case OBJECTIVESTATE_ALLIANCE: m_TowerState = EP_TS_A; SummonFlightMaster(ALLIANCE); artkit = 2; ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, ALLIANCE); m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_PLAGUEWOOD_TOWER_TAKEN_ALLIANCE); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; SummonFlightMaster(HORDE); artkit = 1; ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, HORDE); m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_PLAGUEWOOD_TOWER_TAKEN_HORDE); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; DelCreature(EP_PWT_FLIGHTMASTER); m_FlightMasterSpawned = 0; break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: m_TowerState = EP_TS_N_A; break; case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_TowerState = EP_TS_N_A; DelCreature(EP_PWT_FLIGHTMASTER); m_FlightMasterSpawned = 0; break; case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: m_TowerState = EP_TS_N_H; break; case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: m_TowerState = EP_TS_N_H; DelCreature(EP_PWT_FLIGHTMASTER); m_FlightMasterSpawned = 0; break; } GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID); GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_PWT_FLAGS]); if (flag) { flag->SetGoArtKit(artkit); } if (flag2) { flag2->SetGoArtKit(artkit); } UpdateTowerState(); // complete quest objective if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) SendObjectiveComplete(EP_PWT_CM, ObjectGuid::Empty); }
void OPvPCapturePointEP_PWT::ChangeState() { // if changing from controlling alliance to horde or vice versa if ( m_OldState == OBJECTIVESTATE_ALLIANCE || m_OldState == OBJECTIVESTATE_HORDE) ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, 0); uint32 artkit = 21; switch (m_State) { case OBJECTIVESTATE_ALLIANCE: m_TowerState = EP_TS_A; SummonFlightMaster(ALLIANCE); artkit = 2; ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, ALLIANCE); m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_PLAGUEWOOD_TOWER_TAKEN_ALLIANCE); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; SummonFlightMaster(HORDE); artkit = 1; ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, HORDE); m_PvP->SendDefenseMessage(EP_GraveYardZone, TEXT_PLAGUEWOOD_TOWER_TAKEN_HORDE); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; DelCreature(EP_PWT_FLIGHTMASTER); m_FlightMasterSpawned = 0; break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: m_TowerState = EP_TS_N_A; break; case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_TowerState = EP_TS_N_A; DelCreature(EP_PWT_FLIGHTMASTER); m_FlightMasterSpawned = 0; break; case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: m_TowerState = EP_TS_N_H; break; case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: m_TowerState = EP_TS_N_H; DelCreature(EP_PWT_FLIGHTMASTER); m_FlightMasterSpawned = 0; break; } Map* map = sMapMgr->FindMap(0, 0); auto bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_capturePointSpawnId); for (auto itr = bounds.first; itr != bounds.second; ++itr) itr->second->SetGoArtKit(artkit); bounds = map->GetGameObjectBySpawnIdStore().equal_range(m_Objects[EP_PWT_FLAGS]); for (auto itr = bounds.first; itr != bounds.second; ++itr) itr->second->SetGoArtKit(artkit); UpdateTowerState(); // complete quest objective if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) SendObjectiveComplete(EP_PWT_CM, ObjectGuid::Empty); }
void OPvPCapturePointEP_PWT::ChangeState() { // if changing from controlling alliance to horde or vice versa if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrilliumStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_A)); ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, 0); } else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrilliumStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_H)); ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, 0); } uint32 artkit = 21; switch (m_State) { case OBJECTIVESTATE_ALLIANCE: m_TowerState = EP_TS_A; SummonFlightMaster(ALLIANCE); artkit = 2; ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, ALLIANCE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrilliumStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; SummonFlightMaster(HORDE); artkit = 1; ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, HORDE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrilliumStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; DelCreature(EP_PWT_FLIGHTMASTER); m_FlightMasterSpawned = 0; break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: m_TowerState = EP_TS_N_A; break; case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_TowerState = EP_TS_N_A; DelCreature(EP_PWT_FLIGHTMASTER); m_FlightMasterSpawned = 0; break; case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: m_TowerState = EP_TS_N_H; break; case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: m_TowerState = EP_TS_N_H; DelCreature(EP_PWT_FLIGHTMASTER); m_FlightMasterSpawned = 0; break; } GameObject* flag = HashMapHolder<GameObject>::Find(m_capturePointGUID); GameObject* flag2 = HashMapHolder<GameObject>::Find(m_Objects[EP_PWT_FLAGS]); if (flag) { flag->SetGoArtKit(artkit); } if (flag2) { flag2->SetGoArtKit(artkit); } UpdateTowerState(); // complete quest objective if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) SendObjectiveComplete(EP_PWT_CM, 0); }
void OPvPCapturePointEP_EWT::ChangeState() { if (fabs(m_value) == m_maxValue) // state won't change, only phase when maxed out! { // if changing from controlling alliance to horde or vice versa if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) { sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetStringForDBCLocale(LANG_OPVP_EP_LOOSE_EWT_A)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; } else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) { sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetStringForDBCLocale(LANG_OPVP_EP_LOOSE_EWT_H)); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; } uint32 artkit = 21; switch (m_State) { case OBJECTIVESTATE_ALLIANCE: if (m_value == m_maxValue) m_TowerState = EP_TS_A; else m_TowerState = EP_TS_A_P; artkit = 2; SummonSupportUnitAtNorthpassTower(ALLIANCE); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = ALLIANCE; if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A)); break; case OBJECTIVESTATE_HORDE: if (m_value == -m_maxValue) m_TowerState = EP_TS_H; else m_TowerState = EP_TS_H_P; artkit = 1; SummonSupportUnitAtNorthpassTower(HORDE); ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = HORDE; if (m_OldState != m_State) sWorld.SendZoneText(EP_GraveYardZone,sObjectMgr.GetStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H)); break; case OBJECTIVESTATE_NEUTRAL: m_TowerState = EP_TS_N; break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_TowerState = EP_TS_N_A; break; case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: m_TowerState = EP_TS_N_H; break; } GameObject * flag = ObjectAccessor::GetGameObjectInWorld(m_capturePointGUID); GameObject * flag2 = ObjectAccessor::GetGameObjectInWorld(m_Objects[EP_EWT_FLAGS]); if (flag) { flag->SetGoArtKit(artkit); } if (flag2) { flag2->SetGoArtKit(artkit); } UpdateTowerState(); // complete quest objective if (m_TowerState == EP_TS_A || m_TowerState == EP_TS_H) SendObjectiveComplete(EP_EWT_CM, 0); } }
bool OutdoorPvPObjectiveTF::Update(uint32 diff) { // can update even in locked state if gathers the controlling faction bool canupdate = ((((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled > 0) && this->m_AllianceActivePlayerCount > this->m_HordeActivePlayerCount) || ((((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled > 0) && this->m_AllianceActivePlayerCount < this->m_HordeActivePlayerCount); // if gathers the other faction, then only update if the pvp is unlocked canupdate = canupdate || !((OutdoorPvPTF*)m_PvP)->m_IsLocked; if(canupdate && OutdoorPvPObjective::Update(diff)) { if(m_OldState != m_State) { // if changing from controlling alliance to horde if( m_OldState == OBJECTIVESTATE_ALLIANCE ) { if(((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled) ((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled--; sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOOSE_A)); } // if changing from controlling horde to alliance else if ( m_OldState == OBJECTIVESTATE_HORDE ) { if(((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled) ((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled--; sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOOSE_H)); } uint32 artkit = 21; switch(m_State) { case OBJECTIVESTATE_ALLIANCE: m_TowerState = TF_TOWERSTATE_A; artkit = 2; if(((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled<TF_TOWER_NUM) ((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled++; sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = TF_TOWERSTATE_H; artkit = 1; if(((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled<TF_TOWER_NUM) ((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled++; sWorld.SendZoneText(OutdoorPvPTFBuffZones[0],objmgr.GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H)); break; case OBJECTIVESTATE_NEUTRAL: case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: case OBJECTIVESTATE_ALLIANCE_HORDE_CHALLENGE: case OBJECTIVESTATE_HORDE_ALLIANCE_CHALLENGE: m_TowerState = TF_TOWERSTATE_N; break; } GameObject* flag = HashMapHolder<GameObject>::Find(m_CapturePoint); if(flag) { flag->SetGoArtKit(artkit); flag->SendUpdateObjectToAllExcept(NULL); } UpdateTowerState(); } if(m_ShiftPhase != m_OldPhase) { // send this too, sometimes the slider disappears, dunno why :( SendUpdateWorldState(TF_UI_TOWER_SLIDER_DISPLAY, 1); // send these updates to only the ones in this objective uint32 phase = (uint32)ceil(( m_ShiftPhase + m_ShiftMaxPhase) / ( 2 * m_ShiftMaxPhase ) * 100.0f); SendUpdateWorldState(TF_UI_TOWER_SLIDER_POS, phase); // send this too, sometimes it resets :S SendUpdateWorldState(TF_UI_TOWER_SLIDER_N, m_NeutralValue); } return true; } return false; }