Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2J_Server
- Index: java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java
- ===================================================================
- --- java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java (revision 5563)
- +++ java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
- @@ -25,6 +25,8 @@
- import com.l2jserver.gameserver.handler.BypassHandler;
- import com.l2jserver.gameserver.handler.IAdminCommandHandler;
- import com.l2jserver.gameserver.handler.IBypassHandler;
- +import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
- +import com.l2jserver.gameserver.handler.VoicedCommandHandler;
- import com.l2jserver.gameserver.model.L2CharPosition;
- import com.l2jserver.gameserver.model.L2Object;
- import com.l2jserver.gameserver.model.L2World;
- @@ -117,6 +119,17 @@
- ach.useAdminCommand(_command, activeChar);
- }
- }
- + else if (_command.startsWith(".")) {
- + String command = _command.substring(1).split(" ")[0];
- + String params = _command.substring(1).split(" ").length > 1 ? _command.substring(1).split(" ")[1] : "";
- + IVoicedCommandHandler vch = VoicedCommandHandler.getInstance().getHandler(command);
- + if (vch == null)
- + {
- + _log.warning(activeChar + " requested not registered admin command '" + command + "'");
- + return;
- + }
- + vch.useVoicedCommand(command, activeChar, params);
- + }
- else if (_command.equals("come_here") && activeChar.isGM())
- {
- comeHere(activeChar);
- Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 5563)
- +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -7466,6 +7466,7 @@
- player.restoreUISettings();
- player.restoreZoneRestartLimitTime();
- + player.restoreVisualArmors();
- }
- catch (Exception e)
- {
- @@ -7728,6 +7729,7 @@
- storeCharSub();
- storeEffect(storeActiveEffects);
- storeItemReuseDelay();
- + storeVisualArmors();
- transformInsertInfo();
- if(Config.STORE_RECIPE_SHOPLIST)
- storeRecipeShopList();
- @@ -15471,4 +15473,300 @@
- {
- globalProfessionChangeListeners.remove(listener);
- }
- +
- + private void restoreVisualArmors()
- + {
- + try
- + {
- + Connection con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement("SELECT * FROM character_visual_armors WHERE charId=?");
- + statement.setInt(1, getObjectId());
- + ResultSet rset = statement.executeQuery();
- + if (rset.next())
- + {
- + isUsingVisualArmors(rset.getBoolean("isUsingVisual"));
- + setVisualArmor(VisualArmors.Armor, rset.getInt("armor"));
- + setVisualArmor(VisualArmors.Legs, rset.getInt("leggings"));
- + setVisualArmor(VisualArmors.Feet, rset.getInt("feet"));
- + setVisualArmor(VisualArmors.Gloves, rset.getInt("gloves"));
- + setVisualArmor(VisualArmors.LHand, rset.getInt("lHand"));
- + setVisualArmor(VisualArmors.Sword, rset.getInt("sword"));
- + setVisualArmor(VisualArmors.Bow, rset.getInt("bow"));
- + setVisualArmor(VisualArmors.Pole, rset.getInt("pole"));
- + setVisualArmor(VisualArmors.Dual, rset.getInt("dualWeapons"));
- + setVisualArmor(VisualArmors.BigSword, rset.getInt("bigSword"));
- + }
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING, "Could not restore " + getObjectId() + " visual armors data " + e.getMessage(), e);
- + }
- + }
- +
- + private boolean checkIfExist()
- + {
- + try
- + {
- + Connection con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement("SELECT charId FROM character_visual_armors WHERE charId=?");
- + statement.setInt(1, getObjectId());
- + try (ResultSet rset = statement.executeQuery()) {
- + if (rset.next())
- + return true;
- + }
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING, "Could not restore " + getObjectId() + " visual armors data " + e.getMessage(), e);
- + }
- + return false;
- + }
- +
- + private void storeVisualArmors()
- + {
- + if (!checkIfExist())
- + insertVisualArmors();
- + //UPDATE characters SET vitality_points=?,language=? WHERE charId=?";
- + try
- + {
- + Connection con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement("UPDATE character_visual_armors SET isUsingVisual=?,armor=?,leggings=?,feet=?,gloves=?,sword=?,bow=?,pole=?,dualWeapons=?,bigSword=?,lHand=? WHERE charId=?");
- + statement.setInt(1, isUsingVisualArmors() ? 1 : 0);
- + statement.setInt(2, getVisualArmor(VisualArmors.Armor, true) == null ? 0 : getVisualArmor(VisualArmors.Armor, true).getItemId());
- + statement.setInt(3, getVisualArmor(VisualArmors.Legs, true) == null ? 0 : getVisualArmor(VisualArmors.Legs, true).getItemId());
- + statement.setInt(4, getVisualArmor(VisualArmors.Feet, true) == null ? 0 : getVisualArmor(VisualArmors.Feet, true).getItemId());
- + statement.setInt(5, getVisualArmor(VisualArmors.Gloves, true) == null ? 0 : getVisualArmor(VisualArmors.Gloves, true).getItemId());
- + statement.setInt(6, getVisualArmor(VisualArmors.Sword, true) == null ? 0 : getVisualArmor(VisualArmors.Sword, true).getItemId());
- + statement.setInt(7, getVisualArmor(VisualArmors.Bow, true) == null ? 0 : getVisualArmor(VisualArmors.Bow, true).getItemId());
- + statement.setInt(8, getVisualArmor(VisualArmors.Pole, true) == null ? 0 : getVisualArmor(VisualArmors.Pole, true).getItemId());
- + statement.setInt(9, getVisualArmor(VisualArmors.Dual, true) == null ? 0 : getVisualArmor(VisualArmors.Dual, true).getItemId());
- + statement.setInt(10, getVisualArmor(VisualArmors.BigSword, true) == null ? 0 : getVisualArmor(VisualArmors.BigSword, true).getItemId());
- + statement.setInt(11, getVisualArmor(VisualArmors.LHand, true) == null ? 0 : getVisualArmor(VisualArmors.LHand, true).getItemId());
- + statement.setInt(12, getObjectId());
- + statement.execute();
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.WARNING, "Could not store character " + getObjectId() + " visual armors data: ", e);
- + }
- + }
- +
- + private boolean insertVisualArmors()
- + {
- + try
- + {
- + Connection con = L2DatabaseFactory.getInstance().getConnection();
- + PreparedStatement statement = con.prepareStatement("INSERT INTO character_visual_armors (charId) values (?)");
- + statement.setInt(1, getObjectId());
- + statement.executeUpdate();
- + }
- + catch (Exception e)
- + {
- + _log.log(Level.SEVERE, "Could not insert character " + getObjectId() + " visual armors data: " + e.getMessage(), e);
- + return false;
- + }
- + return true;
- + }
- +
- + boolean isUsingVisualArmors = false;
- +
- + public boolean isUsingVisualArmors() {
- + return isUsingVisualArmors;
- + }
- +
- + public void isUsingVisualArmors(boolean _isUsingVisualArmors) {
- + isUsingVisualArmors = _isUsingVisualArmors;
- + }
- +
- + public enum VisualArmors {
- + Sword,
- + Bow,
- + Pole,
- + Dual,
- + BigSword,
- + RHand,
- + LHand,
- + Armor,
- + Legs,
- + Feet,
- + Gloves,
- + Cloak
- + }
- +
- + int visualArmors[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- +
- + public void setVisualArmor(VisualArmors position, int itemId) {
- + visualArmors[position.ordinal()] = itemId;
- + }
- +
- + public L2Item getVisualArmor(VisualArmors position, boolean forceShow) {
- + switch (position) {
- + case Sword:
- + if (visualArmors[VisualArmors.Sword.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[VisualArmors.Sword.ordinal()]);
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null)
- + switch (getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getWeaponItem().getItemType()) {
- + case SWORD:
- + case BLUNT:
- + case DAGGER:
- + case ETC:
- + case FIST:
- + case RAPIER:
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getItem();
- + }
- + return null;
- + case Bow:
- + if (visualArmors[VisualArmors.Bow.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[VisualArmors.Bow.ordinal()]);
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null)
- + switch (getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getWeaponItem().getItemType()) {
- + case BOW:
- + case CROSSBOW:
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getItem();
- + }
- + return null;
- + case Pole:
- + if (visualArmors[VisualArmors.Pole.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[VisualArmors.Pole.ordinal()]);
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null)
- + switch (getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getWeaponItem().getItemType()) {
- + case POLE:
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getItem();
- + }
- + return null;
- + case BigSword:
- + if (visualArmors[VisualArmors.BigSword.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[VisualArmors.BigSword.ordinal()]);
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null)
- + switch (getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getWeaponItem().getItemType()) {
- + case ANCIENTSWORD:
- + case BIGBLUNT:
- + case BIGSWORD:
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getItem();
- + }
- + return null;
- + case Dual:
- + if (visualArmors[VisualArmors.Dual.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[VisualArmors.Dual.ordinal()]);
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null)
- + switch (getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getWeaponItem().getItemType()) {
- + case DUAL:
- + case DUALFIST:
- + case DUALDAGGER:
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getItem();
- + }
- + return null;
- + case RHand:
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) == null && !forceShow)
- + return null;
- + else if (isUsingVisualArmors() || forceShow) {
- + switch (getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getWeaponItem().getItemType()) {
- + case SWORD:
- + case BLUNT:
- + case DAGGER:
- + case ETC:
- + case FIST:
- + case RAPIER:
- + if (visualArmors[VisualArmors.Sword.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[VisualArmors.Sword.ordinal()]);
- + break;
- + case BOW:
- + case CROSSBOW:
- + if (visualArmors[VisualArmors.Bow.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[VisualArmors.Bow.ordinal()]);
- + break;
- + case POLE:
- + if (visualArmors[VisualArmors.Pole.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[VisualArmors.Pole.ordinal()]);
- + break;
- + case DUAL:
- + case DUALFIST:
- + case DUALDAGGER:
- + if (visualArmors[VisualArmors.Dual.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[VisualArmors.Dual.ordinal()]);
- + break;
- + case ANCIENTSWORD:
- + case BIGBLUNT:
- + case BIGSWORD:
- + if (visualArmors[VisualArmors.BigSword.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[VisualArmors.BigSword.ordinal()]);
- + break;
- + default:
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getItem();
- + }
- + }
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getItem();
- + case LHand:
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND) == null) {
- + if (visualArmors[position.ordinal()] > 0 && forceShow)
- + return ItemTable.getInstance().getTemplate(visualArmors[position.ordinal()]);
- + return null;
- + }
- + else if ((isUsingVisualArmors() || forceShow) && visualArmors[position.ordinal()] > 0) {
- + L2Item item = ItemTable.getInstance().getTemplate(visualArmors[position.ordinal()]);
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND).isArmor() && item instanceof L2Armor)
- + return item;
- + return null;
- + }
- + else
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND).getItem();
- + case Armor:
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST) == null) {
- + if (visualArmors[position.ordinal()] > 0 && forceShow)
- + return ItemTable.getInstance().getTemplate(visualArmors[position.ordinal()]);
- + return null;
- + }
- + else if ((isUsingVisualArmors() || forceShow) && visualArmors[position.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[position.ordinal()]);
- + else
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST).getItem();
- + case Legs:
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS) == null) {
- + if (visualArmors[position.ordinal()] > 0 && forceShow)
- + return ItemTable.getInstance().getTemplate(visualArmors[position.ordinal()]);
- + return null;
- + }
- + else if (isUsingVisualArmors() || forceShow) {
- + L2Item armor = getVisualArmor(VisualArmors.Armor, true);
- + if (armor.getBodyPart() == L2Item.SLOT_FULL_ARMOR)
- + return null;
- + if (visualArmors[position.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[position.ordinal()]);
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS).getItem();
- + }
- + else
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS).getItem();
- + case Feet:
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET) == null) {
- + if (visualArmors[position.ordinal()] > 0 && forceShow)
- + return ItemTable.getInstance().getTemplate(visualArmors[position.ordinal()]);
- + return null;
- + }
- + else if ((isUsingVisualArmors() || forceShow) && visualArmors[position.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[position.ordinal()]);
- + else
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET).getItem();
- + case Gloves:
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES) == null) {
- + if (visualArmors[position.ordinal()] > 0 && forceShow)
- + return ItemTable.getInstance().getTemplate(visualArmors[position.ordinal()]);
- + return null;
- + }
- + else if ((isUsingVisualArmors() || forceShow) && visualArmors[position.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[position.ordinal()]);
- + else
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES).getItem();
- + case Cloak:
- + if (getInventory().getPaperdollItem(Inventory.PAPERDOLL_CLOAK) == null) {
- + if (visualArmors[position.ordinal()] > 0 && forceShow)
- + return ItemTable.getInstance().getTemplate(visualArmors[position.ordinal()]);
- + return null;
- + }
- + else if ((isUsingVisualArmors() || forceShow) && visualArmors[position.ordinal()] > 0)
- + return ItemTable.getInstance().getTemplate(visualArmors[position.ordinal()]);
- + else
- + return getInventory().getPaperdollItem(Inventory.PAPERDOLL_CLOAK).getItem();
- + }
- + return null;
- + }
- }
- \ No newline at end of file
- Index: java/com/l2jserver/gameserver/network/serverpackets/CharInfo.java
- ===================================================================
- --- java/com/l2jserver/gameserver/network/serverpackets/CharInfo.java (revision 5563)
- +++ java/com/l2jserver/gameserver/network/serverpackets/CharInfo.java (working copy)
- @@ -19,6 +19,7 @@
- import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager;
- import com.l2jserver.gameserver.model.actor.L2Decoy;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.VisualArmors;
- import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
- import com.l2jserver.gameserver.model.effects.AbnormalEffect;
- import com.l2jserver.gameserver.model.itemcontainer.Inventory;
- @@ -196,15 +197,15 @@
- writeD(_inv.getPaperdollItemDisplayId(Inventory.PAPERDOLL_UNDER));
- writeD(_inv.getPaperdollItemDisplayId(Inventory.PAPERDOLL_HEAD));
- +
- + writeD(_activeChar.getVisualArmor(VisualArmors.RHand, false) != null ? _activeChar.getVisualArmor(VisualArmors.RHand, false).getItemId() : 0x00);
- + writeD(_activeChar.getVisualArmor(VisualArmors.LHand, false) != null ? _activeChar.getVisualArmor(VisualArmors.LHand, false).getItemId() : 0x00);
- - writeD(_airShipHelm == 0 ? _inv.getPaperdollItemDisplayId(Inventory.PAPERDOLL_RHAND) : _airShipHelm);
- - writeD(_airShipHelm == 0 ? _inv.getPaperdollItemDisplayId(Inventory.PAPERDOLL_LHAND) : 0);
- -
- - writeD(_inv.getPaperdollItemDisplayId(Inventory.PAPERDOLL_GLOVES));
- - writeD(_inv.getPaperdollItemDisplayId(Inventory.PAPERDOLL_CHEST));
- - writeD(_inv.getPaperdollItemDisplayId(Inventory.PAPERDOLL_LEGS));
- - writeD(_inv.getPaperdollItemDisplayId(Inventory.PAPERDOLL_FEET));
- - writeD(_inv.getPaperdollItemDisplayId(Inventory.PAPERDOLL_CLOAK));
- + writeD(_activeChar.getVisualArmor(VisualArmors.Gloves, false) != null ? _activeChar.getVisualArmor(VisualArmors.Gloves, false).getItemId() : 0x00);
- + writeD(_activeChar.getVisualArmor(VisualArmors.Armor, false) != null ? _activeChar.getVisualArmor(VisualArmors.Armor, false).getItemId() : 0x00);
- + writeD(_activeChar.getVisualArmor(VisualArmors.Legs, false) != null ? _activeChar.getVisualArmor(VisualArmors.Legs, false).getItemId() : 0x00);
- + writeD(_activeChar.getVisualArmor(VisualArmors.Feet, false) != null ? _activeChar.getVisualArmor(VisualArmors.Feet, false).getItemId() : 0x00);
- + writeD(_activeChar.getVisualArmor(VisualArmors.Cloak, false) != null ? _activeChar.getVisualArmor(VisualArmors.Cloak, false).getItemId() : 0x00);
- writeD(_inv.getPaperdollItemDisplayId(Inventory.PAPERDOLL_RHAND));
- writeD(_inv.getPaperdollItemDisplayId(Inventory.PAPERDOLL_HAIR));
- writeD(_inv.getPaperdollItemDisplayId(Inventory.PAPERDOLL_HAIR2));
- Index: java/com/l2jserver/gameserver/network/serverpackets/UserInfo.java
- ===================================================================
- --- java/com/l2jserver/gameserver/network/serverpackets/UserInfo.java (revision 5563)
- +++ java/com/l2jserver/gameserver/network/serverpackets/UserInfo.java (working copy)
- @@ -21,6 +21,7 @@
- import com.l2jserver.gameserver.instancemanager.TerritoryWarManager;
- import com.l2jserver.gameserver.model.Elementals;
- import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.VisualArmors;
- import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
- import com.l2jserver.gameserver.model.effects.AbnormalEffect;
- import com.l2jserver.gameserver.model.itemcontainer.Inventory;
- @@ -143,15 +144,15 @@
- writeD(_activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_LFINGER));
- writeD(_activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_HEAD));
- - writeD(_airShipHelm == 0 ? _activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_RHAND) : 0);
- - writeD(_airShipHelm == 0 ? _activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_LHAND) : 0);
- + writeD(_activeChar.getVisualArmor(VisualArmors.RHand, false) != null ? _activeChar.getVisualArmor(VisualArmors.RHand, false).getItemId() : 0x00);
- + writeD(_activeChar.getVisualArmor(VisualArmors.LHand, false) != null ? _activeChar.getVisualArmor(VisualArmors.LHand, false).getItemId() : 0x00);
- - writeD(_activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_GLOVES));
- - writeD(_activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_CHEST));
- - writeD(_activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_LEGS));
- - writeD(_activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_FEET));
- - writeD(_activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_CLOAK));
- - writeD(_activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_RHAND));
- + writeD(_activeChar.getVisualArmor(VisualArmors.Gloves, false) != null ? _activeChar.getVisualArmor(VisualArmors.Gloves, false).getItemId() : 0x00);
- + writeD(_activeChar.getVisualArmor(VisualArmors.Armor, false) != null ? _activeChar.getVisualArmor(VisualArmors.Armor, false).getItemId() : 0x00);
- + writeD(_activeChar.getVisualArmor(VisualArmors.Legs, false) != null ? _activeChar.getVisualArmor(VisualArmors.Legs, false).getItemId() : 0x00);
- + writeD(_activeChar.getVisualArmor(VisualArmors.Feet, false) != null ? _activeChar.getVisualArmor(VisualArmors.Feet, false).getItemId() : 0x00);
- + writeD(_activeChar.getVisualArmor(VisualArmors.Cloak, false) != null ? _activeChar.getVisualArmor(VisualArmors.Cloak, false).getItemId() : 0x00);
- + writeD(_activeChar.getVisualArmor(VisualArmors.RHand, false) != null ? _activeChar.getVisualArmor(VisualArmors.RHand, false).getItemId() : 0x00);
- writeD(_activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_HAIR));
- writeD(_activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_HAIR2));
- writeD(_activeChar.getInventory().getPaperdollItemDisplayId(Inventory.PAPERDOLL_RBRACELET));
- #P L2J_DataPack
- Index: dist/game/data/scripts/handlers/MasterHandler.java
- ===================================================================
- --- dist/game/data/scripts/handlers/MasterHandler.java (revision 9067)
- +++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
- @@ -288,6 +288,7 @@
- import handlers.voicedcommandhandlers.ChangePassword;
- import handlers.voicedcommandhandlers.ChatAdmin;
- import handlers.voicedcommandhandlers.Debug;
- +import handlers.voicedcommandhandlers.DressMe;
- import handlers.voicedcommandhandlers.Hellbound;
- import handlers.voicedcommandhandlers.Lang;
- import handlers.voicedcommandhandlers.StatsVCmd;
- @@ -603,6 +604,7 @@
- (Config.L2JMOD_DEBUG_VOICE_COMMAND ? Debug.class : null),
- (Config.L2JMOD_ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null),
- (Config.L2JMOD_HELLBOUND_STATUS ? Hellbound.class : null),
- + DressMe.class
- },
- {
- // Target Handlers
- Index: dist/sql/game/character_visual_armors.sql
- ===================================================================
- --- dist/sql/game/character_visual_armors.sql (revision 0)
- +++ dist/sql/game/character_visual_armors.sql (working copy)
- @@ -0,0 +1,15 @@
- +CREATE TABLE IF NOT EXISTS `character_visual_armors` (
- + `charId` int(10) unsigned NOT NULL DEFAULT '0',
- + `isUsingVisual` tinyint(3) NOT NULL DEFAULT '0',
- + `armor` int(10) NOT NULL DEFAULT '0',
- + `leggings` int(10) NOT NULL DEFAULT '0',
- + `feet` int(10) NOT NULL DEFAULT '0',
- + `gloves` int(10) NOT NULL DEFAULT '0',
- + `lHand` int(10) NOT NULL DEFAULT '0',
- + `sword` int(10) NOT NULL DEFAULT '0',
- + `bow` int(10) NOT NULL DEFAULT '0',
- + `pole` int(10) NOT NULL DEFAULT '0',
- + `dualWeapons` int(10) NOT NULL DEFAULT '0',
- + `bigSword` int(10) NOT NULL DEFAULT '0',
- + PRIMARY KEY (`charId`)
- +) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- \ No newline at end of file
- Index: dist/game/data/html/DressMe/Menu.htm
- ===================================================================
- --- dist/game/data/html/DressMe/Menu.htm (revision 0)
- +++ dist/game/data/html/DressMe/Menu.htm (working copy)
- @@ -0,0 +1,11 @@
- +<html>
- +<body>
- +<center>
- +<button value="Copy Target" action="bypass -h .dressmetarget" width=80 height=27 back="L2UI_CT1.Button_DF_Down" fore="L2UI_ct1.button_df">
- +<br1>
- +%items%
- +<br>
- +%visualArmorState%
- +</center>
- +</body>
- +</html>
- \ No newline at end of file
- Index: dist/game/data/scripts/handlers/voicedcommandhandlers/DressMe.java
- ===================================================================
- --- dist/game/data/scripts/handlers/voicedcommandhandlers/DressMe.java (revision 0)
- +++ dist/game/data/scripts/handlers/voicedcommandhandlers/DressMe.java (working copy)
- @@ -0,0 +1,179 @@
- +/*
- + * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
- + */
- +package handlers.voicedcommandhandlers;
- +
- +import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
- +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance.VisualArmors;
- +import com.l2jserver.gameserver.model.itemcontainer.Inventory;
- +import com.l2jserver.gameserver.network.SystemMessageId;
- +import com.l2jserver.gameserver.network.serverpackets.CharInfo;
- +import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
- +import com.l2jserver.gameserver.network.serverpackets.UserInfo;
- +
- +/**
- + * @author Erlandys
- + *
- + */
- +public class DressMe implements IVoicedCommandHandler
- +{
- + private static final String[] VOICED_COMMANDS =
- + {
- + "dressme", "dressmetarget", "dressmestate"
- + };
- +
- + @Override
- + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
- + {
- + if (command.equalsIgnoreCase("dressme")) {
- + NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setFile(activeChar.getHtmlPrefix(), "data/html/DressMe/Menu.htm");
- + html.replace("%items%", showItems(activeChar));
- + html.replace("%visualArmorState%", "You are currently " + (activeChar.isUsingVisualArmors() ? "enabled" : "disabled") + " your Visual Armors! <a action=\"bypass -h .dressmestate\">Turn " + (activeChar.isUsingVisualArmors() ? "off" : "on") + " Visual Armors!</a>");
- + activeChar.sendPacket(html);
- + }
- + else if (command.equalsIgnoreCase("dressmetarget")) {
- + if (!(activeChar.getTarget() instanceof L2PcInstance) || activeChar.getTarget() == activeChar) {
- + activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
- + useVoicedCommand("dressme", activeChar, "");
- + return false;
- + }
- + L2PcInstance target = ((L2PcInstance) activeChar.getTarget());
- + if (target.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND) != null) {
- + switch (target.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND).getWeaponItem().getItemType()) {
- + case SWORD:
- + case BLUNT:
- + case DAGGER:
- + case ETC:
- + case FIST:
- + case RAPIER:
- + activeChar.setVisualArmor(VisualArmors.Sword, target.getVisualArmor(VisualArmors.RHand, false).getItemId());
- + break;
- + case BOW:
- + case CROSSBOW:
- + activeChar.setVisualArmor(VisualArmors.Bow, target.getVisualArmor(VisualArmors.RHand, false).getItemId());
- + break;
- + case POLE:
- + activeChar.setVisualArmor(VisualArmors.Pole, target.getVisualArmor(VisualArmors.RHand, false).getItemId());
- + break;
- + case DUAL:
- + case DUALFIST:
- + case DUALDAGGER:
- + activeChar.setVisualArmor(VisualArmors.Dual, target.getVisualArmor(VisualArmors.RHand, false).getItemId());
- + break;
- + case ANCIENTSWORD:
- + case BIGBLUNT:
- + case BIGSWORD:
- + activeChar.setVisualArmor(VisualArmors.BigSword, target.getVisualArmor(VisualArmors.RHand, false).getItemId());
- + break;
- + }
- + }
- + if (target.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND) != null && target.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LHAND).isArmor())
- + activeChar.setVisualArmor(VisualArmors.LHand, target.getVisualArmor(VisualArmors.LHand, false).getItemId());
- + if (target.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CHEST) != null)
- + activeChar.setVisualArmor(VisualArmors.Armor, target.getVisualArmor(VisualArmors.Armor, false).getItemId());
- + if (target.getInventory().getPaperdollItem(Inventory.PAPERDOLL_LEGS) != null && target.getVisualArmor(VisualArmors.Legs, false) != null)
- + activeChar.setVisualArmor(VisualArmors.Legs, target.getVisualArmor(VisualArmors.Legs, false).getItemId());
- + if (target.getInventory().getPaperdollItem(Inventory.PAPERDOLL_FEET) != null)
- + activeChar.setVisualArmor(VisualArmors.Feet, target.getVisualArmor(VisualArmors.Feet, false).getItemId());
- + if (target.getInventory().getPaperdollItem(Inventory.PAPERDOLL_GLOVES) != null)
- + activeChar.setVisualArmor(VisualArmors.Gloves, target.getVisualArmor(VisualArmors.Gloves, false).getItemId());
- + if (target.getInventory().getPaperdollItem(Inventory.PAPERDOLL_CLOAK) != null)
- + activeChar.setVisualArmor(VisualArmors.Cloak, target.getVisualArmor(VisualArmors.Cloak, false).getItemId());
- + activeChar.sendMessage("You have successfully copied " + target.getName() + "'s template!");
- + activeChar.sendPacket(new UserInfo(activeChar));
- + activeChar.sendPacket(new UserInfo(activeChar));
- + activeChar.broadcastPacket(new CharInfo(activeChar));
- + useVoicedCommand("dressme", activeChar, "");
- + }
- + else if (command.toLowerCase().startsWith("dressmestate")) {
- + boolean turnOn = !activeChar.isUsingVisualArmors();
- + activeChar.isUsingVisualArmors(turnOn);
- + activeChar.sendMessage("You have successfully " + (turnOn ? "enabled" : "disabled") + " Visual Armors!");
- + activeChar.sendPacket(new UserInfo(activeChar));
- + activeChar.sendPacket(new UserInfo(activeChar));
- + activeChar.broadcastPacket(new CharInfo(activeChar));
- + useVoicedCommand("dressme", activeChar, "");
- + }
- + return true;
- + }
- +
- + public String showItems(L2PcInstance activeChar) {
- + String items = "";
- + String sword = "icon.NOIMAGE";
- + if (activeChar.getVisualArmor(VisualArmors.Sword, true) != null)
- + sword = activeChar.getVisualArmor(VisualArmors.Sword, true).getIcon();
- + String bow = "icon.NOIMAGE";
- + if (activeChar.getVisualArmor(VisualArmors.Bow, true) != null)
- + bow = activeChar.getVisualArmor(VisualArmors.Bow, true).getIcon();
- + String pole = "icon.NOIMAGE";
- + if (activeChar.getVisualArmor(VisualArmors.Pole, true) != null)
- + pole = activeChar.getVisualArmor(VisualArmors.Pole, true).getIcon();
- + String dual = "icon.NOIMAGE";
- + if (activeChar.getVisualArmor(VisualArmors.Dual, true) != null)
- + dual = activeChar.getVisualArmor(VisualArmors.Dual, true).getIcon();
- + String bigSword = "icon.NOIMAGE";
- + if (activeChar.getVisualArmor(VisualArmors.BigSword, true) != null)
- + bigSword = activeChar.getVisualArmor(VisualArmors.BigSword, true).getIcon();
- + String cloak = "icon.NOIMAGE";
- + if (activeChar.getVisualArmor(VisualArmors.Cloak, true) != null)
- + cloak = activeChar.getVisualArmor(VisualArmors.Cloak, true).getIcon();
- + String armor = "icon.NOIMAGE";
- + if (activeChar.getVisualArmor(VisualArmors.Armor, true) != null)
- + armor = activeChar.getVisualArmor(VisualArmors.Armor, true).getIcon();
- + String lHand = "icon.NOIMAGE";
- + if (activeChar.getVisualArmor(VisualArmors.LHand, true) != null)
- + lHand = activeChar.getVisualArmor(VisualArmors.LHand, true).getIcon();
- + String legs = "icon.NOIMAGE";
- + if (activeChar.getVisualArmor(VisualArmors.Legs, true) != null)
- + legs = activeChar.getVisualArmor(VisualArmors.Legs, true).getIcon();
- + String feet = "icon.NOIMAGE";
- + if (activeChar.getVisualArmor(VisualArmors.Feet, true) != null)
- + feet = activeChar.getVisualArmor(VisualArmors.Feet, true).getIcon();
- + String gloves = "icon.NOIMAGE";
- + if (activeChar.getVisualArmor(VisualArmors.Gloves, true) != null)
- + gloves = activeChar.getVisualArmor(VisualArmors.Gloves, true).getIcon();
- + items += "<table width=200>" +
- + "<tr>" +
- + "<td><img src=\"" + cloak + "\" width=32 height=32/></td>" +
- + "<td><img src=\"" + armor + "\" width=32 height=32/></td>" +
- + "<td><img src=\"" + lHand + "\" width=32 height=32/></td>" +
- + "</tr>" +
- + "<tr></tr><tr></tr>" +
- + "<tr>" +
- + "<td><img src=\"" + gloves + "\" width=32 height=32/></td>" +
- + "<td><img src=\"" + legs + "\" width=32 height=32/></td>" +
- + "<td><img src=\"" + feet + "\" width=32 height=32/></td>" +
- + "</tr>" +
- + "</table>";
- + items += "<br><table width=250>" +
- + "<tr>" +
- + "<td><img src=\"" + sword + "\" width=32 height=32/></td>" +
- + "<td><img src=\"" + bow + "\" width=32 height=32/></td>" +
- + "<td><img src=\"" + pole + "\" width=32 height=32/></td>" +
- + "<td><img src=\"" + dual + "\" width=32 height=32/></td>" +
- + "<td><img src=\"" + bigSword + "\" width=32 height=32/></td>" +
- + "</tr>" +
- + "</table>" +
- + "<br>";
- + return items;
- + }
- +
- + @Override
- + public String[] getVoicedCommandList()
- + {
- + return VOICED_COMMANDS;
- + }
- +}
Advertisement
Add Comment
Please, Sign In to add comment