From 20eff9eb0340d7174bcac5449e1575a5d199b757 Mon Sep 17 00:00:00 2001 From: Ragelezz <69433539+Ragelezz@users.noreply.github.com> Date: Tue, 2 Nov 2021 18:18:56 +0200 Subject: [PATCH] fix(Core\Scripts):Venomhide Hatchling multiple fixes (#8792) --- .../rev_1635420472205770200.sql | 3 + src/server/scripts/World/npcs_special.cpp | 78 +++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 data/sql/updates/pending_db_world/rev_1635420472205770200.sql diff --git a/data/sql/updates/pending_db_world/rev_1635420472205770200.sql b/data/sql/updates/pending_db_world/rev_1635420472205770200.sql new file mode 100644 index 000000000..aa9cbaa4e --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1635420472205770200.sql @@ -0,0 +1,3 @@ +INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1635420472205770200'); + +UPDATE `creature_template` SET `ScriptName`='npc_venomhide_hatchling' WHERE `entry`=34320; diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 1e6af7ad5..858586dc9 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -2459,6 +2459,83 @@ public: } }; +enum VenomhideHatchlingMisc +{ + ITEM_VENOMHIDE_BABY_TOOTH = 47196, + + MODEL_BABY_RAPTOR = 29251, + MODEL_BABY_RAPTOR_REPTILE_EYES = 29809, + MODEL_ADOLESCENT_RAPTOR = 29103, + MODEL_FULL_RAPTOR = 5291, +}; + +enum VenomhideHatchlingTexts +{ + TALK_EMOTE_EAT = 0, +}; + +enum VenomhideHatchlingSpellEmotes +{ + SPELL_SILITHID_MEAT = 65258, + SPELL_SILITHID_EGG = 65265, + SPELL_FRESH_DINOSAUR_MEAT = 65200, +}; + +class npc_venomhide_hatchling : public CreatureScript +{ +public: + npc_venomhide_hatchling() : CreatureScript("npc_venomhide_hatchling") {} + + struct npc_venomhide_hatchlingAI : public ScriptedAI + { + npc_venomhide_hatchlingAI(Creature* creature) : ScriptedAI(creature) {} + + void IsSummonedBy(Unit* summoner) override + { + if (summoner->GetTypeId() != TYPEID_PLAYER) + { + return; + } + + if (summoner->ToPlayer()->GetItemCount(ITEM_VENOMHIDE_BABY_TOOTH) >= 6) + { + me->SetDisplayId(MODEL_BABY_RAPTOR_REPTILE_EYES); + } + if (summoner->ToPlayer()->GetItemCount(ITEM_VENOMHIDE_BABY_TOOTH) >= 11) + { + me->SetDisplayId(MODEL_ADOLESCENT_RAPTOR); + } + if (summoner->ToPlayer()->GetItemCount(ITEM_VENOMHIDE_BABY_TOOTH) >= 16) + { + me->SetDisplayId(MODEL_FULL_RAPTOR); + } + } + + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) override + { + if (spell->Id == SPELL_SILITHID_EGG || spell->Id == SPELL_SILITHID_MEAT || spell->Id == SPELL_FRESH_DINOSAUR_MEAT) + { + Talk(TALK_EMOTE_EAT); + } + } + }; + + bool OnGossipHello(Player* player, Creature* creature) override + { + if (creature->GetOwnerGUID() && creature->GetOwnerGUID() == player->GetGUID()) + { + return false; + } + + return true; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_venomhide_hatchlingAI(creature); + } +}; + void AddSC_npcs_special() { // Ours @@ -2466,6 +2543,7 @@ void AddSC_npcs_special() new npc_riggle_bassbait(); new npc_target_dummy(); new npc_training_dummy(); + new npc_venomhide_hatchling(); // Theirs new npc_air_force_bots();