Jump to content

Recommended Posts

Posted

Custom Bonus Enchant on Armor { Hi5 }

Hello MxC this is my first Share here at java code's so dont flame and etc !

 

The Normal Enchant Bonus on armor's when the armor goes to +6 plus u can do at +12 or +16 or both

 

This is for the Last rev on L2JServer H5

 

Here's the Code :

 

### Eclipse Workspace Patch 1.0
#P L2J_Server
Index: java/com/l2jserver/gameserver/datatables/ArmorSetsData.java
===================================================================
--- java/com/l2jserver/gameserver/datatables/ArmorSetsData.java	(revision 5685)
+++ java/com/l2jserver/gameserver/datatables/ArmorSetsData.java	(working copy)
@@ -119,6 +119,20 @@
									set.addEnchant6Skill(new SkillHolder(skillId, skillLevel));
									break;
								}
+								case "enchant12skill":
+								{
+									int skillId = parseInt(attrs, "id");
+									int skillLevel = parseInt(attrs, "level");
+									set.addEnchant12Skill(new SkillHolder(skillId, skillLevel));
+									break;
+								}
+								case "enchant16skill":
+								{
+									int skillId = parseInt(attrs, "id");
+									int skillLevel = parseInt(attrs, "level");
+									set.addEnchant12Skill(new SkillHolder(skillId, skillLevel));
+									break;
+								}
								case "con":
								{
									set.addCon(parseInt(attrs, "val"));
Index: java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java
===================================================================
--- java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java	(revision 5685)
+++ java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java	(working copy)
@@ -570,6 +570,34 @@
								_log.warning("Inventory.ArmorSetListener: Incorrect skill: " + holder + ".");
						}
					}
+					
+					if (armorSet.isEnchanted12(player)) // has all parts of set enchanted to 12 or more
+					{
+						for (SkillHolder holder : armorSet.getEnchant12skillId())
+						{
+							if (holder.getSkill() != null)
+							{
+								player.addSkill(holder.getSkill(), false);
+								update = true;
+							}
+							else
+								_log.warning("Inventory.ArmorSetListener: Incorrect skill: " + holder + ".");
+						}
+					}
+					
+					if (armorSet.isEnchanted16(player)) // has all parts of set enchanted to 6 or more
+					{
+						for (SkillHolder holder : armorSet.getEnchant16skillId())
+						{
+							if (holder.getSkill() != null)
+							{
+								player.addSkill(holder.getSkill(), false);
+								update = true;
+							}
+							else
+								_log.warning("Inventory.ArmorSetListener: Incorrect skill: " + holder + ".");
+						}
+					}
				}
			}
			else if (armorSet.containShield(item.getItemId()))
@@ -608,6 +636,8 @@
			List<SkillHolder> skills = null;
			List<SkillHolder> shieldSkill = null; // shield skill
			List<SkillHolder> skillId6 = null; // enchant +6 skill
+			List<SkillHolder> skillId12 = null; // enchant +12 skill
+			List<SkillHolder> skillId16 = null; // enchant +16 skill

			if (slot == PAPERDOLL_CHEST)
			{
@@ -620,6 +650,8 @@
				skills = armorSet.getSkills();
				shieldSkill = armorSet.getShieldSkillId();
				skillId6 = armorSet.getEnchant6skillId();
+				skillId12 = armorSet.getEnchant12skillId();
+				skillId16 = armorSet.getEnchant16skillId();
			}
			else
			{
@@ -637,6 +669,8 @@
					skills = armorSet.getSkills();
					shieldSkill = armorSet.getShieldSkillId();
					skillId6 = armorSet.getEnchant6skillId();
+					skillId12 = armorSet.getEnchant12skillId();
+					skillId16 = armorSet.getEnchant16skillId();
				}
				else if (armorSet.containShield(item.getItemId())) // removed shield
				{
@@ -683,6 +717,30 @@
					}
				}

+				if (skillId12 != null)
+				{
+					for (SkillHolder holder : skillId12)
+					{
+						itemSkill = holder.getSkill();
+						if (itemSkill != null)
+							player.removeSkill(itemSkill, false, itemSkill.isPassive());
+						else
+							_log.warning("Inventory.ArmorSetListener: Incorrect skill: " + holder + ".");
+					}
+				}
+				
+				if (skillId16 != null)
+				{
+					for (SkillHolder holder : skillId16)
+					{
+						itemSkill = holder.getSkill();
+						if (itemSkill != null)
+							player.removeSkill(itemSkill, false, itemSkill.isPassive());
+						else
+							_log.warning("Inventory.ArmorSetListener: Incorrect skill: " + holder + ".");
+					}
+				}
+				
				player.checkItemRestriction();
				player.sendSkillList();
			}
Index: java/com/l2jserver/gameserver/model/L2ArmorSet.java
===================================================================
--- java/com/l2jserver/gameserver/model/L2ArmorSet.java	(revision 5685)
+++ java/com/l2jserver/gameserver/model/L2ArmorSet.java	(working copy)
@@ -37,6 +37,8 @@
	private final List<SkillHolder> _skills;
	private final List<SkillHolder> _shieldSkills;
	private final List<SkillHolder> _enchant6Skill;
+	private final List<SkillHolder> _enchant12Skill;
+	private final List<SkillHolder> _enchant16Skill;

	private int _con;
	private int _dex;
@@ -56,6 +58,8 @@
		_skills = new ArrayList<>();
		_shieldSkills = new ArrayList<>();
		_enchant6Skill = new ArrayList<>();
+		_enchant12Skill = new ArrayList<>();
+		_enchant16Skill = new ArrayList<>();
	}

	public void addChest(int id)
@@ -102,6 +106,16 @@
	{
		_enchant6Skill.add(holder);
	}
+
+	public void addEnchant12Skill(SkillHolder holder)
+	{
+		_enchant12Skill.add(holder);
+	}
+
+	public void addEnchant16Skill(SkillHolder holder)
+	{
+		_enchant16Skill.add(holder);
+	}

	public void addCon(int val)
	{
@@ -237,6 +251,16 @@
		return _enchant6Skill;
	}

