wxString upFile::DebugInfo() { wxString S; S += wxString::Format( wxT(" N:<%s>"), PF_STR(FileName.GetName()) ); S += wxString::Format( wxT(" SP:<0x%.8x 0x%.8x>"), static_cast<dword>(Length()), static_cast<dword>(Tell()) ); S += wxString::Format( wxT( "GR:<0x%.8x-0x%.8x>") , static_cast<dword>(GetGuard().From) , static_cast<dword>(GetGuard().To) ); return S; }
void npc_reginald_windsorAI::UpdateAI(const uint32 uiDiff) { // in case of idle / afk players if (m_uiDespawnTimer < uiDiff) { PokeRowe(); m_creature->ForcedDespawn(); } else m_uiDespawnTimer -= uiDiff; for (int i = 0; i < 6; i++) { if (GardeNeed[i] == true) { if (GardeTimer[i] < uiDiff) { if (Creature* pGarde = GetGuard(i)) { int Var = i + 7; pGarde->SetFacingTo(WindsorEventMove[Var].o); pGarde->SetStandState(UNIT_STAND_STATE_KNEEL); GardeNeed[i] = false; } } else GardeTimer[i] -= uiDiff; } } if (Begin) { if (m_creature->GetDistance2d(WindsorDeplacement[0].x, WindsorDeplacement[0].y) < 2.0f) { Begin = false; m_creature->Unmount(); m_creature->CastSpell(m_creature, SPELL_WINDSOR_DISMISS_HORSE, true); m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); if (Creature* pMercutio = m_creature->FindNearestCreature(NPC_MERCUTIO, 10.0f)) { pMercutio->SetSpeedRate(MOVE_WALK, 2.5f, true); pMercutio->setFaction(m_creature->getFaction()); pMercutio->GetMotionMaster()->MovePoint(0, -9148.395508f, 371.322174f, 90.543655f); pMercutio->ForcedDespawn(12000); m_creature->SetFacingToObject(pMercutio); m_creature->MonsterSay("Yawww!"); m_creature->HandleEmote(EMOTE_ONESHOT_ATTACKUNARMED); } m_creature->SetWalk(true); m_creature->SetSpeedRate(MOVE_WALK, 1.0f, true); GreetPlayer = true; } } if (!BeginQuest) { if (GreetPlayer) { if (Timer <= uiDiff) { Player* pPlayer = GetPlayer(); if (pPlayer) { m_creature->SetFacingToObject(pPlayer); char sMessage[200]; sprintf(sMessage, "I knew you would come, %s. It is good to see you again, friend.", pPlayer->GetName()); m_creature->MonsterSay(sMessage); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); } Timer = 5000; GreetPlayer = false; } else Timer -= uiDiff; } return; } if (Timer < uiDiff) { std::list<Creature*> DragListe; float X = 0.0f; float Y = 0.0f; uint32 eventGardId = 6; switch (Tick) { case 0: m_uiDespawnTimer = 20 * MINUTE*IN_MILLISECONDS; m_creature->SetFacingTo(0.659f); m_creature->MonsterYellToZone(NOST_TEXT(235)); m_creature->HandleEmote(EMOTE_ONESHOT_SHOUT); Timer = 5000; break; case 1: for (int i = 0; i < 6; i++) { int Var = i + 1; Creature* pSummon = m_creature->SummonCreature(NPC_STORMWIND_CITY_GUARD, WindsorEventMove[Var].x, WindsorEventMove[Var].y, WindsorEventMove[Var].z, WindsorEventMove[Var].o, TEMPSUMMON_TIMED_DESPAWN, 240 * IN_MILLISECONDS); if (pSummon) { GardesGUIDs[i] = pSummon->GetGUID(); pSummon->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); } } if (Creature* Onyxia = m_creature->SummonCreature(NPC_KATRANA_PRESTOR, -9075.6f, 466.11f, 120.383f, 6.27f, TEMPSUMMON_TIMED_DESPAWN, 10 * IN_MILLISECONDS)) { Onyxia->SetDisplayId(11686); Onyxia->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); Onyxia->MonsterYellToZone(NOST_TEXT(WindsorTalk[IDSpeech])); IDSpeech++; } if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { General->GetMotionMaster()->MovePoint(0, WindsorEventMove[0].x, WindsorEventMove[0].y, WindsorEventMove[0].z); General->Unmount(); } m_creature->GetMotionMaster()->MovePoint(0, WindsorDeplacement[1].x, WindsorDeplacement[1].y, WindsorDeplacement[1].z); X = m_creature->GetPositionX() - WindsorDeplacement[1].x; Y = m_creature->GetPositionY() - WindsorDeplacement[1].y; Timer = 1000 + sqrt(X * X + Y * Y) / (m_creature->GetSpeed(MOVE_WALK) * 0.001f); break; case 2: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { DoTalk(General, false); General->HandleEmote(EMOTE_ONESHOT_TALK); } Timer = 10000; break; case 3: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 10000; break; case 4: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 10000; break; case 5: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { DoTalk(General, false); General->HandleEmote(EMOTE_ONESHOT_TALK); General->MonsterTextEmote("General Marcus Jonathan appears lost in contemplation.", nullptr); } Timer = 10000; break; case 6: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { DoTalk(General, false); General->HandleEmote(EMOTE_ONESHOT_TALK); } Timer = 10000; break; case 7: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 10000; break; case 8: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 10000; break; case 9: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { if (Creature* pGarde = GetGuard(0)) General->SetFacingToObject(pGarde); General->HandleEmote(EMOTE_ONESHOT_EXCLAMATION); DoTalk(General, false); } Timer = 4000; break; case 10: eventGardId = 0; break; case 11: eventGardId = 1; break; case 12: eventGardId = 2; break; case 13: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { if (Creature* pGarde = GetGuard(3)) General->SetFacingToObject(pGarde); General->HandleEmote(EMOTE_ONESHOT_EXCLAMATION); DoTalk(General, false); } Timer = 4000; break; case 14: eventGardId = 3; break; case 15: eventGardId = 4; break; case 16: eventGardId = 5; break; case 17: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { General->SetFacingToObject(m_creature); DoTalk(General, true); General->HandleEmote(EMOTE_ONESHOT_SHOUT); } Timer = 5000; break; case 18: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) General->HandleEmote(EMOTE_ONESHOT_SALUTE); Timer = 5000; break; case 19: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) DoTalk(General, false); Timer = 10000; break; case 20: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { General->GetMotionMaster()->MovePoint(0, WindsorEventMove[13].x, WindsorEventMove[13].y, WindsorEventMove[13].z); X = General->GetPositionX() - WindsorEventMove[13].x; Y = General->GetPositionY() - WindsorEventMove[13].y; Timer = 1000 + sqrt(X * X + Y * Y) / (m_creature->GetSpeed(MOVE_WALK) * 0.001f); } else Timer = 1000; break; case 21: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { General->HandleEmote(EMOTE_STATE_KNEEL); General->SetFacingTo(WindsorEventMove[13].o); m_creature->SetFacingToObject(General); DoTalk(m_creature, false); } Timer = 10000; break; case 22: if (Creature* pGarde = GetGuard(0)) m_creature->SetFacingToObject(pGarde); DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_POINT); Timer = 5000; break; case 25: NeedCheck = true; break; case 26: if (Creature* General = m_creature->FindNearestCreature(NPC_MARCUS_JONATHAN, 150.0f)) { General->ForcedDespawn(); General->Respawn(); } break; case 40: m_uiDespawnTimer = 10 * MINUTE*IN_MILLISECONDS; BeginQuest = false; m_creature->SetUInt32Value(UNIT_NPC_FLAGS, 1); DoTalk(m_creature, false); break; case 47: DoTalk(m_creature, false); if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) Bolvar->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER | UNIT_NPC_FLAG_GOSSIP); if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) Onyxia->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER | UNIT_NPC_FLAG_GOSSIP); Timer = 10000; break; case 48: if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) DoTalk(Bolvar, false); Timer = 500; break; case 49: if (Creature* Anduin = m_creature->FindNearestCreature(NPC_ANDUIN_WRYNN, 150.0f)) Anduin->GetMotionMaster()->MovePoint(0, WindsorEventMove[14].x, WindsorEventMove[14].y, WindsorEventMove[14].z); Timer = 5000; break; case 50: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { m_creature->SetFacingToObject(Onyxia); DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_POINT); } Timer = 10000; break; case 51: case 52: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { DoTalk(Onyxia, false); Onyxia->HandleEmote(EMOTE_ONESHOT_TALK); } Timer = 10000; break; case 53: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 7000; break; case 54: m_creature->MonsterTextEmote("Reginald Windsor reaches into his pack and pulls out the encoded tablets."); Timer = 4000; break; case 55: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 6000; break; case 56: DoTalk(m_creature, false); m_creature->HandleEmote(EMOTE_ONESHOT_TALK); Timer = 4000; break; case 57: m_creature->MonsterTextEmote("Reginald Windsor reads from the tablets. Unknown, unheard sounds flow through your consciousness."); Timer = 2000; break; case 58: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) m_creature->CastSpell(Onyxia, SPELL_WINSOR_READ_TABLETS, false); Timer = 10000; break; case 59: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { Onyxia->CastSpell(Onyxia, SPELL_ONYXIA_TRANS, true); Onyxia->SetFloatValue(OBJECT_FIELD_SCALE_X, 0.5f); } if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) Bolvar->MonsterTextEmote("Highlord Bolvar Fordragon gasps."); Timer = 2000; break; case 60: if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) { Bolvar->GetMotionMaster()->MovePoint(0, WindsorEventMove[15].x, WindsorEventMove[15].y, WindsorEventMove[15].z); X = Bolvar->GetPositionX() - WindsorEventMove[15].x; Y = Bolvar->GetPositionY() - WindsorEventMove[15].y; Timer = 1000 + sqrt((X * X) + (Y * Y)) / (m_creature->GetSpeed(MOVE_WALK) * 0.001f); } if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { DoTalk(Onyxia, false); Onyxia->HandleEmote(EMOTE_ONESHOT_TALK); } else Timer = 5000; break; case 61: if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) { if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) Bolvar->SetFacingToObject(Onyxia); DoTalk(Bolvar, true); } Timer = 1000; break; case 62: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) Onyxia->MonsterTextEmote("Lady Onyxia laughs."); Timer = 2000; break; case 63: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { Onyxia->MonsterSay("Yesss... Guards, come to your lord's aid!"); int Var = 0; GetCreatureListWithEntryInGrid(DragListe, Onyxia, NPC_STORMWIND_ROYAL_GUARD, 25.0f); for (auto itr = DragListe.begin(); itr != DragListe.end(); ++itr) { DragsGUIDs[Var] = (*itr)->GetGUID(); (*itr)->UpdateEntry(NPC_ONYXIA_ELITE_GUARD); (*itr)->AIM_Initialize(); (*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); if (!urand(0, 2)) (*itr)->MonsterTextEmote("Onyxia's Elite Guard hisses."); Var++; } } Timer = 4000; break; case 64: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) Onyxia->CastSpell(m_creature, SPELL_WINDSOR_DEATH, false); Timer = 1500; break; case 65: DoTalk(m_creature, false); if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { Onyxia->MonsterSay("Was this fated, Windsor? If it was death that you came for then the prophecy has been fulfilled. May your consciousness rot in the Twisting Nether. Finish the rest of these meddlesome insects, children. Bolvar, you have been a pleasurable puppet."); Onyxia->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_PASSIVE); if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) { int Var = 0; while (DragsGUIDs[Var] && Var < 9) { Creature* crea = me->GetMap()->GetCreature(DragsGUIDs[Var]); crea->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); crea->getThreatManager().addThreatDirectly(Bolvar, 5000.0f); crea->SetTargetGuid(Bolvar->GetGUID()); Bolvar->AddThreat(crea); Bolvar->SetInCombatWith(crea); crea->SetInCombatWith(Bolvar); Var++; } } } Timer = 5000; break; case 66: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { Onyxia->MonsterYell("You have failed him, mortalsss... Farewell!"); Onyxia->CastSpell(Onyxia, SPELL_PRESTOR_DESPAWNS, true); } if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) Bolvar->MonsterTextEmote("Highlord Bolvar Fordragon's medallion shatters."); Timer = 1000; PhaseFinale = true; break; case 67: if (Creature* Onyxia = m_creature->FindNearestCreature(NPC_KATRANA_PRESTOR, 150.0f)) { Onyxia->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER | UNIT_NPC_FLAG_GOSSIP); Onyxia->SetFloatValue(OBJECT_FIELD_SCALE_X, 1.0f); Onyxia->ForcedDespawn(); Onyxia->SetRespawnDelay(7 * MINUTE); Onyxia->SetRespawnTime(7 * MINUTE); } Tick = 100; // come back when combat is done break; case 68: if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) { DoTalk(Bolvar, false); DoTalk(m_creature, false); Bolvar->HandleEmote(EMOTE_ONESHOT_KNEEL); } Timer = 4500; break; case 69: SituationFinale(); BeginQuest = false; m_creature->MonsterTextEmote("Reginald Windsor dies."); m_creature->CastSpell(m_creature, 5, true); break; } if (eventGardId < 6) { if (Creature* pGarde = GetGuard(eventGardId)) { int Var = eventGardId + 7; pGarde->GetMotionMaster()->MovePoint(0, WindsorEventMove[Var].x, WindsorEventMove[Var].y, WindsorEventMove[Var].z); X = pGarde->GetPositionX() - WindsorEventMove[Var].x; Y = pGarde->GetPositionY() - WindsorEventMove[Var].y; } GardeTimer[eventGardId] = 1000 + sqrt(X * X + Y * Y) / (m_creature->GetSpeed(MOVE_WALK) * 0.001f); GardeNeed[eventGardId] = true; Timer = 1000; } if (Tick > 23 && Tick < 40) { int Var = Tick - 21; m_creature->GetMotionMaster()->MovePoint(0, WindsorDeplacement[Var].x, WindsorDeplacement[Var].y, WindsorDeplacement[Var].z); X = m_creature->GetPositionX() - WindsorDeplacement[Var].x; Y = m_creature->GetPositionY() - WindsorDeplacement[Var].y; Timer = 1000 + sqrt(X * X + Y * Y) / (m_creature->GetSpeed(MOVE_WALK) * 0.001f); } else if (Tick > 41 && Tick < 46) { int Var = Tick - 22; m_creature->GetMotionMaster()->MovePoint(0, WindsorDeplacement[Var].x, WindsorDeplacement[Var].y, WindsorDeplacement[Var].z); X = m_creature->GetPositionX() - WindsorDeplacement[Var].x; Y = m_creature->GetPositionY() - WindsorDeplacement[Var].y; Timer = 1000 + sqrt(X * X + Y * Y) / (m_creature->GetSpeed(MOVE_WALK) * 0.001f); } else if (PhaseFinale == true) { if (Creature* Bolvar = m_creature->FindNearestCreature(NPC_BOLVAR_FORDRAGON, 150.0f)) { if (!Bolvar->isInCombat()) { if (!CombatJustEnded) { Bolvar->SetWalk(true); Bolvar->GetMotionMaster()->MovePoint(0, -8447.39f, 335.35f, 121.747f, 1.29f); CombatJustEnded = true; Timer = 5000; Tick = 68; return; } } } } Tick++; } else Timer -= uiDiff; }