Jump to content

Recommended Posts

Posted

Hi i wanted to share this "addon"

its nothing special

since you know Armors giving stats when all parts enchanted over+6 and this simple patch allows you to give stats when the Armor is enchanted also to +12 and +16

 

here we go:

Index: java/com/l2jserver/gameserver/datatables/ArmorSetsTable.java
===================================================================
--- java/com/l2jserver/gameserver/datatables/ArmorSetsTable.java	(revision 5101)
+++ java/com/l2jserver/gameserver/datatables/ArmorSetsTable.java	(working copy)
@@ -60,7 +60,7 @@
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement statement = con.prepareStatement("SELECT chest, legs, head, gloves, feet, skill, shield, shield_skill_id, enchant6skill, mw_legs, mw_head, mw_gloves, mw_feet, mw_shield FROM armorsets");
+			PreparedStatement statement = con.prepareStatement("SELECT chest, legs, head, gloves, feet, skill, shield, shield_skill_id, enchant6skill, enchant12skill, enchant16skill, mw_legs, mw_head, mw_gloves, mw_feet, mw_shield FROM armorsets");
			ResultSet rset = statement.executeQuery();

			while (rset.next())
@@ -74,12 +74,14 @@
				int shield = rset.getInt("shield");
				int shield_skill_id = rset.getInt("shield_skill_id");
				int enchant6skill = rset.getInt("enchant6skill");
+				int enchant12skill = rset.getInt("enchant12skill");
+				int enchant16skill = rset.getInt("enchant16skill");
				int mw_legs = rset.getInt("mw_legs");
				int mw_head = rset.getInt("mw_head");
				int mw_gloves = rset.getInt("mw_gloves");
				int mw_feet = rset.getInt("mw_feet");
				int mw_shield = rset.getInt("mw_shield");
-				_armorSets.put(chest, new L2ArmorSet(chest, legs, head, gloves, feet, skills, shield, shield_skill_id, enchant6skill, mw_legs, mw_head, mw_gloves, mw_feet, mw_shield));
+				_armorSets.put(chest, new L2ArmorSet(chest, legs, head, gloves, feet, skills, shield, shield_skill_id, enchant6skill, enchant12skill, enchant16skill, mw_legs, mw_head, mw_gloves, mw_feet, mw_shield));
			}

			rset.close();
@@ -101,7 +103,7 @@
			{
				int cSets = _armorSets.size();
				con = L2DatabaseFactory.getInstance().getConnection();
-				PreparedStatement statement = con.prepareStatement("SELECT chest, legs, head, gloves, feet, skill, shield, shield_skill_id, enchant6skill, mw_legs, mw_head, mw_gloves, mw_feet, mw_shield FROM custom_armorsets");
+				PreparedStatement statement = con.prepareStatement("SELECT chest, legs, head, gloves, feet, skill, shield, shield_skill_id, enchant6skill, enchant12skill, enchant16skill, mw_legs, mw_head, mw_gloves, mw_feet, mw_shield FROM custom_armorsets");
				ResultSet rset = statement.executeQuery();
				while (rset.next())
				{
@@ -114,12 +116,14 @@
					int shield = rset.getInt("shield");
					int shield_skill_id = rset.getInt("shield_skill_id");
					int enchant6skill = rset.getInt("enchant6skill");
+					int enchant12skill = rset.getInt("enchant12skill");
+					int enchant16skill = rset.getInt("enchant16skill");
					int mw_legs = rset.getInt("mw_legs");
					int mw_head = rset.getInt("mw_head");
					int mw_gloves = rset.getInt("mw_gloves");
					int mw_feet = rset.getInt("mw_feet");
					int mw_shield = rset.getInt("mw_shield");
-					_armorSets.put(chest, new L2ArmorSet(chest, legs, head, gloves, feet, skills, shield, shield_skill_id, enchant6skill, mw_legs, mw_head, mw_gloves, mw_feet, mw_shield));
+					_armorSets.put(chest, new L2ArmorSet(chest, legs, head, gloves, feet, skills, shield, shield_skill_id, enchant6skill, enchant12skill, enchant16skill, mw_legs, mw_head, mw_gloves, mw_feet, mw_shield));
				}

				rset.close();
Index: java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java
===================================================================
--- java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java	(revision 5101)
+++ java/com/l2jserver/gameserver/model/itemcontainer/Inventory.java	(working copy)
@@ -552,6 +537,40 @@
								_log.warning("Inventory.ArmorSetListener: Incorrect skill: "+armorSet.getEnchant6skillId()+".");
						}
					}
