Advertisement
GOODPower

Untitled

Nov 25th, 2013
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 8.09 KB | None | 0 0
  1. Index: trunk/java/l2r/gameserver/dao/ItemsDAO.java
  2. ===================================================================
  3. --- a/trunk/java/l2r/gameserver/dao/ItemsDAO.java
  4. +++ b/trunk/java/l2r/gameserver/dao/ItemsDAO.java
  5. @@ -1,4 +1,5 @@
  6.  package l2r.gameserver.dao;
  7.  
  8. +import gnu.trove.list.array.TIntArrayList;
  9.  import l2r.commons.dao.JdbcDAO;
  10.  import l2r.commons.dao.JdbcEntityState;
  11. @@ -27,13 +28,13 @@
  12.          private static final Logger _log = LoggerFactory.getLogger(ItemsDAO.class);
  13.  
  14. -        private final static String RESTORE_ITEM = "SELECT object_id, owner_id, item_id, count, enchant_level, loc, loc_data, custom_type1, custom_type2, life_time, custom_flags, augmentation_id, attribute_fire, attribute_water, attribute_wind, attribute_earth, attribute_holy, attribute_unholy, agathion_energy FROM items WHERE object_id = ?";
  15. +        private final static String RESTORE_ITEM = "SELECT object_id, owner_id, item_id, count, enchant_level, loc, loc_data, custom_type1, custom_type2, life_time, custom_flags, augmentation_id, attribute_fire, attribute_water, attribute_wind, attribute_earth, attribute_holy, attribute_unholy, agathion_energy, display_id FROM items WHERE object_id = ?";
  16.          private final static String RESTORE_OWNER_ITEMS = "SELECT object_id FROM items WHERE owner_id = ? AND loc = ?";
  17. -        private final static String STORE_ITEM = "INSERT INTO items (object_id, owner_id, item_id, count, enchant_level, loc, loc_data, custom_type1, custom_type2, life_time, custom_flags, augmentation_id, attribute_fire, attribute_water, attribute_wind, attribute_earth, attribute_holy, attribute_unholy, agathion_energy) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  18. -        private final static String UPDATE_ITEM = "UPDATE items SET owner_id = ?, item_id = ?, count = ?, enchant_level = ?, loc = ?, loc_data = ?, custom_type1 = ?, custom_type2 = ?, life_time = ?, custom_flags = ?, augmentation_id = ?, attribute_fire = ?, attribute_water = ?, attribute_wind = ?, attribute_earth = ?, attribute_holy = ?, attribute_unholy = ?, agathion_energy=? WHERE object_id = ?";
  19. +        private final static String STORE_ITEM = "INSERT INTO items (object_id, owner_id, item_id, count, enchant_level, loc, loc_data, custom_type1, custom_type2, life_time, custom_flags, augmentation_id, attribute_fire, attribute_water, attribute_wind, attribute_earth, attribute_holy, attribute_unholy, agathion_energy, display_id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
  20. +        private final static String UPDATE_ITEM = "UPDATE items SET owner_id = ?, item_id = ?, count = ?, enchant_level = ?, loc = ?, loc_data = ?, custom_type1 = ?, custom_type2 = ?, life_time = ?, custom_flags = ?, augmentation_id = ?, attribute_fire = ?, attribute_water = ?, attribute_wind = ?, attribute_earth = ?, attribute_holy = ?, attribute_unholy = ?, agathion_energy=?, display_id=? WHERE object_id = ?";
  21.          private final static String REMOVE_ITEM = "DELETE FROM items WHERE object_id = ?";
  22.  
  23.          private final static ItemsDAO instance = new ItemsDAO();
  24.  
  25. -        public final static ItemsDAO getInstance()
  26. +        public static ItemsDAO getInstance()
  27.          {
  28.                  return instance;
  29. @@ -118,7 +119,5 @@
  30.                  if(rset.next())
  31.                  {
  32. -                        int objectId = rset.getInt(1);
  33. -                        item = new ItemInstance(objectId);
  34. -                        //item.setObjectId(rset.getInt(1));
  35. +                        item = new ItemInstance(rset.getInt(1));
  36.                          item.setOwnerId(rset.getInt(2));
  37.                          item.setItemId(rset.getInt(3));
  38. @@ -139,4 +138,5 @@
  39.                          item.getAttributes().setUnholy(rset.getInt(18));
  40.                          item.setAgathionEnergy(rset.getInt(19));
  41. +                        item.setDisplayItemId(rset.getInt(20));
  42.                  }
  43.  
  44. @@ -165,4 +165,5 @@
  45.                  statement.setInt(18, item.getAttributes().getUnholy());
  46.                  statement.setInt(19, item.getAgathionEnergy());
  47. +                statement.setInt(20, item.getDisplayItemId());
  48.          }
  49.  
  50. @@ -212,5 +213,6 @@
  51.          private void update0(ItemInstance item, PreparedStatement statement) throws SQLException
  52.          {
  53. -                statement.setInt(19, item.getObjectId());
  54. +                statement.setInt(20, item.getObjectId());
  55. +
  56.                  statement.setInt(1, item.getOwnerId());
  57.                  statement.setInt(2, item.getItemId());
  58. @@ -231,4 +233,5 @@
  59.                  statement.setInt(17, item.getAttributes().getUnholy());
  60.                  statement.setInt(18, item.getAgathionEnergy());
  61. +                statement.setInt(19, item.getDisplayItemId());
  62.          }
  63.  
  64. @@ -283,5 +286,5 @@
  65.          }
  66.  
  67. -        public Collection<ItemInstance> load(Collection<Integer> objectIds)
  68. +        public Collection<ItemInstance> load(TIntArrayList objectIds)
  69.          {
  70.                  Collection<ItemInstance> list = Collections.emptyList();
  71. @@ -293,5 +296,5 @@
  72.  
  73.                  ItemInstance item;
  74. -                for(Integer objectId : objectIds)
  75. +                for(int objectId : objectIds.toArray())
  76.                  {
  77.                          item = load(objectId);
  78. @@ -410,5 +413,5 @@
  79.          public Collection<ItemInstance> getItemsByOwnerIdAndLoc(int ownerId, ItemLocation loc)
  80.          {
  81. -                Collection<Integer> objectIds = Collections.emptyList();
  82. +                TIntArrayList objectIds = new TIntArrayList();
  83.  
  84.                  Connection con = null;
  85. @@ -422,5 +425,5 @@
  86.                          statement.setString(2, loc.name());
  87.                          rset = statement.executeQuery();
  88. -                        objectIds = new ArrayList<Integer>();
  89. +
  90.                          while(rset.next())
  91.                                  objectIds.add(rset.getInt(1));
  92.  
  93.  
  94. Index: trunk/java/l2r/gameserver/model/items/Inventory.java
  95. ===================================================================
  96. --- a/trunk/java/l2r/gameserver/model/items/Inventory.java
  97. +++ b/trunk/java/l2r/gameserver/model/items/Inventory.java
  98. @@ -262,11 +262,16 @@
  99.          {
  100.                  ItemInstance item = getPaperdollItem(slot);
  101. +
  102.                  if(item != null)
  103. -                        return item.getItemId();
  104. +                {
  105. +                        return item.getItemVisualId();
  106. +                }
  107.                  else if(slot == PAPERDOLL_HAIR)
  108.                  {
  109.                          item = _paperdoll[PAPERDOLL_DHAIR];
  110.                          if(item != null)
  111. -                                return item.getItemId();
  112. +                        {
  113. +                                return item.getItemVisualId();
  114. +                        }
  115.                  }
  116.  
  117.  
  118. Index: trunk/java/l2r/gameserver/model/items/ItemInstance.java
  119. ===================================================================
  120. --- a/trunk/java/l2r/gameserver/model/items/ItemInstance.java
  121. +++ b/trunk/java/l2r/gameserver/model/items/ItemInstance.java
  122. @@ -85,4 +85,6 @@
  123.          /** ID of the item */
  124.          private int itemId;
  125. +        // item display id
  126. +        private int itemDisplayId;
  127.          /** Quantity of the item */
  128.          private long count;
  129. @@ -161,4 +163,14 @@
  130.          }
  131.  
  132. +        public int getItemVisualId()
  133. +        {
  134. +                return getDisplayItemId() > 0 ? getDisplayItemId() : itemId;
  135. +        }
  136. +
  137. +        public int getDisplayItemId()
  138. +        {
  139. +                return itemDisplayId;
  140. +        }
  141. +
  142.          public void setItemId(int id)
  143.          {
  144. @@ -166,4 +178,9 @@
  145.                  template = ItemHolder.getInstance().getTemplate(id);
  146.                  setCustomFlags(getCustomFlags());
  147. +        }
  148. +
  149. +        public void setDisplayItemId(int id)
  150. +        {
  151. +                itemDisplayId = id;
  152.          }
  153.  
  154.  
  155. Index: trunk/dist/sql/game/items.sql
  156. ===================================================================
  157. --- a/trunk/dist/sql/game/items.sql
  158. +++ b/trunk/dist/sql/game/items.sql
  159. @@ -5,4 +5,5 @@
  160.    `count` bigint(20) NOT NULL,
  161.    `enchant_level` int(11) NOT NULL,
  162. +  `display_id` int(7) NOT NULL,
  163.    `loc` varchar(32) NOT NULL,
  164.    `loc_data` int(11) NOT NULL,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement