Originally Posted by
omglolomghi
inventoryoptionshandler.java
look for :
Code:
public static void handleItemOnItem
Example
Code:
if (itemUsed.getId() == 11332 || usedWith.getId() == 946) {
if (player.getInventory().containsItem(946, 1)
&& player.getInventory().containsItem(11332, 1)) {
player.getInventory().deleteItem(11332, 1);
player.getInventory().addItem(11324, 1);
}
}
It might be a bit different in matrix3, but won't be much
Das not a good way of doing it.
If someone has the items (id 946, id 11332) in their inventory & uses some other item on for example id 946, this code would also launch.
It should be like..
Code:
if (itemUsed.getId() == 11332 && usedWith.getId() == 946 || itemUsed.getId() == 946 && usedWith.getId() == 11332) {//Both ways, so that the code doesn't only work if you use item X on item Y, but otherwise too.
if (!player.getInventory().containsItem(946, 1) || !player.getInventory().containsItem(11332, 1))//This is a check in case they're using a cheat client or something similar, to make sure the player actually has the items.
return;
player.getInventory().deleteItem(11332, 1);
player.getInventory().deleteItem(946, 1);//Delete both items before giving the new item, otherwise you may have issues with space if the person has full inventory.
player.getInventory().addItem(id, 1);//Add the given item.
return;//Stop the code from going any further.
}
Note: I used omglolomghi's item IDs in this example, I've got no idea what these items actually are, it's just an example.