PDA

View Full Version : [C++] Enchantment NPC



Vision
12-01-10, 10:08 PM
Enchant Gossip NPC!
This is my second C++ script, I've been learning for about a week now so the script probably isn't as efficient as it could be.

Updates:
~ Added 28 spellpower to gloves.
~ Any Enchant to any item with the code box should now work for everyone.
~ Message to players telling them what item they've enchanted with what enchant.
~ Small new feature with any enchant on any item:
- You can now type 'all' into the codebox instead of the equipment slot you want enchanted, and it will enchant all you currently equipped gear with the enchant you've picked.

This script allows players to talk to an NPC through a gossip menu, and choose an enchant to be applied to the appropriate piece of currently equipped gear.

If your server is blizzlike, you can disable the use of Profession Specific Enchants/Unreleased Leg Armors. And If your handy with C++, you could make it a donation feature.

Weapon Menus populated with enchants according to the players current weapons.

Proper Npc text for each gossip menu.

The day has finally arrived for all the custom servers. This Enchant NPC will apply enchants to custom gear!!!

Screenshots:

Any Enchant on Any Item[Enchant 2H Weapon - Massacre] on a necklace.
http://img114.imageshack.us/img114/2917/anyenchantonanyitem.jpg


Unreleased Leg armor[100 ap, 36 crit][stam/agi equiv]
http://img200.imageshack.us/img200/1998/customlegarmor.jpg


Profession Specific Enchants[Masters inscription of the axe]
http://img395.imageshack.us/img395/2416/profspecificenchants.jpg


Main Menu with all options allowed
http://img203.imageshack.us/img203/435/mainmenud.jpg


Sub menu for boots
http://img94.imageshack.us/img94/6339/submenu.jpg

Heres the actual script: C++ pastebin - collaborative debugging tool (http://pastebin.com/f4b747857). (Updated 12/27/09)

also this is the pastebin for the enchantId array. It has all the index numbers of each enchant if your interested in editing it. pastebin - collaborative debugging tool (http://pastebin.com/f56015b65)

npc_text SQL;


INSERT INTO `npc_text` VALUES ('4040', '100', 'What Helmet Enchant would you like to have applied to your currently equipped Helm?', 'What Helmet Enchant would you like to have applied to your currently equipped Helm?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4041', '100', 'What Shoulder Enchant would you like to have applied to your currently equipped Shoulders?', 'What Shoulder Enchant would you like to have applied to your currently equipped Shoulders?', '0', '0', '0', '1', '0', '1', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4042', '100', 'What Cloak Enchant would you like to have applied to your currently equipped Cloak?', 'What Cloak Enchant would you like to have applied to your currently equipped Cloak?', '0', '0', '0', '1', '0', '18', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4043', '100', 'What Chest Enchant would you like to have applied to your currently equipped Chest?', 'What Chest Enchant would you like to have applied to your currently equipped Chest?', '0', '0', '0', '1', '0', '1', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4044', '100', 'What Bracer Enchant would you like to have applied to your currently equipped Bracers?', 'What Bracer Enchant would you like to have applied to your currently equipped Bracers?', '0', '0', '0', '1', '0', '1', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4045', '100', 'What Glove Enchant would you like to have applied to your currently equipped Gloves?', 'What Glove Enchant would you like to have applied to your currently equipped Gloves?', '0', '0', '0', '1', '0', '1', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4046', '100', 'What Leg Enchant would you like to have applied to your currently equipped Legguards?', 'What Leg Enchant would you like to have applied to your currently equipped Legguards?', '0', '0', '0', '1', '0', '1', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4047', '100', 'What Boot Enchant would you like to have applied to your currently equipped Boots?', 'What Boot Enchant would you like to have applied to your currently equipped Boots?', '0', '0', '0', '1', '0', '1', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4048', '100', 'What Shield Enchant would you like to have applied to your currently equipped Shield?', 'What Shield Enchant would you like to have applied to your currently equipped Shield?', '0', '0', '0', '1', '0', '1', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4049', '100', 'What One Hand Weapon Enchant would you like to have applied to your currently equipped...?', 'What One Hand Weapon Enchant would you like to have applied to your currently equipped...?', '0', '0', '0', '1', '0', '1', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4050', '100', 'What One Handed Weapon Enchant would you like to have applied to your currently equipped Offhand?', 'What One Handed Weapon Enchant would you like to have applied to your currently equipped Offhand?', '0', '0', '0', '1', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4051', '100', 'What One Handed Weapon Enchant would you like to have applied to your currently equipped Main Hand?', 'What One Handed Weapon Enchant would you like to have applied to your currently equipped Main Hand?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4052', '100', 'What Two handed Weapon Enchant would you like to have applied to your currently equipped Two handed weapon?', 'What Two handed Weapon Enchant would you like to have applied to your currently equipped Two handed weapon?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4053', '100', 'What Two handed Enchant would you like to have applied to your currently equipped...?', 'What Two handed Enchant would you like to have applied to your currently equipped...?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4054', '100', 'What Two handed Weapon Enchant would you like to have applied to your currently equipped 2h Offhand?', 'What Two handed Weapon Enchant would you like to have applied to your currently equipped 2h Offhand?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4055', '100', 'What Two handed Weapon Enchant would you like to have applied to your currently equipped 2h Mainhand?', 'What Two handed Weapon Enchant would you like to have applied to your currently equipped 2h Mainhand?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4056', '100', 'Hello $n, I can enchant any item you have equipped on your person. Where would you like to start?', 'Hello $n, I can enchant any item you have equipped on your person. Where would you like to start?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4057', '100', 'What Ring Enchant would you like to have applied to your currently equipped first slot ring?', 'What Ring Enchant would you like to have applied to your currently equipped first slot ring?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4058', '100', 'What Fur Lining would you like to have applied to your currently equipped bracers?', 'What Fur Lining would you like to have applied to your currently equipped bracers?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4059', '100', 'What Cloak Embroidery would you like to have applied to your currently equipped Cloak?', 'What Cloak Embroidery would you like to have applied to your currently equipped Cloak?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4060', '100', 'What Shoulder Inscription would you like to have applied to your currently equipped Shoulders?', 'What Shoulder Inscription would you like to have applied to your currently equipped Shoulders?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4061', '100', 'What Engineering gadget would you like to have applied to your currently equipped item relative to the enchant?', 'What Engineering gadget would you like to have applied to your currently equipped item relative to the enchant?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4062', '100', 'What Leg Armor Enchant would you like to have applied to your currently equipped Legs?', 'What Leg Armor Enchant would you like to have applied to your currently equipped Legs?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4063', '100', 'What Ring Enchant would you like to have applied to your currently equipped 2nd slot ring?', 'What Ring Enchant would you like to have applied to your currently equipped 2nd slot ring?', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4064', '100', 'Hello $n, I\'ve been instructed to tell you specifically, about my more powerful enchants and apply any of those enchants to your gear if you wish to do so.', 'Hello $n, I\'ve been instructed to tell you specifically, about my more powerful enchants and apply any of those enchants to your gear if you wish to do so.', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');
INSERT INTO `npc_text` VALUES ('4065', '100', '$n. Select an enchantment you would like applied to any peice of your gear. Then write in the item you want the enchant applied to. For example, if you click Enchant Weapon - Massacre, and you want it applied to your helm. When the box pops up write in \"Helm\".', '$n. Select an enchantment you would like applied to any peice of your gear. Then write in the item you want the enchant applied to. For example, if you click Enchant Weapon - Massacre, and you want it applied to your helm. When the box pops up write in \"Helm\".', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '1', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '', '', '0', '0', '0', '0', '0', '0', '0');

Credits go to me for the script, and Pwntzyou for helping me with all the problems i ran into.

Enjoy!, This script was tested on Arcemu r2954.

Here is an SQL for the NPC for arcemu.


INSERT INTO `creature_names` VALUES ('48056', 'Supreme Enchantress Ulia', 'Master Inscriber & Enchanter', '', '0', '0', '0', '0', '0', '0', '0', '7', '0', '3', '0', null, '28176', '0', '0', '0', '1', '1', null, null);
INSERT INTO `creature_proto` VALUES ('48056', '80', '80', '35', '1000000', '1000000', '1000000', '2', '1', '1000', '0', '1e+006', '1e+006', '0', '0', '0', '0', '360000', '10000', '0', '0', '0', '0', '0', '0', '1', '1', '', '1', '0', '0', '0', '2.5', '8', '14', '0', '0', '0', '0', '0', '0', '0', '0', '0');

Before anyone asks: I'm working on converting it to TC2, but I've been slacking a bit. Shouldn't be too much longer though.

Apple
12-01-10, 10:14 PM
Nice one +rep

treetree
13-01-10, 04:14 AM
hmm,,this is interesting

I will test it,,

+rep

tree :)

Booty
06-02-10, 04:46 PM
Wow, awesome dude. :) +rep

Dimman
06-02-10, 06:40 PM
Credits: Vision100.

Milation
07-02-10, 12:41 PM
Nice script +rep

namesis
20-04-10, 05:17 PM
tyvm,I will test itI will test .

.SalMAX™
22-04-10, 10:54 PM
Nice, I love it. It works for 3.3.3a ArcEmu Servers. +repz

StickyIcky
02-05-10, 03:52 AM
Very Nice

+rep