diff --git a/scripts/world/areatrigger_scripts.cpp b/scripts/world/areatrigger_scripts.cpp index 2906ef9..1493f98 100644 --- a/scripts/world/areatrigger_scripts.cpp +++ b/scripts/world/areatrigger_scripts.cpp @@ -17,7 +17,7 @@ /* ScriptData SDName: Areatrigger_Scripts SD%Complete: 100 -SDComment: Quest support: 4291, 6681, 11686, 10589/10604, 12741, 12548, 13315/13351, 12575 +SDComment: Quest support: 4291, 6681, 11686, 10589/10604, 12741, 12548, 13315/13351, 12575, 24849, 24851 SDCategory: Areatrigger EndScriptData */ @@ -32,10 +32,12 @@ at_stormwright_shelf 5108 at_childrens_week_spot 3546,3547,3548,3552,3549,3550 at_scent_larkorwi 1726,1727,1728,1729,1730,1731,1732,1733,1734,1735,1736,1737,1738,1739,1740 at_murkdeep 1966 +at_hot_on_the_trail 5710,5711,5712,5714,5715,5716 EndContentData */ #include "precompiled.h" #include "world_map_scripts.h" +#include "GameEventMgr.h" static uint32 TriggerOrphanSpell[6][3] = { @@ -323,6 +325,45 @@ bool AreaTrigger_at_murkdeep(Player* pPlayer, AreaTriggerEntry const* /*pAt*/) return false; } +/*###### +## at_hot_on_the_trail +######*/ + +static uint32 AtConfig[6][4] = +{ + {5710, 24849, 38340, 71713}, // Stormwind Counting House, Quest entry, Killcredit, Spell entry + {5711, 24849, 38341, 71745}, // Stormwind Auction House ... + {5712, 24849, 38342, 71752}, // Stormwind Barber Shop ... + {5714, 24851, 38341, 71760}, // Orgrimmar Auction House ... + {5715, 24851, 38340, 71759}, // Orgrimmar Bank ... + {5716, 24851, 38342, 71758} // Orgrimmar Barber Shop ... +}; + +enum +{ + EVENT_LOVE_IS_IN_THE_AIR = 8 +}; + +bool AreaTrigger_at_hot_on_the_trail(Player* pPlayer, AreaTriggerEntry const* pAt) +{ + if (pPlayer->isAlive() && !pPlayer->isGameMaster()) + { + for (uint8 i = 0; i < 6; ++i) + { + if (pAt->id == AtConfig[i][0] && + IsHolidayActive(HOLIDAY_LOVE_IS_IN_THE_AIR) && + pPlayer->GetQuestStatus(AtConfig[i][1]) == QUEST_STATUS_INCOMPLETE && + pPlayer->GetReqKillOrCastCurrentCount(AtConfig[i][1], AtConfig[i][2]) == 0) + { + pPlayer->CastSpell(pPlayer, AtConfig[i][3], true); + return true; + } + } + } + + return false; +} + void AddSC_areatrigger_scripts() { Script* pNewScript; @@ -381,4 +422,9 @@ void AddSC_areatrigger_scripts() pNewScript->Name = "at_murkdeep"; pNewScript->pAreaTrigger = &AreaTrigger_at_murkdeep; pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "at_hot_on_the_trail"; + pNewScript->pAreaTrigger = &AreaTrigger_at_hot_on_the_trail; + pNewScript->RegisterSelf(); } diff --git a/scripts/world/npcs_special.cpp b/scripts/world/npcs_special.cpp index c1e25e7..d9b1f5c 100644 --- a/scripts/world/npcs_special.cpp +++ b/scripts/world/npcs_special.cpp @@ -39,6 +39,7 @@ npc_doctor 100% Gustaf Vanhowzen and Gregory Victor, quest 6622 npc_innkeeper 25% ScriptName not assigned. Innkeepers in general. npc_spring_rabbit 1% Used for pet "Spring Rabbit" of Noblegarden npc_redemption_target 100% Used for the paladin quests: 1779,1781,9600,9685 +npc_snivel_rustrocket ?% Quests: 24849, 24851 EndContentData */ /*######## @@ -1357,6 +1358,98 @@ bool EffectDummyCreature_npc_redemption_target(Unit* pCaster, uint32 uiSpellId, return false; } +/*###### +## npc_snivel_rustrocket +######*/ + +static uint32 NpcSnivelRustrocket[6][2] = +{ + {1, 38334}, // Counting House, Npc entry + {1, 38337}, // Counting House ... + {2, 38335}, // Auction House ... + {2, 38338}, // Auction House ... + {3, 38336}, // Barber Shop ... + {3, 38339} // Barber Shop ... +}; + +static uint32 SayNpcSnivelRustrocket[9][3] = +{ + {1, 1, -1999936}, // Counting House, Npc say1 + {1, 2, -1999937}, // Counting House, Npc say2 + {2, 1, -1999938}, // Auction House, Npc say1 + {2, 2, -1999939}, // Auction House, Npc say2 + {2, 3, -1999940}, // Auction House, Npc say3 + {3, 1, -1999941}, // Barber Shop, Npc say1 + {3, 2, -1999942}, // Barber Shop, Npc say2 + {3, 3, -1999943}, // Barber Shop, Npc say3 + {3, 4, -1999944}, // Barber Shop, Npc say4 +}; + +struct MANGOS_DLL_DECL npc_snivel_rustrocketAI : public ScriptedAI +{ + npc_snivel_rustrocketAI(Creature* pCreature) : ScriptedAI(pCreature) { Reset(); } + + uint32 m_uiTimer; + uint8 m_uiPlace; + uint8 m_uiSay; + bool bActionEnd; + + void Reset() + { + m_uiTimer = 0; + m_uiPlace = 0; + m_uiSay = 0; + bActionEnd = false; + } + + void UpdateAI(const uint32 uiDiff) + { + if (!bActionEnd && m_uiTimer <= uiDiff) + { + if (!m_uiPlace) + { + for (uint8 i = 0; i < 6; ++i) + { + if (m_creature->GetEntry() == NpcSnivelRustrocket[i][1]) + { + m_uiTimer = 1000; + m_uiPlace = NpcSnivelRustrocket[i][0]; + m_uiSay = 1; + break; + } + } + } + else + { + bool bSay = false; + for (uint8 i = 0; i < 9; ++i) + { + if (SayNpcSnivelRustrocket[i][0] == m_uiPlace && SayNpcSnivelRustrocket[i][1] == m_uiSay) + { + bSay = true; + m_uiTimer = 4000; + DoScriptText(SayNpcSnivelRustrocket[i][2], m_creature); + ++m_uiSay; + break; + } + } + if (!bSay) + { + bActionEnd = true; + m_creature->ForcedDespawn(3000); + } + } + } + else + m_uiTimer -= uiDiff; + } +}; + +CreatureAI* GetAI_npc_snivel_rustrocket(Creature* pCreature) +{ + return new npc_snivel_rustrocketAI(pCreature); +} + void AddSC_npcs_special() { Script* pNewScript; @@ -1415,4 +1508,9 @@ void AddSC_npcs_special() pNewScript->GetAI = &GetAI_npc_redemption_target; pNewScript->pEffectDummyNPC = &EffectDummyCreature_npc_redemption_target; pNewScript->RegisterSelf(); + + pNewScript = new Script; + pNewScript->Name = "npc_snivel_rustrocket"; + pNewScript->GetAI = &GetAI_npc_snivel_rustrocket; + pNewScript->RegisterSelf(); }