Jump to content
  • 0

EnchantItemOptions.xml


Question

Posted

Can explain me how i can add more options in EnchantItemOptions,xml? Now it is max 3 options: 

<options level="1" option1="xxxx" option2="xxxx"  option3="xxxx" />

Thank you

Recommended Posts

  • 0
Posted

Every xml needs an xsd to tell it how to work and what to accept 

http://prntscr.com/katwav

you find that xsd file and you make the changes there first

http://prntscr.com/katwt7

 

then you can use them in your xml 

( if i am not mistaken )

still give it a go. gl

  • 0
Posted

Oh so there is a built-in way to add custom effects based on the enchant value. So as @SilverShadow said, you have to add a fourth option to olf's shirt, but first you must modify the xsd in order for it to be expected to exist.

 

From the xsd you can see that level, option1 and id have the "required" parameter which means that they are always there for all entries, option2 and option3 don't have it so they are optional. You will need to create an option4 that resembles the latter then.

 

add this after option3 in the data/xsd/enchantItemOptions.xsd

<xs:attribute name="option4">
	<xs:simpleType>
		<xs:restriction base="xs:positiveInteger">
			<xs:minInclusive value="1" />
			<xs:maxInclusive value="65535" />
		</xs:restriction>
	</xs:simpleType>
</xs:attribute>

 

then in the data/stats/options/24900-24999.xml you need to create the option to be used

<option id="id_here" name="name_here">
  <for>
      <add stat="STR" val="1" />
      <add stat="INT" val="1" />
      <add stat="CON" val="1" />
      <add stat="DEX" val="1" />
      <!--etc...-->
  </for>
</option>
 

finally you will add the new parameter to olf's shirt in data/enchantItemOptions.xml

 

<item id="21580"> <!-- Olf's T-shirt -->
  <options level="0" option1="24965" />
  <options level="1" option1="24966" />
  <options level="2" option1="24967" />
  <options level="3" option1="24968" />
  <options level="4" option1="24969" option2="24975" />
  <options level="5" option1="24970" option2="24976" />
  <options level="6" option1="24971" option2="24977" />
  <options level="7" option1="24972" option2="24978" option3="24982" />
  <options level="8" option1="24973" option2="24979" option3="24982" />
  <options level="9" option1="24974" option2="24980" option3="24983" />
  <options level="10" option1="24984" option2="24985" option3="24983" />
  <options level="11" option1="24984" option2="24985" option3="24983" option4="id_here"/>
</item>

 

  • Upvote 1
  • 0
Posted

Ok, i make all steps how u say, but i get on item just 3 options. 

<item id="21580"> <!-- Olf's T-shirt -->
		<options level="0" option1="24963" />
		<options level="1" option1="24907" />
		<options level="2" option1="24908" />
		<options level="3" option1="24909" />
		<options level="4" option1="24910" />
		<options level="5" option1="24911" />
		<options level="6" option1="24912" />
		<options level="7" option1="24913" option2="24950" />
		<options level="8" option1="24914" option2="24951" />
		<options level="9" option1="24915" option2="24952" />
		<options level="10" option1="24916" option2="24953" />
		<options level="11" option1="24917" option2="24953" />
		<options level="12" option1="24918" option2="24953" />
		<options level="13" option1="24919" option2="24953" option3="24612" />
		<options level="14" option1="24920" option2="24954" option3="24613" />
		<options level="15" option1="24921" option2="24958" option3="24613" option4="24641" />
	</item>

and in game 

image.png.9e1c3c5812e9a7ab4e62fdad13371f6e.png

  • 0
Posted (edited)

Option 1:

<option id="24921" name="o_july_shirt_stat_23">
		<!-- INT +5. STR +5. CON +5. MEN +5. -->
		<for>
			<add stat="STR" val="5" />
			<add stat="INT" val="5" />
			<add stat="CON" val="5" />
			<add stat="DEX" val="5" />
		</for>
	</option>

Option 2:

<option id="24958" name="o_s_76_85_opt_earring_drop_up4">
		<!-- Passive: Item drop rate increases by 40%. -->
		<passive_skill id="8416" level="4" /> <!-- Earring Ability - Drop Rate Up -->
	</option>

Option 3:

<option id="24691" name="o_s_84_2u_47">
		<!-- Passive: Increases the rate of critical attacks. -->
		<passive_skill id="3249" level="10" /> <!-- Item Skill: Focus -->
	</option>

Option 4:

<option id="24641" name="o_s_84_2r_104">
		<!-- Passive: Increases one's own P. Atk. -->
		<passive_skill id="3240" level="10" /> <!-- Item Skill: Might -->
	</option>

image.png.aeab9b779c3f3e0780393cad58aee6f0.png

Edited by InFocus
  • 0
Posted
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
	<xs:element name="list">
		<xs:complexType>
			<xs:sequence maxOccurs="1" minOccurs="1">
				<xs:element name="item" maxOccurs="unbounded" minOccurs="1">
					<xs:complexType>
						<xs:sequence maxOccurs="1" minOccurs="1">
							<xs:element name="options" maxOccurs="51" minOccurs="1">
								<xs:complexType>
									<xs:attribute name="level" use="required">
										<xs:simpleType>
											<xs:restriction base="xs:nonNegativeInteger">
												<xs:minInclusive value="0" />
												<xs:maxInclusive value="50" />
											</xs:restriction>
										</xs:simpleType>
									</xs:attribute>
									<xs:attribute name="option1" use="required">
										<xs:simpleType>
											<xs:restriction base="xs:positiveInteger">
												<xs:minInclusive value="1" />
												<xs:maxInclusive value="65535" />
											</xs:restriction>
										</xs:simpleType>
									</xs:attribute>
									<xs:attribute name="option2">
										<xs:simpleType>
											<xs:restriction base="xs:positiveInteger">
												<xs:minInclusive value="1" />
												<xs:maxInclusive value="65535" />
											</xs:restriction>
										</xs:simpleType>
									</xs:attribute>
									<xs:attribute name="option3">
										<xs:simpleType>
											<xs:restriction base="xs:positiveInteger">
												<xs:minInclusive value="1" />
												<xs:maxInclusive value="65535" />
											</xs:restriction>
										</xs:simpleType>
									</xs:attribute>
									<xs:attribute name="option4">
										<xs:simpleType>
											<xs:restriction base="xs:positiveInteger">
												<xs:minInclusive value="1" />
												<xs:maxInclusive value="65535" />
											</xs:restriction>
										</xs:simpleType>
									</xs:attribute>
								</xs:complexType>
							</xs:element>
						</xs:sequence>
						<xs:attribute name="id" use="required">
							<xs:simpleType>
								<xs:restriction base="xs:positiveInteger">
									<xs:minInclusive value="1" />
									<xs:maxInclusive value="65535" />
								</xs:restriction>
							</xs:simpleType>
						</xs:attribute>
					</xs:complexType>
				</xs:element>
			</xs:sequence>
		</xs:complexType>
	</xs:element>
</xs:schema>

 

  • 0
Posted

Dunno how it's coded, but I doubt it's as simple as that, still you have to edit core. So simply search where it is loaded and how data is parsed.

 

Ps: didn't read whole topic just few first posts. 

  • Upvote 1
  • 0
Posted

i think, here is 

public void parseDocument(Document doc)
	{
		int counter = 0;
		for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
		{
			if ("list".equalsIgnoreCase(n.getNodeName()))
			{
				for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
				{
					if ("item".equalsIgnoreCase(d.getNodeName()))
					{
						int itemId = parseInteger(d.getAttributes(), "id");
						if (!_data.containsKey(itemId))
						{
							_data.put(itemId, new HashMap<Integer, EnchantOptions>());
						}
						for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
						{
							if ("options".equalsIgnoreCase(cd.getNodeName()))
							{
								final EnchantOptions op = new EnchantOptions(parseInteger(cd.getAttributes(), "level"));
								_data.get(itemId).put(op.getLevel(), op);
								
								for (byte i = 0; i < 3; i++)
								{
									final Node att = cd.getAttributes().getNamedItem("option" + (i + 1));
									if ((att != null) && Util.isDigit(att.getNodeValue()))
									{
										op.setOption(i, parseInteger(att));
									}
								}
								counter++;
							}
						}
					}
				}
			}
		}
		LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _data.size() + " Items and " + counter + " Options.");
	}
	

 

  • 0
Posted

I try, no work :/

here it is all code 

