diff --git a/data/sql/db-world/base/promotion_rewards_Azerothcore_creature.sql b/data/sql/db-world/base/promotion_rewards_Azerothcore_creature.sql index af63702..b0da8e0 100644 --- a/data/sql/db-world/base/promotion_rewards_Azerothcore_creature.sql +++ b/data/sql/db-world/base/promotion_rewards_Azerothcore_creature.sql @@ -5,5 +5,10 @@ SET @GOSSIP:=62000; SET @MODELID1:=22234; DELETE FROM `creature_template` WHERE `entry`=@ENTRY; -INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES -(@ENTRY, 0, 0, 0, 0, 0, @MODELID1, 0, 0, 0, @NAME, @SUBNAME, NULL, @GOSSIP, 83, 83, 0, 35, 1, 1, 1, 0, 0, 20, 2, 0, 0, 0, 0, 0, 1, 1, 1, 768, 2048, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 'npc_promotion', 12340); +INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `speed_swim`, `speed_flight`, `detection_range`, `scale`, `rank`, `dmgschool`, `DamageModifier`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `spell_school_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES +(@ENTRY, 0, 0, 0, 0, 0, @NAME, @SUBNAME, NULL, @GOSSIP, 83, 83, 0, 35, 1, 1, 1, 0, 0, 20, 2, 0, 0, 0, 0, 0, 1, 1, 1, 768, 2048, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 'npc_promotion', 12340); + +-- NPC MODEL +DELETE FROM `creature_template_model` WHERE `CreatureID` = @ENTRY; +INSERT INTO `creature_template_model` (`CreatureID`, `Idx`, `CreatureDisplayID`, `DisplayScale`, `Probability`, `VerifiedBuild`) VALUES +(@ENTRY, 0, @MODELID1, 1, 1, 0); diff --git a/src/mod_promotion.cpp b/src/mod_promotion.cpp index b5adb08..55fecda 100644 --- a/src/mod_promotion.cpp +++ b/src/mod_promotion.cpp @@ -2,18 +2,18 @@ * This plugin can be used for common player customizations */ -#include "ScriptMgr.h" -#include "Player.h" -#include "Config.h" #include "Chat.h" +#include "Config.h" +#include "DatabaseEnv.h" #include "GossipDef.h" -#include "ScriptedCreature.h" -#include "ScriptedGossip.h" #include "Language.h" -#include "DatabaseEnv.h" -#include "WorldSession.h" #include "mod_promotion.h" +#include "Player.h" +#include "ScriptedCreature.h" +#include "ScriptedGossip.h" +#include "ScriptMgr.h" #include "World.h" +#include "WorldSession.h" static bool promotionEnable, mountEnable, bagEnable, equippedbags; static int promotionCount, moneyRewardConst, mountPromotion, bagReward; @@ -22,18 +22,16 @@ static int classConfArmor, LevelForPromotion; class announce_module : public PlayerScript { public: - announce_module() : PlayerScript("announce_module") { } + announce_module() : PlayerScript("announce_module", { + PLAYERHOOK_ON_LOGIN + }) { } - void OnLogin(Player* player) override + void OnPlayerLogin(Player* player) override { if (sConfigMgr->GetOption("announce_module.enableHelloWorld", true)) - { ChatHandler(player->GetSession()).SendSysMessage("Hello World from Promotion-Module! - By Asmadeuxx"); - } else - { ChatHandler(player->GetSession()).SendSysMessage("Hello World from Promotion-Module! - By Asmadeuxx"); - } } }; @@ -45,16 +43,12 @@ class npc_promotion : public CreatureScript bool OnGossipHello(Player* player, Creature* creature) override { if (player->getClass() == CLASS_DEATH_KNIGHT) - { return true; - } - if (player->getLevel() != 1) + if (player->GetLevel() != 1) { if (player && creature) - { SendGossipMenuFor(player, 68, creature); - } return true; } @@ -506,9 +500,7 @@ class npc_promotion : public CreatureScript creature->Whisper("You Got Your Promotion!", LANG_UNIVERSAL, player); if (mountEnable) - { player->learnSpell(sConfigMgr->GetOption("mountPromotion", 42777)); //Swift Spectral Tiger - } //Bags if (bagEnable) @@ -523,9 +515,7 @@ class npc_promotion : public CreatureScript player->EquipNewItem(slot, (sConfigMgr->GetOption("bagReward.Id", 14156)), true); } else - { player->AddItem((sConfigMgr->GetOption("bagReward.Id", 14156)), 4); - } } switch (action) @@ -577,9 +567,7 @@ class npc_promotion : public CreatureScript } } else - { SendGossipMenuFor(player, 80000, creature); - } return true; } @@ -588,7 +576,9 @@ class npc_promotion : public CreatureScript class mod_promotion_conf : public WorldScript { public: - mod_promotion_conf() : WorldScript("mod_promotion.conf") { } + mod_promotion_conf() : WorldScript("mod_promotion.conf", { + WORLDHOOK_ON_BEFORE_CONFIG_LOAD + }) { } void OnBeforeConfigLoad(bool reload) override {