SHARE
TWEET

com.l2jserver.gameserver.model.itemauction.AuctionItem

fforc9e Apr 28th, 2014 82 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  * This program is free software: you can redistribute it and/or modify it under
  3.  * the terms of the GNU General Public License as published by the Free Software
  4.  * Foundation, either version 3 of the License, or (at your option) any later
  5.  * version.
  6.  *
  7.  * This program is distributed in the hope that it will be useful, but WITHOUT
  8.  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9.  * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10.  * details.
  11.  *
  12.  * You should have received a copy of the GNU General Public License along with
  13.  * this program. If not, see <http://www.gnu.org/licenses/>.
  14.  */
  15. package com.l2jserver.gameserver.model.itemauction;
  16.  
  17. import com.l2jserver.gameserver.datatables.ItemTable;
  18. import com.l2jserver.gameserver.model.L2Augmentation;
  19. import com.l2jserver.gameserver.model.L2ItemInstance;
  20. import com.l2jserver.gameserver.templates.StatsSet;
  21. import com.l2jserver.gameserver.templates.item.L2Item;
  22.  
  23. /**
  24.  * @author Forsaiken
  25.  */
  26. public final class AuctionItem
  27. {
  28.         private final int _auctionItemId;
  29.         private final int _auctionLength;
  30.         private final long _auctionInitBid;
  31.        
  32.         private final int _itemId;
  33.         private final long _itemCount;
  34.         private final StatsSet _itemExtra;
  35.        
  36.         public AuctionItem(final int auctionItemId, final int auctionLength, final long auctionInitBid, final int itemId, final long itemCount, final StatsSet itemExtra)
  37.         {
  38.                 _auctionItemId = auctionItemId;
  39.                 _auctionLength = auctionLength;
  40.                 _auctionInitBid = auctionInitBid;
  41.                
  42.                 _itemId = itemId;
  43.                 _itemCount = itemCount;
  44.                 _itemExtra = itemExtra;
  45.         }
  46.        
  47.         public final boolean checkItemExists()
  48.         {
  49.                 final L2Item item = ItemTable.getInstance().getTemplate(_itemId);
  50.                 if (item == null)
  51.                         return false;
  52.                 return true;
  53.         }
  54.        
  55.         public final int getAuctionItemId()
  56.         {
  57.                 return _auctionItemId;
  58.         }
  59.        
  60.         public final int getAuctionLength()
  61.         {
  62.                 return _auctionLength;
  63.         }
  64.        
  65.         public final long getAuctionInitBid()
  66.         {
  67.                 return _auctionInitBid;
  68.         }
  69.        
  70.         public final int getItemId()
  71.         {
  72.                 return _itemId;
  73.         }
  74.        
  75.         public final long getItemCount()
  76.         {
  77.                 return _itemCount;
  78.         }
  79.        
  80.         public final L2ItemInstance createNewItemInstance()
  81.         {
  82.                 final L2ItemInstance item = ItemTable.getInstance().createItem("ItemAuction", _itemId, _itemCount, null, null);
  83.                
  84.                 final int enchantLevel = _itemExtra.getInteger("enchant_level", 0);
  85.                 item.setEnchantLevel(enchantLevel);
  86.                
  87.                 final int augmentationId = _itemExtra.getInteger("augmentation_id", 0);
  88.                 if (augmentationId != 0)
  89.                 {
  90.                         final int augmentationSkillId = _itemExtra.getInteger("augmentation_skill_id", 0);
  91.                         final int augmentationSkillLevel = _itemExtra.getInteger("augmentation_skill_lvl", 0);
  92.                         item.setAugmentation(new L2Augmentation(augmentationId, augmentationSkillId, augmentationSkillLevel));
  93.                 }
  94.                
  95.                 return item;
  96.         }
  97. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top