/*
 * Copyright (C) 2004-2015 L2J Server
 * 
 * This file is part of L2J Server.
 * 
 * L2J Server is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * L2J Server is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package com.l2jserver.gameserver.data.xml.impl;

import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;

import org.w3c.dom.Document;
import org.w3c.dom.Node;

import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.model.options.EnchantOptions;
import com.l2jserver.gameserver.util.Util;
import com.l2jserver.util.data.xml.IXmlReader;

/**
 * @author UnAfraid
 */
public class EnchantItemOptionsData implements IXmlReader
{
	private final Map<Integer, Map<Integer, EnchantOptions>> _data = new HashMap<>();
	
	protected EnchantItemOptionsData()
	{
		load();
	}
	
	@Override
	public synchronized void load()
	{
		_data.clear();
		parseDatapackFile("data/enchantItemOptions.xml");
	}
	
	@Override
	public void parseDocument(Document doc)
	{
		int counter = 0;
		for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
		{
			if ("list".equalsIgnoreCase(n.getNodeName()))
			{
				for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
				{
					if ("item".equalsIgnoreCase(d.getNodeName()))
					{
						int itemId = parseInteger(d.getAttributes(), "id");
						if (!_data.containsKey(itemId))
						{
							_data.put(itemId, new HashMap<Integer, EnchantOptions>());
						}
						for (Node cd = d.getFirstChild(); cd != null; cd = cd.getNextSibling())
						{
							if ("options".equalsIgnoreCase(cd.getNodeName()))
							{
								final EnchantOptions op = new EnchantOptions(parseInteger(cd.getAttributes(), "level"));
								_data.get(itemId).put(op.getLevel(), op);
								
								for (byte i = 0; i < 4; i++)
								{
									final Node att = cd.getAttributes().getNamedItem("option" + (i + 1));
									if ((att != null) && Util.isDigit(att.getNodeValue()))
									{
										op.setOption(i, parseInteger(att));
									}
								}
								counter++;
							}
						}
					}
				}
			}
		}
		LOGGER.log(Level.INFO, getClass().getSimpleName() + ": Loaded: " + _data.size() + " Items and " + counter + " Options.");
	}
	
	/**
	 * @param itemId
	 * @param enchantLevel
	 * @return enchant effects information.
	 */
	public EnchantOptions getOptions(int itemId, int enchantLevel)
	{
		if (!_data.containsKey(itemId) || !_data.get(itemId).containsKey(enchantLevel))
		{
			return null;
		}
		return _data.get(itemId).get(enchantLevel);
	}
	
	/**
	 * @param item
	 * @return enchant effects information.
	 */
	public EnchantOptions getOptions(L2ItemInstance item)
	{
		return item != null ? getOptions(item.getId(), item.getEnchantLevel()) : null;
	}
	
	/**
	 * Gets the single instance of EnchantOptionsData.
	 * @return single instance of EnchantOptionsData
	 */
	public static final EnchantItemOptionsData getInstance()
	{
		return SingletonHolder._instance;
	}
	
	private static class SingletonHolder
	{
		protected static final EnchantItemOptionsData _instance = new EnchantItemOptionsData();
	}
}

 

  • 0
Posted

