The best would be to make use of Item objects (as opposed to an array containing the ids and an array containing the amounts).
Such a plain Item object would contain the itemId and itemCount/itemAmount.
A special item such as a rapier would have its own class.
A class extending the Item class with an aditional variable: charge.
Before items would be differentiated by itemId but now things should be done a bit different.
In the Item class, you would have a method named (for example): isSameTypeAs.
It could look like this:
Code:
public boolean isSameTypeAs(Item compare){
return this.getSpecialIdentifier() == compare.getSpecialIdentifier();
}
The Item class should then have the method getSpecialIdentifier():
Code:
private int getSpecialIdentifier(){
return id;
}
For normal items (items not extending the Item class), the special identifier would be the same as the id of the item.
(This would be NOT the same method as getId(), despite returning the same value.)
An item extending the Item class would override this method in order to create an output different from the normal one.
For the abnormal whip it COULD be:
Code:
private int getSpecialIdentifier(){
return 1 << 16 | id;
}
The 1 would indicate it's different. Another, different type of, abnormal would have another value.
The rapier could include the charge in this special identifier.