diff --git a/scripts/northrend/icecrown.cpp b/scripts/northrend/icecrown.cpp index 98d4b3a..8894405 100644 --- a/scripts/northrend/icecrown.cpp +++ b/scripts/northrend/icecrown.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Icecrown SD%Complete: 100 -SDComment: Quest support: 13221, 13229, 13284, 13301, 13481, 13482. +SDComment: Quest support: 13221, 13229, 13284, 13300, 13301, 13302, 13481, 13482. SDCategory: Icecrown EndScriptData */ @@ -25,6 +25,7 @@ EndScriptData */ npc_squad_leader npc_infantry npc_father_kamaros +npc_saronite_mine_slave EndContentData */ #include "precompiled.h" @@ -556,6 +557,95 @@ bool QuestAccept_npc_father_kamaros(Player* pPlayer, Creature* pCreature, const return false; } +/*###### +## npc_saronite_mine_slave +######*/ +static const float aPointOfSalvation[3] = {7030.59f, 1866.73f, 533.94f}; + +enum +{ + QUEST_SLAVES_TO_SARONITE_ALLIANCE = 13300, + QUEST_SLAVES_TO_SARONITE_HORDE = 13302, + + GOSSIP_SARONITE_MINE_SLAVE = -3649012, + TEXT_ID = 14068, + + YEL_NPC_SARONITE_MINE_SLAVE_1 = -1999945, + YEL_NPC_SARONITE_MINE_SLAVE_2 = -1999946, + YEL_NPC_SARONITE_MINE_SLAVE_3 = -1999947, + YEL_NPC_SARONITE_MINE_SLAVE_4 = -1999948, + + NPC_SARONITE_KILL_CREDIT_BUNNY = 31866, + + FACTION_HOSTILE = 16, +}; + +struct MANGOS_DLL_DECL npc_saronite_mine_slaveAI : public ScriptedAI +{ + npc_saronite_mine_slaveAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } + + bool m_bActivate; + + void Reset() + { + m_bActivate = false; + } +}; + +CreatureAI* GetAI_npc_saronite_mine_slave(Creature* pCreature) +{ + return new npc_saronite_mine_slaveAI(pCreature); +} + +bool GossipHello_npc_saronite_mine_slave(Player* pPlayer, Creature* pCreature) +{ + if (pPlayer->GetQuestStatus(QUEST_SLAVES_TO_SARONITE_ALLIANCE) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_SLAVES_TO_SARONITE_HORDE) == QUEST_STATUS_INCOMPLETE) + { + if (npc_saronite_mine_slaveAI* pSaroniteMineSlaveAI = dynamic_cast(pCreature->AI())) + { + if (!pSaroniteMineSlaveAI->m_bActivate) + pPlayer->ADD_GOSSIP_ITEM_ID(GOSSIP_ICON_CHAT, GOSSIP_SARONITE_MINE_SLAVE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF); + } + + } + pPlayer->SEND_GOSSIP_MENU(TEXT_ID, pCreature->GetObjectGuid()); + return true; +} + +bool GossipSelect_npc_saronite_mine_slave(Player* pPlayer, Creature* pCreature, uint32 /*uiSender*/, uint32 uiAction) +{ + switch (urand(0, 2)) + { + case 0: + pPlayer->CLOSE_GOSSIP_MENU(); + pPlayer->KilledMonsterCredit(NPC_SARONITE_KILL_CREDIT_BUNNY); + pCreature->SetWalk(false); + pCreature->UpdateSpeed(MOVE_RUN, true); + pCreature->GetMotionMaster()->MovePoint(0, aPointOfSalvation[0], aPointOfSalvation[1], aPointOfSalvation[2]); + if (npc_saronite_mine_slaveAI* pSaroniteMineSlaveAI = dynamic_cast(pCreature->AI())) + pSaroniteMineSlaveAI->m_bActivate = true; + break; + case 1: + pCreature->SetFactionTemporary(FACTION_HOSTILE, TEMPFACTION_RESTORE_RESPAWN | TEMPFACTION_RESTORE_COMBAT_STOP); + pCreature->AI()->AttackStart(pPlayer); + break; + case 2: + pPlayer->CLOSE_GOSSIP_MENU(); + switch (urand(0, 3)) + { + case 0: DoScriptText(YEL_NPC_SARONITE_MINE_SLAVE_1, pCreature); break; + case 1: DoScriptText(YEL_NPC_SARONITE_MINE_SLAVE_2, pCreature); break; + case 2: DoScriptText(YEL_NPC_SARONITE_MINE_SLAVE_3, pCreature); break; + case 3: DoScriptText(YEL_NPC_SARONITE_MINE_SLAVE_4, pCreature); break; + } + if (npc_saronite_mine_slaveAI* pSaroniteMineSlaveAI = dynamic_cast(pCreature->AI())) + pSaroniteMineSlaveAI->m_bActivate = true; + break; + } + + return true; +} + void AddSC_icecrown() { Script* pNewScript; @@ -576,4 +666,11 @@ void AddSC_icecrown() pNewScript->GetAI = &GetAI_npc_father_kamaros; pNewScript->pQuestAcceptNPC = &QuestAccept_npc_father_kamaros; pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "npc_saronite_mine_slave"; + pNewScript->GetAI = &GetAI_npc_saronite_mine_slave; + pNewScript->pGossipHello = &GossipHello_npc_saronite_mine_slave; + pNewScript->pGossipSelect = &GossipSelect_npc_saronite_mine_slave; + pNewScript->RegisterSelf(); }