diff --git a/src/main/java/server/Shop.java b/src/main/java/server/Shop.java index 634daaa522..72fc26cb54 100644 --- a/src/main/java/server/Shop.java +++ b/src/main/java/server/Shop.java @@ -46,7 +46,7 @@ public class Shop { private static final Set rechargeableItems = new LinkedHashSet<>(); private final int id; private final int npcId; - private final List items; + private final List items; private final int tokenvalue = 1000000000; private final int token = 4000313; @@ -69,7 +69,7 @@ public class Shop { items = new ArrayList<>(); } - private void addItem(MapleShopItem item) { + private void addItem(ShopItem item) { items.add(item); } @@ -79,7 +79,7 @@ public class Shop { } public void buy(Client c, short slot, int itemId, short quantity) { - MapleShopItem item = findBySlot(slot); + ShopItem item = findBySlot(slot); if (item != null) { if (item.getItemId() != itemId) { System.out.println("Wrong slot number in shop " + id); @@ -232,7 +232,7 @@ public class Shop { } } - private MapleShopItem findBySlot(short slot) { + private ShopItem findBySlot(short slot) { return items.get(slot); } @@ -267,17 +267,17 @@ public class Shop { List recharges = new ArrayList<>(rechargeableItems); while (rs.next()) { if (ItemConstants.isRechargeable(rs.getInt("itemid"))) { - MapleShopItem starItem = new MapleShopItem((short) 1, rs.getInt("itemid"), rs.getInt("price"), rs.getInt("pitch")); + ShopItem starItem = new ShopItem((short) 1, rs.getInt("itemid"), rs.getInt("price"), rs.getInt("pitch")); ret.addItem(starItem); if (rechargeableItems.contains(starItem.getItemId())) { recharges.remove(Integer.valueOf(starItem.getItemId())); } } else { - ret.addItem(new MapleShopItem((short) 1000, rs.getInt("itemid"), rs.getInt("price"), rs.getInt("pitch"))); + ret.addItem(new ShopItem((short) 1000, rs.getInt("itemid"), rs.getInt("price"), rs.getInt("pitch"))); } } for (Integer recharge : recharges) { - ret.addItem(new MapleShopItem((short) 1000, recharge, 0, 0)); + ret.addItem(new ShopItem((short) 1000, recharge, 0, 0)); } } } diff --git a/src/main/java/server/MapleShopItem.java b/src/main/java/server/ShopItem.java similarity index 86% rename from src/main/java/server/MapleShopItem.java rename to src/main/java/server/ShopItem.java index 608fabf4f5..6fe6fcd3c8 100644 --- a/src/main/java/server/MapleShopItem.java +++ b/src/main/java/server/ShopItem.java @@ -22,16 +22,15 @@ package server; /** - * * @author Matze */ -public class MapleShopItem { - private short buyable; - private int itemId; - private int price; - private int pitch; +public class ShopItem { + private final short buyable; + private final int itemId; + private final int price; + private final int pitch; - public MapleShopItem(short buyable, int itemId, int price, int pitch) { + public ShopItem(short buyable, int itemId, int price, int pitch) { this.buyable = buyable; this.itemId = itemId; this.price = price; diff --git a/src/main/java/tools/PacketCreator.java b/src/main/java/tools/PacketCreator.java index 1d18b872e0..9147fc1812 100644 --- a/src/main/java/tools/PacketCreator.java +++ b/src/main/java/tools/PacketCreator.java @@ -2357,12 +2357,12 @@ public class PacketCreator { return (int) (Double.doubleToLongBits(d) >> 48); } - public static Packet getNPCShop(Client c, int sid, List items) { + public static Packet getNPCShop(Client c, int sid, List items) { ItemInformationProvider ii = ItemInformationProvider.getInstance(); final OutPacket p = OutPacket.create(SendOpcode.OPEN_NPC_SHOP); p.writeInt(sid); p.writeShort(items.size()); // item count - for (MapleShopItem item : items) { + for (ShopItem item : items) { p.writeInt(item.getItemId()); p.writeInt(item.getPrice()); p.writeInt(item.getPrice() == 0 ? item.getPitch() : 0); //Perfect Pitch