Skip to content
Open
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
8 changes: 8 additions & 0 deletions conf/npc_enchanter.conf.dist
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
# -------------------------------------------------------------------------------------
Enchanter.Enable = 1

# -------------------------------------------------------------------------------------
# Enable special enchantments such as 100 AP & 36 Crit for Leg
# that is not available for players normaly.
# Enable : 1
# Disable: 0
# -------------------------------------------------------------------------------------
Enchanter.EnableSpecialEnchantments = 0

# -------------------------------------------------------------------------------------
# Announce the module when the player logs in?
# Enable : 1
Expand Down
57 changes: 31 additions & 26 deletions src/npc_enchanter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ enum Enchants

uint32 roll;
bool EnchanterEnableModule;
bool EnchanterEnableSpecialEnchantments;
bool EnchanterAnnounceModule;
uint32 EnchanterNumPhrases;
uint32 EnchanterMessageTimer;
Expand All @@ -203,12 +204,14 @@ uint32 EnchanterEmoteCommand;
class EnchanterConfig : public WorldScript
{
public:
EnchanterConfig() : WorldScript("EnchanterConfig_conf") { }
EnchanterConfig() : WorldScript("EnchanterConfig_conf") {}

void OnBeforeConfigLoad(bool reload) override
{
if (!reload) {
if (!reload)
{
EnchanterEnableModule = sConfigMgr->GetOption<bool>("Enchanter.Enable", 1);
EnchanterEnableSpecialEnchantments = sConfigMgr->GetOption<bool>("Enchanter.EnableSpecialEnchantments", 0);
EnchanterAnnounceModule = sConfigMgr->GetOption<bool>("Enchanter.Announce", 1);
EnchanterNumPhrases = sConfigMgr->GetOption<uint32>("Enchanter.NumPhrases", 3);
EnchanterMessageTimer = sConfigMgr->GetOption<uint32>("Enchanter.MessageTimer", 60000);
Expand All @@ -231,10 +234,9 @@ class EnchanterAnnounce : public PlayerScript
{

public:

EnchanterAnnounce() : PlayerScript("EnchanterAnnounce") {}

void OnLogin(Player* player)
void OnLogin(Player *player)
{
// Announce Module
if (EnchanterAnnounceModule)
Expand All @@ -248,8 +250,7 @@ class npc_enchantment : public CreatureScript
{

public:

npc_enchantment() : CreatureScript("npc_enchantment") { }
npc_enchantment() : CreatureScript("npc_enchantment") {}

// Pick Phrase
static std::string PickPhrase()
Expand All @@ -270,7 +271,7 @@ class npc_enchantment : public CreatureScript
return randMsg.c_str();
}

bool OnGossipHello(Player* player, Creature* creature)
bool OnGossipHello(Player *player, Creature *creature)
{

if (!EnchanterEnableModule)
Expand Down Expand Up @@ -302,14 +303,14 @@ class npc_enchantment : public CreatureScript
return true;
}

bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action)
bool OnGossipSelect(Player *player, Creature *creature, uint32 /*sender*/, uint32 action)
{
if (!EnchanterEnableModule)
{
return false;
}
Item * item;

Item *item;
player->PlayerTalkClass->ClearMenus();

switch (action)
Expand Down Expand Up @@ -388,7 +389,6 @@ class npc_enchantment : public CreatureScript
{
creature->Whisper("This enchant requires a shield to be equipped.", LANG_UNIVERSAL, player);
player->PlayerTalkClass->SendGossipMenu(100004, creature->GetGUID());

}
player->PlayerTalkClass->SendGossipMenu(100004, creature->GetGUID());
return true;
Expand Down Expand Up @@ -455,7 +455,7 @@ class npc_enchantment : public CreatureScript
return true;
break;

case 7: //Enchant chest
case 7: // Enchant chest
AddGossipItemFor(player, 1, "+10 All Stats", GOSSIP_SENDER_MAIN, 158);
AddGossipItemFor(player, 1, "225 Health", GOSSIP_SENDER_MAIN, 159);
AddGossipItemFor(player, 1, "10 Mp5", GOSSIP_SENDER_MAIN, 160);
Expand All @@ -466,7 +466,7 @@ class npc_enchantment : public CreatureScript
return true;
break;

case 8: //Enchant Bracers
case 8: // Enchant Bracers
AddGossipItemFor(player, 1, "40 Stamina", GOSSIP_SENDER_MAIN, 163);
AddGossipItemFor(player, 1, "30 Spell Power", GOSSIP_SENDER_MAIN, 164);
AddGossipItemFor(player, 1, "50 Attack Power", GOSSIP_SENDER_MAIN, 165);
Expand All @@ -490,8 +490,8 @@ class npc_enchantment : public CreatureScript
return true;
break;

case 9: //Enchant Gloves
if (player->HasSkill(SKILL_ENGINEERING) && player->GetSkillValue(SKILL_ENGINEERING) == 400)
case 9: // Enchant Gloves
if (player->HasSkill(SKILL_ENGINEERING) && player->GetSkillValue(SKILL_ENGINEERING) >= 400)
{
AddGossipItemFor(player, 1, "Hyperspeed Accelerators", GOSSIP_SENDER_MAIN, 200);
}
Expand All @@ -506,20 +506,23 @@ class npc_enchantment : public CreatureScript
return true;
break;

case 10: //Enchant legs
case 10: // Enchant legs
AddGossipItemFor(player, 1, "40 Resilience + 28 Stamina", GOSSIP_SENDER_MAIN, 184);
AddGossipItemFor(player, 1, "55 Stamina + 22 Agility", GOSSIP_SENDER_MAIN, 185);
AddGossipItemFor(player, 1, "75 Attack Power + 22 Critical", GOSSIP_SENDER_MAIN, 186);
AddGossipItemFor(player, 1, "50 Spell Power + 22 Spirit", GOSSIP_SENDER_MAIN, 187);
AddGossipItemFor(player, 1, "50 Spell Power + 30 Stamina", GOSSIP_SENDER_MAIN, 188);
AddGossipItemFor(player, 1, "72 Stamina + 35 Agility", GOSSIP_SENDER_MAIN, 189);
AddGossipItemFor(player, 1, "100 Attack Power + 36 Critical", GOSSIP_SENDER_MAIN, 190);
if (EnchanterEnableSpecialEnchantments)
{
AddGossipItemFor(player, 1, "100 Attack Power + 36 Critical", GOSSIP_SENDER_MAIN, 190);
}
AddGossipItemFor(player, GOSSIP_ICON_TALK, "Back", GOSSIP_SENDER_MAIN, 300);
player->PlayerTalkClass->SendGossipMenu(100011, creature->GetGUID());
return true;
break;

case 11: //Enchant Boots
case 11: // Enchant Boots
AddGossipItemFor(player, 1, "32 Attack Power", GOSSIP_SENDER_MAIN, 191);
AddGossipItemFor(player, 1, "15 Stamina + Minor Speed Increase", GOSSIP_SENDER_MAIN, 192);
AddGossipItemFor(player, 1, "16 Agility", GOSSIP_SENDER_MAIN, 193);
Expand All @@ -538,7 +541,7 @@ class npc_enchantment : public CreatureScript
return true;
break;

case 12: //Enchant rings
case 12: // Enchant rings
AddGossipItemFor(player, 1, "40 Attack Power", GOSSIP_SENDER_MAIN, 202);
AddGossipItemFor(player, 1, "23 Spell Power", GOSSIP_SENDER_MAIN, 203);
AddGossipItemFor(player, 1, "30 Stamina", GOSSIP_SENDER_MAIN, 204);
Expand Down Expand Up @@ -581,7 +584,6 @@ class npc_enchantment : public CreatureScript
{
creature->Whisper("This enchant requires a weapon to be equipped in offhand.", LANG_UNIVERSAL, player);
player->PlayerTalkClass->SendGossipMenu(100004, creature->GetGUID());

}
player->PlayerTalkClass->SendGossipMenu(100004, creature->GetGUID());
return true;
Expand Down Expand Up @@ -1069,7 +1071,7 @@ class npc_enchantment : public CreatureScript
case 219:
Enchant(player, creature, player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND), ENCHANT_WEP_EXECUTIONER);
break;

case 300:
{
AddGossipItemFor(player, 1, "|TInterface/ICONS/Inv_mace_116:24:24:-18|t[Enchant Main Weapon]", GOSSIP_SENDER_MAIN, 1);
Expand Down Expand Up @@ -1101,7 +1103,7 @@ class npc_enchantment : public CreatureScript
return true;
}

void Enchant(Player* player, Creature* creature, Item* item, uint32 enchantid)
void Enchant(Player *player, Creature *creature, Item *item, uint32 enchantid)
{
if (!item)
{
Expand All @@ -1113,7 +1115,7 @@ class npc_enchantment : public CreatureScript

if (!enchantid)
{
ChatHandler(player->GetSession()).SendNotification("Something went wrong in the code. It has been logged for developers and will be looked into, sorry for the inconvenience.");
ChatHandler(player->GetSession()).SendNotification("Something went wrong in the code. It has been logged for developers and will be looked into, sorry for the inconvenience.");
player->PlayerTalkClass->SendCloseGossip();
creature->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH);
return;
Expand Down Expand Up @@ -1148,7 +1150,7 @@ class npc_enchantment : public CreatureScript
// Passive Emotes
struct NPC_PassiveAI : public ScriptedAI
{
NPC_PassiveAI(Creature * creature) : ScriptedAI(creature) { }
NPC_PassiveAI(Creature *creature) : ScriptedAI(creature) {}

uint32 MessageTimer = 0;

Expand Down Expand Up @@ -1189,13 +1191,16 @@ class npc_enchantment : public CreatureScript

MessageTimer = urand(EnchanterMessageTimer, 300000);
}
else { MessageTimer -= diff; }
else
{
MessageTimer -= diff;
}
}
}
};

// CREATURE AI
CreatureAI * GetAI(Creature * creature) const
CreatureAI *GetAI(Creature *creature) const
{
return new NPC_PassiveAI(creature);
}
Expand Down