How could I make level items craftable?

magik hatt

Active Member
Apr 7, 2018
31
3
I saw in this thread, someone was attempting to make craftable level items. I understand what that OP was doing. Creating the level item files individually then adding to the craft gump. I don't follow where or how to add it to the craft gump menu though.

The other suggestions in the thread talk about editing the BaseWeapon file, but don't go into detail. I understand the thought behind the suggestions; a true/false if it's a level item, then if true it makes it levelable. But implementing that is not something I can do without further instruction.

I'm willing to take the time to create the custom files for each level item I want to be craftable. Could I get some direction on how to add that to the crafting gump menu after those are made? Or if someone is feeling generous, explain the BaseWeapon edits? Or a better alternative?
 

Grimoric

Well-Known Member
Mar 21, 2015
174
40
43
I have no clue what you meant by level on items sins I'm only targeting T2A in my coding, but items are added to the crafting menu on ServUO by this file.
https://github.com/ServUO/ServUO/blob/master/Scripts/Services/Craft/DefBlacksmithy.cs, line 311+

Easiest is to add the new weapons to a map inside here:
https://github.com/ServUO/ServUO/tree/master/Scripts/Items/Equipment/Weapons

An example with daggers:
https://github.com/ServUO/ServUO/blob/master/Scripts/Items/Equipment/Weapons/Dagger.cs
https://github.com/ServUO/ServUO/blob/master/Scripts/Services/Craft/DefBlacksmithy.cs, line 466

"explain the BaseWeapon edits" What is your question? The class is used to add weapon properties to an item object from the core item class. Next step is the base group class that split the weapons into different groups like swords, bows, staffs and so on. Each weapon class is then inherited from this group class.
This is done so you don't need to add every property on every object and might forget one. it looks like this for the dagger.

Item => BaseWeapon => BaseMeleeWeapon => BaseKnife => Dagger


https://github.com/ServUO/ServUO/blob/master/Scripts/Items/Equipment/Weapons/Dagger.cs
https://github.com/ServUO/ServUO/blob/master/Scripts/Items/Equipment/Weapons/BaseKnife.cs
https://github.com/ServUO/ServUO/blob/master/Scripts/Items/Equipment/Weapons/BaseMeleeWeapon.cs
https://github.com/ServUO/ServUO/blob/master/Scripts/Items/Equipment/Weapons/BaseWeapon.cs
https://github.com/ServUO/ServUO/blob/master/Server/Item.cs

-Grim
 
  • Like
Reactions: magik hatt

magik hatt

Active Member
Apr 7, 2018
31
3
Thank you. Level items are custom, but XMLspawner2 comes with it standard if you want to use it. It has a level item deed that can be used on things, I just want to add crafting. The files are here for me: ServUO\Scripts\Services\XmlSpawner\XMLSpawner Extras\XmlLevelItem

The dagger you mention is this:
AddCraft(typeof(Dagger), 1011081, 1023921, -0.4, 49.6, typeof(IronIngot), 1044036, 3, 1044037);
I created a LevelDagger.cs file and added the code below to the DefBlacksmithy file to test.
AddCraft(typeof(LevelDagger), 1011081, "Levelable Dagger", -0.4, 49.6, typeof(IronIngot), 1044036, 3, 1044037);
This added the item to the menu as Levelable Dagger and when crafted it was levelable and named as below in the LevelDagger.cs file I created:
XmlAttach.AttachTo(this, new XmlLevelItem());
Name = "Level Dagger";


Now to repeat for everything else. Thanks!

Your explanation of BaseWeapon helps. It makes a lot more sense now why that would be an easier way to go about things as you could add the xml there once and not worry about individual files for each item. I just don't know enough to make use of it. I would assume you can make some boolean that turns true when clicking the craft menu button for a level item. With 6000+ lines though, I don't know how to implement that or connect the boolean to the craft menu. I'll stick to doing the above stuff for now.
 
  • Like
Reactions: Grimoric