Why it is so complicated to explain me how i can add 1 more option? i don't must edit half server in java. i try to add changes in EnchantItemOptionsData.java but no work. Where somewhere else i must edit?

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • ## [1.5.5] - 2026-02-02   ### ✨ New Features - **Discord Login**: You can now sign in with your Discord account. Admins enable and configure Discord login in **cpadmin → Users** (Discord auth settings: Client ID, Client Secret, Redirect URI). If you already have an account with the same email (e.g. forum, Google, or legacy), signing in with Discord links to that account so you keep one profile. Discord login is available on Add Server, My Servers, Vote page, and Premium Ads booking. - **Setup Links**: In **cpadmin → Users**, both Google and Discord login settings now include direct links to their official developer portals (Google Cloud Console and Discord Developer Portal) for easier OAuth app setup.   ### 🔒 Security - **Email Required for Registration**: New user registration via OAuth (Forum, Google, Discord) now requires a valid email address. If the OAuth provider doesn't provide an email (e.g. unverified Discord email), registration is rejected with a clear message. This prevents anonymous accounts and ensures all users can receive important notifications.   ### 🔄 Improvements - **User Auth Badges**: In **cpadmin → Users**, the Registered Members table now shows auth method badges: **Forum**, **Google**, **Discord**, or **Legacy**. Users can have multiple badges if they've linked multiple login methods. - **Server Info Labels**: Translated server info labels (Owner Name, Language, Server Location) are now properly localized in all 5 languages (English, Spanish, Portuguese, Greek, Russian).   ---   ## [1.5.4] - 2026-02-01   ### ✨ New Features - **Google Login**: You can now sign in with your Google account. Admins enable and configure Google login in **cpadmin → Users** (Google auth settings: Client ID, Client Secret, Redirect URI). If you already have an account with the same email (e.g. forum or legacy), signing in with Google links to that account so you keep one profile. The login menu (navbar and login prompts) offers **Login with Forum Account**, **Login with Google** (when enabled), and **Create Forum Account**. Google login is available on Add Server, My Servers, Profile Settings, Vote page, and Premium Ads booking. - **Ban/Unban Members**: In **cpadmin → Users**, admins can ban or unban registered members. Banned users see a full-page message: "Sorry, you are banned from using this site." When a user is banned, all their servers are set to inactive. - **Moderator Activity Log**: **cpadmin → Moderators** now records when a moderator or admin enters the CPAdmin panel (e.g. "Moderator X entered CPAdmin panel at &lt;time&gt;") and when they change any cpadmin settings (only write actions are logged; read-only use is not). - **Clear Moderator Logs**: Admins can clear all moderator activity log entries via a **Clear logs** button with confirmation. Logs are shown at 100 per page with pagination. - **Filter by Moderator**: In the Moderator Activity Log, a **Filter by moderator** dropdown lets you view activity for a specific moderator or "All moderators." - **cpadmin → Users Tab**: New **Users** tab in the admin panel with Registered Members list (paginated), Google auth settings card, and per-user Ban/Unban and server links.   ### 🔄 Improvements - **cpadmin → Servers**: Each server name in the servers table is now clickable and opens that server’s info page. - **cpadmin → Users – Servers column**: The servers count/list is clickable and opens a small modal listing that user’s servers; each server name in the modal links to the server info page. - **cpadmin → Users – Search**: A search bar above the Registered Members table lets you search by **username**, **email**, or **server name**. Results are filtered on the server (paginated); clearing the search resets the list. - **Moderator Activity Log**: Pagination shows "Showing X–Y of Z" and "Page N of M" with Previous/Next when there are more than 100 entries. - **Login UI**: Login options (Forum, Google, Create account) are shown in a consistent dropdown and in modals (Add Server, My Servers, Vote, Premium Ads) for a clearer sign-in experience. - **Vote Page – Unauthenticated**: When you must log in to vote, the page now shows "Vote for [Server Name]" as the main heading and presents login options in a compact section.   ---   ## [1.5.3] - 2026-01-30   ### ✨ New Features - **File Logs in Admin Panel**: Admins can now view CodeIgniter PHP logs (api/writable/logs) directly in **cpadmin → Logs**. Select a date to view the log file, refresh to reload, or delete all log files to free up space.   ### 🔄 Improvements - **Cache System**: Full cache audit and improvements — when you clear cache in cpadmin, both backend and frontend caches are cleared. Server listings, My Servers, pricing, ad config, and chronicles all refresh with fresh data. New paid servers now appear in listings and My Servers immediately. - **Admin Panel – Server Rates**: Server rates in the admin servers table now display in compact format (e.g. x10000 → x10k, x100000 → x100k, x1000000 → x1m) for easier scanning. Hover to see the full value.
    • WTB High Five source running on Salvation/Fafurion client
    • MoMoProxy has updated more static residential proxies for USA location, anyone interested in can view: https://momoproxy.com/static-residential-proxies
    • Hello, i am selling a project that was going to open but at the end i have not the time to do it Its a c4 server ( scripts) with all the c5 changes played from Interlude Client    the server is 1:1 copy of the legendary 2007 L2Revenge server with some bits like events and some more sync stuff There is a lot of retail fixes included  , extender is vanganth and has a lot of mods but mostly fixes on the retail stuff.   Test server is available through discord , i offer client/patch/server/sources The price is 300 Euro and for testing the server you have to pm me at discord banshee1019 , dont really wanna let anybody log because some people are "bad"   Once you buy you also have free support for 1 year , that doesnt mean i will code all your ideas but support you if something comes up , and guide you to do simple edits
  • Topics

×
×
  • Create New...

Important Information

This community uses essential cookies to function properly. Non-essential cookies and third-party services are used only with your consent. Read our Privacy Policy and 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..