MTSItemInfo.java
Upload User: gwt600
Upload Date: 2021-06-03
Package Size: 704k
Code Size: 2k
Category:

Games

Development Platform:

Java

  1. /*
  2. This file is part of the OdinMS Maple Story Server
  3. Copyright (C) 2008 Patrick Huy <patrick.huy@frz.cc>
  4. Matthias Butz <matze@odinms.de>
  5. Jan Christian Meyer <vimes@odinms.de>
  6. This program is free software: you can redistribute it and/or modify
  7. it under the terms of the GNU Affero General Public License version 3
  8. as published by the Free Software Foundation. You may not use, modify
  9. or distribute this program under any other version of the
  10. GNU Affero General Public License.
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU Affero General Public License for more details.
  15. You should have received a copy of the GNU Affero General Public License
  16. along with this program.  If not, see <http://www.gnu.org/licenses/>.
  17.  */
  18. package net.sf.odinms.server;
  19. import net.sf.odinms.client.IItem;
  20. import java.util.*;
  21. /**
  22.  *
  23.  * @author Traitor
  24.  */
  25. public class MTSItemInfo {
  26.     private int price;
  27.     private IItem item;
  28.     private String seller;
  29.     private int id;
  30.     private int cid;
  31.     private int year,  month,  day = 1;
  32.     public MTSItemInfo(IItem item, int price, int id, int cid, String seller, String date) {
  33.         this.item = item;
  34.         this.price = price;
  35.         this.seller = seller;
  36.         this.id = id;
  37.         this.cid = cid;
  38.         this.year = Integer.parseInt(date.substring(0, 4));
  39.         this.month = Integer.parseInt(date.substring(5, 7));
  40.         this.day = Integer.parseInt(date.substring(8, 10));
  41.     }
  42.     public IItem getItem() {
  43.         return item;
  44.     }
  45.     public int getPrice() {
  46.         return price;
  47.     }
  48.     public int getRealPrice() {
  49.         return price + getTaxes();
  50.     }
  51.     public int getTaxes() {
  52.         return 110 + (int) (price * 0.1);
  53.     }
  54.     public int getID() {
  55.         return id;
  56.     }
  57.     public int getCID() {
  58.         return cid;
  59.     }
  60.     public long getEndingDate() {
  61.         Calendar now = Calendar.getInstance();
  62.         now.set(year, month - 1, day);
  63.         return now.getTimeInMillis();
  64.     }
  65.     public String getSeller() {
  66.         return seller;
  67.     }
  68. }