diff options
author | maximius <none@none> | 2009-11-17 16:03:13 -0800 |
---|---|---|
committer | maximius <none@none> | 2009-11-17 16:03:13 -0800 |
commit | 670e6a69fa01a3529907b76822966edceba8795f (patch) | |
tree | eb837259400238ee4646d13d696809fa66a6e502 | |
parent | 009791d3281acc68342059afacb18d810442b844 (diff) |
*Proper handling for quests 6001 and 6002 (Body and Heart), from SD2 1415 and 1495. Closes #278
--HG--
branch : trunk
-rw-r--r-- | sql/FULL/world_scripts_full.sql | 1 | ||||
-rw-r--r-- | sql/updates/6246_world_scripts.sql | 2 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/world/npcs_special.cpp | 64 |
3 files changed, 55 insertions, 12 deletions
diff --git a/sql/FULL/world_scripts_full.sql b/sql/FULL/world_scripts_full.sql index 038951743c2..1300193bbd4 100644 --- a/sql/FULL/world_scripts_full.sql +++ b/sql/FULL/world_scripts_full.sql @@ -86,6 +86,7 @@ UPDATE `item_template` SET `ScriptName`='item_disgusting_jar' WHERE `entry` IN(4 /* NPC (usually creatures to be found in more than one specific zone) */ UPDATE `creature_template` SET `ScriptName`='npc_air_force_bots' WHERE `entry` IN (2614,2615,21974,21993,21996,21997,21999,22001,22002,22003,22063,22065,22066,22068,22069,22070,22071,22078,22079,22080,22086,22087,22088,22090,22124,22125,22126); +UPDATE `creature_template` SET `ScriptName`='npc_lunaclaw_spirit' WHERE `entry`=12144; UPDATE `creature_template` SET `ScriptName`='npc_chicken_cluck' WHERE `entry`=620; UPDATE `creature_template` SET `ScriptName`='npc_dancing_flames' WHERE `entry`=25305; UPDATE `creature_template` SET `ScriptName`='npc_garments_of_quests' WHERE `entry` IN (12429,12423,12427,12430,12428); diff --git a/sql/updates/6246_world_scripts.sql b/sql/updates/6246_world_scripts.sql new file mode 100644 index 00000000000..b082693be2b --- /dev/null +++ b/sql/updates/6246_world_scripts.sql @@ -0,0 +1,2 @@ + +UPDATE `creature_template` SET `ScriptName`='npc_lunaclaw_spirit' WHERE `entry`=12144; diff --git a/src/bindings/scripts/scripts/world/npcs_special.cpp b/src/bindings/scripts/scripts/world/npcs_special.cpp index 9396f30f214..26b943a3f65 100644 --- a/src/bindings/scripts/scripts/world/npcs_special.cpp +++ b/src/bindings/scripts/scripts/world/npcs_special.cpp @@ -24,17 +24,18 @@ EndScriptData /* ContentData npc_air_force_bots 80% support for misc (invisible) guard bots in areas where player allowed to fly. Summon guards after a preset time if tagged by spell +npc_lunaclaw_spirit 80% support for quests 6001/6002 (Body and Heart) npc_chicken_cluck 100% support for quest 3861 (Cluck!) npc_dancing_flames 100% midsummer event NPC npc_guardian 100% guardianAI used to prevent players from accessing off-limits areas. Not in use by SD2 -npc_garments_of_quests 80% NPC's related to all Garments of-quests 5621, 5624, 5625, 5648, 565 +npc_garments_of_quests 80% NPC's related to all Garments of-quests 5621, 5624, 5625, 5648, 565 npc_injured_patient 100% patients for triage-quests (6622 and 6624) npc_doctor 100% Gustaf Vanhowzen and Gregory Victor, quest 6622 and 6624 (Triage) npc_kingdom_of_dalaran_quests Misc NPC's gossip option related to quests 12791, 12794 and 12796 npc_mount_vendor 100% Regular mount vendors all over the world. Display gossip if player doesn't meet the requirements to buy -npc_rogue_trainer 80% Scripted trainers, so they are able to offer item 17126 for class quest 6681 +npc_rogue_trainer 80% Scripted trainers, so they are able to offer item 17126 for class quest 6681 npc_sayge 100% Darkmoon event fortune teller, buff player based on answers given -npc_snake_trap_serpents 80% AI for snakes that summoned by Snake Trap +npc_snake_trap_serpents 80% AI for snakes that summoned by Snake Trap EndContentData */ #include "precompiled.h" @@ -247,6 +248,40 @@ CreatureAI* GetAI_npc_air_force_bots(Creature* pCreature) return new npc_air_force_botsAI(pCreature); } +/*###### +## npc_lunaclaw_spirit +######*/ + +enum +{ + QUEST_BODY_HEART_A = 6001, + QUEST_BODY_HEART_H = 6002, + + TEXT_ID_DEFAULT = 4714, + TEXT_ID_PROGRESS = 4715 +}; + +#define GOSSIP_ITEM_GRANT "You have thought well, spirit. I ask you to grant me the strength of your body and the strength of your heart." + +bool GossipHello_npc_lunaclaw_spirit(Player *pPlayer, Creature *pCreature) +{ + if (pPlayer->GetQuestStatus(QUEST_BODY_HEART_A) == QUEST_STATUS_INCOMPLETE || pPlayer->GetQuestStatus(QUEST_BODY_HEART_H) == QUEST_STATUS_INCOMPLETE) + pPlayer->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GRANT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + + pPlayer->SEND_GOSSIP_MENU(TEXT_ID_DEFAULT, pCreature->GetGUID()); + return true; +} + +bool GossipSelect_npc_lunaclaw_spirit(Player* pPlayer, Creature* pCreature, uint32 uiSender, uint32 uiAction) +{ + if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + { + pPlayer->SEND_GOSSIP_MENU(TEXT_ID_PROGRESS, pCreature->GetGUID()); + pPlayer->AreaExploredOrEventHappens(pPlayer->GetTeam() == ALLIANCE ? QUEST_BODY_HEART_A : QUEST_BODY_HEART_H); + } + return true; +} + /*######## # npc_chicken_cluck #########*/ @@ -1584,10 +1619,10 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI { if (IsViper) //Viper { - if (rand() % 3 == 0) //33% chance to cast + if (urand(0,2) == 0) //33% chance to cast { uint32 spell; - if (rand() % 2 == 0) + if (urand(0,1) == 0) spell = SPELL_MIND_NUMBING_POISON; else spell = SPELL_CRIPPLING_POISON; @@ -1599,11 +1634,11 @@ struct TRINITY_DLL_DECL npc_snake_trap_serpentsAI : public ScriptedAI } else //Venomous Snake { - if (rand() % 10 < 8) //80% chance to cast + if (urand(0,9) < 8) //80% chance to cast DoCast(m_creature->getVictim(), SPELL_DEADLY_POISON); SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() %5)*100; } - } else SpellTimer-=diff; + } else SpellTimer -= diff; DoMeleeAttackIfReady(); } }; @@ -1632,20 +1667,19 @@ struct TRINITY_DLL_DECL mob_mojoAI : public ScriptedAI { victimGUID = 0; hearts = 15000; - Unit* own = m_creature->GetOwner(); - if (own) + if (Unit* own = m_creature->GetOwner()) m_creature->GetMotionMaster()->MoveFollow(own,0,0); } void Aggro(Unit *who){} void UpdateAI(const uint32 diff) { - if (m_creature->HasAura(20372,0)) + if (m_creature->HasAura(20372)) { - if (hearts<= diff) + if (hearts <= diff) { m_creature->RemoveAurasDueToSpell(20372); hearts = 15000; - }hearts-=diff; + } hearts -= diff; } } void ReceiveEmote(Player* pPlayer, uint32 emote) @@ -1906,6 +1940,12 @@ void AddSC_npcs_special() newscript->Name = "npc_air_force_bots"; newscript->GetAI = &GetAI_npc_air_force_bots; newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name = "npc_lunaclaw_spirit"; + newscript->pGossipHello = &GossipHello_npc_lunaclaw_spirit; + newscript->pGossipSelect = &GossipSelect_npc_lunaclaw_spirit; + newscript->RegisterSelf(); newscript = new Script; newscript->Name = "npc_chicken_cluck"; |