+	public List<SkillHolder> getEnchant12skillId()
+	{
+		return _enchant12Skill;
+	}
+	
+	public List<SkillHolder> getEnchant16skillId()
+	{
+		return _enchant16Skill;
+	}
+	
	/**
	 * @param player
	 * @return true if all parts of set are enchanted to +6 or more
@@ -269,6 +293,60 @@
		return true;
	}

+		public boolean isEnchanted12(L2PcInstance player)
+		{
+			// Player don't have full set
+			if (!containAll(player))
+				return false;
+			
+			Inventory inv = player.getInventory();
+			
+			L2ItemInstance chestItem = inv.getPaperdollItem(Inventory.PAPERDOLL_CHEST);
+			L2ItemInstance legsItem = inv.getPaperdollItem(Inventory.PAPERDOLL_LEGS);
+			L2ItemInstance headItem = inv.getPaperdollItem(Inventory.PAPERDOLL_HEAD);
+			L2ItemInstance glovesItem = inv.getPaperdollItem(Inventory.PAPERDOLL_GLOVES);
+			L2ItemInstance feetItem = inv.getPaperdollItem(Inventory.PAPERDOLL_FEET);
+			
+			if (chestItem == null || chestItem.getEnchantLevel() < 12)
+				return false;
+			if (!_legs.isEmpty() && (legsItem == null || legsItem.getEnchantLevel() < 12))
+				return false;
+			if (!_gloves.isEmpty() && (glovesItem == null || glovesItem.getEnchantLevel() < 12))
+				return false;
+			if (!_head.isEmpty() && (headItem == null || headItem.getEnchantLevel() < 12))
+				return false;
+			if (!_feet.isEmpty() && (feetItem == null || feetItem.getEnchantLevel() < 12))
+				return false;
+			
+			return true;
+		}
+		public boolean isEnchanted16(L2PcInstance player)
+		{
+			// Player don't have full set
+			if (!containAll(player))
+				return false;
+			
+			Inventory inv = player.getInventory();
+			
+			L2ItemInstance chestItem = inv.getPaperdollItem(Inventory.PAPERDOLL_CHEST);
+			L2ItemInstance legsItem = inv.getPaperdollItem(Inventory.PAPERDOLL_LEGS);
+			L2ItemInstance headItem = inv.getPaperdollItem(Inventory.PAPERDOLL_HEAD);
+			L2ItemInstance glovesItem = inv.getPaperdollItem(Inventory.PAPERDOLL_GLOVES);
+			L2ItemInstance feetItem = inv.getPaperdollItem(Inventory.PAPERDOLL_FEET);
+			
+			if (chestItem == null || chestItem.getEnchantLevel() < 16)
+				return false;
+			if (!_legs.isEmpty() && (legsItem == null || legsItem.getEnchantLevel() < 16))
+				return false;
+			if (!_gloves.isEmpty() && (glovesItem == null || glovesItem.getEnchantLevel() < 16))
+				return false;
+			if (!_head.isEmpty() && (headItem == null || headItem.getEnchantLevel() < 16))
+				return false;
+			if (!_feet.isEmpty() && (feetItem == null || feetItem.getEnchantLevel() < 16))
+				return false;
+			
+			return true;
+		}
	public int getCON()
	{
		return _con;

 

 

Also U need to Add this Line's On armorSets.xsd

 

							<xs:element name="enchant6skill" maxOccurs="1" minOccurs="0">
							<xs:complexType>
								<xs:attribute name="id" type="xs:positiveInteger" use="required" />
								<xs:attribute name="level" type="xs:positiveInteger" use="required" />
							</xs:complexType>
						</xs:element>
						+         <xs:element name="enchant12skill" maxOccurs="1" minOccurs="0">
						+	   <xs:complexType>
						+		<xs:attribute name="id" type="xs:positiveInteger" use="required" />
						+		<xs:attribute name="level" type="xs:positiveInteger" use="required" />
						+	    </xs:complexType>
						+         </xs:element>
						+         <xs:element name="enchant16skill" maxOccurs="1" minOccurs="0">
						+	   <xs:complexType>
						+		<xs:attribute name="id" type="xs:positiveInteger" use="required" />
						+		<xs:attribute name="level" type="xs:positiveInteger" use="required" />
						+	    </xs:complexType>
						+         </xs:element>

 

It's easy to add a skill

 

Just found the Armorset folder open your armor file ( like s84_elegia.xml )

 

and then add ur skill like

 

		<enchant12skill id="8461" level="1" /> <!-- Enchant Heavy Armor (S Grade) -->

For Armor Set's at +12

 

		<enchant16skill id="8461" level="1" /> <!-- Enchant Heavy Armor (S Grade) -->

For Armor Set's at +16

 

 

Like :

 

<!-- S84 Elegia Armor Sets -->

<set id="188">

<chest id="15575" /> <!-- Elegia Breastplate -->

<legs id="15578" /> <!-- Elegia Gaiter -->

<head id="15572" /> <!-- Elegia Helmet -->

<gloves id="15581" /> <!-- Elegia Gauntlet -->

<feet id="15584" /> <!-- Elegia Boots -->

<shield id="15587" /> <!-- Elegia Shield -->

<skill id="3006" level="1" /> <!-- Equip Set Items -->

<skill id="8403" level="1" /> <!-- Elegia Heavy Armor Set -->

<shield_skill id="8496" level="1" /> <!-- Elegia Shield -->

<enchant6skill id="8461" level="1" /> <!-- Enchant Heavy Armor (S Grade) -->

<enchant12skill id="8461" level="1" /> <!-- Enchant Heavy Armor (S Grade) -->

<str val="3" />

<con val="-2" />

</set>

  • 2 weeks later...
Posted

i don't understand what is that make ?

 

What is that ?

 

If your armor it's +6 as set u gain one bonus at Passive Skill's with that u can change that at +12 or +16

  • 3 weeks later...
  • 2 weeks later...
Posted

I think now this thing can be done from XML side...

 

without this code is not possible :/

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Posts

    • Server mid rate craft PvP   CLIENTE INTERLUDE Website server Discord olympus x25 &nbsp;server 🇧🇷🇦🇷🇨🇱🇬🇷🇲🇽🇵🇪🇸🇰🇪🇸🇺🇾 Server mid rate craft PvP 🔱CLIENTE INTERLUDE🔱 🔅xpx25 🔅Sp x25 🔅Adena x15 🔅Droop x2 🔅Spoil x2 🔅Raidboss xp x2 🔅Raidboss sp x2 🔅Raidboss droop x1 🔅All Rate quest reward  x1 ⚠️All Quest drop reward. x1 🔅Manor x 3 🔅Seal stone x1 🛡️🗡️INFO GRADO S🗡️🛡️ ⚠️Inicia desabilitado drop/spoil/quest. 🔱PROFESIONES/SUBCLASS🔱 🛡️1st profession - 50medal 🛡️2nd profession - 500 medal 🛡️3rd profession - 1k medal +30kk adena 🛡️Sub class - Quest. No necesita matar raids. ⚙️Configuraciones⚙️ 🛡️Gmshop  grade - B. 🛡️Grade A-S Craft - yes x1 chance 🛡️Globlal teleport - yes 🛡️Buffer 1hora. 🛡️Buffer slot 24(+4divine)+12 dances-song 🛡️Auto learn skils - yes 🛡️Autoloot - yes 🛡️Mana potion recarga 1000 ,9segundos delay. 🛡️Champions system:     ▫️lvl 30 - 76     ▫️chance respawn 0.5%.     ▫️adena x20 🛡️Max lvl party 14 lvl. 🛡️Festive sweeper on. 🛡️Max client pc 2. 🛡️Raid boss respawn retail. 🛡️Nobleza quest - yes. 🛡️Barakiel respawn 6 horas + -30 min. 🛡️Olimpiada duracion 14 dias. 🛡️Olimpiada de 18:00 a 00:00 🛡️Safe enchant +3 🛡️Normal enchant scroll 50% ⚠️+11-16 chance 30% 🛡️Bleesed enchant scroll 55% ⚠️+11-16 chance 35% 🛡️Rate dinamico x1 lvl 77-80   🛡️🗡️CLANES INFO🗡️🛡️ 🔅Crear clan min. level 20 🔅Max Alianzas 1 🔅Duracion penalidades clan / alianzas 8 horas. 🔅Cambio de lider 24 horas. 🛡️⚔️ ASEDIOS ⚔️🛡️ 🔅Cada 2 semanas. 🔅Proteccion hwid 1 pc. 🔅Clanes registrados. acceden a zona de asedio. 🔅Castillo asediable Aden. 🔅Reward 1000 FA 🔅Horario 16:00 GMT-3 🎊PACK DE INICIO🎊 🔅Start set - armor\weapon no grade. 🔅Level 20  - 5 shadow cuppon grado D 🔅Level 40 - 5 shadow cuppon grado C 🔅Free Autofarm 24 horas. 💰 INFO PREMIUM 💰 🔅Free autofarm. 🔅xp x30 🔅sp x30 🔅adena x17 🔅drop x4 🔅spoil x4 🔅enchant +2% 🔅seal stone x1 🔅Altb Gk-Gmshop/buffe ⚔️ RAID  BOSS INFO ⚔️ 🔅Raid boss 70 ++ respawn 5 días despues. 🔅Raid boss 75 ++ respawn 15 días despues 🔅Drop LETTER L2DAY para tradear en GMshop. ⚔️ INFO SEVEN SING ⚔️ 🔅Inicio del drop Seal stones dia 5 de iniciado el server. 🎊 EPIC RAID INFO 🎊 🔅Queen Ant (lvl 40)respawn Lunes a Viernes 22:00 GMT-3 drop chance 30%. 🔅Core (lvl 80)respawn Martes-miercoles 20:20 GMT-3 drop chance 100%. 🔅Orfen (lvl 80)respawn Martes-miercoles 21:00 GMT-3 drop chance 100%. 🔅Zaken (lvl 80)respawn Jueves 23:00 GMT-3 drop chance 100%. 🔅Frintezza (lvl 80)respawn Viernes 23:00 GMT-3 drop chance 100%. 🔅Baium (lvl 80)respawn Sabado 22:00 GMT-3 drop chance 100%. 🔅Valakas (lvl 80)respawn Domingo 20:00 GMT-3 drop chance 100%. 🔅Antharas (lvl 80)respawn Domingo 22:00 GMT-3 drop chance 100%.
    • The server is running in l2house.com.ar with C4 mode and in L2Tekila within the same login you can also test it in C5, if you want me to raise another chronicle to test, just let me know.
    • video nice song TopGear  gaming 1990    ....  
    • I have a system where Accounts are saved on login screen for fast login. I am playing a server where this feature is not on the logic screen. How I can try to add this feature to the system? I don't know what files I would have to touch.   Thanks!!
  • Topics

×
×
  • Create New...