Jump to content

[Share]Hero mxc On Epic Set Wear


Recommended Posts

Hello Ladies. I want to share java code about hero mxc if weared epic set.for example if have Dynasty Set at server. you must go to navicat -> l2jdb open armorsets table and set value 1 in mxchero field.and if your wear dynasty set you become hero!

Credits to La2Base Forum and me for patch create!

 

Let's Start

First make sql script

 

ALTER TABLE `armorsets` ADD COLUMN `mxchero` INTEGER NOT NULL DEFAULT 0;

 

Patch:

 

Index: sf/l2j/gameserver/datatables/ArmorSetsTable.java
===================================================================
--- sf/l2j/gameserver/datatables/ArmorSetsTable.java	(revision 4407)
+++ sf/l2j/gameserver/datatables/ArmorSetsTable.java	(working copy)
@@ -62,7 +62,7 @@
		try
		{
			con = L2DatabaseFactory.getInstance().getConnection();
-			PreparedStatement statement = con.prepareStatement("SELECT chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill FROM armorsets");
+			PreparedStatement statement = con.prepareStatement("SELECT chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill, mxchero FROM armorsets");
			ResultSet rset = statement.executeQuery();

			while(rset.next())
@@ -76,7 +76,8 @@
				int shield = rset.getInt("shield");
				int shield_skill_id = rset.getInt("shield_skill_id");
				int enchant6skill = rset.getInt("enchant6skill");
-				_armorSets.put(chest, new L2ArmorSet(chest, legs, head, gloves, feet,skill_id, shield, shield_skill_id, enchant6skill));
+				int mxchero = rset.getInt("mxchero");
+				_armorSets.put(chest, new L2ArmorSet(chest, legs, head, gloves, feet,skill_id, shield, shield_skill_id, enchant6skill, mxchero));
			}

			_log.config("ArmorSetsTable: Loaded "+_armorSets.size()+" armor sets.");
Index: sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 4407)
+++ sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -452,6 +452,7 @@

	private boolean _noble = false;
	private boolean _hero = false;
+	private boolean _epic = false;

	/** The L2FolkInstance corresponding to the last Folk wich one the player talked. */
	private L2FolkInstance _lastFolkNpc = null;
@@ -8114,6 +8115,23 @@
		sendSkillList();
	}

