{"action":"created","issue":{"url":"https://api.github.com/repos/TrinityCore/TrinityCore/issues/22793","repository_url":"https://api.github.com/repos/TrinityCore/TrinityCore","labels_url":"https://api.github.com/repos/TrinityCore/TrinityCore/issues/22793/labels{/name}","comments_url":"https://api.github.com/repos/TrinityCore/TrinityCore/issues/22793/comments","events_url":"https://api.github.com/repos/TrinityCore/TrinityCore/issues/22793/events","html_url":"https://github.com/TrinityCore/TrinityCore/pull/22793","id":381013667,"node_id":"MDExOlB1bGxSZXF1ZXN0MjMxMDc4NzEy","number":22793,"title":"scrip/zone_durotar","user":{"login":"Padrino0622","id":42727238,"node_id":"MDQ6VXNlcjQyNzI3MjM4","avatar_url":"https://avatars2.githubusercontent.com/u/42727238?v=4","gravatar_id":"","url":"https://api.github.com/users/Padrino0622","html_url":"https://github.com/Padrino0622","followers_url":"https://api.github.com/users/Padrino0622/followers","following_url":"https://api.github.com/users/Padrino0622/following{/other_user}","gists_url":"https://api.github.com/users/Padrino0622/gists{/gist_id}","starred_url":"https://api.github.com/users/Padrino0622/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Padrino0622/subscriptions","organizations_url":"https://api.github.com/users/Padrino0622/orgs","repos_url":"https://api.github.com/users/Padrino0622/repos","events_url":"https://api.github.com/users/Padrino0622/events{/privacy}","received_events_url":"https://api.github.com/users/Padrino0622/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-15T06:06:45Z","updated_at":"2018-11-15T06:18:22Z","closed_at":"2018-11-15T06:18:22Z","author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/TrinityCore/TrinityCore/pulls/22793","html_url":"https://github.com/TrinityCore/TrinityCore/pull/22793","diff_url":"https://github.com/TrinityCore/TrinityCore/pull/22793.diff","patch_url":"https://github.com/TrinityCore/TrinityCore/pull/22793.patch"},"body":"<!--- (**********************************)\r\n      (** Fill in the following fields **)\r\n      (**********************************) --->\r\n\r\n**Changes proposed:**\r\n/*\r\n * Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>\r\n *\r\n * This program is free software; you can redistribute it and/or modify it\r\n * under the terms of the GNU General Public License as published by the\r\n * Free Software Foundation; either version 2 of the License, or (at your\r\n * option) any later version.\r\n *\r\n * This program is distributed in the hope that it will be useful, but WITHOUT\r\n * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r\n * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r\n * more details.\r\n *\r\n * You should have received a copy of the GNU General Public License along\r\n * with this program. If not, see <http://www.gnu.org/licenses/>.\r\n */\r\n\r\n#include \"ScriptMgr.h\"\r\n#include \"CreatureAIImpl.h\"\r\n#include \"GameObject.h\"\r\n#include \"MotionMaster.h\"\r\n#include \"Player.h\"\r\n#include \"ScriptedCreature.h\"\r\n#include \"SpellInfo.h\"\r\n#include \"SpellScript.h\"\r\n\r\n/*######\r\n## Quest 25134: Lazy Peons\r\n## npc_lazy_peon\r\n######*/\r\n\r\nenum LazyPeonYells\r\n{\r\n    SAY_SPELL_HIT                                 = 0\r\n};\r\n\r\nenum LazyPeon\r\n{\r\n    QUEST_LAZY_PEONS    = 25134,\r\n    GO_LUMBERPILE       = 175784,\r\n    SPELL_BUFF_SLEEP    = 17743,\r\n    SPELL_AWAKEN_PEON   = 19938\r\n};\r\n\r\nclass npc_lazy_peon : public CreatureScript\r\n{\r\npublic:\r\n    npc_lazy_peon() : CreatureScript(\"npc_lazy_peon\") { }\r\n\r\n    CreatureAI* GetAI(Creature* creature) const override\r\n    {\r\n        return new npc_lazy_peonAI(creature);\r\n    }\r\n\r\n    struct npc_lazy_peonAI : public ScriptedAI\r\n    {\r\n        npc_lazy_peonAI(Creature* creature) : ScriptedAI(creature)\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n        void Initialize()\r\n        {\r\n            RebuffTimer = 0;\r\n            work = false;\r\n        }\r\n\r\n        uint32 RebuffTimer;\r\n        bool work;\r\n\r\n        void Reset() override\r\n        {\r\n            Initialize();\r\n        }\r\n\r\n        void MovementInform(uint32 /*type*/, uint32 id) override\r\n        {\r\n            if (id == 1)\r\n                work = true;\r\n        }\r\n\r\n        void SpellHit(Unit* caster, const SpellInfo* spell) override\r\n        {\r\n            if (spell->Id != SPELL_AWAKEN_PEON)\r\n                return;\r\n\r\n            Player* player = caster->ToPlayer();\r\n            if (player && player->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE)\r\n            {\r\n                player->KilledMonsterCredit(me->GetEntry(), me->GetGUID());\r\n                Talk(SAY_SPELL_HIT, caster);\r\n                me->RemoveAllAuras();\r\n                if (GameObject* Lumberpile = me->FindNearestGameObject(GO_LUMBERPILE, 20))\r\n                    me->GetMotionMaster()->MovePoint(1, Lumberpile->GetPositionX()-1, Lumberpile->GetPositionY(), Lumberpile->GetPositionZ());\r\n            }\r\n        }\r\n\r\n        void UpdateAI(uint32 diff) override\r\n        {\r\n            if (work == true)\r\n                me->HandleEmoteCommand(EMOTE_ONESHOT_WORK_CHOPWOOD);\r\n            if (RebuffTimer <= diff)\r\n            {\r\n                DoCast(me, SPELL_BUFF_SLEEP);\r\n                RebuffTimer = 300000; //Rebuff agian in 5 minutes\r\n            }\r\n            else\r\n                RebuffTimer -= diff;\r\n            if (!UpdateVictim())\r\n                return;\r\n            DoMeleeAttackIfReady();\r\n        }\r\n    };\r\n};\r\n\r\nenum VoodooSpells\r\n{\r\n    SPELL_BREW      = 16712, // Special Brew\r\n    SPELL_GHOSTLY   = 16713, // Ghostly\r\n    SPELL_HEX1      = 16707, // Hex\r\n    SPELL_HEX2      = 16708, // Hex\r\n    SPELL_HEX3      = 16709, // Hex\r\n    SPELL_GROW      = 16711, // Grow\r\n    SPELL_LAUNCH    = 16716, // Launch (Whee!)\r\n};\r\n\r\n// 17009\r\nclass spell_voodoo : public SpellScriptLoader\r\n{\r\n    public:\r\n        spell_voodoo() : SpellScriptLoader(\"spell_voodoo\") { }\r\n\r\n        class spell_voodoo_SpellScript : public SpellScript\r\n        {\r\n            PrepareSpellScript(spell_voodoo_SpellScript);\r\n\r\n            bool Validate(SpellInfo const* /*spellInfo*/) override\r\n            {\r\n                return ValidateSpellInfo({ SPELL_BREW, SPELL_GHOSTLY, SPELL_HEX1, SPELL_HEX2, SPELL_HEX3, SPELL_GROW, SPELL_LAUNCH });\r\n            }\r\n\r\n            void HandleDummy(SpellEffIndex /*effIndex*/)\r\n            {\r\n                uint32 spellid = RAND(SPELL_BREW, SPELL_GHOSTLY, RAND(SPELL_HEX1, SPELL_HEX2, SPELL_HEX3), SPELL_GROW, SPELL_LAUNCH);\r\n                if (Unit* target = GetHitUnit())\r\n                    GetCaster()->CastSpell(target, spellid, false);\r\n            }\r\n\r\n            void Register() override\r\n            {\r\n                OnEffectHitTarget += SpellEffectFn(spell_voodoo_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);\r\n            }\r\n        };\r\n\r\n        SpellScript* GetSpellScript() const override\r\n        {\r\n            return new spell_voodoo_SpellScript();\r\n        }\r\n};\r\n\r\nvoid AddSC_durotar()\r\n{\r\n    new npc_lazy_peon();\r\n    new spell_voodoo();\r\n}\r\n-  \r\n-  \r\n-  \r\n\r\n**Target branch(es):** 3.3.5/master\r\n\r\n- [ ] 3.3.5\r\n- [ ] master\r\n\r\n**Issues addressed:** Closes #  (insert issue tracker number)\r\n\r\n\r\n**Tests performed:** (Does it build, tested in-game, etc.)\r\n\r\n\r\n**Known issues and TODO list:** (add/remove lines as needed)\r\n\r\n- [ ] \r\n- [ ] \r\n\r\n\r\n<!--- Notes\r\n- Enable the setting \"[√] Allow edits from maintainers.\" when creating your pull request.\r\n- If this PR only contains SQL files, open a new issue instead and post or link the SQL in the issue.\r\n- When adding new SQL files, name them 9999_99_99_99_db_name.sql to reduce the chance of possible merge conflicts.\r\n--->\r\n"},"comment":{"url":"https://api.github.com/repos/TrinityCore/TrinityCore/issues/comments/438930702","html_url":"https://github.com/TrinityCore/TrinityCore/pull/22793#issuecomment-438930702","issue_url":"https://api.github.com/repos/TrinityCore/TrinityCore/issues/22793","id":438930702,"node_id":"MDEyOklzc3VlQ29tbWVudDQzODkzMDcwMg==","user":{"login":"Padrino0622","id":42727238,"node_id":"MDQ6VXNlcjQyNzI3MjM4","avatar_url":"https://avatars2.githubusercontent.com/u/42727238?v=4","gravatar_id":"","url":"https://api.github.com/users/Padrino0622","html_url":"https://github.com/Padrino0622","followers_url":"https://api.github.com/users/Padrino0622/followers","following_url":"https://api.github.com/users/Padrino0622/following{/other_user}","gists_url":"https://api.github.com/users/Padrino0622/gists{/gist_id}","starred_url":"https://api.github.com/users/Padrino0622/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Padrino0622/subscriptions","organizations_url":"https://api.github.com/users/Padrino0622/orgs","repos_url":"https://api.github.com/users/Padrino0622/repos","events_url":"https://api.github.com/users/Padrino0622/events{/privacy}","received_events_url":"https://api.github.com/users/Padrino0622/received_events","type":"User","site_admin":false},"created_at":"2018-11-15T06:18:22Z","updated_at":"2018-11-15T06:18:22Z","author_association":"NONE","body":"> **Changes proposed:**\r\n> /*\r\n> \r\n> * Copyright (C) 2008-2018 TrinityCore https://www.trinitycore.org/\r\n> * This program is free software; you can redistribute it and/or modify it\r\n> * under the terms of the GNU General Public License as published by the\r\n> * Free Software Foundation; either version 2 of the License, or (at your\r\n> * option) any later version.\r\n> * This program is distributed in the hope that it will be useful, but WITHOUT\r\n> * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\r\n> * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for\r\n> * more details.\r\n> * You should have received a copy of the GNU General Public License along\r\n> * with this program. If not, see http://www.gnu.org/licenses/.\r\n>   */\r\n> \r\n> #include \"ScriptMgr.h\"\r\n> #include \"CreatureAIImpl.h\"\r\n> #include \"GameObject.h\"\r\n> #include \"MotionMaster.h\"\r\n> #include \"Player.h\"\r\n> #include \"ScriptedCreature.h\"\r\n> #include \"SpellInfo.h\"\r\n> #include \"SpellScript.h\"\r\n> \r\n> /*######\r\n> \r\n> ## Quest 25134: Lazy Peons\r\n> ## npc_lazy_peon\r\n> ######*/\r\n> \r\n> enum LazyPeonYells\r\n> {\r\n> SAY_SPELL_HIT = 0\r\n> };\r\n> \r\n> enum LazyPeon\r\n> {\r\n> QUEST_LAZY_PEONS = 25134,\r\n> GO_LUMBERPILE = 175784,\r\n> SPELL_BUFF_SLEEP = 17743,\r\n> SPELL_AWAKEN_PEON = 19938\r\n> };\r\n> \r\n> class npc_lazy_peon : public CreatureScript\r\n> {\r\n> public:\r\n> npc_lazy_peon() : CreatureScript(\"npc_lazy_peon\") { }\r\n> \r\n> ```\r\n> CreatureAI* GetAI(Creature* creature) const override\r\n> {\r\n>     return new npc_lazy_peonAI(creature);\r\n> }\r\n> \r\n> struct npc_lazy_peonAI : public ScriptedAI\r\n> {\r\n>     npc_lazy_peonAI(Creature* creature) : ScriptedAI(creature)\r\n>     {\r\n>         Initialize();\r\n>     }\r\n> \r\n>     void Initialize()\r\n>     {\r\n>         RebuffTimer = 0;\r\n>         work = false;\r\n>     }\r\n> \r\n>     uint32 RebuffTimer;\r\n>     bool work;\r\n> \r\n>     void Reset() override\r\n>     {\r\n>         Initialize();\r\n>     }\r\n> \r\n>     void MovementInform(uint32 /*type*/, uint32 id) override\r\n>     {\r\n>         if (id == 1)\r\n>             work = true;\r\n>     }\r\n> \r\n>     void SpellHit(Unit* caster, const SpellInfo* spell) override\r\n>     {\r\n>         if (spell->Id != SPELL_AWAKEN_PEON)\r\n>             return;\r\n> \r\n>         Player* player = caster->ToPlayer();\r\n>         if (player && player->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE)\r\n>         {\r\n>             player->KilledMonsterCredit(me->GetEntry(), me->GetGUID());\r\n>             Talk(SAY_SPELL_HIT, caster);\r\n>             me->RemoveAllAuras();\r\n>             if (GameObject* Lumberpile = me->FindNearestGameObject(GO_LUMBERPILE, 20))\r\n>                 me->GetMotionMaster()->MovePoint(1, Lumberpile->GetPositionX()-1, Lumberpile->GetPositionY(), Lumberpile->GetPositionZ());\r\n>         }\r\n>     }\r\n> \r\n>     void UpdateAI(uint32 diff) override\r\n>     {\r\n>         if (work == true)\r\n>             me->HandleEmoteCommand(EMOTE_ONESHOT_WORK_CHOPWOOD);\r\n>         if (RebuffTimer <= diff)\r\n>         {\r\n>             DoCast(me, SPELL_BUFF_SLEEP);\r\n>             RebuffTimer = 300000; //Rebuff agian in 5 minutes\r\n>         }\r\n>         else\r\n>             RebuffTimer -= diff;\r\n>         if (!UpdateVictim())\r\n>             return;\r\n>         DoMeleeAttackIfReady();\r\n>     }\r\n> };\r\n> ```\r\n> };\r\n> \r\n> enum VoodooSpells\r\n> {\r\n> SPELL_BREW = 16712, // Special Brew\r\n> SPELL_GHOSTLY = 16713, // Ghostly\r\n> SPELL_HEX1 = 16707, // Hex\r\n> SPELL_HEX2 = 16708, // Hex\r\n> SPELL_HEX3 = 16709, // Hex\r\n> SPELL_GROW = 16711, // Grow\r\n> SPELL_LAUNCH = 16716, // Launch (Whee!)\r\n> };\r\n> \r\n> // 17009\r\n> class spell_voodoo : public SpellScriptLoader\r\n> {\r\n> public:\r\n> spell_voodoo() : SpellScriptLoader(\"spell_voodoo\") { }\r\n> \r\n> ```\r\n>     class spell_voodoo_SpellScript : public SpellScript\r\n>     {\r\n>         PrepareSpellScript(spell_voodoo_SpellScript);\r\n> \r\n>         bool Validate(SpellInfo const* /*spellInfo*/) override\r\n>         {\r\n>             return ValidateSpellInfo({ SPELL_BREW, SPELL_GHOSTLY, SPELL_HEX1, SPELL_HEX2, SPELL_HEX3, SPELL_GROW, SPELL_LAUNCH });\r\n>         }\r\n> \r\n>         void HandleDummy(SpellEffIndex /*effIndex*/)\r\n>         {\r\n>             uint32 spellid = RAND(SPELL_BREW, SPELL_GHOSTLY, RAND(SPELL_HEX1, SPELL_HEX2, SPELL_HEX3), SPELL_GROW, SPELL_LAUNCH);\r\n>             if (Unit* target = GetHitUnit())\r\n>                 GetCaster()->CastSpell(target, spellid, false);\r\n>         }\r\n> \r\n>         void Register() override\r\n>         {\r\n>             OnEffectHitTarget += SpellEffectFn(spell_voodoo_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);\r\n>         }\r\n>     };\r\n> \r\n>     SpellScript* GetSpellScript() const override\r\n>     {\r\n>         return new spell_voodoo_SpellScript();\r\n>     }\r\n> ```\r\n> };\r\n> \r\n> ## void AddSC_durotar()\r\n> {\r\n> new npc_lazy_peon();\r\n> new spell_voodoo();\r\n> }\r\n> \r\n> **Target branch(es):** 3.3.5/master\r\n> \r\n> * [ ]  3.3.5\r\n> * [ ]  master\r\n> \r\n> **Issues addressed:** Closes # (insert issue tracker number)\r\n> \r\n> **Tests performed:** (Does it build, tested in-game, etc.)\r\n> \r\n> **Known issues and TODO list:** (add/remove lines as needed)\r\n> \r\n> * [ ]\r\n> * [ ]\r\n\r\n"}}
{"actor":{"display_login":"Padrino0622"}}