Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Index: trunk/java/l2r/gameserver/dao/ItemsDAO.java
- ===================================================================
- --- a/trunk/java/l2r/gameserver/dao/ItemsDAO.java
- +++ b/trunk/java/l2r/gameserver/dao/ItemsDAO.java
- @@ -1,4 +1,5 @@
- package l2r.gameserver.dao;
- +import gnu.trove.list.array.TIntArrayList;
- import l2r.commons.dao.JdbcDAO;
- import l2r.commons.dao.JdbcEntityState;
- @@ -27,13 +28,13 @@
- private static final Logger _log = LoggerFactory.getLogger(ItemsDAO.class);
- - 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 = ?";
- + 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 = ?";
- private final static String RESTORE_OWNER_ITEMS = "SELECT object_id FROM items WHERE owner_id = ? AND loc = ?";
- - 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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- - 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 = ?";
- + 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 (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
- + 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 = ?";
- private final static String REMOVE_ITEM = "DELETE FROM items WHERE object_id = ?";
- private final static ItemsDAO instance = new ItemsDAO();
- - public final static ItemsDAO getInstance()
- + public static ItemsDAO getInstance()
- {
- return instance;
- @@ -118,7 +119,5 @@
- if(rset.next())
- {
- - int objectId = rset.getInt(1);
- - item = new ItemInstance(objectId);
- - //item.setObjectId(rset.getInt(1));
- + item = new ItemInstance(rset.getInt(1));
- item.setOwnerId(rset.getInt(2));
- item.setItemId(rset.getInt(3));
- @@ -139,4 +138,5 @@
- item.getAttributes().setUnholy(rset.getInt(18));
- item.setAgathionEnergy(rset.getInt(19));
- + item.setDisplayItemId(rset.getInt(20));
- }
- @@ -165,4 +165,5 @@
- statement.setInt(18, item.getAttributes().getUnholy());
- statement.setInt(19, item.getAgathionEnergy());
- + statement.setInt(20, item.getDisplayItemId());
- }
- @@ -212,5 +213,6 @@
- private void update0(ItemInstance item, PreparedStatement statement) throws SQLException
- {
- - statement.setInt(19, item.getObjectId());
- + statement.setInt(20, item.getObjectId());
- +
- statement.setInt(1, item.getOwnerId());
- statement.setInt(2, item.getItemId());
- @@ -231,4 +233,5 @@
- statement.setInt(17, item.getAttributes().getUnholy());
- statement.setInt(18, item.getAgathionEnergy());
- + statement.setInt(19, item.getDisplayItemId());
- }
- @@ -283,5 +286,5 @@
- }
- - public Collection<ItemInstance> load(Collection<Integer> objectIds)
- + public Collection<ItemInstance> load(TIntArrayList objectIds)
- {
- Collection<ItemInstance> list = Collections.emptyList();
- @@ -293,5 +296,5 @@
- ItemInstance item;
- - for(Integer objectId : objectIds)
- + for(int objectId : objectIds.toArray())
- {
- item = load(objectId);
- @@ -410,5 +413,5 @@
- public Collection<ItemInstance> getItemsByOwnerIdAndLoc(int ownerId, ItemLocation loc)
- {
- - Collection<Integer> objectIds = Collections.emptyList();
- + TIntArrayList objectIds = new TIntArrayList();
- Connection con = null;
- @@ -422,5 +425,5 @@
- statement.setString(2, loc.name());
- rset = statement.executeQuery();
- - objectIds = new ArrayList<Integer>();
- +
- while(rset.next())
- objectIds.add(rset.getInt(1));
- Index: trunk/java/l2r/gameserver/model/items/Inventory.java
- ===================================================================
- --- a/trunk/java/l2r/gameserver/model/items/Inventory.java
- +++ b/trunk/java/l2r/gameserver/model/items/Inventory.java
- @@ -262,11 +262,16 @@
- {
- ItemInstance item = getPaperdollItem(slot);
- +
- if(item != null)
- - return item.getItemId();
- + {
- + return item.getItemVisualId();
- + }
- else if(slot == PAPERDOLL_HAIR)
- {
- item = _paperdoll[PAPERDOLL_DHAIR];
- if(item != null)
- - return item.getItemId();
- + {
- + return item.getItemVisualId();
- + }
- }
- Index: trunk/java/l2r/gameserver/model/items/ItemInstance.java
- ===================================================================
- --- a/trunk/java/l2r/gameserver/model/items/ItemInstance.java
- +++ b/trunk/java/l2r/gameserver/model/items/ItemInstance.java
- @@ -85,4 +85,6 @@
- /** ID of the item */
- private int itemId;
- + // item display id
- + private int itemDisplayId;
- /** Quantity of the item */
- private long count;
- @@ -161,4 +163,14 @@
- }
- + public int getItemVisualId()
- + {
- + return getDisplayItemId() > 0 ? getDisplayItemId() : itemId;
- + }
- +
- + public int getDisplayItemId()
- + {
- + return itemDisplayId;
- + }
- +
- public void setItemId(int id)
- {
- @@ -166,4 +178,9 @@
- template = ItemHolder.getInstance().getTemplate(id);
- setCustomFlags(getCustomFlags());
- + }
- +
- + public void setDisplayItemId(int id)
- + {
- + itemDisplayId = id;
- }
- Index: trunk/dist/sql/game/items.sql
- ===================================================================
- --- a/trunk/dist/sql/game/items.sql
- +++ b/trunk/dist/sql/game/items.sql
- @@ -5,4 +5,5 @@
- `count` bigint(20) NOT NULL,
- `enchant_level` int(11) NOT NULL,
- + `display_id` int(7) NOT NULL,
- `loc` varchar(32) NOT NULL,
- `loc_data` int(11) NOT NULL,
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement