Jump to content

Enchantment NPC

Guest Kreegoth

Recommended Posts

Hello there,

Kreegoth here. Looking to get some assistance with this work in progress non core script.

First let me explain what the script is.

For many servers people create armor and weapons. For weapons this isnt such a big deal but for armor it is. Its a pain to find ids that you can use to be able to make it so you can enchant your gear. This is a bad thing also for Tradeskillers as they cannot use their hard earned self enchants.

This would give another option to it.

This script will in the end allow a Admin to create an NPC and apply this script to it and then the NPC will charge players a set amount of gold to enchant their items for them.

This will allow tradeskillers to use this NPC to enchant their gear ( Still requiring the tradeskill level to actually have the stat values apply though )

It also would allow lower population servers a NPC to use instead of having to wait for someone who has enchanting to log in provided you have the coin to afford the enchants.

Anyways I have all of the gossip and a bunch of other things set up. Keep in mind this is as i said a work in progress and currently needs to be worked on and fixed.

Having said that.

Here is a pastebin of it ---> http://pastebin.com/cAzRyKR2

The part that I am having trouble and need help with is this part

      case 0: //Titan Guard
            for (int i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i)
                if (pItem->GetItemByPos( INVENTORY_SLOT_BAG_0, i ))
                   for(int slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot)
                        SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(3851);
                        if (!pEnchant)
                        ApplyEnchantment(pItem, EnchantmentSlot(slot), true);

That part of the code is after the player has actually selected the enchant they want. In that case the player selected Titan Guard from the Main Hand selections. The problem is it does not compile. It should pretty much go like this.

Check the players corresponding slot (Based on their selection earlier in gossip)

Check if there is an Enchant present and remove it.

Check if the enchant they selected can be applied to that slot/Item

if so apply enchant to players item

If not send player message saying that they did not pick a valid item.

Now the problem is. I cannot figure out how to make that work. If someone would be so kind as to work with me on this script as I think it would be useful to a great many servers who fix their items or not.

What I need in terms of help is someone to show me pretty much a cookie cutter set of code that does what i needed up above and I will reconfigure it for each case(Enchant selection) and change the slot affected and enchantment to be put on it.

Thank you to anyone who shows interest in this and can provide any assistance.


Link to comment
Share on other sites

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use