+					if (armorSet.isEnchanted12(player)) // has all parts of set enchanted to 12 or more
+					{
+						final int skillId12 = armorSet.getEnchant12skillId();
+						
+						if (skillId12 > 0)
+						{
+							L2Skill skille = SkillTable.getInstance().getInfo(skillId12,1);
+							
+							if (skille != null)
+							{
+								player.addSkill(skille, false);
+								update = true;
+							}
+							else
+								_log.warning("Inventory.ArmorSetListener: Incorrect skill: "+armorSet.getEnchant12skillId()+".");
+						}
+					}
+					if (armorSet.isEnchanted16(player)) // has all parts of set enchanted to 16 or more
+					{
+						final int skillId16 = armorSet.getEnchant16skillId();
+						
+						if (skillId16 > 0)
+						{
+							L2Skill skille = SkillTable.getInstance().getInfo(skillId16,1);
+							
+							if (skille != null)
+							{
+								player.addSkill(skille, false);
+								update = true;
+							}
+							else
+								_log.warning("Inventory.ArmorSetListener: Incorrect skill: "+armorSet.getEnchant16skillId()+".");
+						}
+					}
				}
			}
			else if (armorSet.containShield(item.getItemId()))
@@ -579,7 +598,6 @@
			}
		}

-		@Override
		public void notifyUnequiped(int slot, L2ItemInstance item, Inventory inventory)
		{
			if (!(inventory.getOwner() instanceof L2PcInstance))
@@ -593,6 +611,8 @@
			String[] skills = null;
			int shieldSkill = 0; // shield skill
			int skillId6 = 0; // enchant +6 skill
+			int skillId12 = 0; // enchant +12 skill
+			int skillId16 = 0; // enchant +16 skill

			if (slot == PAPERDOLL_CHEST)
			{
@@ -604,6 +624,8 @@
				skills = armorSet.getSkills();
				shieldSkill = armorSet.getShieldSkillId();
				skillId6 = armorSet.getEnchant6skillId();
+				skillId12 = armorSet.getEnchant12skillId();
+				skillId16 = armorSet.getEnchant16skillId();
			}
			else
			{
@@ -621,6 +643,8 @@
					skills = armorSet.getSkills();
					shieldSkill = armorSet.getShieldSkillId();
					skillId6 = armorSet.getEnchant6skillId();
+					skillId12 = armorSet.getEnchant12skillId();
+					skillId16 = armorSet.getEnchant16skillId();
				}
				else if (armorSet.containShield(item.getItemId())) // removed shield
				{
@@ -679,6 +703,24 @@
						_log.warning("Inventory.ArmorSetListener: Incorrect skill: "+skillId6+".");
				}

+				if (skillId12 != 0)
+				{
+					L2Skill skill = SkillTable.getInstance().getInfo(skillId12,1);
+					if (skill != null)
+						player.removeSkill(skill, false, skill.isPassive());
+					else
+						_log.warning("Inventory.ArmorSetListener: Incorrect skill: "+skillId12+".");
+				}
+				
+				if (skillId16 != 0)
+				{
+					L2Skill skill = SkillTable.getInstance().getInfo(skillId16,1);
+					if (skill != null)
+						player.removeSkill(skill, false, skill.isPassive());
+					else
+						_log.warning("Inventory.ArmorSetListener: Incorrect skill: "+skillId16+".");
+				}
+				
				player.checkItemRestriction();
				player.sendSkillList();
			}

Index: java/com/l2jserver/gameserver/model/L2ArmorSet.java
===================================================================
--- java/com/l2jserver/gameserver/model/L2ArmorSet.java	(revision 5101)
+++ java/com/l2jserver/gameserver/model/L2ArmorSet.java	(working copy)
@@ -39,8 +39,10 @@
	private final int _shieldSkillId;

	private final int _enchant6Skill;
