class npc_windsor : public CreatureScript
{
public:
npc_windsor() : CreatureScript("npc_windsor") { }
CreatureAI* GetAI(Creature* creature) const
{
return new npc_windsorAI(creature);
}
bool OnGossipHello(Player* player, Creature* creature)
{
player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Lets kill this bitch!", GOSSIP_SENDER_MAIN, 1);
player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
return true;
}
bool OnGossipSelect(Player* player, Creature* npc, uint32 /*sender*/, uint32 action)
{
player->PlayerTalkClass->ClearMenus();
switch (action)
{
case 1:
if (npc_windsorAI* WinAI = CAST_AI(npc_windsorAI, npc->GetAI()))
{
if (!WinAI->start)
{
WinAI->start = true;
WinAI->uiTimer = 0;
WinAI->uiPhase = 0;
npc->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
player->CLOSE_GOSSIP_MENU();
return true;
}
return true;
}
return true;
}
}
struct npc_windsorAI : public ScriptedAI
{
npc_windsorAI(Creature* creature) : ScriptedAI(creature) { }
Creature* Prestor = me->FindNearestCreature(1749, 300.0f, true);
uint32 uiTimer;
uint32 uiPhase;
bool start;
void Reset()
{
uiTimer = 0;
uiPhase = 0;
start = false;
if (!me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP))
me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
}
void UpdateAI(uint32 uiDiff)
{
if (start)
{
if (uiPhase)
{
if (uiTimer <= uiDiff)
{
switch (uiPhase)
{
case 1:
me->MonsterSay("The masquerade is over, Lady Prestor. Or should I call you by your true name... Onyxia...", LANG_UNIVERSAL, Prestor);
uiTimer = 3000;
uiPhase = 2;
break;
case 2:
Prestor->MonsterTextEmote("Lady Katrana Prestor laughs.", me);
uiTimer = 1000;
uiPhase = 3;
break;
case 3:
Prestor->MonsterSay("You will be incarcerated and tried for treason, Windsor. I shall watch with glee as they hand down a guilty verdict and sentence you to death by hanging...", LANG_UNIVERSAL, me);
uiTimer = 4000;
uiPhase = 4;
break;
case 4:
Prestor->MonsterSay("And as your limp body dangles from the rafters, I shall take pleasure in knowing that a mad man has been put to death. After all, what proof do you have? Did you expect to come in here and point your fingers at royalty and leave unscathed?", LANG_UNIVERSAL, me);
uiPhase = 4000;
uiTimer = 5;
break;
case 5:
me->MonsterSay("You will not escape your fate, Onyxia. It has been prophesied - a vision resonating from the great halls of Karazhan. It ends now..", LANG_UNIVERSAL, Prestor);
uiTimer = 3000;
uiPhase = 6;
break;
case 6:
me->MonsterSay("The Dark Iron's thought these tablets to be encoded. This is not any form of coding, it is the tongue of ancient dragon.", LANG_UNIVERSAL, Prestor);
uiTimer = 3000;
uiPhase = 7;
break;
case 7:
me->MonsterSay("Listen, dragon. Let the truth resonate throughout these halls.", LANG_UNIVERSAL, Prestor);
uiTimer = 3000;
uiPhase = 8;
break;
case 8:
Prestor->UpdateEntry(NPC_LADY_ONYXIA);
uiTimer = 3000;
uiPhase = 9;
break;
case 9:
Prestor->MonsterSay("Curious... Windsor, in this vision, did you survive? I only ask because one thing that I can and will assure is your death. Here and now.", LANG_UNIVERSAL, me);
uiTimer = 3000;
uiPhase = 10;
break;
case 10:
me->MonsterSay("DO NOT LET HER ESCAPE!", LANG_UNIVERSAL, Prestor);
uiTimer = 2000;
uiPhase = 11;
break;
case 11:
me->Kill(Prestor, me);
Prestor->MonsterTextEmote("Lady Onyxia laughs as Reginald Windsor is mortally wounded", me);
uiTimer = 2000;
uiPhase = 12;
break;
}
}
else uiTimer -= uiDiff;
}
ScriptedAI::UpdateAI(uiDiff);
if (!UpdateVictim())
return;
}
}
};
};
void AddSC_stormwind_city()
{
new npc_archmage_malin();
new npc_bartleby();
new npc_lady_katrana_prestor();
new npc_tyrion();
new npc_tyrion_spybot();
new npc_lord_gregor_lescovar();
new npc_marzon_silent_blade();
new npc_windsor();
}