l2bartdev Posted April 12, 2018 Posted April 12, 2018 hello guys still learning java coding and i found this code but i think that is for acis so adaption i dont know yet how it works thanks in advance! Quote
0 KillSwith Posted April 19, 2018 Posted April 19, 2018 (edited) Index: config/functions/l2jfrozen.properties =================================================================== --- config/functions/l2jfrozen.properties (revision 1132) +++ config/functions/l2jfrozen.properties (working copy) @@ -281,4 +293,19 @@ ProtectorSkillLevel = 13 ProtectorSkillTime = 600 # Npc Protector Message -ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules! \ No newline at end of file +ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules! + + +# ----------------------------------------- +# DressMe system - +# ----------------------------------------- +# +AllowDressMeSystem = False +# DressMe values. +# Note: It works like name,id;name,id +# WARNING: No spaces on names, use _ instead of space. +DressMeChests = Draconic,6379;Imperial,6373;Arcana,6383 +DressMeLegs = Imperial,6374 +DressMeBoots = Draconic,6381;Imperial,6376;Arcana,6385 +DressMeGloves = Draconic,6380;Imperial,6375;Arcana,6384 +DressMeWeapons = Draconic_Bow,7577;Shining_Bow,6594;Arcana_Mace,6608 \ No newline at end of file Index: head-src/com/l2jfrozen/Config.java =================================================================== --- head-src/com/l2jfrozen/Config.java (revision 1132) +++ head-src/com/l2jfrozen/Config.java (working copy) @@ -2427,6 +2431,13 @@ public static String FARM2_CUSTOM_MESSAGE; public static String PVP1_CUSTOM_MESSAGE; public static String PVP2_CUSTOM_MESSAGE; + public static boolean ALLOW_DRESS_ME_SYSTEM; + public static Map<String, Integer> DRESS_ME_CHESTS = new HashMap<>(); + public static Map<String, Integer> DRESS_ME_LEGS = new HashMap<>(); + public static Map<String, Integer> DRESS_ME_BOOTS = new HashMap<>(); + public static Map<String, Integer> DRESS_ME_GLOVES = new HashMap<>(); + public static Map<String, Integer> DRESS_ME_WEAPONS = new HashMap<>(); + // ============================================================ public static void loadL2JFrozenConfig() @@ -2546,6 +2563,42 @@ FARM2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("Farm2CustomMeesage", "You have been teleported to Farm Zone 2!"); PVP1_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP1CustomMeesage", "You have been teleported to PvP Zone 1!"); PVP2_CUSTOM_MESSAGE = L2JFrozenSettings.getProperty("PvP2CustomMeesage", "You have been teleported to PvP Zone 2!"); + ALLOW_DRESS_ME_SYSTEM = Boolean.parseBoolean(L2JFrozenSettings.getProperty("AllowDressMeSystem", "false")); + String temp = L2JFrozenSettings.getProperty("DressMeChests", ""); + String[] temp2 = temp.split(";"); + for (String s : temp2) + { + String[] t = s.split(","); + DRESS_ME_CHESTS.put(t[0], Integer.parseInt(t[1])); + } + temp = L2JFrozenSettings.getProperty("DressMeLegs", ""); + temp2 = temp.split(";"); + for (String s : temp2) + { + String[] t = s.split(","); + DRESS_ME_LEGS.put(t[0], Integer.parseInt(t[1])); + } + temp = L2JFrozenSettings.getProperty("DressMeBoots", ""); + temp2 = temp.split(";"); + for (String s : temp2) + { + String[] t = s.split(","); + DRESS_ME_BOOTS.put(t[0], Integer.parseInt(t[1])); + } + temp = L2JFrozenSettings.getProperty("DressMeGloves", ""); + temp2 = temp.split(";"); + for (String s : temp2) + { + String[] t = s.split(","); + DRESS_ME_GLOVES.put(t[0], Integer.parseInt(t[1])); + } + temp = L2JFrozenSettings.getProperty("DressMeWeapons", ""); + temp2 = temp.split(";"); + for (String s : temp2) + { + String[] t = s.split(","); + DRESS_ME_WEAPONS.put(t[0], Integer.parseInt(t[1])); + } } catch (final Exception e) { Index: head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java =================================================================== --- head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (revision 1132) +++ head-src/com/l2jfrozen/gameserver/handler/VoicedCommandHandler.java (working copy) @@ -32,7 +30,9 @@ import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.BankingCmd; import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.CTFCmd; import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.DMCmd; +import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.DressMe; import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.FarmPvpCmd; import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.OfflineShop; import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.Online; @@ -121,6 +123,14 @@ registerVoicedCommandHandler(new OfflineShop()); } + + if (Config.ALLOW_DRESS_ME_SYSTEM) + registerVoicedCommandHandler(new DressMe()); + LOGGER.info("VoicedCommandHandler: Loaded " + _datatable.size() + " handlers."); } Index: head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java =================================================================== --- head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (revision 1132) +++ head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java (working copy) @@ -81,6 +77,7 @@ import com.l2jfrozen.gameserver.handler.IItemHandler; import com.l2jfrozen.gameserver.handler.ItemHandler; import com.l2jfrozen.gameserver.handler.admincommandhandlers.AdminEditChar; +import com.l2jfrozen.gameserver.handler.custom.DressMeData; import com.l2jfrozen.gameserver.handler.skillhandlers.SiegeFlag; import com.l2jfrozen.gameserver.handler.skillhandlers.StrSiegeAssault; import com.l2jfrozen.gameserver.handler.skillhandlers.TakeCastle; @@ -305,6 +306,30 @@ /** The TOGGLE_USE time. */ protected long TOGGLE_USE = 0; + private DressMeData _dressmedata = null; + private boolean _dressed = false; + + + public DressMeData getDressMeData() + { + return _dressmedata; + } + + public void setDressMeData(DressMeData val) + { + _dressmedata = val; + } + + public boolean isDressMeEnabled() + { + return _dressed; + } + + public void setDressMeEnabled(boolean val) + { + _dressed = val; + } + /** * Gets the actual status. * @return the actual status Index: head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (revision 1132) +++ head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java (working copy) @@ -20,6 +20,8 @@ */ package com.l2jfrozen.gameserver.network.clientpackets; +import java.util.StringTokenizer; + import org.apache.log4j.Logger; import com.l2jfrozen.Config; @@ -26,9 +28,13 @@ import com.l2jfrozen.gameserver.ai.CtrlIntention; import com.l2jfrozen.gameserver.communitybbs.CommunityBoard; import com.l2jfrozen.gameserver.datatables.sql.AdminCommandAccessRights; +import com.l2jfrozen.gameserver.datatables.sql.ItemTable; import com.l2jfrozen.gameserver.handler.AdminCommandHandler; import com.l2jfrozen.gameserver.handler.IAdminCommandHandler; import com.l2jfrozen.gameserver.handler.custom.CustomBypassHandler; +import com.l2jfrozen.gameserver.handler.custom.DressMeData; +import com.l2jfrozen.gameserver.handler.voicedcommandhandlers.DressMe; +import com.l2jfrozen.gameserver.model.Inventory; import com.l2jfrozen.gameserver.model.L2Object; import com.l2jfrozen.gameserver.model.L2World; import com.l2jfrozen.gameserver.model.actor.instance.L2ClassMasterInstance; @@ -117,6 +123,51 @@ ach.useAdminCommand(_command, activeChar); } + else if (_command.equals("bp_changedressmestatus")) + { + if (activeChar.isDressMeEnabled()) + { + activeChar.setDressMeEnabled(false); + activeChar.broadcastUserInfo(); + } + else + { + activeChar.setDressMeEnabled(true); + activeChar.broadcastUserInfo(); + } + + DressMe.sendMainWindow(activeChar); + } + else if (_command.startsWith("bp_editWindow")) + { + String bp = _command.substring(14); + StringTokenizer st = new StringTokenizer(bp); + + sendEditWindow(activeChar, st.nextToken()); + } + else if (_command.startsWith("bp_setpart")) + { + String bp = _command.substring(11); + StringTokenizer st = new StringTokenizer(bp); + + String part = st.nextToken(); + String type = st.nextToken(); + + setPart(activeChar, part, type); + } + else if (_command.startsWith("bp_gettarget")) + { + String bp = _command.substring(13); + StringTokenizer st = new StringTokenizer(bp); + + String part = st.nextToken(); + + stealTarget(activeChar, part); + } + else if (_command.equals("bp_main")) + { + DressMe.sendMainWindow(activeChar); + } else if (_command.equals("come_here") && activeChar.isGM()) { comeHere(activeChar); @@ -362,6 +413,303 @@ activeChar.sendPacket(html); } + public void stealTarget(L2PcInstance p, String part) + { + if (p.getTarget() == null || !(p.getTarget() instanceof L2PcInstance)) + { + p.sendMessage("Invalid target."); + return; + } + + L2PcInstance t = (L2PcInstance)p.getTarget(); + + if (p.getDressMeData() == null) + { + DressMeData dmd = new DressMeData(); + p.setDressMeData(dmd); + } + + boolean returnMain = false; + + switch (part) + { + case "chest": + { + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST) == null) + { + p.getDressMeData().setChestId(0); + } + else + { + p.getDressMeData().setChestId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItemId()); + } + break; + } + case "legs": + { + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS) == null) + { + p.getDressMeData().setLegsId(0); + } + else + { + p.getDressMeData().setLegsId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS).getItemId()); + } + break; + } + case "gloves": + { + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES) == null) + { + p.getDressMeData().setGlovesId(0); + } + else + { + p.getDressMeData().setGlovesId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES).getItemId()); + } + break; + } + case "boots": + { + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET) == null) + { + p.getDressMeData().setBootsId(0); + } + else + { + p.getDressMeData().setBootsId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET).getItemId()); + } + break; + } + case "weap": + { + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null) + { + p.getDressMeData().setWeapId(0); + } + else + { + p.getDressMeData().setWeapId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getItemId()); + } + break; + } + case "all": + { + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST) == null) + { + p.getDressMeData().setChestId(0); + } + else + { + p.getDressMeData().setChestId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItemId()); + } + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS) == null) + { + p.getDressMeData().setLegsId(0); + } + else + { + p.getDressMeData().setLegsId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS).getItemId()); + } + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES) == null) + { + p.getDressMeData().setGlovesId(0); + } + else + { + p.getDressMeData().setGlovesId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES).getItemId()); + } + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET) == null) + { + p.getDressMeData().setBootsId(0); + } + else + { + p.getDressMeData().setBootsId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET).getItemId()); + } + if (t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null) + { + p.getDressMeData().setWeapId(0); + } + else + { + p.getDressMeData().setWeapId(t.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getItemId()); + } + returnMain = true; + break; + } + } + + p.broadcastUserInfo(); + if (!returnMain) + sendEditWindow(p, part); + else + DressMe.sendMainWindow(p); + } + + public void setPart(L2PcInstance p, String part, String type) + { + if (p.getDressMeData() == null) + { + DressMeData dmd = new DressMeData(); + p.setDressMeData(dmd); + } + + switch (part) + { + case "chest": + { + if (Config.DRESS_ME_CHESTS.keySet().contains(type)) + { + p.getDressMeData().setChestId(Config.DRESS_ME_CHESTS.get(type)); + } + + break; + } + case "legs": + { + if (Config.DRESS_ME_LEGS.keySet().contains(type)) + { + p.getDressMeData().setLegsId(Config.DRESS_ME_LEGS.get(type)); + } + + break; + } + case "gloves": + { + if (Config.DRESS_ME_GLOVES.keySet().contains(type)) + { + p.getDressMeData().setGlovesId(Config.DRESS_ME_GLOVES.get(type)); + } + + break; + } + case "boots": + { + if (Config.DRESS_ME_BOOTS.keySet().contains(type)) + { + p.getDressMeData().setBootsId(Config.DRESS_ME_BOOTS.get(type)); + } + + break; + } + case "weap": + { + if (Config.DRESS_ME_WEAPONS.keySet().contains(type)) + { + p.getDressMeData().setWeapId(Config.DRESS_ME_WEAPONS.get(type)); + } + + break; + } + } + + p.broadcastUserInfo(); + sendEditWindow(p, part); + } + + public void sendEditWindow(L2PcInstance p, String part) + { + NpcHtmlMessage htm = new NpcHtmlMessage(0); + htm.setFile("./data/html/custom/dressme/edit.htm"); + htm.replace("%part%", part); + switch (part) + { + case "chest": + { + if (p.getDressMeData() == null) + { + htm.replace("%partinfo%", "You have no custom chest."); + } + else + { + htm.replace("%partinfo%", p.getDressMeData().getChestId() == 0 ? "You have no custom chest." : ItemTable.getInstance().getTemplate(p.getDressMeData().getChestId()).getName()); + } + String temp = ""; + for (String s : Config.DRESS_ME_CHESTS.keySet()) + { + temp += s+";"; + } + htm.replace("%dropboxdata%", temp); + break; + } + case "legs": + { + if (p.getDressMeData() == null) + { + htm.replace("%partinfo%", "You have no custom legs."); + } + else + { + htm.replace("%partinfo%", p.getDressMeData().getLegsId() == 0 ? "You have no custom legs." : ItemTable.getInstance().getTemplate(p.getDressMeData().getLegsId()).getName()); + } + String temp = ""; + for (String s : Config.DRESS_ME_LEGS.keySet()) + { + temp += s+";"; + } + htm.replace("%dropboxdata%", temp); + break; + } + case "gloves": + { + if (p.getDressMeData() == null) + { + htm.replace("%partinfo%", "You have no custom gloves."); + } + else + { + htm.replace("%partinfo%", p.getDressMeData().getGlovesId() == 0 ? "You have no custom gloves." : ItemTable.getInstance().getTemplate(p.getDressMeData().getGlovesId()).getName()); + } + String temp = ""; + for (String s : Config.DRESS_ME_GLOVES.keySet()) + { + temp += s+";"; + } + htm.replace("%dropboxdata%", temp); + break; + } + case "boots": + { + if (p.getDressMeData() == null) + { + htm.replace("%partinfo%", "You have no custom boots."); + } + else + { + htm.replace("%partinfo%", p.getDressMeData().getBootsId() == 0 ? "You have no custom boots." : ItemTable.getInstance().getTemplate(p.getDressMeData().getBootsId()).getName()); + } + String temp = ""; + for (String s : Config.DRESS_ME_BOOTS.keySet()) + { + temp += s+";"; + } + htm.replace("%dropboxdata%", temp); + break; + } + case "weap": + { + if (p.getDressMeData() == null) + { + htm.replace("%partinfo%", "You have no custom weapon."); + } + else + { + htm.replace("%partinfo%", p.getDressMeData().getWeapId() == 0 ? "You have no custom weapon." : ItemTable.getInstance().getTemplate(p.getDressMeData().getWeapId()).getName()); + } + String temp = ""; + for (String s : Config.DRESS_ME_WEAPONS.keySet()) + { + temp += s+";"; + } + htm.replace("%dropboxdata%", temp); + break; + } + } + + p.sendPacket(htm); + } + @Override public String getType() { Index: head-src/com/l2jfrozen/gameserver/network/serverpackets/CharInfo.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/serverpackets/CharInfo.java (revision 1132) +++ head-src/com/l2jfrozen/gameserver/network/serverpackets/CharInfo.java (working copy) @@ -230,19 +230,36 @@ writeD(_activeChar.getBaseClass()); } - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_DHAIR)); - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HEAD)); - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND)); - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LHAND)); - 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_BACK)); - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LRHAND)); - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIR)); - writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FACE)); - + if (!_activeChar.isDressMeEnabled()) + { + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_DHAIR)); + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HEAD)); + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND)); + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LHAND)); + 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_BACK)); + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_RHAND)); + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIR)); + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FACE)); + } + else + { + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_DHAIR)); + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HEAD)); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND) : (_activeChar.getDressMeData().getWeapId() == 0 ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND) : _activeChar.getDressMeData().getWeapId())); + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_LHAND)); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES) : (_activeChar.getDressMeData().getGlovesId() == 0 ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES) : _activeChar.getDressMeData().getGlovesId())); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST) : (_activeChar.getDressMeData().getChestId() == 0 ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST) : _activeChar.getDressMeData().getChestId())); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS) : (_activeChar.getDressMeData().getLegsId() == 0 ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS) : _activeChar.getDressMeData().getLegsId())); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET) : (_activeChar.getDressMeData().getBootsId() == 0 ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET) : _activeChar.getDressMeData().getBootsId())); + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_BACK)); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND) : (_activeChar.getDressMeData().getWeapId() == 0 ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND) : _activeChar.getDressMeData().getWeapId())); + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_HAIR)); + writeD(_inv.getPaperdollItemId(Inventory.PAPERDOLL_FACE)); + } // c6 new h's writeH(0x00); writeH(0x00); Index: head-src/com/l2jfrozen/gameserver/network/serverpackets/UserInfo.java =================================================================== --- head-src/com/l2jfrozen/gameserver/network/serverpackets/UserInfo.java (revision 1132) +++ head-src/com/l2jfrozen/gameserver/network/serverpackets/UserInfo.java (working copy) @@ -139,42 +139,83 @@ writeD(_activeChar.getActiveWeaponItem() != null ? 40 : 20); // 20 no weapon, 40 weapon equippe - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_DHAIR)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_REAR)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEAR)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_NECK)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RFINGER)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LFINGER)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HEAD)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LHAND)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_GLOVES)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_CHEST)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEGS)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FEET)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_BACK)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LRHAND)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HAIR)); - writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FACE)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_DHAIR)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_REAR)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEAR)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_NECK)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RFINGER)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LFINGER)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HEAD)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND)); - 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_BACK)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LRHAND)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR)); - writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE)); - + if (!_activeChar.isDressMeEnabled()) + { + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_DHAIR)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_REAR)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEAR)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_NECK)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RFINGER)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LFINGER)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HEAD)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LHAND)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_GLOVES)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_CHEST)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEGS)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FEET)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_BACK)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HAIR)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FACE)); + + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_DHAIR)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_REAR)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEAR)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_NECK)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RFINGER)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LFINGER)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HEAD)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND)); + 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_BACK)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE)); + } + else + { + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_DHAIR)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_REAR)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEAR)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_NECK)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RFINGER)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LFINGER)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HEAD)); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND) : (_activeChar.getDressMeData().getWeapId() == 0 ? _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND) : _activeChar.getDressMeData().getWeapId())); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LHAND)); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_GLOVES) : (_activeChar.getDressMeData().getGlovesId() == 0 ? _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_GLOVES) : _activeChar.getDressMeData().getGlovesId())); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_CHEST) : (_activeChar.getDressMeData().getChestId() == 0 ? _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_CHEST) : _activeChar.getDressMeData().getChestId())); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEGS) : (_activeChar.getDressMeData().getLegsId() == 0 ? _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_LEGS) : _activeChar.getDressMeData().getLegsId())); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FEET) : (_activeChar.getDressMeData().getBootsId() == 0 ? _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FEET) : _activeChar.getDressMeData().getBootsId())); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_BACK)); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND) : (_activeChar.getDressMeData().getWeapId() == 0 ? _activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_RHAND) : _activeChar.getDressMeData().getWeapId())); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_HAIR)); + writeD(_activeChar.getInventory().getPaperdollObjectId(Inventory.PAPERDOLL_FACE)); + + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_DHAIR)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_REAR)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEAR)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_NECK)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RFINGER)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LFINGER)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HEAD)); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND) : (_activeChar.getDressMeData().getWeapId() == 0 ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND) : _activeChar.getDressMeData().getWeapId())); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LHAND)); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES) : (_activeChar.getDressMeData().getGlovesId() == 0 ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_GLOVES) : _activeChar.getDressMeData().getGlovesId())); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST) : (_activeChar.getDressMeData().getChestId() == 0 ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_CHEST) : _activeChar.getDressMeData().getChestId())); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS) : (_activeChar.getDressMeData().getLegsId() == 0 ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_LEGS) : _activeChar.getDressMeData().getLegsId())); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET) : (_activeChar.getDressMeData().getBootsId() == 0 ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FEET) : _activeChar.getDressMeData().getBootsId())); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_BACK)); + writeD(_activeChar.getDressMeData() == null ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND) : (_activeChar.getDressMeData().getWeapId() == 0 ? _activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_RHAND) : _activeChar.getDressMeData().getWeapId())); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_HAIR)); + writeD(_activeChar.getInventory().getPaperdollItemId(Inventory.PAPERDOLL_FACE)); + } writeH(0x00); writeH(0x00); writeH(0x00); Index: custom/DressMeData.java =================================================================== --- custom/DressMeData.java (nonexistent) +++ custom/DressMeData.java (working copy) @@ -0,0 +1,73 @@ +package com.l2jfrozen.gameserver.handler.custom; + +/** + * @author Anarchy + * @adaptação Tayran.JavaDev + * + */ +public class DressMeData +{ + private int chestId, + legsId, + glovesId, + feetId, + weapId; + + public DressMeData() + { + chestId = 0; + legsId = 0; + glovesId = 0; + feetId = 0; + weapId = 0; + } + + public int getChestId() + { + return chestId; + } + + public int getLegsId() + { + return legsId; + } + + public int getGlovesId() + { + return glovesId; + } + + public int getBootsId() + { + return feetId; + } + + public int getWeapId() + { + return weapId; + } + + public void setChestId(int val) + { + chestId = val; + } + + public void setLegsId(int val) + { + legsId = val; + } + + public void setGlovesId(int val) + { + glovesId = val; + } + + public void setBootsId(int val) + { + feetId = val; + } + + public void setWeapId(int val) + { + weapId = val; + } +} \ No newline at end of file Index: voicedcommandhandlers/DressMe.java =================================================================== --- voicedcommandhandlers/DressMe.java (nonexistent) +++ voicedcommandhandlers/DressMe.java (working copy) @@ -0,0 +1,58 @@ +package com.l2jfrozen.gameserver.handler.voicedcommandhandlers; + +import com.l2jfrozen.gameserver.datatables.sql.ItemTable; +import com.l2jfrozen.gameserver.handler.IVoicedCommandHandler; +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance; +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage; + +/** + * @author Anarchy + * @adaptação Tayran.JavaDev + * + */ +public class DressMe implements IVoicedCommandHandler +{ + private static final String[] VOICED_COMMANDS = { "dressme" }; + + + @Override + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) + { + if (command.equals("dressme")) + { + sendMainWindow(activeChar); + } + + return true; + } + + public static void sendMainWindow(L2PcInstance activeChar) + { + NpcHtmlMessage htm = new NpcHtmlMessage(0); + htm.setFile("./data/html/custom/dressme/main.htm"); + htm.replace("%enabled%", activeChar.isDressMeEnabled() ? "enabled" : "disabled"); + if (activeChar.getDressMeData() == null) + { + htm.replace("%chestinfo%", "You have no custom chest."); + htm.replace("%legsinfo%", "You have no custom legs."); + htm.replace("%bootsinfo%", "You have no custom boots."); + htm.replace("%glovesinfo%", "You have no custom gloves."); + htm.replace("%weapinfo%", "You have no custom weapon."); + } + else + { + htm.replace("%chestinfo%", activeChar.getDressMeData().getChestId() == 0 ? "You have no custom chest." : ItemTable.getInstance().getTemplate(activeChar.getDressMeData().getChestId()).getName()); + htm.replace("%legsinfo%", activeChar.getDressMeData().getLegsId() == 0 ? "You have no custom legs." : ItemTable.getInstance().getTemplate(activeChar.getDressMeData().getLegsId()).getName()); + htm.replace("%bootsinfo%", activeChar.getDressMeData().getBootsId() == 0 ? "You have no custom boots." : ItemTable.getInstance().getTemplate(activeChar.getDressMeData().getBootsId()).getName()); + htm.replace("%glovesinfo%", activeChar.getDressMeData().getGlovesId() == 0 ? "You have no custom gloves." : ItemTable.getInstance().getTemplate(activeChar.getDressMeData().getGlovesId()).getName()); + htm.replace("%weapinfo%", activeChar.getDressMeData().getWeapId() == 0 ? "You have no custom weapon." : ItemTable.getInstance().getTemplate(activeChar.getDressMeData().getWeapId()).getName()); + } + + activeChar.sendPacket(htm); + } + + @Override + public String[] getVoicedCommandList() + { + return VOICED_COMMANDS; + } +} \ No newline at end of file Index: data\dressme\edit.htm =================================================================== --- data\dressme\edit.htm (nonexistent) +++ data\dressme\edit.htm (working copy) @@ -0,0 +1,13 @@ +<html><body> +<center> +Current %part%: %partinfo% +<br> +<combobox width=120 height=17 var=val list=%dropboxdata%> +<br1> +<a action="bypass -h bp_setpart %part% $val">Set.</a> +<br1> +<a action="bypass -h bp_gettarget %part%">Get target's.</a> +<br> +<a action="bypass -h bp_main">Back.</a> +</center> +</body></html> \ No newline at end of file Index: data\dressme\main.htm =================================================================== --- data\dressme\main.htm (nonexistent) +++ data\dressme\main.htm (working copy) @@ -0,0 +1,32 @@ +<html><body> +<center> +Here you can change your appearance! +<br> +Dress me status is currently <font color="LEVEL">%enabled%</font>.<br1> +<a action="bypass -h bp_changedressmestatus">Change status.</a> +<br> +Your current custom appearance items: +<br> +</center> +Chest: %chestinfo% +<br1> +<a action="bypass -h bp_editWindow chest">Edit.</a> +<br> +Legs: %legsinfo% +<br1> +<a action="bypass -h bp_editWindow legs">Edit.</a> +<br> +Gloves: %glovesinfo% +<br1> +<a action="bypass -h bp_editWindow gloves">Edit.</a> +<br> +Boots: %bootsinfo% +<br1> +<a action="bypass -h bp_editWindow boots">Edit.</a> +<br> +Weapon: %weapinfo% +<br1> +<a action="bypass -h bp_editWindow weap">Edit.</a> +<br> +<center><a action="bypass -h bp_gettarget all">Get target's appearance.</a></center> +</body></html> \ No newline at end of file Edited April 19, 2018 by KillSwith Add Code Quote
Question
l2bartdev
hello guys still learning java coding and i found this code
but i think that is for acis so adaption i dont know yet how it works thanks in advance!
1 answer to this question
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.