+	public void setEpic(boolean epic)
+	{
+		if (epic)
+		{
+			sendMessage("You wear Epic Set");
+			sendPacket(new UserInfo(this));
+			broadcastUserInfo();
+		}
+		else
+		{
+			sendPacket(new UserInfo(this));
+			broadcastUserInfo();
+		}
+		_epic = epic;
+
+	}	
+	
	public void setIsInOlympiadMode(boolean b)
     {
     	_inOlympiadMode = b;
@@ -8132,7 +8150,12 @@
     {
         return _hero;
     }
-
+	
+	public boolean isEpic()
+	{
+		return _epic;
+	}
+	
     public boolean isInOlympiadMode()
     {
     	return _inOlympiadMode;
Index: sf/l2j/gameserver/model/Inventory.java
===================================================================
--- sf/l2j/gameserver/model/Inventory.java	(revision 4407)
+++ sf/l2j/gameserver/model/Inventory.java	(working copy)
@@ -309,10 +309,17 @@
     	    		L2Skill skill = SkillTable.getInstance().getInfo(armorSet.getSkillId(),1);
     	    		if(skill != null)
     	    		{
-    	    			player.addSkill(skill, false);
-    	    			player.sendSkillList(); 
-    	    		}
-    	    		else
+				int mxc = armorSet.getmxcHero();
+					if (mxc != 0)
+					{ 
+					player.addSkill(skill, false);
+					player.sendSkillList();
+					player.setEpic(true);
+					}
+					player.addSkill(skill, false);
+					player.sendSkillList(); 
+					}
+						else
     	    			_log.warning("Inventory.ArmorSetListener: Incorrect skill: "+armorSet.getSkillId()+".");
     	    		
     	    		if(armorSet.containShield(player)) // has shield from set
@@ -371,42 +378,44 @@
     		int removeSkillId3 = 0; // enchant +6 skill
     		
     		if(slot == PAPERDOLL_CHEST)
+			{
+				L2ArmorSet armorSet = ArmorSetsTable.getInstance().getSet(item.getItemId());
+			if(armorSet == null)
+				return;
+
+				remove = true;
+				removeSkillId1 = armorSet.getSkillId();
+				removeSkillId2 = armorSet.getShieldSkillId();
+				removeSkillId3 = armorSet.getEnchant6skillId();
+				player.setEpic(false);
+				}
+				else
+				{
+				L2ItemInstance chestItem = getPaperdollItem(PAPERDOLL_CHEST); 
+				if(chestItem == null)
+				return;
+
+				L2ArmorSet armorSet = ArmorSetsTable.getInstance().getSet(chestItem.getItemId());
+				if(armorSet == null)
+				return;
+
+				if(armorSet.containItem(slot, item.getItemId())) // removed part of set
+				{
+				remove = true;
+				removeSkillId1 = armorSet.getSkillId();
+				removeSkillId2 = armorSet.getShieldSkillId();
+				removeSkillId3 = armorSet.getEnchant6skillId();
+				player.setEpic(false);
+				}
+				else if(armorSet.containShield(item.getItemId())) // removed shield
+				{
+				remove = true;
+				removeSkillId2 = armorSet.getShieldSkillId();
+				}
+					}
+
+			if(remove)
     		{
-    			L2ArmorSet armorSet = ArmorSetsTable.getInstance().getSet(item.getItemId());
-    			if(armorSet == null)
-    				return;
-    			
-    			remove = true;
-    			removeSkillId1 = armorSet.getSkillId();
-    			removeSkillId2 = armorSet.getShieldSkillId();
-    			removeSkillId3 = armorSet.getEnchant6skillId();
-    		}
-    		else
-    		{
-    			L2ItemInstance chestItem = getPaperdollItem(PAPERDOLL_CHEST); 
-    			if(chestItem == null)
-    				return;
-    			
-    			L2ArmorSet armorSet = ArmorSetsTable.getInstance().getSet(chestItem.getItemId());
-    			if(armorSet == null)
-    				return;
-    			
-    			if(armorSet.containItem(slot, item.getItemId())) // removed part of set
-    			{
-    				remove = true;
-    				removeSkillId1 = armorSet.getSkillId();
-    				removeSkillId2 = armorSet.getShieldSkillId();
-    				removeSkillId3 = armorSet.getEnchant6skillId();
-    			}
-    			else if(armorSet.containShield(item.getItemId())) // removed shield
-    			{
-    				remove = true;
-    				removeSkillId2 = armorSet.getShieldSkillId();
-    			}
-    		}
-    		
-    		if(remove)
-    		{
     			if(removeSkillId1 != 0)
     			{
         			L2Skill skill = SkillTable.getInstance().getInfo(removeSkillId1,1);
Index: sf/l2j/gameserver/model/L2ArmorSet.java
===================================================================
--- sf/l2j/gameserver/model/L2ArmorSet.java	(revision 4407)
+++ sf/l2j/gameserver/model/L2ArmorSet.java	(working copy)
@@ -39,8 +39,9 @@
	private final int _shieldSkillId;

	private final int _enchant6Skill;
+	private final int _mxcHero;

-	public L2ArmorSet(int chest, int legs, int head, int gloves, int feet, int skill_id, int shield, int shield_skill_id, int enchant6skill)
+	public L2ArmorSet(int chest, int legs, int head, int gloves, int feet, int skill_id, int shield, int shield_skill_id, int enchant6skill, int mxcHero)
	{
		_chest = chest;
		_legs  = legs;
@@ -53,6 +54,7 @@
		_shieldSkillId = shield_skill_id;

		_enchant6Skill = enchant6skill;
+		_mxcHero = mxcHero;
	}
	/**
	 * Checks if player have equiped all items from set (not checking shield)
@@ -143,6 +145,10 @@
	{
		return _enchant6Skill;
	}
+	public int getmxcHero()
+	{
+		return _mxcHero;
+	}	
	/**
	 * Checks if all parts of set are enchanted to +6 or more
	 * @param player
Index: sf/l2j/gameserver/serverpackets/CharInfo.java
===================================================================
--- sf/l2j/gameserver/serverpackets/CharInfo.java	(revision 4407)
+++ sf/l2j/gameserver/serverpackets/CharInfo.java	(working copy)
@@ -325,7 +325,7 @@

			writeD(_activeChar.getClanCrestLargeId());
			writeC(_activeChar.isNoble() ? 1 : 0); // Symbol on char menu ctrl+I
-			writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_mxc)) ? 1 : 0); // Hero mxc
+			writeC((_activeChar.isHero() ||  (_activeChar.isEpic()) || (_activeChar.isGM() && Config.GM_HERO_mxc)) ? 1 : 0); // Hero mxc

			writeC(_activeChar.isFishing() ? 1 : 0); //0x01: Fishing Mode (Cant be undone by setting back to 0)
			writeD(_activeChar.GetFishx());
Index: sf/l2j/gameserver/serverpackets/UserInfo.java
===================================================================
--- sf/l2j/gameserver/serverpackets/UserInfo.java	(revision 4407)
+++ sf/l2j/gameserver/serverpackets/UserInfo.java	(working copy)
@@ -294,7 +294,7 @@

         writeD(_activeChar.getClanCrestLargeId());
         writeC(_activeChar.isNoble() ? 1 : 0); //0x01: symbol on char menu ctrl+I
-        writeC((_activeChar.isHero() || (_activeChar.isGM() && Config.GM_HERO_mxc)) ? 1 : 0); //0x01: Hero mxc
+        writeC((_activeChar.isHero() ||  (_activeChar.isEpic()) || (_activeChar.isGM() && Config.GM_HERO_mxc)) ? 1 : 0); //0x01: Hero mxc

         writeC(_activeChar.isFishing() ? 1 : 0); //Fishing Mode
         writeD(_activeChar.GetFishx()); //fishing x

 

Thats all.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

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.

 Share



×
×
  • Create New...