Quest "The Great Masquerade" is not working at all

Issue #369 resolved
Former user created an issue

This is the next quest in Onyxia chain after "Jail Break!" and "Stormwind Rendezvous"
In this quest player should follow and protect Reginald Windsor and at the end, Lady Prestor should transform into Onyxia and kill Reginald Windsor.
But there are no script for this quest :(
And this quest can not be completed

http://old.wowhead.com/quest=6403

p.s Quest "Stormwind Rendezvous" is broken too
In this quest player should speak with Squire Rowe and then Reginald Windsor appears, complete quest "Stormwind Rendezvous" and start escort-quest "The Great Masquerade"

http://old.wowhead.com/quest=6402

Comments (7)

  1. Filip

    Scripts are commented out, here is patch to enable all scripts in blackrock depths(for more than this quest?) & sqls:

    UPDATE creature_template SET ScriptName = 'npc_marshal_windsor' WHERE entry=9023;
    UPDATE creature_template SET ScriptName = 'npc_marshal_reginald_windsor' WHERE entry=12580;
    UPDATE creature_template SET ScriptName = 'npc_tobias_seecher' WHERE entry=9679;
    UPDATE creature_template SET ScriptName = 'npc_dughal_stormwing' WHERE entry=9022;
    

    needs tests

  2. Filip

    There are compile errors and scripts are not 100% correct, maybe better way is to backport it from mangos-zero, where script looks much better O.o

  3. Selphius

    Fixed it today. Will share it as well.

    enum Encounters
    {
        ENCOUNTER_STATE_NOT_STARTED = 1,
        ENCOUNTER_STATE_IN_PROGRESS = 2,
        ENCOUNTER_STATE_ENDED = 3,
        ENCOUNTER_STATE_FAILED = 4,
        ENCOUNTER_STATE_OBJECTIVE_COMPLETED = 5,
        ENCOUNTER_STATE_BEFORE_START = 6
    };
    
    enum JailBreak
    {
        QUEST_JAIL_BREAK                                       = 4322
    };
    
    /*######
    ## npc_marshal_windsor
    ######*/
    
    #define SAY_WINDSOR_AGGRO1          "You locked up the wrong Marshal. Prepare to be destroyed!"
    #define SAY_WINDSOR_AGGRO2          "I bet you're sorry now, aren't you !?!!"
    #define SAY_WINDSOR_AGGRO3          "You better hold me back $N or they are going to feel some prison house beatings."
    #define SAY_WINDSOR_1               "Let's get a move on. My gear should be in the storage area up this way..."
    #define SAY_WINDSOR_4_1             "Check that cell, $N. If someone is alive in there, we need to get them out."
    #define SAY_WINDSOR_4_2             "Get him out of there!"
    #define SAY_WINDSOR_4_3             "Good work! We're almost there, $N. This way."
    #define SAY_WINDSOR_6               "This is it, $N. My stuff should be in that room. Cover me, I'm going in!"
    #define SAY_WINDSOR_9               "Ah, there it is!"
    #define MOB_ENTRY_REGINALD_WINDSOR  9682
    
    struct npc_marshal_windsorAI : public npc_escortAI
    {
        npc_marshal_windsorAI(Creature* creature) : npc_escortAI(creature) 
        {
            pInstance = (ScriptedInstance*)creature->GetInstanceData();
        }
    
        ScriptedInstance* pInstance;
        uint64 PlayerGUID;
    
        void Reset() 
        {
            PlayerGUID = 0;
        }
    
        void EnterCombat(Unit* who)
        {
            switch (urand(0, 2))
            {
            case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, 0); break;
            case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, 0); break;
            case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break;
            }
        }
    
        void JustDied(Unit* /*killer*/)
        {
            pInstance->SetData(DATA_QUEST_JAIL_BREAK, ENCOUNTER_STATE_FAILED);
        }
    
        void WaypointReached(uint32 waypointId)
        {
            Player* player = GetPlayerForEscort();
            if (!player)
                return;
    
            switch (waypointId)
            {
            case 1:
                me->Say(SAY_WINDSOR_1, LANG_UNIVERSAL, 0);
                break;
            case 7:
                me->HandleEmoteCommand(EMOTE_STATE_POINT);
                me->Say(SAY_WINDSOR_4_1, LANG_UNIVERSAL, PlayerGUID);
                SetEscortPaused(true);
                break;
            case 10:
                me->setFaction(534);
                break;
            case 12:
                me->Say(SAY_WINDSOR_6, LANG_UNIVERSAL, PlayerGUID);
                pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_IN_PROGRESS);
                break;
            case 13:
                me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK
                break;
            case 14:
                pInstance->SetData(DATA_GATE_SR, 0);
                me->setFaction(11);
                break;
            case 16:
                me->Say(SAY_WINDSOR_9, LANG_UNIVERSAL, 0);
                break;
            case 17:
                me->HandleEmoteCommand(EMOTE_STATE_USESTANDING);//EMOTE_STATE_WORK
                break;
            case 18:
                pInstance->SetData(DATA_GATE_SC, 0);
                break;
            case 19:
                me->SetVisibility(VISIBILITY_OFF);
                me->SummonCreature(MOB_ENTRY_REGINALD_WINDSOR, 403.61, -51.71, -63.92, 3.600434, TEMPSUMMON_DEAD_DESPAWN, 0);
                pInstance->SetData(DATA_SUPPLY_ROOM, ENCOUNTER_STATE_ENDED);
                break;
            }
        }
    
        void UpdateAI(const uint32 diff)
        {
            if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) 
                return;
    
            if (pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED)
                SetEscortPaused(false);
    
            if (!pInstance->GetData(DATA_GATE_D) && pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_NOT_STARTED)
            {
                me->Say(SAY_WINDSOR_4_2, LANG_UNIVERSAL, 0);
                pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_BEFORE_START);
            }
            if (pInstance->GetData(DATA_DUGHAL) == ENCOUNTER_STATE_OBJECTIVE_COMPLETED)
            {
                me->Say(SAY_WINDSOR_4_3, LANG_UNIVERSAL, PlayerGUID);
                pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED);
            }
            if ((pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_FAILED || pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_ENDED) && pInstance->GetData(DATA_SUPPLY_ROOM) == ENCOUNTER_STATE_ENDED)
            {
                me->SetVisibility(VISIBILITY_OFF);
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            }
            else
            {
                me->SetVisibility(VISIBILITY_ON);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            }
            npc_escortAI::UpdateAI(diff);
        }
    };
    
    CreatureAI* GetAI_npc_marshal_windsor(Creature* pCreature)
    {
        npc_marshal_windsorAI* marshal_windsorAI = new npc_marshal_windsorAI(pCreature);
    
        marshal_windsorAI->AddWaypoint(0, 316.336, -225.528, -77.7258, 3000);
        marshal_windsorAI->AddWaypoint(1, 316.336, -225.528, -77.7258, 2000);
        marshal_windsorAI->AddWaypoint(2, 322.96, -207.13, -77.87, 0);
        marshal_windsorAI->AddWaypoint(3, 281.05, -172.16, -75.12, 0);
        marshal_windsorAI->AddWaypoint(4, 272.19, -139.14, -70.61, 0);
        marshal_windsorAI->AddWaypoint(5, 283.62, -116.09, -70.21, 0);
        marshal_windsorAI->AddWaypoint(6, 296.18, -94.30, -74.08, 0);
        marshal_windsorAI->AddWaypoint(7, 294.57, -93.11, -74.08, 0);
        marshal_windsorAI->AddWaypoint(8, 314.31, -74.31, -76.09, 0);
        marshal_windsorAI->AddWaypoint(9, 360.22, -62.93, -66.77, 0);
        marshal_windsorAI->AddWaypoint(10, 383.38, -69.40, -63.25, 0);
        marshal_windsorAI->AddWaypoint(11, 389.99, -67.86, -62.57, 0);
        marshal_windsorAI->AddWaypoint(12, 400.98, -72.01, -62.31, 0);
        marshal_windsorAI->AddWaypoint(13, 404.22, -62.30, -63.50, 2300);
        marshal_windsorAI->AddWaypoint(14, 404.22, -62.30, -63.50, 1500);
        marshal_windsorAI->AddWaypoint(15, 407.65, -51.86, -63.96, 0);
        marshal_windsorAI->AddWaypoint(16, 403.61, -51.71, -63.92, 1000);
        marshal_windsorAI->AddWaypoint(17, 403.61, -51.71, -63.92, 2000);
        marshal_windsorAI->AddWaypoint(18, 403.61, -51.71, -63.92, 1000);
        marshal_windsorAI->AddWaypoint(19, 403.61, -51.71, -63.92, 0);
    
        return marshal_windsorAI;
    }
    
    bool QuestAccept_npc_marshal_windsor(Player* player, Creature* creature, Quest const* quest)
    {
        if (quest->GetQuestId() == 4322)
        {
            CAST_AI(npc_marshal_windsorAI, creature->AI())->PlayerGUID = player->GetGUID();
    
            if (npc_escortAI* pEscortAI = CAST_AI(npc_marshal_windsorAI, creature->AI()))
                pEscortAI->Start(true, true, player->GetGUID());
    
            creature->setFaction(11);
        }
    
        return true;
    }
    
    /*######
    ## npc_dughal_stormwing
    ######*/
    
    #define SAY_DUGHAL_FREE         "Thank you, $N! I'm free!!!"
    #define GOSSIP_DUGHAL           "You're free, Dughal! Get out of here!"
    
    struct npc_dughal_stormwingAI : public npc_escortAI
    {
        npc_dughal_stormwingAI(Creature* creature) : npc_escortAI(creature)
        {
            pInstance = (ScriptedInstance*)creature->GetInstanceData();
        }
    
        ScriptedInstance* pInstance;
        uint64 PlayerGUID;
    
        void Reset()
        {
            me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
            PlayerGUID = 0;
        }
    
        void JustDied(Unit* /*killer*/)
        {
            me->SetVisibility(VISIBILITY_OFF);
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED);
        }
    
        void WaypointReached(uint32 waypointId)
        {
            Player* player = GetPlayerForEscort();
            if (!player)
                return;
    
            switch (waypointId)
            {
            case 0:
                me->Say(SAY_DUGHAL_FREE, LANG_UNIVERSAL, PlayerGUID);
                break;
            case 1:
                pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_OBJECTIVE_COMPLETED);
                break;
            case 2:
                me->SetVisibility(VISIBILITY_OFF);
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                pInstance->SetData(DATA_DUGHAL, ENCOUNTER_STATE_ENDED);
                break;
            }
        }
    
        void UpdateAI(const uint32 diff)
        {
            if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED)
                return;
    
            if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS)
            {
                me->SetVisibility(VISIBILITY_ON);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            }
            npc_escortAI::UpdateAI(diff);
        }
    };
    
    CreatureAI* GetAI_npc_dughal_stormwing(Creature* pCreature)
    {
        npc_dughal_stormwingAI* dughal_stormwingAI = new npc_dughal_stormwingAI(pCreature);
    
        dughal_stormwingAI->AddWaypoint(0, 280.42, -82.86, -77.12, 0);
        dughal_stormwingAI->AddWaypoint(1, 287.64, -87.01, -76.79, 0);
        dughal_stormwingAI->AddWaypoint(2, 354.63, -64.95, -67.53, 0);
    
        return dughal_stormwingAI;
    }
    
    bool GossipHello_npc_dughal_stormwing(Player* player, Creature* creature)
    {
        if (player->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && creature->FindNearestCreature(9023, 20.0f, true))
        {       
            player->ADD_GOSSIP_ITEM(0, GOSSIP_DUGHAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
            player->SEND_GOSSIP_MENU(2846, creature->GetGUID());
        }
        return true;
    }
    
    bool GossipSelect_npc_dughal_stormwing(Player* player, Creature* creature, uint32 sender, uint32 action)
    {
        switch (action)
        {
        case GOSSIP_ACTION_INFO_DEF + 1:
    
            CAST_AI(npc_dughal_stormwingAI, creature->AI())->PlayerGUID = player->GetGUID();
    
            if (npc_escortAI* pEscortAI = CAST_AI(npc_dughal_stormwingAI, creature->AI()))
                pEscortAI->Start(false, true, player->GetGUID());
    
            if (Creature* windsor = creature->FindNearestCreature(9023, 20.0f, true))
            {
                CAST_AI(npc_marshal_windsorAI, windsor->AI())->SetEscortPaused(false);
            }
    
            creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
            player->CLOSE_GOSSIP_MENU();
            break;
        }
        return true;
    }
    
    /*######
    ## npc_marshal_reginald_windsor
    ######*/
    
    #define SAY_REGINALD_WINDSOR_0_1    "Can you feel the power, $N??? It's time to ROCK!"
    #define SAY_REGINALD_WINDSOR_0_2    "Now we just have to free Tobias and we can get out of here. This way!"
    #define SAY_REGINALD_WINDSOR_5_1    "Open it."
    #define SAY_REGINALD_WINDSOR_5_2    "I never did like those two. Let's get moving."
    #define SAY_REGINALD_WINDSOR_7_1    "Open it and be careful this time!"
    #define SAY_REGINALD_WINDSOR_7_2    "That intolerant dirtbag finally got what was coming to him. Good riddance!"
    #define SAY_REGINALD_WINDSOR_7_3    "Alright, let's go."
    #define SAY_REGINALD_WINDSOR_13_1   "Open it. We need to hurry up. I can smell those Dark Irons coming a mile away and I can tell you one thing, they're COMING!"
    #define SAY_REGINALD_WINDSOR_13_2   "Administering fists of fury on Crest Killer!"
    #define SAY_REGINALD_WINDSOR_13_4   "I bet you're sorry now, aren't you Crest Killer!?!"
    #define SAY_REGINALD_WINDSOR_13_3   "He has to be in the last cell. Unless... they killed him."
    #define SAY_REGINALD_WINDSOR_14_1   "Get him out of there!"
    #define SAY_REGINALD_WINDSOR_14_2   "Excellent work, $N. Let's find the exit. I think I know the way. Follow me!"
    #define SAY_REGINALD_WINDSOR_20_1   "We made it!"
    #define SAY_REGINALD_WINDSOR_20_2   "Meet me at Maxwell's encampment. We'll go over the next stages of the plan there and figure out a way to decode my tablets without the decryption ring."
    #define MOB_ENTRY_SHILL_DINGER      9678
    #define MOB_ENTRY_CREST_KILLER      9680
    
    struct npc_marshal_reginald_windsorAI : public npc_escortAI
    {
        npc_marshal_reginald_windsorAI(Creature* creature) : npc_escortAI(creature)
        {
            pInstance = (ScriptedInstance*)creature->GetInstanceData();
        }
    
        ScriptedInstance* pInstance;
        uint64 PlayerGUID;
        bool crest;
    
        void Reset()
        {       
            PlayerGUID = 0;
            crest = false;
        }
    
        void EnterCombat(Unit* /*who*/)
        {
            switch (urand(0, 2))
            {
            case 0: me->Say(SAY_WINDSOR_AGGRO1, LANG_UNIVERSAL, 0); break;
            case 1: me->Say(SAY_WINDSOR_AGGRO2, LANG_UNIVERSAL, 0); break;
            case 2: me->Say(SAY_WINDSOR_AGGRO3, LANG_UNIVERSAL, PlayerGUID); break;
            }
        }
    
        void JustDied(Unit* /*killer*/)
        {
            pInstance->SetData(DATA_QUEST_JAIL_BREAK, ENCOUNTER_STATE_FAILED);
        }
    
        void MoveInLineOfSight(Unit* who)
        {
            if (HasEscortState(STATE_ESCORT_ESCORTING))
                return;
    
            if (who->GetTypeId() == TYPEID_PLAYER)
            {
                if (CAST_PLR(who)->GetQuestStatus(4322) == QUEST_STATUS_INCOMPLETE)
                {
                    float Radius = 10.0;
                    if (me->IsWithinDistInMap(who, Radius))
                    {
                        SetEscortPaused(false);
                        Start(true, false, who->GetGUID());
    
                        PlayerGUID = who->GetGUID();
                    }
                }
            }
        }
    
        void WaypointReached(uint32 waypointId)
        {
            Player* player = GetPlayerForEscort();
            if (!player)
                return;
    
            switch (waypointId)
            {
            case 0:
                me->setFaction(11);
                me->Say(SAY_REGINALD_WINDSOR_0_1, LANG_UNIVERSAL, PlayerGUID);
                break;
            case 1:
                me->Say(SAY_REGINALD_WINDSOR_0_2, LANG_UNIVERSAL, 0);
                break;
            case 7:
                me->HandleEmoteCommand(EMOTE_STATE_POINT);
                me->Say(SAY_REGINALD_WINDSOR_5_1, LANG_UNIVERSAL, 0);
                SetEscortPaused(true);
                break;
            case 8:
                me->Say(SAY_REGINALD_WINDSOR_5_2, LANG_UNIVERSAL, 0);
                break;
            case 11:
                me->HandleEmoteCommand(EMOTE_STATE_POINT);
                me->Say(SAY_REGINALD_WINDSOR_7_1, LANG_UNIVERSAL, 0);
                SetEscortPaused(true);
                break;
            case 12:
                me->Say(SAY_REGINALD_WINDSOR_7_2, LANG_UNIVERSAL, 0);
                break;
            case 13:
                me->Say(SAY_REGINALD_WINDSOR_7_3, LANG_UNIVERSAL, 0);
                break;
            case 20:
                me->HandleEmoteCommand(EMOTE_STATE_POINT);
                me->Say(SAY_REGINALD_WINDSOR_13_1, LANG_UNIVERSAL, 0);
                SetEscortPaused(true);
                break;
            case 21:
                me->Say(SAY_REGINALD_WINDSOR_13_3, LANG_UNIVERSAL, 0);
                break;
            case 23:
                me->HandleEmoteCommand(EMOTE_STATE_POINT);
                me->Say(SAY_REGINALD_WINDSOR_14_1, LANG_UNIVERSAL, 0);
                SetEscortPaused(true);
                break;
            case 24:
                me->Say(SAY_REGINALD_WINDSOR_14_2, LANG_UNIVERSAL, PlayerGUID);
                break;
            case 31:
                me->Say(SAY_REGINALD_WINDSOR_20_1, LANG_UNIVERSAL, 0);
                break;
            case 32:
                me->Say(SAY_REGINALD_WINDSOR_20_2, LANG_UNIVERSAL, 0);
    
                if (Player* pPlayer = Unit::GetPlayer(*me, PlayerGUID))
                    pPlayer->GroupEventHappens(QUEST_JAIL_BREAK, me);
    
                pInstance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED);
                break;
            }
        }
    
        void UpdateAI(const uint32 diff)
        {
            if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED)
                return;
    
            if (!crest)
            {
                if (me->FindNearestCreature(MOB_ENTRY_CREST_KILLER, 10.0f, true))
                {
                    me->Say(SAY_REGINALD_WINDSOR_13_2, LANG_UNIVERSAL, 0);
                    crest = true;
                }
            }
    
            npc_escortAI::UpdateAI(diff);
        }
    };
    
    CreatureAI* GetAI_npc_marshal_reginald_windsor(Creature* pCreature)
    {
        npc_marshal_reginald_windsorAI* marshal_reginald_windsorAI = new npc_marshal_reginald_windsorAI(pCreature);
    
        marshal_reginald_windsorAI->AddWaypoint(0, 403.61, -52.71, -63.92, 4000);
        marshal_reginald_windsorAI->AddWaypoint(1, 403.61, -52.71, -63.92, 4000);
        marshal_reginald_windsorAI->AddWaypoint(2, 406.33, -54.87, -63.95, 0);
        marshal_reginald_windsorAI->AddWaypoint(3, 407.99, -73.91, -62.26, 0);
        marshal_reginald_windsorAI->AddWaypoint(4, 557.03, -119.71, -61.83, 0);
        marshal_reginald_windsorAI->AddWaypoint(5, 573.40, -124.39, -65.07, 0);
        marshal_reginald_windsorAI->AddWaypoint(6, 593.91, -130.29, -69.25, 0);
        marshal_reginald_windsorAI->AddWaypoint(7, 593.21, -132.16, -69.25, 0);
        marshal_reginald_windsorAI->AddWaypoint(8, 593.21, -132.16, -69.25, 3000);
        marshal_reginald_windsorAI->AddWaypoint(9, 622.81, -135.55, -71.92, 0);
        marshal_reginald_windsorAI->AddWaypoint(10, 634.68, -151.29, -70.32, 0);
        marshal_reginald_windsorAI->AddWaypoint(11, 635.06, -153.25, -70.32, 0);
        marshal_reginald_windsorAI->AddWaypoint(12, 635.06, -153.25, -70.32, 3000);
        marshal_reginald_windsorAI->AddWaypoint(13, 635.06, -153.25, -70.32, 1500);
        marshal_reginald_windsorAI->AddWaypoint(14, 655.25, -172.39, -73.72, 0);
        marshal_reginald_windsorAI->AddWaypoint(15, 654.79, -226.30, -83.06, 0);
        marshal_reginald_windsorAI->AddWaypoint(16, 622.85, -268.85, -83.96, 0);
        marshal_reginald_windsorAI->AddWaypoint(17, 579.45, -275.56, -80.44, 0);
        marshal_reginald_windsorAI->AddWaypoint(18, 561.19, -266.85, -75.59, 0);
        marshal_reginald_windsorAI->AddWaypoint(19, 547.91, -253.92, -70.34, 0);
        marshal_reginald_windsorAI->AddWaypoint(20, 549.20, -252.40, -70.34, 0);
        marshal_reginald_windsorAI->AddWaypoint(21, 549.20, -252.40, -70.34, 4000);
        marshal_reginald_windsorAI->AddWaypoint(22, 555.33, -269.16, -74.40, 0);
        marshal_reginald_windsorAI->AddWaypoint(23, 554.31, -270.88, -74.40, 0);
        marshal_reginald_windsorAI->AddWaypoint(24, 554.31, -270.88, -74.40, 4000);
        marshal_reginald_windsorAI->AddWaypoint(25, 536.10, -249.60, -67.47, 0);
        marshal_reginald_windsorAI->AddWaypoint(26, 520.94, -216.65, -59.28, 0);
        marshal_reginald_windsorAI->AddWaypoint(27, 505.99, -148.74, -62.17, 0);
        marshal_reginald_windsorAI->AddWaypoint(28, 484.21, -56.24, -62.43, 0);
        marshal_reginald_windsorAI->AddWaypoint(29, 470.39, -6.01, -70.10, 0);
        marshal_reginald_windsorAI->AddWaypoint(30, 451.27, 30.85, -70.07, 0);
        marshal_reginald_windsorAI->AddWaypoint(31, 452.45, 29.85, -70.37, 1500);
        marshal_reginald_windsorAI->AddWaypoint(32, 452.45, 29.85, -70.37, 7000);
        marshal_reginald_windsorAI->AddWaypoint(33, 452.45, 29.85, -70.37, 10000);
        marshal_reginald_windsorAI->AddWaypoint(34, 451.27, 31.85, -70.07, 0);
    
        return marshal_reginald_windsorAI;
    }
    
    /*######
    ## npc_ograbisi
    ######*/
    
    struct npc_ograbisiAI : public ScriptedAI
    {
        npc_ograbisiAI(Creature* creature) :ScriptedAI(creature)
        {
            pInstance = (ScriptedInstance*)creature->GetInstanceData();
        }
    
        ScriptedInstance* pInstance;
    
        void Reset() 
        {
            me->setFaction(35);
    
            if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS)
            {
                pInstance->SetData(DATA_OGRABISI, ENCOUNTER_STATE_NOT_STARTED);
            }
        }
    
        void EnterCombat(Unit* /*who*/)
        {
            pInstance->SetData(DATA_OGRABISI, ENCOUNTER_STATE_IN_PROGRESS);
        }
    
        void JustDied(Unit* killer)
        {       
            pInstance->SetData(DATA_OGRABISI, ENCOUNTER_STATE_ENDED);
    
            if (me->FindNearestCreature(9681, 30.0f, false))
            {
                if (Creature* reginald = me->FindNearestCreature(MOB_ENTRY_REGINALD_WINDSOR, 35.0f, true))
                {
                    CAST_AI(npc_marshal_reginald_windsorAI, reginald->AI())->SetEscortPaused(false);
                }
            }
        }
    
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
            {
                if (me->FindNearestCreature(MOB_ENTRY_REGINALD_WINDSOR, 20.0f, true))
                {
                    me->setFaction(14);
                }
            }
    
            DoMeleeAttackIfReady();
        }
    };
    
    CreatureAI* GetAI_npc_ograbisi(Creature* pCreature)
    {
        return new npc_ograbisiAI(pCreature);
    }
    
    /*######
    ## npc_jaz
    ######*/
    
    struct npc_jazAI : public ScriptedAI
    {
        npc_jazAI(Creature* creature) :ScriptedAI(creature)
        {
            pInstance = (ScriptedInstance*)creature->GetInstanceData();
        }
    
        ScriptedInstance* pInstance;
    
        void Reset()
        {
            me->setFaction(35);
    
            if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS)
            {
                pInstance->SetData(DATA_JAZ, ENCOUNTER_STATE_NOT_STARTED);
            }
        }
    
        void EnterCombat(Unit* /*who*/)
        {
            pInstance->SetData(DATA_JAZ, ENCOUNTER_STATE_IN_PROGRESS);
        }
    
        void JustDied(Unit* killer)
        {
            pInstance->SetData(DATA_JAZ, ENCOUNTER_STATE_ENDED);
    
    
            if (me->FindNearestCreature(9677, 30.0f, false))
            {
                if (Creature* reginald = me->FindNearestCreature(MOB_ENTRY_REGINALD_WINDSOR, 35.0f, true))
                {
                    CAST_AI(npc_marshal_reginald_windsorAI, reginald->AI())->SetEscortPaused(false);
                }
            }       
        }
    
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
            {
                if (me->FindNearestCreature(MOB_ENTRY_REGINALD_WINDSOR, 20.0f, true))
                {
                    me->setFaction(14);
                }
            }
    
            DoMeleeAttackIfReady();
        }
    };
    
    CreatureAI* GetAI_npc_jaz(Creature* pCreature)
    {
        return new npc_jazAI(pCreature);
    }
    
    /*######
    ## npc_shill
    ######*/
    
    struct npc_shillAI : public ScriptedAI
    {
        npc_shillAI(Creature* creature) :ScriptedAI(creature)
        {
            pInstance = (ScriptedInstance*)creature->GetInstanceData();
        }
    
        ScriptedInstance* pInstance;
    
        void Reset()
        {
            me->setFaction(35);
    
            if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS)
            {
                pInstance->SetData(DATA_SHILL, ENCOUNTER_STATE_NOT_STARTED);
            }
        }
    
        void EnterCombat(Unit* /*who*/)
        {
            pInstance->SetData(DATA_SHILL, ENCOUNTER_STATE_IN_PROGRESS);
        }
    
        void JustDied(Unit* killer)
        {
            pInstance->SetData(DATA_SHILL, ENCOUNTER_STATE_ENDED);
    
            if (Creature* reginald = me->FindNearestCreature(MOB_ENTRY_REGINALD_WINDSOR, 35.0f, true))
            {
                CAST_AI(npc_marshal_reginald_windsorAI, reginald->AI())->SetEscortPaused(false);
            }
        }
    
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
            {
                if (me->FindNearestCreature(MOB_ENTRY_REGINALD_WINDSOR, 20.0f, true))
                {
                    me->setFaction(14);
                }
            }
    
            DoMeleeAttackIfReady();
        }
    };
    
    CreatureAI* GetAI_npc_shill(Creature* pCreature)
    {
        return new npc_shillAI(pCreature);
    }
    
    /*######
    ## npc_crest
    ######*/
    
    #define SAY_CREST_1 "Where I come from, you get shanked for opening another inmate's cell door!"
    
    struct npc_crestAI : public ScriptedAI
    {
        npc_crestAI(Creature* creature) :ScriptedAI(creature)
        {
            pInstance = (ScriptedInstance*)creature->GetInstanceData();
        }
    
        ScriptedInstance* pInstance;
    
        void Reset()
        {
            me->setFaction(35);
    
            if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS)
            {
                pInstance->SetData(DATA_CREST, ENCOUNTER_STATE_NOT_STARTED);
            }
        }
    
        void EnterCombat(Unit* /*who*/)
        {
            me->Say(SAY_CREST_1, LANG_UNIVERSAL, 0);
            pInstance->SetData(DATA_CREST, ENCOUNTER_STATE_IN_PROGRESS);
        }
    
        void JustDied(Unit* killer)
        {
            pInstance->SetData(DATA_CREST, ENCOUNTER_STATE_ENDED);
    
            if (Creature* reginald = me->FindNearestCreature(MOB_ENTRY_REGINALD_WINDSOR, 35.0f, true))
            {
                reginald->Say(SAY_REGINALD_WINDSOR_13_4, LANG_UNIVERSAL, 0);
                CAST_AI(npc_marshal_reginald_windsorAI, reginald->AI())->SetEscortPaused(false);
            }
        }
    
        void UpdateAI(const uint32 diff)
        {
            if (!UpdateVictim())
            {
                if (me->FindNearestCreature(MOB_ENTRY_REGINALD_WINDSOR, 20.0f, true))
                {
                    me->setFaction(14);
                }
            }
    
            DoMeleeAttackIfReady();
        }
    };
    
    CreatureAI* GetAI_npc_crest(Creature* pCreature)
    {
        return new npc_crestAI(pCreature);
    }
    
    /*######
    ## npc_tobias_seecher
    ######*/
    
    #define SAY_TOBIAS_FREE         "Thank you! I will run for safety immediately!"
    
    struct npc_tobias_seecherAI : public npc_escortAI
    {
        npc_tobias_seecherAI(Creature* creature) : npc_escortAI(creature)
        {
            pInstance = (ScriptedInstance*)creature->GetInstanceData();
        }
    
        ScriptedInstance* pInstance;
        uint64 PlayerGUID;
    
        void Reset()
        {
            me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
            PlayerGUID = 0;
        }
    
        void JustDied(Unit* /*killer*/)
        {
            me->SetVisibility(VISIBILITY_OFF);
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
            me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            pInstance->SetData(DATA_TOBIAS, ENCOUNTER_STATE_ENDED);
        }
    
        void WaypointReached(uint32 waypointId)
        {
            Player* player = GetPlayerForEscort();
            if (!player)
                return;
    
            switch (waypointId)
            {
            case 0:
                me->Say(SAY_TOBIAS_FREE, LANG_UNIVERSAL, 0); 
                break;
            case 2:
                pInstance->SetData(DATA_TOBIAS, ENCOUNTER_STATE_OBJECTIVE_COMPLETED); 
                break;
            case 4:
                me->SetVisibility(VISIBILITY_OFF);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
                pInstance->SetData(DATA_TOBIAS, ENCOUNTER_STATE_ENDED);
                break;
            }
        }
    
        void UpdateAI(const uint32 diff)
        {
            if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_NOT_STARTED) 
                return;
    
            if (pInstance->GetData(DATA_QUEST_JAIL_BREAK) == ENCOUNTER_STATE_IN_PROGRESS)
            {
                me->SetVisibility(VISIBILITY_ON);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
                me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
            }
            npc_escortAI::UpdateAI(diff);
        }
    };
    
    CreatureAI* GetAI_npc_tobias_seecher(Creature* pCreature)
    {
        npc_tobias_seecherAI* tobias_seecherAI = new npc_tobias_seecherAI(pCreature);
    
        tobias_seecherAI->AddWaypoint(0, 549.21, -281.07, -75.27);
        tobias_seecherAI->AddWaypoint(1, 554.39, -267.39, -73.68);
        tobias_seecherAI->AddWaypoint(2, 533.59, -249.38, -67.04);
        tobias_seecherAI->AddWaypoint(3, 519.44, -217.02, -59.34);
        tobias_seecherAI->AddWaypoint(4, 506.55, -153.49, -62.34);
    
        return tobias_seecherAI;
    }
    
    bool GossipHello_npc_tobias_seecher(Player* player, Creature* creature)
    {
        if (player->GetQuestStatus(QUEST_JAIL_BREAK) == QUEST_STATUS_INCOMPLETE && creature->FindNearestCreature(9682, 20.0f, true))
        {
            player->ADD_GOSSIP_ITEM(0, GOSSIP_DUGHAL, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
            player->SEND_GOSSIP_MENU(2846, creature->GetGUID());
        }
        return true;
    }
    
    bool GossipSelect_npc_tobias_seecher(Player* player, Creature* creature, uint32 sender, uint32 action)
    {
        switch (action)
        {
        case GOSSIP_ACTION_INFO_DEF + 1:
    
            CAST_AI(npc_tobias_seecherAI, creature->AI())->PlayerGUID = player->GetGUID();
    
            if (npc_escortAI* pEscortAI = CAST_AI(npc_tobias_seecherAI, creature->AI()))
                pEscortAI->Start(false, true, player->GetGUID());
    
            if (Creature* reginald = creature->FindNearestCreature(MOB_ENTRY_REGINALD_WINDSOR, 23.0f, true))
            {
                CAST_AI(npc_marshal_reginald_windsorAI, reginald->AI())->SetEscortPaused(false);
            }
    
            creature->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP);
            player->CLOSE_GOSSIP_MENU();
            break;
        }
        return true;
    }
    
    void AddSC_blackrock_depths()
    {
        Script* newscript;
    
     newscript = new Script;
            newscript->Name = "npc_dughal_stormwing";
            newscript->GetAI = &GetAI_npc_dughal_stormwing;
            newscript->pGossipHello =  &GossipHello_npc_dughal_stormwing;
            newscript->pGossipSelect = &GossipSelect_npc_dughal_stormwing;       
            newscript->RegisterSelf();
    
            newscript = new Script;
            newscript->Name = "npc_tobias_seecher";
            newscript->GetAI = &GetAI_npc_tobias_seecher;
            newscript->pGossipHello =  &GossipHello_npc_tobias_seecher;
            newscript->pGossipSelect = &GossipSelect_npc_tobias_seecher;       
            newscript->RegisterSelf();
    
            newscript = new Script;
            newscript->Name = "npc_marshal_windsor";
            newscript->GetAI = &GetAI_npc_marshal_windsor;
            newscript->pQuestAccept = &QuestAccept_npc_marshal_windsor;     
            newscript->RegisterSelf();  
    
            newscript = new Script;
            newscript->Name = "npc_marshal_reginald_windsor";
            newscript->GetAI = &GetAI_npc_marshal_reginald_windsor;
            newscript->RegisterSelf();
    
            newscript = new Script;
            newscript->Name = "npc_crest";
            newscript->GetAI = &GetAI_npc_crest;
            newscript->RegisterSelf();
    
            newscript = new Script;
            newscript->Name = "npc_shill";
            newscript->GetAI = &GetAI_npc_shill;
            newscript->RegisterSelf();
    
            newscript = new Script;
            newscript->Name = "npc_ograbisi";
            newscript->GetAI = &GetAI_npc_ograbisi;
            newscript->RegisterSelf();
    
            newscript = new Script;
            newscript->Name = "npc_jaz";
            newscript->GetAI = &GetAI_npc_jaz;
            newscript->RegisterSelf();
    }
    
  4. Log in to comment