+	private final int _enchant12Skill;
+	private final int _enchant16Skill;

-	public L2ArmorSet(int chest, int legs, int head, int gloves, int feet, String[] skills, int shield, int shield_skill_id, int enchant6skill, int mw_legs, int mw_head, int mw_gloves, int mw_feet, int mw_shield)
+	public L2ArmorSet(int chest, int legs, int head, int gloves, int feet, String[] skills, int shield, int shield_skill_id, int enchant6skill, int enchant12skill, int enchant16skill, int mw_legs, int mw_head, int mw_gloves, int mw_feet, int mw_shield)
	{
		_chest = chest;
		_legs = legs;
@@ -58,6 +60,8 @@
		_shieldSkillId = shield_skill_id;

		_enchant6Skill = enchant6skill;
+		_enchant12Skill = enchant12skill;
+		_enchant16Skill = enchant16skill;
	}

	/**
@@ -162,9 +166,21 @@
		return _enchant6Skill;
	}

+	public int getEnchant12skillId()
+	{
+		return _enchant12Skill;
+	}
+	
+	public int getEnchant16skillId()
+	{
+		return _enchant16Skill;
+	}
+	
	public boolean isEnchanted6(L2PcInstance player)
	{
@@ -193,4 +209,58 @@

		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 != 0 && (legsItem == null || legsItem.getEnchantLevel() < 12))
+			return false;
+		if (_gloves != 0 && (glovesItem == null || glovesItem.getEnchantLevel() < 12))
+			return false;
+		if (_head != 0 && (headItem == null || headItem.getEnchantLevel() < 12))
+			return false;
+		if (_feet != 0 && (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 != 0 && (legsItem == null || legsItem.getEnchantLevel() < 16))
+			return false;
+		if (_gloves != 0 && (glovesItem == null || glovesItem.getEnchantLevel() < 16))
+			return false;
+		if (_head != 0 && (headItem == null || headItem.getEnchantLevel() < 16))
+			return false;
+		if (_feet != 0 && (feetItem == null || feetItem.getEnchantLevel() < 16))
+			return false;
+		
+		return true;
+	}
}

 

 

after this you have to add 2 new column at "armorsets" table

 `enchant12skill` smallint(5) unsigned NOT NULL DEFAULT '0',
`enchant16skill` smallint(5) unsigned NOT NULL DEFAULT '0',

 

it explains it self...you have to add the id of the skill that give the stats (\gameserver\data\stats\skills) to the column enchant12skill or enchant16skill of the armor you want

 

or example:

 

<skill id="1234" levels="1" name="Example Stats for the Armorstats">
	<set name="magicLvl" val="1" />
	<set name="target" val="TARGET_SELF" />
	<set name="skillType" val="BUFF" />
	<set name="operateType" val="OP_PASSIVE" />
	<for>
		<add order="0x40" stat="pDef" val="100">
			<using kind="Heavy" />
		</add>
		<add order="0x40" stat="mDef" val="100">
			<using kind="Heavy" />
		</add>
	</for>
</skill>

 

if you care about credits they goes to me

 

  • 4 years later...
Posted

why you undig such old and crappy topics? :D

because for pvp server this custom code can be useful so if someone can adapt it it will be good 

Posted

why you undig such old and crappy topics? :D

 

because for pvp server this custom code can be useful so if someone can adapt it it will be good 

Why is it that the model has not gotten an adaptation and has not found a more current version, but could have been adapted?

  • 4 weeks later...
Posted

Why is it that the model has not gotten an adaptation and has not found a more current version, but could have been adapted?

  :-X  :-X  :-X Up , adapted for L2JFrozen plis?  :-X

  • 5 weeks later...
Posted

my last post was "Posted 29 November 2016 - 10:25 PM" but still nothing ? what the fuck is wrong with this pro forum that everything is so easy ? maybe no one cares if there are not money involved ?

:dat:  :dat:

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.

×
×
  • Create New...