Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: java/com/l2jserver/extensions/VisualArmorController.java
- ===================================================================
- --- java/com/l2jserver/extensions/VisualArmorController.java (revision 0)
- +++ java/com/l2jserver/extensions/VisualArmorController.java (revision 0)
- @@ -0,0 +1,373 @@
- +/*
- + * 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 com.l2jserver.extensions;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.SQLException;
- +import com.l2jserver.L2DatabaseFactory;
- +import com.l2jserver.gameserver.datatables.ItemTable;
- +import com.l2jserver.gameserver.model.L2ItemInstance;
- +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jserver.gameserver.model.itemcontainer.Inventory;
- +import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
- +import com.l2jserver.gameserver.templates.item.L2Armor;
- +import com.l2jserver.gameserver.templates.item.L2ArmorType;
- +import com.l2jserver.gameserver.templates.item.L2Item;
- +import com.l2jserver.gameserver.templates.item.L2Weapon;
- +import com.l2jserver.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();
- + }
- +}
- Index: java/com/l2jserver/extensions/VisualArmorModel.java
- ===================================================================
- --- java/com/l2jserver/extensions/VisualArmorModel.java (revision 0)
- +++ java/com/l2jserver/extensions/VisualArmorModel.java (revision 0)
- @@ -0,0 +1,171 @@
- +/*
- + * 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 com.l2jserver.extensions;
- +
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.sql.ResultSet;
- +import java.sql.SQLException;
- +import com.l2jserver.L2DatabaseFactory;
- +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jserver.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) {}
- + }
- + }
- +
- +}
- +
- Index: java/com/l2jserver/gameserver/GameServer.java
- ===================================================================
- --- java/com/l2jserver/gameserver/GameServer.java (revision 4469)
- +++ java/com/l2jserver/gameserver/GameServer.java (working copy)
- @@ -32,6 +32,7 @@
- import com.l2jserver.Config;
- import com.l2jserver.L2DatabaseFactory;
- import com.l2jserver.Server;
- +import com.l2jserver.extensions.VisualArmorController;
- import com.l2jserver.gameserver.cache.CrestCache;
- import com.l2jserver.gameserver.cache.HtmCache;
- import com.l2jserver.gameserver.datatables.AccessLevels;
- @@ -315,6 +316,7 @@
- BoatManager.getInstance();
- AirShipManager.getInstance();
- GraciaSeedsManager.getInstance();
- + VisualArmorController.load();
- try
- {
- Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 4469)
- +++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
- @@ -38,6 +38,7 @@
- import com.l2jserver.Config;
- import com.l2jserver.L2DatabaseFactory;
- +import com.l2jserver.extensions.VisualArmorModel;
- import com.l2jserver.gameserver.Announcements;
- import com.l2jserver.gameserver.GameTimeController;
- import com.l2jserver.gameserver.GeoData;
- @@ -274,6 +275,7 @@
- */
- public final class L2PcInstance extends L2Playable
- {
- + 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 (?,?,?,?)";
- @@ -324,6 +326,8 @@
- public static final int STORE_PRIVATE_MANUFACTURE = 5;
- public static final int STORE_PRIVATE_PACKAGE_SELL = 8;
- +
- +
- /** The table containing all minimum level needed for each Expertise (None, D, C, B, A, S, S80, S84)*/
- private static final int[] EXPERTISE_LEVELS =
- {
- @@ -1254,6 +1258,7 @@
- if (!Config.WAREHOUSE_CACHE)
- getWarehouse();
- startVitalityTask();
- + visualArmor = new VisualArmorModel(this);
- }
- private L2PcInstance(int objectId)
- Index: java/com/l2jserver/gameserver/network/serverpackets/CharInfo.java
- ===================================================================
- --- java/com/l2jserver/gameserver/network/serverpackets/CharInfo.java (revision 4469)
- +++ java/com/l2jserver/gameserver/network/serverpackets/CharInfo.java (working copy)
- @@ -17,6 +17,7 @@
- import java.util.logging.Logger;
- import com.l2jserver.Config;
- +import com.l2jserver.extensions.VisualArmorController;
- import com.l2jserver.gameserver.datatables.NpcTable;
- import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager;
- import com.l2jserver.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/com/l2jserver/gameserver/network/serverpackets/UserInfo.java
- ===================================================================
- --- java/com/l2jserver/gameserver/network/serverpackets/UserInfo.java (revision 4469)
- +++ java/com/l2jserver/gameserver/network/serverpackets/UserInfo.java (working copy)
- @@ -15,6 +15,7 @@
- package com.l2jserver.gameserver.network.serverpackets;
- import com.l2jserver.Config;
- +import com.l2jserver.extensions.VisualArmorController;
- import com.l2jserver.gameserver.datatables.NpcTable;
- import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager;
- import com.l2jserver.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));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement