Jump to content

HyperBlown

Gaming Moderator
  • Posts

    836
  • Credits

  • Joined

  • Last visited

  • Days Won

    8
  • Feedback

    100%

Everything posted by HyperBlown

  1. add on the lines of the item <set name="item_skill" val="SKILLID-SKILLLEVEL" />
  2. Hello, I came here just to say what I find that needs to be implemented in this forum. we all know the following sections: Server Development Discussion [L2OFF] Server Development Discussion [L2J] Client Development Discussion and I was thinking, Why dont the staff ordens the topics: "Server Dev Help", "Shares and Files" and "Client Dev Help" per chronicle? Well, I think you guys got the example. It would look very clean and ordened. Hope you guys like this idea
  3. Asuki you mean? I already have. but dont have them. also, he is getting a pause in lineage 2 editions. he is focusing now into his modeling skills on Unreal engine. thx for the reply
  4. for interlude i have them aswell, but I cant transfer from IL to H5, also IL is missing 3 weapons for kamael. Ty for the extra fotos :3
  5. Hello maxcheaters. Im interested in buying the emerald weapona from god+ to H5. (example in attachment) Do you have it? pm with prove and price. Or if shared, please tell me. also if you know any server(H5) that has it. att Marciox25
  6. his adress is attached. I hope you delete your message and bluur or remove his address
  7. well, send proof of deposit
  8. Hello maxcheaters After reading in a post that no-ip is a honeypot for fbi agency, I started to reask my self If I should keep using no-ip or move to another one. Do you guys know any free dns sites that works like the redirection from no-ip does? Thank you in advance. Marciox25
  9. Can you only encrypt texture and animation files? or also protect the .dat and .ini ?
  10. This pack is a totally mistake by Gandalf it self. "Limited players". All he can do is decompile packs, and steal things from it, and put his assignature under it... I wouldnt not recommend this revision because it is shit. But for those who want it, here is a Unlimited player revision: https://mega.nz/#!JEESnSJb!rZedYlH0wR4LVIqH2OfbwWt4hU4fsaA8mSkRbY7-SMY Have fun with all these bugs (duplication, skill etc) Edit: not only Gandalf can Decompile. But if you do, make the right choise just like denieing the limitation of players .... Unlimited players revision recompilation credits : Leo >.>'
  11. code for frozen, other versions will need adaptation ### Eclipse Workspace Patch 1.0 #P L2jFrozen_DataPack Index: data/html/mods/change_password.htm =================================================================== --- data/html/mods/change_password.htm (revision 0) +++ data/html/mods/change_password.htm (working copy) @@ -0,0 +1,35 @@ +<html> + <body> + <center><img src=L2UI_CH3.herotower_deco width=256 height=32></center><br> + <center><font color="008080">Change Password</font></center> + <center> + <table cellspacing=-1> + <tr><td><img src="L2UI.SquareBlank" width=40 height=20></td></tr> + </table> + <center><img src=L2UI.SquareGray width=250 height=1></center> + <img src="L2UI.SquareBlank" width=40 height=2> + <center><img src="L2UI.SquareGray" width=300 height=1></center> + <table bgcolor=000000 width=300 height=47> + <tr><td><center>First fill in your <font color=LEVEL>current password</font> and then your new!</center></td></tr> + </table> + <center><img src="L2UI.SquareGray" width=300 height=1></center> + <img src="L2UI.SquareBlank" width=40 height=2> + <center><img src=L2UI.SquareGray width=250 height=1></center> + <table cellspacing=-1> + <tr><td><img src="L2UI.SquareBlank" width=40 height=20></td></tr> + </table> + </center> + <table width=256> + <tr><td align=right><font color="3366FF">Current Password:</font></td><td><edit var="curPass" type="password" width=125 height=15></td></tr> + <tr><td align=right><font color="3366FF">New Password:</font></td><td><edit var="newPass" type="password" width=125 height=15></td></tr> + <tr><td align=right><font color="3366FF">Repeat Password:</font></td><td><edit var="repPass" type="password" width=125 height=15></td></tr> + </table> + <br><br> + <center> + <button value="Change" action="bypass -h npc_%objectId%_change_password $curPass $newPass $repPass" width=75 height=21 back="L2UI_CH3.Btn1_normal_over" fore="L2UI_CH3.Btn1_normal"> + <br><br> + <font color="LEVEL">Copyright 2013 i9 Games TM.</font><br1> + <font color="0066FF">www.i9games.com</font> + </center> + </body> +</html> \ No newline at end of file #P L2jFrozen_GameServer Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2ChangePasswordInstance.java =================================================================== --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2ChangePasswordInstance.java (revision 0) +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2ChangePasswordInstance.java (working copy) @@ -0,0 +1,220 @@ +/* This program 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 2, or (at your option) + * any later version. + * + * This program 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, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * http://www.gnu.org/copyleft/gpl.html + */ +package com.l2jfrozen.gameserver.model.actor.instance; + +import java.security.MessageDigest; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.util.StringTokenizer; + +import com.l2jfrozen.Config; +import com.l2jfrozen.crypt.Base64; +import com.l2jfrozen.gameserver.ai.CtrlIntention; +import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed; +import com.l2jfrozen.gameserver.network.serverpackets.LeaveWorld; +import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected; +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage; +import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation; +import com.l2jfrozen.gameserver.templates.L2NpcTemplate; +import com.l2jfrozen.util.CloseUtil; +import com.l2jfrozen.util.database.L2DatabaseFactory; + +public class L2ChangePasswordInstance extends L2FolkInstance +{ + public L2ChangePasswordInstance(int objectId, L2NpcTemplate template) + { + super(objectId, template); + } + + @Override + public void onAction(L2PcInstance player) + { + if (!canTarget(player)) + { + return; + } + + player.setLastFolkNPC(this); + + // Check if the L2PcInstance already target the L2NpcInstance + if (this != player.getTarget()) + { + // Set the target of the L2PcInstance player + player.setTarget(this); + + // Send a Server->Client packet MyTargetSelected to the L2PcInstance player + MyTargetSelected my = new MyTargetSelected(getObjectId(), 0); + player.sendPacket(my); + my = null; + + // Send a Server->Client packet ValidateLocation to correct the L2NpcInstance position and heading on the client + player.sendPacket(new ValidateLocation(this)); + } + else + { + // Calculate the distance between the L2PcInstance and the L2NpcInstance + if (!canInteract(player)) + { + // Notify the L2PcInstance AI with AI_INTENTION_INTERACT + player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this); + } + else + { + showHtmlWindow(player); + } + } + + player.sendPacket(new ActionFailed()); + } + + private void showHtmlWindow(L2PcInstance player) + { + String filename = "data/html/mods/change_password.htm"; + NpcHtmlMessage html = new NpcHtmlMessage(1); + html.setFile(filename); + html.replace("%objectId%", String.valueOf(getObjectId())); + player.sendPacket(html); + filename = null; + html = null; + } + + @Override + public void onBypassFeedback(L2PcInstance player, String command) + { + if (command.startsWith("change_password")) + { + StringTokenizer st = new StringTokenizer(command); + st.nextToken(); + String curPass = null; + String newPass = null; + String repPass = null; + try + { + if (st.hasMoreTokens()) + { + curPass = st.nextToken(); + newPass = st.nextToken(); + repPass = st.nextToken(); + } + else + { + player.sendMessage("Please fill in all the blanks before requesting for a password change."); + return; + } + changePassword(curPass, newPass, repPass, player); + } + catch (StringIndexOutOfBoundsException e) + { + if (Config.ENABLE_ALL_EXCEPTIONS) + { + e.printStackTrace(); + } + } + } + } + + public static boolean changePassword(String currPass, String newPass, String repeatNewPass, L2PcInstance activeChar) + { + if (newPass.length() < 3) + { + activeChar.sendMessage("The new password is too short!"); + return false; + } + if (newPass.length() > 16) + { + activeChar.sendMessage("The new password is too long!"); + return false; + } + if (!newPass.equals(repeatNewPass)) + { + activeChar.sendMessage("Repeated password doesn't match the new password."); + return false; + } + + Connection con = null; + String password = null; + try + { + MessageDigest md = MessageDigest.getInstance("SHA"); + byte[] raw = currPass.getBytes("UTF-8"); + raw = md.digest(raw); + String currPassEncoded = Base64.encodeBytes(raw); + + con = L2DatabaseFactory.getInstance().getConnection(false); + PreparedStatement statement = con.prepareStatement("SELECT password FROM accounts WHERE login=?"); + statement.setString(1, activeChar.getAccountName()); + ResultSet rset = statement.executeQuery(); + while (rset.next()) + { + password = rset.getString("password"); + } + rset.close(); + statement.close(); + byte[] password2 = null; + if (currPassEncoded.equals(password)) + { + password2 = newPass.getBytes("UTF-8"); + password2 = md.digest(password2); + + PreparedStatement statement2 = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?"); + statement2.setString(1, Base64.encodeBytes(password2)); + statement2.setString(2, activeChar.getAccountName()); + statement2.executeUpdate(); + statement2.close(); + + activeChar.sendMessage("Your password has been changed successfully! For security reasons, You will be disconnected. Please login again!"); + try + { + Thread.sleep(3000L); + } + catch (Exception e) + { + if (Config.ENABLE_ALL_EXCEPTIONS) + { + e.printStackTrace(); + } + } + + activeChar.deleteMe(); + activeChar.sendPacket(new LeaveWorld()); + } + else + { + activeChar.sendMessage("The current password you've inserted is incorrect! Please try again!"); + + return password2 != null; + } + } + catch (Exception e) + { + if (Config.ENABLE_ALL_EXCEPTIONS) + { + e.printStackTrace(); + } + + _log.warning("could not update the password of account: " + activeChar.getAccountName()); + } + finally + { + CloseUtil.close(con); + } + + return true; + } +} \ No newline at end of file SQL: INSERT IGNORE INTO `custom_npc` VALUES ('55', '30026', 'Julio', '1', 'Change Password', '1', 'NPC.a_fighterguild_master_Mhuman', '8.00', '23.50', '70', 'male', 'L2ChangePassword', '40', '3862', '1493', '11.85', '2.78', '40', '43', '30', '21', '20', '10', '0', '0', '1314', '470', '780', '382', '278', '0', '333', '0', '0', '0', '55', '132', null, '0', '1', '0', 'LAST_HIT');
  12. Do you still have the Files of the server? If so, you can get them easy. But if the files are protected, meh you know it ;P
  13. stop trying to duplicate items and play normal ...
  14. What you can do is buy a "Balancer" for your revision. IF you have source ofcorse
  15. You said the same about L2Elcardia. it was a faillure
  16. will need to adapt to IL. but is the same code. Equip item u want, and type ".dressme" ### Eclipse Workspace Patch 1.0 #P CT25-DataPack Index: dist/game/data/scripts/handlers/voicedcommandhandlers/VisualArmor.java =================================================================== --- dist/game/data/scripts/handlers/voicedcommandhandlers/VisualArmor.java (revision 0) +++ dist/game/data/scripts/handlers/voicedcommandhandlers/VisualArmor.java (working copy) @@ -0,0 +1,51 @@ +package handlers.voicedcommandhandlers; + +import ct25.xtreme.extensions.VisualArmorController; +import ct25.xtreme.gameserver.handler.IVoicedCommandHandler; +import ct25.xtreme.gameserver.model.actor.instance.L2PcInstance; +import ct25.xtreme.gameserver.network.serverpackets.InventoryUpdate; + +public class VisualArmor implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = + { + "dressme", "dressMe", "DressMe", "cloakOn", "cloakOff" + }; + + + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params) + { + if(command.contains("cloakOn")) + { + activeChar.visualArmor.weaponLRHANDId =0; + InventoryUpdate iu = new InventoryUpdate(); + activeChar.sendPacket(iu); + activeChar.broadcastUserInfo(); + InventoryUpdate iu2 = new InventoryUpdate(); + activeChar.sendPacket(iu2); + activeChar.broadcastUserInfo(); + activeChar.sendMessage("Cloak enabled."); + } + else if(command.contains("cloakOff")) + { + activeChar.visualArmor.weaponLRHANDId =1; + InventoryUpdate iu = new InventoryUpdate(); + activeChar.sendPacket(iu); + activeChar.broadcastUserInfo(); + InventoryUpdate iu2 = new InventoryUpdate(); + activeChar.sendPacket(iu2); + activeChar.broadcastUserInfo(); + activeChar.sendMessage("Cloak disabled."); + } + else + VisualArmorController.dressMe(activeChar); + + return true; + } + + + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} \ No newline at end of file Index: dist/game/data/scripts/handlers/MasterHandler.java =================================================================== --- dist/game/data/scripts/handlers/MasterHandler.java (revision 19) +++ dist/game/data/scripts/handlers/MasterHandler.java (working copy) @@ -247,6 +247,7 @@ import handlers.voicedcommandhandlers.Hellbound; import handlers.voicedcommandhandlers.Lang; import handlers.voicedcommandhandlers.TvTVoicedInfo; +import handlers.voicedcommandhandlers.VisualArmor; import handlers.voicedcommandhandlers.Wedding; import handlers.voicedcommandhandlers.stats; @@ -556,6 +557,7 @@ if (Config.L2JMOD_HELLBOUND_STATUS) VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new Hellbound()); + VoicedCommandHandler.getInstance().registerVoicedCommandHandler(new VisualArmor()); _log.config("Loaded " + VoicedCommandHandler.getInstance().size() + " VoicedHandlers"); } #P CT25-GameServer Index: java/ct25/xtreme/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- java/ct25/xtreme/gameserver/model/actor/instance/L2PcInstance.java (revision 19) +++ java/ct25/xtreme/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -38,6 +38,7 @@ import ct25.xtreme.Config; import ct25.xtreme.L2DatabaseFactory; +import ct25.xtreme.extensions.VisualArmorModel; import ct25.xtreme.gameserver.Announcements; import ct25.xtreme.gameserver.GameTimeController; import ct25.xtreme.gameserver.GeoData; @@ -278,6 +279,8 @@ */ public final class L2PcInstance extends L2Playable { + //Dresseme + public VisualArmorModel visualArmor; // Character Skill SQL String Definitions: private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE charId=? AND class_index=?"; private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (charId,skill_id,skill_level,class_index) VALUES (?,?,?,?)"; @@ -1239,6 +1242,7 @@ _radar = new L2Radar(this); startVitalityTask(); + visualArmor = new VisualArmorModel(this); } private L2PcInstance(int objectId) @@ -7265,6 +7269,7 @@ if (!Config.WAREHOUSE_CACHE) player.getWarehouse(); + // Retrieve from the database all secondary data of this L2PcInstance // and reward expertise/lucky skills if necessary. // Note that Clan, Noblesse and Hero skills are given separately and not here. Index: java/ct25/xtreme/gameserver/GameServer.java =================================================================== --- java/ct25/xtreme/gameserver/GameServer.java (revision 19) +++ java/ct25/xtreme/gameserver/GameServer.java (working copy) @@ -32,6 +32,7 @@ import ct25.xtreme.Config; import ct25.xtreme.L2DatabaseFactory; import ct25.xtreme.Server; +import ct25.xtreme.extensions.VisualArmorController; import ct25.xtreme.gameserver.cache.CrestCache; import ct25.xtreme.gameserver.cache.HtmCache; import ct25.xtreme.gameserver.datatables.AccessLevels; @@ -318,6 +319,7 @@ BoatManager.getInstance(); AirShipManager.getInstance(); GraciaSeedsManager.getInstance(); + VisualArmorController.load(); try { Index: java/ct25/xtreme/extensions/VisualArmorModel.java =================================================================== --- java/ct25/xtreme/extensions/VisualArmorModel.java (revision 0) +++ java/ct25/xtreme/extensions/VisualArmorModel.java (working copy) @@ -0,0 +1,156 @@ +package ct25.xtreme.extensions; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import ct25.xtreme.L2DatabaseFactory; +import ct25.xtreme.gameserver.model.actor.instance.L2PcInstance; +import ct25.xtreme.gameserver.network.serverpackets.InventoryUpdate; + +/** + * @author Issle + * + */ + public class VisualArmorModel + { + private static final String RESTORE_VISUAL_ARMOR = "SELECT GlovesId,ChestId,BootsId,PantsId,LeftHandId,RightHandId,DoubleHandId FROM visual_armor WHERE CharId=?"; + private static final String UPDATE_VISUAL_ARMOR = "UPDATE visual_armor SET GlovesId=?,ChestId=?,BootsId=?,PantsId=?,LeftHandId=?,RightHandId=?,DoubleHandId=? WHERE CharId=?"; + private static final String CREATE_VISUAL_ARMOR = "INSERT INTO visual_armor (CharId,GlovesId,ChestId,BootsId,PantsId,LeftHandId,RightHandId,DoubleHandId) values (?,?,?,?,?,?,?,?)"; + + public static final String CREATE = + "CREATE TABLE IF NOT EXISTS `visual_armor` (" + + "`CharId` int(11) NOT NULL," + + "`GlovesId` int(11) NOT NULL DEFAULT '0'," + + "`BootsId` int(11) NOT NULL DEFAULT '0'," + + "`ChestId` int(11) NOT NULL DEFAULT '0'," + + "`PantsId` int(11) NOT NULL DEFAULT '0'," + + "`LeftHandId` int(11) NOT NULL DEFAULT '0'," + + "`RightHandId` int(11) NOT NULL DEFAULT '0'," + + "`DoubleHandId` int(11) NOT NULL DEFAULT '0',PRIMARY KEY (`CharId`))"; + + public static final String DROP = + "DROP TABLE 'visual_armor'"; + + public int glovesTextureId=0; + public int armorTextureId=0; + public int pantsTextureId=0; + public int bootsTextureId=0; + public int weaponLHANDId=0; + public int weaponRHANDId=0; + public int weaponLRHANDId=0; + public int ownerId; + + + public void updateVisualArmor() + { + Connection con = null; + try + { + con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement = con.prepareStatement(UPDATE_VISUAL_ARMOR); + statement.setInt(1, glovesTextureId); + statement.setInt(2, armorTextureId); + statement.setInt(3, bootsTextureId); + statement.setInt(4, pantsTextureId); + statement.setInt(5, weaponLHANDId); + statement.setInt(6, weaponRHANDId); + statement.setInt(7, weaponLRHANDId); + statement.setInt(8, ownerId); + statement.execute(); + statement.close(); + + } + catch (SQLException e) + { + e.printStackTrace(); + } + finally + { + try { con.close(); } catch (Exception e) {} + } + } + + public VisualArmorModel(L2PcInstance activeChar) + { + ownerId = activeChar.getObjectId(); + Connection con = null; + try + { + con = L2DatabaseFactory.getInstance().getConnection(); + + PreparedStatement statement = con.prepareStatement(RESTORE_VISUAL_ARMOR); + statement.setInt(1, ownerId); + ResultSet rset = statement.executeQuery(); + boolean got = false; + while(rset.next()) + { + glovesTextureId = rset.getInt("GlovesId"); + armorTextureId = rset.getInt("ChestId"); + pantsTextureId = rset.getInt("PantsId"); + bootsTextureId = rset.getInt("BootsId"); + weaponLHANDId = rset.getInt("LeftHandId"); + weaponRHANDId = rset.getInt("RightHandId"); + weaponLRHANDId = rset.getInt("DoubleHandId"); + got = true; + + } + + rset.close(); + statement.close(); + + if(got == false) + { + createVisualArmor(); + } + + InventoryUpdate iu = new InventoryUpdate(); + activeChar.sendPacket(iu); + activeChar.broadcastUserInfo(); + InventoryUpdate iu2 = new InventoryUpdate(); + activeChar.sendPacket(iu2); + activeChar.broadcastUserInfo(); + activeChar.sendMessage("You changed clothes."); + } + catch (SQLException e) + { + e.printStackTrace(); + } + finally + { + try { con.close(); } catch (Exception e) {} + } + } + + public void createVisualArmor() throws SQLException + { + Connection con = null; + + try + { + con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement = con.prepareStatement(CREATE_VISUAL_ARMOR); + + statement.setInt(1, ownerId); + statement.setInt(2, 0); + statement.setInt(3, 0); + statement.setInt(4, 0); + statement.setInt(5, 0); + statement.setInt(6, 0); + statement.setInt(7, 0); + statement.setInt(8, 0); + + statement.executeUpdate(); + statement.close(); + } + catch (Exception e) + { + e.printStackTrace(); + } + finally + { + try { con.close(); } catch (Exception e) {} + } + } + +} \ No newline at end of file Index: java/ct25/xtreme/gameserver/network/serverpackets/CharInfo.java =================================================================== --- java/ct25/xtreme/gameserver/network/serverpackets/CharInfo.java (revision 19) +++ java/ct25/xtreme/gameserver/network/serverpackets/CharInfo.java (working copy) @@ -17,6 +17,7 @@ import java.util.logging.Logger; import ct25.xtreme.Config; +import ct25.xtreme.extensions.VisualArmorController; import ct25.xtreme.gameserver.datatables.NpcTable; import ct25.xtreme.gameserver.instancemanager.CursedWeaponsManager; import ct25.xtreme.gameserver.model.actor.L2Decoy; @@ -249,20 +250,20 @@ writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HEAD)); if (_airShipHelm == 0) { - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND)); - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LHAND)); + writeD(VisualArmorController.getRHAND(_activeChar)); + writeD(VisualArmorController.getLHAND(_activeChar)); } else { writeD(_airShipHelm); writeD(0); } - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_GLOVES)); - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_CHEST)); - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LEGS)); - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FEET)); - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_CLOAK)); - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND)); + writeD(VisualArmorController.getVirtualGloves(_activeChar)); + writeD(VisualArmorController.getVirtualBody(_activeChar)); + writeD(VisualArmorController.getVirtualPants(_activeChar)); + writeD(VisualArmorController.getVirtualBoots(_activeChar)); + writeD(VisualArmorController.getCloak(_activeChar)); + writeD(VisualArmorController.getRHAND(_activeChar)); writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIR)); writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIR2)); // T1 new d's Index: java/ct25/xtreme/gameserver/network/serverpackets/UserInfo.java =================================================================== --- java/ct25/xtreme/gameserver/network/serverpackets/UserInfo.java (revision 19) +++ java/ct25/xtreme/gameserver/network/serverpackets/UserInfo.java (working copy) @@ -15,6 +15,7 @@ package ct25.xtreme.gameserver.network.serverpackets; import ct25.xtreme.Config; +import ct25.xtreme.extensions.VisualArmorController; import ct25.xtreme.gameserver.datatables.NpcTable; import ct25.xtreme.gameserver.instancemanager.CursedWeaponsManager; import ct25.xtreme.gameserver.instancemanager.TerritoryWarManager; @@ -192,20 +193,20 @@ writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HEAD)); if (_airShipHelm == 0) { - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND)); + writeD(VisualArmorController.getRHAND(_activeChar) ); + writeD(VisualArmorController.getLHAND(_activeChar) ); } else { writeD(_airShipHelm); writeD(0); } - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CLOAK)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND)); + writeD(VisualArmorController.getVirtualGloves(_activeChar)); + writeD(VisualArmorController.getVirtualBody(_activeChar)); + writeD(VisualArmorController.getVirtualPants(_activeChar)); + writeD(VisualArmorController.getVirtualBoots(_activeChar)); + writeD(VisualArmorController.getCloak(_activeChar)); + writeD(VisualArmorController.getRHAND(_activeChar)); writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR)); writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR2)); writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RBRACELET)); Index: java/ct25/xtreme/extensions/VisualArmorController.java =================================================================== --- java/ct25/xtreme/extensions/VisualArmorController.java (revision 0) +++ java/ct25/xtreme/extensions/VisualArmorController.java (working copy) @@ -0,0 +1,355 @@ +package ct25.xtreme.extensions; + +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import ct25.xtreme.L2DatabaseFactory; +import ct25.xtreme.gameserver.datatables.ItemTable; +import ct25.xtreme.gameserver.model.L2ItemInstance; +import ct25.xtreme.gameserver.model.actor.instance.L2PcInstance; +import ct25.xtreme.gameserver.model.itemcontainer.Inventory; +import ct25.xtreme.gameserver.network.serverpackets.InventoryUpdate; +import ct25.xtreme.gameserver.templates.item.L2Armor; +import ct25.xtreme.gameserver.templates.item.L2ArmorType; +import ct25.xtreme.gameserver.templates.item.L2Item; +import ct25.xtreme.gameserver.templates.item.L2Weapon; +import ct25.xtreme.gameserver.templates.item.L2WeaponType; + +/** + * @author giorgakis + * + */ +public class VisualArmorController +{ + //As of freya there are 19 weapon types. + public static final int totalWeaponTypes = 19; + + //As of freya there are 6 armor types. + public static final int totalArmorTypes = 6; + + public static boolean[][] weaponMapping = new boolean[totalWeaponTypes][totalWeaponTypes]; + public static boolean[][] armorMapping = new boolean[totalArmorTypes][totalArmorTypes]; + + public static void migrate() + { + System.out.println("[VisualArmor]:Migrating the database."); + Connection con = null; + try + { + con = L2DatabaseFactory.getInstance().getConnection(); + PreparedStatement statement = con.prepareStatement(VisualArmorModel.CREATE); + statement.execute(); + statement.close(); + } + catch (SQLException e) + { + e.printStackTrace(); + } + finally + { + try { con.close(); } catch (Exception e) {} + } + } + + public static void load() + { + migrate(); + generateMappings(); + } + + /** + * All same type armors and same type weapons can get visual. All different types + * cannot get visual unless it is stated in here. + */ + public static void generateMappings() + { + for(int i =0; i< weaponMapping.length; i++) + for(int j = 0; j< weaponMapping.length; j++) + weaponMapping[i][j]=false; + + for(int i =0; i< armorMapping.length; i++) + for(int j = 0; j< armorMapping.length; j++) + armorMapping[i][j]=false; + + callRules(); + + } + + public static void callRules() + { + //Example: a Virtual sword can mount an Equipped blunt. + weaponMapping[L2WeaponType.SWORD.ordinal()][L2WeaponType.BLUNT.ordinal()] = true; + + //Example: a Virtual blunt can mount an Equipped sword. + weaponMapping[L2WeaponType.BLUNT.ordinal()][L2WeaponType.SWORD.ordinal()] = true; + + weaponMapping[L2WeaponType.BIGSWORD.ordinal()][L2WeaponType.BIGBLUNT.ordinal()] = true; + weaponMapping[L2WeaponType.BIGBLUNT.ordinal()][L2WeaponType.BIGSWORD.ordinal()] = true; + + armorMapping[L2ArmorType.SIGIL.ordinal()][L2ArmorType.SHIELD.ordinal()] = true; + armorMapping[L2ArmorType.SHIELD.ordinal()][L2ArmorType.SIGIL.ordinal()] = true; + + //armorMapping[L2ArmorType.HEAVY.ordinal()][L2ArmorType.LIGHT.ordinal()] = true; + //armorMapping[L2ArmorType.HEAVY.ordinal()][L2ArmorType.MAGIC.ordinal()] = true; + + //armorMapping[L2ArmorType.LIGHT.ordinal()][L2ArmorType.HEAVY.ordinal()] = true; + //armorMapping[L2ArmorType.LIGHT.ordinal()][L2ArmorType.MAGIC.ordinal()] = true; + + //armorMapping[L2ArmorType.MAGIC.ordinal()][L2ArmorType.LIGHT.ordinal()] = true; + //armorMapping[L2ArmorType.MAGIC.ordinal()][L2ArmorType.HEAVY.ordinal()] = true; + } + + /** + * Checks if the weapon is the same type. If that is true then return + * the matching virtual id. Else check the mapping tables if any + * rule states that the two different weapon types should be matched. + * @param virtual + * @param equiped + * @param matchId + * @param noMatchId + * @return + */ + public static int weaponMatching(L2WeaponType virtual, L2WeaponType equiped, int matchId, int noMatchId) + { + if(virtual == equiped) + return matchId; + + if(weaponMapping[virtual.ordinal()][equiped.ordinal()] == true) + { + return matchId; + } + + return noMatchId; + } + +/** +* Checks if the armor is the same type. If that is true then return +* the matching virtual id. Else check the mapping tables if any +* rule states that the two different armor types should be matched. +* @param virtual +* @param equiped +* @param matchId +* @param noMatchId +* @return +*/ + public static int armorMatching(L2ArmorType virtual, L2ArmorType equiped, int matchId , int noMatchId) + { + if(virtual == equiped) + return matchId; + +if (armorMapping[virtual.ordinal()][equiped.ordinal()] == true) + return matchId; + + return noMatchId; + } + + public static void setVirtualRhand(L2PcInstance actor) + { + actor.visualArmor.weaponRHANDId = actor.getInventory().getPaperdollItemId(Inventory. PAPERDOLL_RHAND); + } + + public static void setVirtualLhand(L2PcInstance actor) + { + actor.visualArmor.weaponLHANDId = actor.getInventory().getPaperdollItemId(Inventory. PAPERDOLL_LHAND); + } + + public static void setVirtualGloves(L2PcInstance actor) + { + actor.visualArmor.glovesTextureId = actor.getInventory().getPaperdollItemId(Inventory. PAPERDOLL_GLOVES); + } + + public static void setVirtualBody(L2PcInstance actor) + { + actor.visualArmor.armorTextureId = actor.getInventory().getPaperdollItemId(Inventory. PAPERDOLL_CHEST); + } + + public static void setVirtualPants(L2PcInstance actor) + { + int chestId = actor.getInventory().getPaperdollItemId(Inventory. PAPERDOLL_CHEST); + int pantsId = actor.getInventory().getPaperdollItemId(Inventory. PAPERDOLL_LEGS); + + if(chestId != 0 && pantsId==0) + actor.visualArmor.pantsTextureId = chestId; + else + actor.visualArmor.pantsTextureId = pantsId; + } + + public static void setVirtualBoots(L2PcInstance actor) + { + actor.visualArmor.bootsTextureId = actor.getInventory().getPaperdollItemId(Inventory. PAPERDOLL_FEET); + } + + //TODO: Merge the armor getters in one function. + public static int getVirtualGloves(L2PcInstance actor) + { + L2ItemInstance equipedItem = actor.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES); + if(equipedItem == null) + return 0; + //ClassCastException wont happen unless some jackass changes the values from the database. + L2Armor equipedGloves = (L2Armor)actor.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES).getItem(); + int equipedGlovesId = actor.getInventory().getPaperdollItemId(Inventory. PAPERDOLL_GLOVES); + + int glovesTextureId = actor.visualArmor.glovesTextureId; + L2Armor virtualGloves = (L2Armor)ItemTable.getInstance().getTemplate(glovesTextureId); + + if(glovesTextureId != 0) + return armorMatching(virtualGloves.getItemType(), equipedGloves.getItemType(),glovesTextureId, equipedGlovesId); + else + return equipedGlovesId; + } + + public static int getVirtualBody(L2PcInstance actor) + { + L2ItemInstance equipedItem = actor.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST); + if(equipedItem == null) + return 0; + //ClassCastException wont happen unless some jackass changes the values from the database. + L2Armor equipedChest = (L2Armor)actor.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem(); + int equipedChestId = actor.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST); + + int chestTextureId = actor.visualArmor.armorTextureId; + L2Armor virtualChest = (L2Armor)ItemTable.getInstance().getTemplate(chestTextureId); + + if(chestTextureId != 0) + return armorMatching(virtualChest.getItemType(), equipedChest.getItemType(),chestTextureId, equipedChestId); + else + return equipedChestId; + } + + /** + * This is a brain fu**er handling the pants since they are + * also part of a fullbody armor. + * @param actor + * @return + */ + public static int getVirtualPants(L2PcInstance actor) + { + L2ItemInstance equipedItem = actor.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS); + + //Here comes the tricky part. If pants are null, then check for a fullbody armor. + if(equipedItem == null) + equipedItem = actor.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST); + if(equipedItem == null) + return 0; + + int pantsTextureId = actor.visualArmor.pantsTextureId; + + L2Armor equipedPants = (L2Armor) equipedItem.getItem(); + + if(equipedPants.getBodyPart() != L2Item.SLOT_FULL_ARMOR && equipedPants.getBodyPart() != L2Item.SLOT_LEGS) + return 0; + int equipedPantsId = actor.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS); + + + L2Armor virtualPants = (L2Armor)ItemTable.getInstance().getTemplate(pantsTextureId); + + if(pantsTextureId != 0) + return armorMatching(virtualPants.getItemType(), equipedPants.getItemType(),pantsTextureId, equipedPantsId); + else + return equipedPantsId; + } + + public static int getVirtualBoots(L2PcInstance actor) + { + L2ItemInstance equipedItem = actor.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET); + if(equipedItem == null) + return 0; + //ClassCastException wont happen unless some jackass changes the values from the database. + L2Armor equipedBoots = (L2Armor)actor.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET).getItem(); + int equipedBootsId = actor.getInventory().getPaperdollItemId(Inventory. PAPERDOLL_FEET); + + int bootsTextureId = actor.visualArmor.bootsTextureId; + L2Armor virtualGloves = (L2Armor)ItemTable.getInstance().getTemplate(bootsTextureId); + + if(bootsTextureId != 0) + return armorMatching(virtualGloves.getItemType(), equipedBoots.getItemType(),bootsTextureId, equipedBootsId); + else + return equipedBootsId; + } + + public static int getLHAND(L2PcInstance actor) + { + L2ItemInstance equipedItem = actor.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND); + int equipedItemId = actor.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND); + + int weaponLHANDId = actor.visualArmor.weaponLHANDId; + L2Item virtualItem = ItemTable.getInstance().getTemplate(weaponLHANDId) ; + + if(equipedItem == null || weaponLHANDId == 0) + return equipedItemId; + + //Only check same weapon types. Virtual replacement should not happen between armor/weapons. + if(equipedItem.getItem() instanceof L2Weapon && virtualItem instanceof L2Weapon) + { + L2Weapon weapon = (L2Weapon) equipedItem.getItem(); + L2Weapon virtualweapon = (L2Weapon)virtualItem; + + return weaponMatching(virtualweapon.getItemType(), weapon.getItemType(), weaponLHANDId, equipedItemId); + } + else if(equipedItem.getItem() instanceof L2Armor && virtualItem instanceof L2Armor) + { + L2Armor armor = (L2Armor) equipedItem.getItem(); + L2Armor virtualarmor = (L2Armor)virtualItem; + + return armorMatching(virtualarmor.getItemType(), armor.getItemType(), weaponLHANDId, equipedItemId); + } + return equipedItemId; + } + + public static int getRHAND(L2PcInstance actor) + { + int weaponRHANDId = actor.visualArmor.weaponRHANDId; + L2ItemInstance equipedItem = actor.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND); + int equipedItemId = actor.getInventory().getPaperdollItemId(Inventory. PAPERDOLL_RHAND); + L2Item virtualItem = ItemTable.getInstance().getTemplate(weaponRHANDId) ; + + if(equipedItem == null || weaponRHANDId == 0) + return equipedItemId; + + //Only check same weapon types. Virtual replacement should not happen between armor/weapons. + if(equipedItem.getItem() instanceof L2Weapon && virtualItem instanceof L2Weapon) + { + L2Weapon weapon = (L2Weapon) equipedItem.getItem(); + L2Weapon virtualweapon = (L2Weapon)virtualItem; + + return weaponMatching(virtualweapon.getItemType(), weapon.getItemType(), weaponRHANDId, equipedItemId); + } + else if(equipedItem.getItem() instanceof L2Armor && virtualItem instanceof L2Armor) + { + L2Armor armor = (L2Armor) equipedItem.getItem(); + L2Armor virtualarmor = (L2Armor)virtualItem; + + return armorMatching(virtualarmor.getItemType(), armor.getItemType(), weaponRHANDId, equipedItemId); + } + return equipedItemId; + + } + + public static int getCloak(L2PcInstance actor) + { + if(actor.visualArmor.weaponLRHANDId == 1) + return 0; + else + return actor.getInventory().getPaperdollItemId(Inventory. PAPERDOLL_CLOAK); + + } + + public static void dressMe(L2PcInstance activeChar) + { + setVirtualBody(activeChar); + setVirtualGloves(activeChar); + setVirtualPants(activeChar); + setVirtualBoots(activeChar); + setVirtualLhand(activeChar); + setVirtualRhand(activeChar); + + InventoryUpdate iu = new InventoryUpdate(); + activeChar.sendPacket(iu); + activeChar.broadcastUserInfo(); + InventoryUpdate iu2 = new InventoryUpdate(); + activeChar.sendPacket(iu2); + activeChar.broadcastUserInfo(); + activeChar.sendMessage("You changed clothes."); + activeChar.visualArmor.updateVisualArmor(); + } +} \ No newline at end of file
×
×
  • Create New...