Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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);
40 changes: 15 additions & 25 deletions src/mod_promotion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<bool>("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");
}
}
};

Expand All @@ -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;
}

Expand Down Expand Up @@ -506,9 +500,7 @@ class npc_promotion : public CreatureScript
creature->Whisper("You Got Your Promotion!", LANG_UNIVERSAL, player);

if (mountEnable)
{
player->learnSpell(sConfigMgr->GetOption<uint32>("mountPromotion", 42777)); //Swift Spectral Tiger
}

//Bags
if (bagEnable)
Expand All @@ -523,9 +515,7 @@ class npc_promotion : public CreatureScript
player->EquipNewItem(slot, (sConfigMgr->GetOption<uint32>("bagReward.Id", 14156)), true);
}
else
{
player->AddItem((sConfigMgr->GetOption<uint32>("bagReward.Id", 14156)), 4);
}
}

switch (action)
Expand Down Expand Up @@ -577,9 +567,7 @@ class npc_promotion : public CreatureScript
}
}
else
{
SendGossipMenuFor(player, 80000, creature);
}

return true;
}
Expand All @@ -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
{
Expand Down