mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-03 16:49:03 +00:00
eab153ee3f
* Object definition cleanup * Update ShopAssistant.java * stackables * notables * unused files * more junk * almost done * working * moving old methods to deprecated * update * fixed pickpocket typos * Update Pickpocket.java * Remove redundant method. Fix stall stealing * Documentation for deprecated methods * WIP commit partial removal. Has test and dump classes * Final cleanup * Move definitions from data folder to cfg * Temporarily moving definition loaders to GameEngine This is until loading can be done asynchronously. * Correct indentation.
99 lines
1.6 KiB
Java
99 lines
1.6 KiB
Java
package com.rs2.game.items;
|
|
|
|
/**
|
|
* Represents a single item.
|
|
*
|
|
* @author Graham Edgecombe
|
|
*
|
|
*/
|
|
public class Item {
|
|
|
|
/**
|
|
* The id.
|
|
*/
|
|
private int id;
|
|
|
|
/**
|
|
* The number of items.
|
|
*/
|
|
private int count;
|
|
|
|
/**
|
|
* Creates a single item.
|
|
*
|
|
* @param id
|
|
* The id.
|
|
*/
|
|
public Item(int id) {
|
|
this(id, 1);
|
|
}
|
|
|
|
public void setCount(int count) {
|
|
this.count = count;
|
|
}
|
|
|
|
/**
|
|
* Creates a stacked item.
|
|
*
|
|
* @param id
|
|
* The id.
|
|
* @param count
|
|
* The number of items.
|
|
* @throws IllegalArgumentException
|
|
* if count is negative.
|
|
*/
|
|
public Item(int id, int count) {
|
|
if (count < 0) {
|
|
throw new IllegalArgumentException("Count cannot be negative.");
|
|
}
|
|
this.id = id;
|
|
this.count = count;
|
|
}
|
|
|
|
/**
|
|
* Creates a stacked item.
|
|
*
|
|
* @param id
|
|
* The id.
|
|
* @param count
|
|
* The number of items.
|
|
* @param timer
|
|
* The timer assigned.
|
|
* @throws IllegalArgumentException
|
|
* if count is negative.
|
|
*/
|
|
public Item(int id, int count, int timer) {
|
|
if (count < 0) {
|
|
throw new IllegalArgumentException("Count cannot be negative.");
|
|
}
|
|
this.id = id;
|
|
this.count = count;
|
|
}
|
|
|
|
/**
|
|
* Gets the item id.
|
|
*
|
|
* @return The item id.
|
|
*/
|
|
public int getId() {
|
|
return id;
|
|
}
|
|
|
|
/**
|
|
* Gets the count.
|
|
*
|
|
* @return The count.
|
|
*/
|
|
public int getCount() {
|
|
return count;
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return Item.class.getName() + " [id=" + id + ", count=" + count + "]";
|
|
}
|
|
|
|
public boolean equals(Item item) {
|
|
return item.getId() == id && count == item.getCount();
|
|
}
|
|
} |