EdenEternal Posted August 2, 2010 Posted August 2, 2010 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. Quote
vagos123 Posted August 2, 2010 Posted August 2, 2010 O YEAH! smthing i was looking for! going to test it right away! ty man Quote
tadas83871 Posted August 2, 2010 Posted August 2, 2010 Y agree it's something uniq but I want ask it's posible to make hero aura different color then the normal 1 when u become hero? Quote
RainWalker Posted August 2, 2010 Posted August 2, 2010 lol Leki your lately shares are freaking awesome well done dude ;D Quote
EdenEternal Posted August 2, 2010 Author Posted August 2, 2010 is that yours -.- ? Credits to La2Base Forum and me for patch create! Quote
][HeRoMaN][ Posted August 2, 2010 Posted August 2, 2010 Very Good Share. Continue To Make Shares Like That! Quote
Fanky Posted August 2, 2010 Posted August 2, 2010 good job, keep sharing. but i suggest you to create something on your own. btw thanks. Quote
Recommended Posts
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.