bool BattleGroundSA::SetupShips() { if (Phase == SA_ROUND_TWO) { for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) { Player* plr = sObjectMgr.GetPlayer(itr->first); if (plr) SendTransportsRemove(plr); } } for (uint8 i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; ++i) { // Remove old ships if (Phase == SA_ROUND_TWO) DelObject(i); uint32 boatid=0; switch (i) { case BG_SA_BOAT_ONE: boatid = GetDefender() == ALLIANCE ? BG_SA_BOAT_ONE_H : BG_SA_BOAT_ONE_A; if (!(AddObject(i, boatid, BG_SA_START_LOCATIONS[i + 5][0], BG_SA_START_LOCATIONS[i + 5][1], BG_SA_START_LOCATIONS[i + 5][2]+ (GetDefender() == ALLIANCE ? -3.750f: 0) , BG_SA_START_LOCATIONS[i + 5][3], 0.0f, 0.0f, 0.0f, 0.0f, RESPAWN_ONE_DAY))) { sLog.outError("SA_ERROR: Can't spawn ships!"); return false; } if (GameObject* boat = GetBGObject(i)) boat->SetTransportPathRotation(QuaternionData(0.0f, 0.0f, 1.0f, 0.0002f)); break; case BG_SA_BOAT_TWO: boatid = GetDefender() == ALLIANCE ? BG_SA_BOAT_TWO_H : BG_SA_BOAT_TWO_A; if (!(AddObject(i, boatid, BG_SA_START_LOCATIONS[i + 5][0], BG_SA_START_LOCATIONS[i + 5][1], BG_SA_START_LOCATIONS[i + 5][2]+ (GetDefender() == ALLIANCE ? -3.750f: 0) , BG_SA_START_LOCATIONS[i + 5][3], 0.0f, 0.0f, 0.0f, 0.0f, RESPAWN_ONE_DAY))) { sLog.outError("SA_ERROR: Can't spawn ships!"); return false; } if (GameObject* boat = GetBGObject(i)) boat->SetTransportPathRotation(QuaternionData(0, 0, 1.0f, 0.00001f)); break; } } SpawnBGObject(m_BgObjects[BG_SA_BOAT_ONE], RESPAWN_IMMEDIATELY); SpawnBGObject(m_BgObjects[BG_SA_BOAT_TWO], RESPAWN_IMMEDIATELY); shipsSpawned = true; for (BattleGroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) { Player* plr = sObjectMgr.GetPlayer(itr->first); if (plr) SendTransportInit(plr); } return true; }
bool OnUse(Player* player, Item* /*item*/, SpellCastTargets const & /*targets*/) override { GameObject* go = nullptr; for (uint8 i = 0; i < CaribouTrapsNum; ++i) { go = player->FindNearestGameObject(CaribouTraps[i], 5.0f); if (go) break; } if (!go) return false; if (go->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, true) || go->FindNearestCreature(NPC_NESINGWARY_TRAPPER, 10.0f, false) || go->FindNearestGameObject(GO_HIGH_QUALITY_FUR, 2.0f)) return true; float x, y, z; go->GetClosePoint(x, y, z, go->GetCombatReach() / 3, 7.0f); go->SummonGameObject(GO_HIGH_QUALITY_FUR, *go, QuaternionData(), 1); if (TempSummon* summon = player->SummonCreature(NPC_NESINGWARY_TRAPPER, x, y, z, go->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1000)) { summon->SetVisible(false); summon->SetReactState(REACT_PASSIVE); summon->SetImmuneToPC(true); } return false; }
bool Transport::Create(ObjectGuid::LowType guidlow, uint32 entry, uint32 mapid, float x, float y, float z, float ang, uint32 animprogress) { Relocate(x, y, z, ang); if (!IsPositionValid()) { TC_LOG_ERROR("entities.transport", "Transport (GUID: " UI64FMTD ") not created. Suggested coordinates isn't valid (X: %f Y: %f)", guidlow, x, y); return false; } Object::_Create(ObjectGuid::Create<HighGuid::Transport>(guidlow)); GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo) { TC_LOG_ERROR("sql.sql", "Transport not created: entry in `gameobject_template` not found, guidlow: " UI64FMTD " map: %u (X: %f Y: %f Z: %f) ang: %f", guidlow, mapid, x, y, z, ang); return false; } m_goInfo = goinfo; m_goTemplateAddon = sObjectMgr->GetGameObjectTemplateAddon(entry); TransportTemplate const* tInfo = sTransportMgr->GetTransportTemplate(entry); if (!tInfo) { TC_LOG_ERROR("sql.sql", "Transport %u (name: %s) will not be created, missing `transport_template` entry.", entry, goinfo->name.c_str()); return false; } _transportInfo = tInfo; // initialize waypoints _nextFrame = tInfo->keyFrames.begin(); _currentFrame = _nextFrame++; _triggeredArrivalEvent = false; _triggeredDepartureEvent = false; if (m_goTemplateAddon) { SetFaction(m_goTemplateAddon->faction); SetUInt32Value(GAMEOBJECT_FLAGS, m_goTemplateAddon->flags); } m_goValue.Transport.PathProgress = 0; SetObjectScale(goinfo->size); SetPeriod(tInfo->pathTime); SetEntry(goinfo->entry); SetDisplayId(goinfo->displayId); SetGoState(!goinfo->moTransport.allowstopping ? GO_STATE_READY : GO_STATE_ACTIVE); SetGoType(GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT); SetGoAnimProgress(animprogress); SetName(goinfo->name); SetWorldRotation(0.0f, 0.0f, 0.0f, 1.0f); SetParentRotation(QuaternionData()); m_model = CreateModel(); return true; }
void WaypointReached(uint32 waypointId) override { Player* player = GetPlayerForEscort(); switch (waypointId) { case 0: Talk(SAY_WP_2); break; case 1: Talk(SAY_WP_3); me->CastSpell(5918.33f, 5372.91f, -98.770f, SPELL_EXPLODE_CRYSTAL, true); me->SummonGameObject(184743, 5918.33f, 5372.91f, -98.770f, 0, QuaternionData(), TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break; case 2: Talk(SAY_WP_4); break; case 7: Talk(SAY_WP_5); break; case 8: me->CastSpell(5887.37f, 5379.39f, -91.289f, SPELL_EXPLODE_CRYSTAL, true); me->SummonGameObject(184743, 5887.37f, 5379.39f, -91.289f, 0, QuaternionData(), TEMPSUMMON_MANUAL_DESPAWN); //approx 3 to 4 seconds me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break; case 9: Talk(SAY_WP_6); break; case 13: if (player) { player->GroupEventHappens(QUEST_DISASTER, me); Talk(SAY_WP_7); } break; } }
void BattlefieldTB::UpdateNPCsAndGameObjects() { for (ObjectGuid guid : BattleInactiveNPCs) if (Creature* creature = GetCreature(guid)) HideNpc(creature); for (ObjectGuid guid : BattleInactiveGOs) if (GameObject* gameobject = GetGameObject(guid)) gameobject->SetRespawnTime(RESPAWN_ONE_DAY); for (ObjectGuid guid : TemporaryNPCs) if (Creature* creature = GetCreature(guid)) creature->RemoveFromWorld(); TemporaryNPCs.clear(); for (ObjectGuid guid : TemporaryGOs) if (GameObject* gameobject = GetGameObject(guid)) gameobject->Delete(); TemporaryGOs.clear(); // Tol Barad gates - closed during warmup if (GameObject* gates = GetGameObject(TBGatesGUID)) gates->SetGoState(GetState() == BATTLEFIELD_WARMUP ? GO_STATE_READY : GO_STATE_ACTIVE); // Baradin Hold door - open when inactive if (GameObject* door = GetGameObject(TBDoorGUID)) door->SetGoState(GetState() == BATTLEFIELD_INACTIVE ? GO_STATE_ACTIVE : GO_STATE_READY); // Decide which cellblock and questgiver will be active. m_iCellblockRandom = GetState() == BATTLEFIELD_INACTIVE ? urand(CELLBLOCK_THE_HOLE, CELLBLOCK_CURSED_DEPTHS) : uint8(CELLBLOCK_NONE); // To The Hole gate if (GameObject* door = GetGameObject(m_gateToTheHoleGUID)) door->SetGoState(m_iCellblockRandom == CELLBLOCK_THE_HOLE ? GO_STATE_ACTIVE : GO_STATE_READY); // D-Block gate if (GameObject* door = GetGameObject(m_gateDBlockGUID)) door->SetGoState(m_iCellblockRandom == CELLBLOCK_D_BLOCK ? GO_STATE_ACTIVE : GO_STATE_READY); // Cursed Depths gate if (GameObject* door = GetGameObject(m_gateCursedDepthsGUID)) door->SetGoState(m_iCellblockRandom == CELLBLOCK_CURSED_DEPTHS ? GO_STATE_ACTIVE : GO_STATE_READY); if (GetState() == BATTLEFIELD_INACTIVE) { // Delete capture points for (BfCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) itr->second->DelCapturePoint(); m_capturePoints.clear(); // Create capture points for (uint8 i = 0; i < TB_BASE_COUNT; i++) { TolBaradCapturePoint* capturePoint = new TolBaradCapturePoint(this, GetDefenderTeam()); //Spawn flag pole if (GameObject* go = SpawnGameObject(TBCapturePoints[i].entryFlagPole[GetDefenderTeam()], TBCapturePoints[i].pos, QuaternionData())) { go->SetGoArtKit(GetDefenderTeam() == TEAM_ALLIANCE ? TB_GO_ARTKIT_FLAG_ALLIANCE : TB_GO_ARTKIT_FLAG_HORDE); capturePoint->SetCapturePointData(go); } AddCapturePoint(capturePoint); } for (ObjectGuid guid : BattleInactiveNPCs) if (Creature* creature = GetCreature(guid)) ShowNpc(creature, true); for (ObjectGuid guid : BattleInactiveGOs) if (GameObject* gameobject = GetGameObject(guid)) gameobject->SetRespawnTime(RESPAWN_IMMEDIATELY); for (uint8 i = 0; i < TB_QUEST_INFANTRY_MAX; i++) { uint32 entry = TB_QUEST_INFANTRY[GetDefenderTeam()][urand(0,3)]; if (Creature* creature = SpawnCreature(entry, TBQuestInfantrySpawnData[i])) TemporaryNPCs.insert(creature->GetGUID()); } for (uint8 i = 0; i < TB_GUARDS_MAX; i++) if (Creature* creature = SpawnCreature(GetDefenderTeam() == TEAM_ALLIANCE ? NPC_BARADIN_GUARD : NPC_HELLSCREAMS_SENTRY, GuardNPCSpawns[i])) TemporaryNPCs.insert(creature->GetGUID()); for (uint8 i = 0; i < TB_FACTION_NPC_MAX; i++) if (Creature* creature = SpawnCreature(GetDefenderTeam() == TEAM_ALLIANCE ? FactionNPCSpawns[i].entryAlliance : FactionNPCSpawns[i].entryHorde, FactionNPCSpawns[i].pos)) TemporaryNPCs.insert(creature->GetGUID()); if (Creature* creature = SpawnCreature(RandomQuestgivers[GetDefenderTeam()][m_iCellblockRandom], RandomQuestgiverPos)) TemporaryNPCs.insert(creature->GetGUID()); // Spawn portals for (uint8 i = 0; i < TB_PORTAL_MAX; i++) if (GameObject* go = SpawnGameObject(TBPortalEntry[GetDefenderTeam()], TBPortals[i], QuaternionData())) TemporaryGOs.insert(go->GetGUID()); // Update towers for (ObjectGuid guid : Towers) if (GameObject* go = GetGameObject(guid)) go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING); } else if (GetState() == BATTLEFIELD_IN_PROGRESS) { for (uint8 i = 0; i < TB_ABANDONED_SIEGE_ENGINE_COUNT; i++) if (Creature* creature = SpawnCreature(NPC_ABANDONED_SIEGE_ENGINE, TBAbandonedSiegeEngineSpawnData[i])) TemporaryNPCs.insert(creature->GetGUID()); for (ObjectGuid guid : Towers) { if (GameObject* go = GetGameObject(guid)) { go->SetDestructibleState(GO_DESTRUCTIBLE_INTACT); go->ModifyHealth(go->GetGOValue()->Building.MaxHealth); } } } // Spawn banners for (uint8 i = 0; i < TB_BANNER_MAX; i++) if (GameObject* go = SpawnGameObject(TBBannerEntry[GetDefenderTeam()], TBBanners[i], QuaternionData())) TemporaryGOs.insert(go->GetGUID()); // Set graveyard controls for (uint8 i = 0; i < BATTLEFIELD_TB_GRAVEYARD_MAX; i++) if (BfGraveyard* graveyard = GetGraveyardById(i)) graveyard->GiveControlTo(!IsWarTime() || TBGraveyards[i].defenderControls ? GetDefenderTeam() : GetAttackerTeam()); };
bool BattlefieldTB::SetupBattlefield() { m_TypeId = BATTLEFIELD_TB; // See enum BattlefieldTypes m_BattleId = BATTLEFIELD_BATTLEID_TB; m_ZoneId = BATTLEFIELD_TB_ZONEID; m_MapId = BATTLEFIELD_TB_MAPID; m_Map = sMapMgr->CreateBaseMap(m_MapId); InitStalker(NPC_DEBUG_ANNOUNCER, TolBaradDebugAnnouncerPos); m_MaxPlayer = sWorld->getIntConfig(CONFIG_TOLBARAD_PLR_MAX); m_IsEnabled = sWorld->getBoolConfig(CONFIG_TOLBARAD_ENABLE); m_MinPlayer = sWorld->getIntConfig(CONFIG_TOLBARAD_PLR_MIN); m_MinLevel = sWorld->getIntConfig(CONFIG_TOLBARAD_PLR_MIN_LVL); m_BattleTime = sWorld->getIntConfig(CONFIG_TOLBARAD_BATTLETIME) * MINUTE * IN_MILLISECONDS; m_BonusTime = sWorld->getIntConfig(CONFIG_TOLBARAD_BONUSTIME) * MINUTE * IN_MILLISECONDS; m_NoWarBattleTime = sWorld->getIntConfig(CONFIG_TOLBARAD_NOBATTLETIME) * MINUTE * IN_MILLISECONDS; m_RestartAfterCrash = sWorld->getIntConfig(CONFIG_TOLBARAD_RESTART_AFTER_CRASH) * MINUTE * IN_MILLISECONDS; m_TimeForAcceptInvite = 20; m_StartGroupingTimer = 15 * MINUTE * IN_MILLISECONDS; m_StartGrouping = false; m_isActive = false; KickPosition.Relocate(-605.5f, 1181.31f, 95.96f, 6.177155f); KickPosition.m_mapId = m_MapId; RegisterZone(m_ZoneId); m_Data32.resize(BATTLEFIELD_TB_DATA_MAX); m_saveTimer = 5 * MINUTE * IN_MILLISECONDS; updatedNPCAndObjects = true; m_updateObjectsTimer = 0; // Was there a battle going on or time isn't set yet? Then use m_RestartAfterCrash if (sWorld->getWorldState(TB_WS_STATE_BATTLE) == 1 || sWorld->getWorldState(TB_WS_TIME_NEXT_BATTLE) == 0) sWorld->setWorldState(TB_WS_TIME_NEXT_BATTLE, m_RestartAfterCrash); // Set timer m_Timer = sWorld->getWorldState(TB_WS_TIME_NEXT_BATTLE); // Defending team isn't set yet? Choose randomly. if (sWorld->getWorldState(TB_WS_FACTION_CONTROLLING) == 0) sWorld->setWorldState(TB_WS_FACTION_CONTROLLING, uint32(urand(1, 2))); // Set defender team SetDefenderTeam(TeamId(sWorld->getWorldState(TB_WS_FACTION_CONTROLLING) - 1)); // Just to save world states SendInitWorldStatesToAll(); // Create capture points for (uint8 i = 0; i < TB_BASE_COUNT; i++) { TolBaradCapturePoint* capturePoint = new TolBaradCapturePoint(this, GetDefenderTeam()); //Spawn flag pole if (GameObject* go = SpawnGameObject(TBCapturePoints[i].entryFlagPole[GetDefenderTeam()], TBCapturePoints[i].pos, QuaternionData())) { go->SetGoArtKit(GetDefenderTeam() == TEAM_ALLIANCE ? TB_GO_ARTKIT_FLAG_ALLIANCE : TB_GO_ARTKIT_FLAG_HORDE); capturePoint->SetCapturePointData(go); } AddCapturePoint(capturePoint); } // Spawn towers for (uint8 i = 0; i < TB_TOWERS_COUNT; i++) if (GameObject* go = SpawnGameObject(TBTowers[i].entry, TBTowers[i].pos, QuaternionData())) Towers.insert(go->GetGUID()); // Init Graveyards SetGraveyardNumber(BATTLEFIELD_TB_GRAVEYARD_MAX); // Graveyards for (uint8 i = 0; i < BATTLEFIELD_TB_GRAVEYARD_MAX; i++) { BfGraveyard* graveyard = new BfGraveyard(this); // When between games, the graveyard is controlled by the defending team graveyard->Initialize(GetDefenderTeam(), TBGraveyards[i].gyid); // Spawn spirits for (uint8 team = 0; team < 2; team++) if (Creature* creature = SpawnCreature(TBGraveyards[i].spiritEntry[team], TBGraveyards[i].pos)) graveyard->SetSpirit(creature, TeamId(team)); m_GraveyardList[i] = graveyard; } // Time warning vars warnedFiveMinutes = false; warnedTwoMinutes = false; warnedOneMinute = false; UpdateNPCsAndGameObjects(); return true; }
void UpdateAI(uint32 diff) override { _events.Update(diff); if (UpdateVictim()) { while (uint32 eventId = _events.ExecuteEvent()) { switch (eventId) { case EVENT_FROST_SHOCK: DoCastVictim(SPELL_FROST_SHOCK); _events.DelayEvents(1 * IN_MILLISECONDS); _events.ScheduleEvent(EVENT_FROST_SHOCK, 10s, 15s); break; case EVENT_SEARING_TOTEM: DoCast(me, SPELL_SEARING_TOTEM); _events.DelayEvents(1 * IN_MILLISECONDS); _events.ScheduleEvent(EVENT_SEARING_TOTEM, urand(110, 130) * IN_MILLISECONDS); break; case EVENT_STRENGTH_OF_EARTH_TOTEM: DoCast(me, SPELL_STRENGTH_OF_EARTH_TOTEM); _events.DelayEvents(1 * IN_MILLISECONDS); _events.ScheduleEvent(EVENT_STRENGTH_OF_EARTH_TOTEM, urand(110, 130) * IN_MILLISECONDS); break; case EVENT_HEALING_SURGE: { Unit* target = nullptr; if (me->GetHealthPct() < 85) target = me; else if (Player* player = GetPlayerForEscort()) if (player->GetHealthPct() < 85) target = player; if (target) { DoCast(target, SPELL_HEALING_SURGE); _events.ScheduleEvent(EVENT_HEALING_SURGE, 10s); } else _events.ScheduleEvent(EVENT_HEALING_SURGE, 2s); break; } default: break; } } DoMeleeAttackIfReady(); } if (HasEscortState(STATE_ESCORT_NONE)) return; EscortAI::UpdateAI(diff); if (_phase) { if (_moveTimer <= diff) { switch (_phase) { case PHASE_WP_26: //debug skip path to point 26, buggy path calculation me->GetMotionMaster()->MovePoint(WP_DEBUG_2, -2021.77f, -10648.8f, 129.903f, false); _moveTimer = 2 * IN_MILLISECONDS; _phase = PHASE_CONTINUE; break; case PHASE_CONTINUE: // continue escort SetEscortPaused(false); _moveTimer = 0 * IN_MILLISECONDS; _phase = PHASE_NONE; break; case PHASE_WP_22: //debug skip path to point 22, buggy path calculation me->GetMotionMaster()->MovePoint(WP_EXPLOSIVES_FIRST_PLANT, -1958.026f, -10660.465f, 111.547f, false); Talk(SAY_LEGOSO_3); _moveTimer = 2 * IN_MILLISECONDS; _phase = PHASE_PLANT_FIRST_KNEEL; break; case PHASE_PLANT_FIRST_KNEEL: // plant first explosives stage 1 kneel me->SetStandState(UNIT_STAND_STATE_KNEEL); _moveTimer = 10 * IN_MILLISECONDS; _phase = PHASE_PLANT_FIRST_STAND; break; case PHASE_PLANT_FIRST_STAND: // plant first explosives stage 1 stand me->SetStandState(UNIT_STAND_STATE_STAND); _moveTimer = 0.5* IN_MILLISECONDS; _phase = PHASE_PLANT_FIRST_WORK; break; case PHASE_PLANT_FIRST_WORK: // plant first explosives stage 2 work Talk(SAY_LEGOSO_4); _moveTimer = 17.5 * IN_MILLISECONDS; _phase = PHASE_PLANT_FIRST_FINISH; break; case PHASE_PLANT_FIRST_FINISH: // plant first explosives finish _explosivesGuids.clear(); for (uint8 i = 0; i != MAX_EXPLOSIVES; ++i) { if (GameObject* explosive = me->SummonGameObject(GO_DRAENEI_EXPLOSIVES_1, ExplosivesPos[0][i], QuaternionData(), 0)) _explosivesGuids.push_back(explosive->GetGUID()); } me->HandleEmoteCommand(EMOTE_ONESHOT_NONE); // reset anim state // force runoff movement so he will not screw up next waypoint me->GetMotionMaster()->MovePoint(WP_EXPLOSIVES_FIRST_RUNOFF, -1955.6f, -10669.8f, 110.65f, false); Talk(SAY_LEGOSO_5); _moveTimer = 1.5 * IN_MILLISECONDS; _phase = PHASE_CONTINUE; break; case PHASE_PLANT_FIRST_TIMER_1: // first explosives detonate timer 1 Talk(SAY_LEGOSO_6); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_PLANT_FIRST_TIMER_2; break; case PHASE_PLANT_FIRST_TIMER_2: // first explosives detonate timer 2 Talk(SAY_LEGOSO_7); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_PLANT_FIRST_TIMER_3; break; case PHASE_PLANT_FIRST_TIMER_3: // first explosives detonate timer 3 Talk(SAY_LEGOSO_8); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_PLANT_FIRST_DETONATE; break; case PHASE_PLANT_FIRST_DETONATE: // first explosives detonate finish for (GuidList::iterator itr = _explosivesGuids.begin(); itr != _explosivesGuids.end(); ++itr) { if (GameObject* explosive = ObjectAccessor::GetGameObject(*me, *itr)) me->RemoveGameObject(explosive, true); } _explosivesGuids.clear(); me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER); _moveTimer = 2 * IN_MILLISECONDS; _phase = PHASE_PLANT_FIRST_SPEECH; break; case PHASE_PLANT_FIRST_SPEECH: // after detonation 1 speech Talk(SAY_LEGOSO_9); _moveTimer = 4 * IN_MILLISECONDS; _phase = PHASE_PLANT_FIRST_ROTATE; break; case PHASE_PLANT_FIRST_ROTATE: // after detonation 1 rotate to next point me->SetFacingTo(2.272f); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_PLANT_FIRST_POINT; break; case PHASE_PLANT_FIRST_POINT: // after detonation 1 send point anim and go on to next point me->HandleEmoteCommand(EMOTE_ONESHOT_POINT); _moveTimer = 2 * IN_MILLISECONDS; _phase = PHASE_CONTINUE; break; case PHASE_FEEL_SIRONAS_1: // legoso exclamation before sironas 1.1 Talk(SAY_LEGOSO_10); _moveTimer = 4 * IN_MILLISECONDS; _phase = PHASE_FEEL_SIRONAS_2; break; case PHASE_FEEL_SIRONAS_2: // legoso exclamation before sironas 1.2 Talk(SAY_LEGOSO_11); _moveTimer = 4 * IN_MILLISECONDS; _phase = PHASE_CONTINUE; break; case PHASE_MEET_SIRONAS_ROAR: // legoso exclamation before sironas 2.1 Talk(SAY_LEGOSO_12); _moveTimer = 4 * IN_MILLISECONDS; _phase = PHASE_MEET_SIRONAS_TURN; break; case PHASE_MEET_SIRONAS_TURN: // legoso exclamation before sironas 2.2 if (Player* player = GetPlayerForEscort()) me->SetFacingToObject(player); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_MEET_SIRONAS_SPEECH; break; case PHASE_MEET_SIRONAS_SPEECH: // legoso exclamation before sironas 2.3 Talk(SAY_LEGOSO_13); _moveTimer = 7 * IN_MILLISECONDS; _phase = PHASE_CONTINUE; break; case PHASE_PLANT_SECOND_KNEEL: // plant second explosives stage 1 kneel me->SetStandState(UNIT_STAND_STATE_KNEEL); _moveTimer = 11 * IN_MILLISECONDS; _phase = PHASE_PLANT_SECOND_SPEECH; break; case PHASE_PLANT_SECOND_SPEECH: // plant second explosives stage 2 kneel Talk(SAY_LEGOSO_14); _moveTimer = 13 * IN_MILLISECONDS; _phase = PHASE_PLANT_SECOND_STAND; break; case PHASE_PLANT_SECOND_STAND: // plant second explosives finish me->SetStandState(UNIT_STAND_STATE_STAND); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_PLANT_SECOND_FINISH; break; case PHASE_PLANT_SECOND_FINISH: // plant second explosives finish - create explosives _explosivesGuids.clear(); for (uint8 i = 0; i != MAX_EXPLOSIVES; ++i) { if (GameObject* explosive = me->SummonGameObject(GO_DRAENEI_EXPLOSIVES_2, ExplosivesPos[1][i], QuaternionData(), 0)) _explosivesGuids.push_back(explosive->GetGUID()); } Talk(SAY_LEGOSO_15); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_PLANT_SECOND_WAIT; break; case PHASE_PLANT_SECOND_WAIT: // plant second explosives finish - proceed to next point _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_CONTINUE; break; case PHASE_PLANT_SECOND_TIMER_1: // second explosives detonate timer 1 Talk(SAY_LEGOSO_16); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_PLANT_SECOND_TIMER_2; break; case PHASE_PLANT_SECOND_TIMER_2: // second explosives detonate timer 2 Talk(SAY_LEGOSO_17); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_PLANT_SECOND_TIMER_3; break; case PHASE_PLANT_SECOND_TIMER_3: // second explosives detonate timer 3 Talk(SAY_LEGOSO_18); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_PLANT_SECOND_DETONATE; break; case PHASE_PLANT_SECOND_DETONATE: // second explosives detonate finish for (GuidList::iterator itr = _explosivesGuids.begin(); itr != _explosivesGuids.end(); ++itr) { if (GameObject* explosive = ObjectAccessor::GetGameObject(*me, *itr)) me->RemoveGameObject(explosive, true); } _explosivesGuids.clear(); if (Creature* sironas = me->FindNearestCreature(NPC_SIRONAS, SIZE_OF_GRIDS)) { sironas->SetImmuneToAll(false); me->SetFacingToObject(sironas); } _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_FIGHT_SIRONAS_STOP; break; case PHASE_FIGHT_SIRONAS_STOP: // sironas channel stop if (Creature* sironas = me->FindNearestCreature(NPC_SIRONAS, SIZE_OF_GRIDS)) sironas->AI()->DoAction(ACTION_SIRONAS_CHANNEL_STOP); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_FIGHT_SIRONAS_SPEECH_1; break; case PHASE_FIGHT_SIRONAS_SPEECH_1: // sironas exclamation before aggro if (Creature* sironas = me->FindNearestCreature(NPC_SIRONAS, SIZE_OF_GRIDS)) sironas->AI()->Talk(SAY_SIRONAS_1); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_FIGHT_SIRONAS_SPEECH_2; break; case PHASE_FIGHT_SIRONAS_SPEECH_2: // legoso exclamation before aggro if (Creature* sironas = me->FindNearestCreature(NPC_SIRONAS, SIZE_OF_GRIDS)) sironas->SetObjectScale(3.0f); Talk(SAY_LEGOSO_19); _moveTimer = 1 * IN_MILLISECONDS; _phase = PHASE_FIGHT_SIRONAS_START; break; case PHASE_FIGHT_SIRONAS_START: // legoso exclamation at aggro if (Creature* sironas = me->FindNearestCreature(NPC_SIRONAS, SIZE_OF_GRIDS)) { Unit* target = GetPlayerForEscort(); if (!target) target = me; AddThreat(sironas, 0.001f, target); sironas->Attack(target, true); sironas->GetMotionMaster()->MoveChase(target); } _moveTimer = 10 * IN_MILLISECONDS; _phase = PHASE_CONTINUE; break; case PHASE_SIRONAS_SLAIN_SPEECH_1: // legoso exclamation after battle - stage 1.1 Talk(SAY_LEGOSO_20); _moveTimer = 2 * IN_MILLISECONDS; _phase = PHASE_SIRONAS_SLAIN_EMOTE_1; break; case PHASE_SIRONAS_SLAIN_EMOTE_1: // legoso exclamation after battle - stage 1.2 me->HandleEmoteCommand(EMOTE_ONESHOT_EXCLAMATION); _moveTimer = 2 * IN_MILLISECONDS; _phase = PHASE_SIRONAS_SLAIN_EMOTE_2; break; case PHASE_SIRONAS_SLAIN_EMOTE_2: // legoso exclamation after battle - stage 1.3 if (Player* player = GetPlayerForEscort()) player->GroupEventHappens(QUEST_ENDING_THEIR_WORLD, me); me->HandleEmoteCommand(EMOTE_ONESHOT_CHEER); _moveTimer = 5 * IN_MILLISECONDS; _phase = PHASE_SIRONAS_SLAIN_SPEECH_2; break; case PHASE_SIRONAS_SLAIN_SPEECH_2: // legoso exclamation after battle - stage 2 Talk(SAY_LEGOSO_21); _moveTimer = 30 * IN_MILLISECONDS; _phase = PHASE_CONTINUE; break; default: break; } } else if (!me->IsInCombat()) _moveTimer -= diff; } }
void BattleGroundIC::SpawnGates() { // is making arrays for spawning these worth it ? AddObject(BG_IC_GO_T_ALLIANCE_GATE_1, BG_IC_GO_ALLIANCE_GATE_1, BG_IC_GATELOCS[0][0], BG_IC_GATELOCS[0][1], BG_IC_GATELOCS[0][2], BG_IC_GATELOCS[0][3], QuaternionData(0.0f, 0.0f, 1.0f, 0.0f), RESPAWN_IMMEDIATELY); AddObject(BG_IC_GO_T_ALLIANCE_GATE_2, BG_IC_GO_ALLIANCE_GATE_2, BG_IC_GATELOCS[1][0], BG_IC_GATELOCS[1][1], BG_IC_GATELOCS[1][2], BG_IC_GATELOCS[1][3], QuaternionData(0.0f, 0.0f, 1.0f, 0.0f), RESPAWN_IMMEDIATELY); AddObject(BG_IC_GO_T_ALLIANCE_GATE_3, BG_IC_GO_ALLIANCE_GATE_3, BG_IC_GATELOCS[2][0], BG_IC_GATELOCS[2][1], BG_IC_GATELOCS[2][2], BG_IC_GATELOCS[2][3], QuaternionData(0.0f, 0.0f, 1.0f, 0.0f), RESPAWN_IMMEDIATELY); AddObject(BG_IC_GO_T_HORDE_GATE_1, BG_IC_GO_HORDE_GATE_1, BG_IC_GATELOCS[3][0], BG_IC_GATELOCS[3][1], BG_IC_GATELOCS[3][2], BG_IC_GATELOCS[3][3], QuaternionData(0.0f, 0.0f, 1.0f, 0.0f), RESPAWN_IMMEDIATELY); AddObject(BG_IC_GO_T_HORDE_GATE_2, BG_IC_GO_HORDE_GATE_2, BG_IC_GATELOCS[4][0], BG_IC_GATELOCS[4][1], BG_IC_GATELOCS[4][2], BG_IC_GATELOCS[4][3], QuaternionData(0.0f, 0.0f, 1.0f, 0.0f), RESPAWN_IMMEDIATELY); AddObject(BG_IC_GO_T_HORDE_GATE_3, BG_IC_GO_HORDE_GATE_3, BG_IC_GATELOCS[5][0], BG_IC_GATELOCS[5][1], BG_IC_GATELOCS[5][2], BG_IC_GATELOCS[5][3], QuaternionData(0.0f, 0.0f, 1.0f, 0.0f), RESPAWN_IMMEDIATELY); AddObject(BG_IC_GO_T_ALLIANCE_WEST, BG_IC_GO_ALLIANCE_PORT, BG_IC_GATELOCS[0][0], BG_IC_GATELOCS[0][1], BG_IC_GATELOCS[0][2], BG_IC_GATELOCS[0][3], QuaternionData(0.0f, 0.0f, 1.0f, 0.0f), RESPAWN_IMMEDIATELY); AddObject(BG_IC_GO_T_ALLIANCE_EAST, BG_IC_GO_ALLIANCE_PORT, BG_IC_GATELOCS[1][0], BG_IC_GATELOCS[1][1], BG_IC_GATELOCS[1][2], BG_IC_GATELOCS[1][3], QuaternionData(0.0f, 0.0f, 1.0f, 0.0f), RESPAWN_IMMEDIATELY); AddObject(BG_IC_GO_T_ALLIANCE_FRONT, BG_IC_GO_ALLIANCE_PORT, BG_IC_GATELOCS[2][0], BG_IC_GATELOCS[2][1], BG_IC_GATELOCS[2][2], BG_IC_GATELOCS[2][3], QuaternionData(0.0f, 0.0f, 1.0f, 0.0f), RESPAWN_IMMEDIATELY); AddObject(BG_IC_GO_T_HORDE_WEST, BG_IC_GO_HORDE_PORT, BG_IC_GATELOCS[3][0], BG_IC_GATELOCS[3][1], BG_IC_GATELOCS[3][2], BG_IC_GATELOCS[3][3], QuaternionData(0.0f, 0.0f, 1.0f, 0.0f), RESPAWN_IMMEDIATELY); AddObject(BG_IC_GO_T_HORDE_EAST, BG_IC_GO_HORDE_PORT, BG_IC_GATELOCS[4][0], BG_IC_GATELOCS[4][1], BG_IC_GATELOCS[4][2], BG_IC_GATELOCS[4][3], QuaternionData(0.0f, 0.0f, 1.0f, 0.0f), RESPAWN_IMMEDIATELY); AddObject(BG_IC_GO_T_HORDE_FRONT, BG_IC_GO_HORDE_PORT, BG_IC_GATELOCS[5][0], BG_IC_GATELOCS[5][1], BG_IC_GATELOCS[5][2], BG_IC_GATELOCS[5][3], QuaternionData(0.0f, 0.0f, 1.0f, 0.0f), RESPAWN_IMMEDIATELY); for (int i = 0; i < BG_IC_MAXOBJ; ++i) SpawnBGObject(m_BgObjects[i], RESPAWN_IMMEDIATELY); }
void UpdateAI(uint32 diff) override { if (!eventInProgress) return; events.Update(diff); while (uint32 eventId = events.ExecuteEvent()) { switch (eventId) { case EVENT_CHANNEL: Talk(SAY_EVENT_START); DoCast(me, SPELL_IDOL_SHUTDOWN_VISUAL); events.ScheduleEvent(EVENT_IDOL_ROOM_SPAWNER, 100); events.ScheduleEvent(EVENT_PROGRESS, 120000); break; case EVENT_IDOL_ROOM_SPAWNER: if (Creature* creature = me->SummonCreature(NPC_IDOL_ROOM_SPAWNER, PosSummonSpawner[urand(0,2)], TEMPSUMMON_TIMED_DESPAWN, 4000)) creature->AI()->SetData(0,spawnerCount); if (++spawnerCount < 8) events.ScheduleEvent(EVENT_IDOL_ROOM_SPAWNER, 35000); break; case EVENT_PROGRESS: { switch (eventProgress) { case 0: Talk(SAY_EVENT_THREE_MIN_LEFT); ++eventProgress; events.ScheduleEvent(EVENT_PROGRESS, 60000); break; case 1: Talk(SAY_EVENT_TWO_MIN_LEFT); ++eventProgress; events.ScheduleEvent(EVENT_PROGRESS, 60000); break; case 2: Talk(SAY_EVENT_ONE_MIN_LEFT); ++eventProgress; events.ScheduleEvent(EVENT_PROGRESS, 60000); break; case 3: events.CancelEvent(EVENT_IDOL_ROOM_SPAWNER); me->InterruptSpell(CURRENT_CHANNELED_SPELL); Talk(SAY_EVENT_END); events.ScheduleEvent(EVENT_COMPLETE, 3000); break; } break; } case EVENT_COMPLETE: { DoCast(me, SPELL_IDOM_ROOM_CAMERA_SHAKE); me->SummonGameObject(GO_BELNISTRASZS_BRAZIER, 2577.196f, 947.0781f, 53.16757f, 2.356195f, QuaternionData(0.f, 0.f, 0.9238796f, 0.3826832f), 3600); std::list<WorldObject*> ClusterList; Trinity::AllWorldObjectsInRange objects(me, 50.0f); Trinity::WorldObjectListSearcher<Trinity::AllWorldObjectsInRange> searcher(me, ClusterList, objects); Cell::VisitAllObjects(me, searcher, 50.0f); for (std::list<WorldObject*>::const_iterator itr = ClusterList.begin(); itr != ClusterList.end(); ++itr) { if (Player* player = (*itr)->ToPlayer()) { if (player->GetQuestStatus(QUEST_EXTINGUISHING_THE_IDOL) == QUEST_STATUS_INCOMPLETE) player->CompleteQuest(QUEST_EXTINGUISHING_THE_IDOL); } else if (GameObject* go = (*itr)->ToGameObject()) { if (go->GetEntry() == GO_IDOL_OVEN_FIRE || go->GetEntry() == GO_IDOL_CUP_FIRE || go->GetEntry() == GO_IDOL_MOUTH_FIRE) go->Delete(); } } instance->SetBossState(DATA_EXTINGUISHING_THE_IDOL, DONE); me->DespawnOrUnsummon(); break; } case EVENT_FIREBALL: if (me->HasUnitState(UNIT_STATE_CASTING) || !UpdateVictim()) return; DoCastVictim(SPELL_FIREBALL); events.ScheduleEvent(EVENT_FIREBALL, 8000); break; case EVENT_FROST_NOVA: if (me->HasUnitState(UNIT_STATE_CASTING) || !UpdateVictim()) return; DoCast(me, SPELL_FROST_NOVA); events.ScheduleEvent(EVENT_FROST_NOVA, 15000); break; } } if (!channeling) DoMeleeAttackIfReady(); }
void Summon(uint8 uiCase) { switch (uiCase) { case 1: me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[4], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[5], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[6], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[7], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[8], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[9], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); break; case 2: if (GameObject* go = me->SummonGameObject(183410, -533.140f, -105.322f, -156.016f, 0.f, QuaternionData(), 1)) { GoSummonList.push_back(go->GetGUID()); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); //We can't use it! } Summon(3); break; case 3: me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[0], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[1], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[2], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[3], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); Talk(SAY_BLASTMASTER_7); break; case 4: if (GameObject* go = me->SummonGameObject(183410, -542.199f, -96.854f, -155.790f, 0.f, QuaternionData(), 1)) { GoSummonList.push_back(go->GetGUID()); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); } break; case 5: me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[10], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[11], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[12], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[13], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); me->SummonCreature(NPC_CAVERNDEEP_AMBUSHER, SpawnPosition[14], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); break; case 6: if (GameObject* go = me->SummonGameObject(183410, -507.820f, -103.333f, -151.353f, 0.f, QuaternionData(), 1)) { GoSummonList.push_back(go->GetGUID()); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); //We can't use it! Summon(5); } break; case 7: if (GameObject* go = me->SummonGameObject(183410, -511.829f, -86.249f, -151.431f, 0.f, QuaternionData(), 1)) { GoSummonList.push_back(go->GetGUID()); go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); //We can't use it! } break; case 8: if (Creature* grubbis = me->SummonCreature(NPC_GRUBBIS, SpawnPosition[15], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000)) grubbis->AI()->Talk(SAY_GRUBBIS); me->SummonCreature(NPC_CHOMPER, SpawnPosition[16], TEMPSUMMON_CORPSE_TIMED_DESPAWN, 1800000); break; case 9: me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[17], QuaternionData::fromEulerAnglesZYX(SpawnPosition[17].GetOrientation(), 0.0f, 0.0f), 7200); me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[18], QuaternionData::fromEulerAnglesZYX(SpawnPosition[18].GetOrientation(), 0.0f, 0.0f), 7200); me->SummonGameObject(GO_RED_ROCKET, SpawnPosition[19], QuaternionData::fromEulerAnglesZYX(SpawnPosition[19].GetOrientation(), 0.0f, 0.0f), 7200); break; } }
/// @todo this should be handled in map, maybe add a summon function in map // There is no other way afaik... void SpawnGameObject(uint32 entry, Position const& pos) { if (GameObject* go = GameObject::CreateGameObject(entry, instance, pos, QuaternionData(), 255, GO_STATE_READY)) instance->AddToMap(go); }
bool BattleGroundBG::SetupBattleGround() { // buffs for (int i = 0; i < BG_BG_BUFFS_MAX; ++i) { if (!AddObject(BG_BG_OBJECT_SPEEDBUFF_1 + 3 * i, Buff_Entries[0], BG_BG_BuffPositions[i][0], BG_BG_BuffPositions[i][1], BG_BG_BuffPositions[i][2], BG_BG_BuffPositions[i][3], QuaternionData(0, 0, sin(BG_BG_BuffPositions[i][3]/2), cos(BG_BG_BuffPositions[i][3]/2)), RESPAWN_ONE_DAY) || !AddObject(BG_BG_OBJECT_SPEEDBUFF_1 + 3 * i + 1, Buff_Entries[1], BG_BG_BuffPositions[i][0], BG_BG_BuffPositions[i][1], BG_BG_BuffPositions[i][2], BG_BG_BuffPositions[i][3], QuaternionData(0, 0, sin(BG_BG_BuffPositions[i][3]/2), cos(BG_BG_BuffPositions[i][3]/2)), RESPAWN_ONE_DAY) || !AddObject(BG_BG_OBJECT_SPEEDBUFF_1 + 3 * i + 2, Buff_Entries[2], BG_BG_BuffPositions[i][0], BG_BG_BuffPositions[i][1], BG_BG_BuffPositions[i][2], BG_BG_BuffPositions[i][3], QuaternionData(0, 0, sin(BG_BG_BuffPositions[i][3]/2), cos(BG_BG_BuffPositions[i][3]/2)), RESPAWN_ONE_DAY) ) sLog.outErrorDb("BatteGroundAB: Failed to spawn buff object!"); } return true; }
void UseStatue(GameObject* go) { go->SummonGameObject(GO_ATALAI_LIGHT1, *go, QuaternionData(), 0); go->SetUInt32Value(GAMEOBJECT_FLAGS, 4); }