public Garage() {…
- User
public Garage() { this.items.add(((Item)GarageItemsLoader.items.get("up_score_small")).clone()); this.items.add(((Item)GarageItemsLoader.items.get("smoky")).clone()); this.items.add(((Item)GarageItemsLoader.items.get("wasp")).clone()); this.items.add(((Item)GarageItemsLoader.items.get("green")).clone()); this.items.add(((Item)GarageItemsLoader.items.get("holiday")).clone()); this.mountItem("wasp_m0"); this.mountItem("smoky_m0"); this.mountItem("green_m0"); }
public boolean containsItem(String id) { Iterator var3 = this.items.iterator();
codewhile(var3.hasNext()) { Item item = (Item)var3.next(); if (item.id.equals(id)) { return true; } } return false;}
public Item getItemById(String id) { Iterator var3 = this.items.iterator();
codewhile(var3.hasNext()) { Item item = (Item)var3.next(); if (item.id.equals(id)) { return item; } } return null;}
public boolean mountItem(String id) { Item item = this.getItemById(id.substring(0, id.length() - 3)); if (item != null && Integer.parseInt(id.substring(id.length() - 1, id.length())) == item.modificationIndex) { if (item.itemType == ItemType.WEAPON) { this.mountTurret = item; return true; }
codeif (item.itemType == ItemType.ARMOR) { this.mountHull = item; return true; } if (item.itemType == ItemType.COLOR) { this.mountColormap = item; return true; } } return false;}
public boolean updateItem(String id) { Item item = this.getItemById(id.substring(0, id.length() - 3)); int modificationID = Integer.parseInt(id.substring(id.length() - 1)); if (modificationID < 3 && item.modificationIndex == modificationID && item.multicounted) { ++item.modificationIndex; item.nextPrice = item.modifications[item.modificationIndex + 1 != 4 ? item.modificationIndex + 1 : item.modificationIndex].price; item.nextProperty = item.modifications[item.modificationIndex + 1 != 4 ? item.modificationIndex + 1 : item.modificationIndex].propertys; item.nextRankId = item.modifications[item.modificationIndex + 1 != 4 ? item.modificationIndex + 1 : item.modificationIndex].rank; this.replaceItems(this.getItemById(id.substring(0, id.length() - 3)), item); return true; } else { return false; } }
public boolean buyItem(String id, int count) { Item temp = (Item)GarageItemsLoader.items.get(id.substring(0, id.length() - 3)); if (temp.specialItem || !temp.multicounted) { return false; } else { Item item = temp.clone(); if (!this.items.contains(this.getItemById(id))) { if (item.isInventory && item.multicounted) { item.count += count; } this.items.add(item); return true; } else if (item.isInventory && item.multicounted) { Item fromUser = this.getItemById(id); fromUser.count += count; return true; } else { return false; } } }
- Assistant
Ваше предложение заключается в добавлении переменной "multicounted" к различным методам и реализацию значения "true" для этой переменной. Вот изменения, которые нужно внести:
- В методе "buyItem(String id, int count)":
javaif (item.isInventory && item.multicounted) { item.count += count; }замените на:
javaif (item.isInventory && item.multicounted) { item.count += count; item.multicounted = true; }- В методе "buyItem(String id, int count, int nul)":
javaif (item.itemType == ItemType.INVENTORY && item.multicounted) { item.count += count; }замените на:
javaif (item.itemType == ItemType.INVENTORY && item.multicounted) { item.count += count; item.multicounted = true; }