Mod_Cubsmiles
June 23rd, 2010, 14:24
Purpse: To rid of your dupes in your ::sellitem command and add some features.
Difficulty: 9/10
Classes Modified: Command.class
Information: The first step makes it so you can spawn noted items for more than you have in your inventory.
Ex: If I have 27 spots left in my inventory, I can spawn more than 27 noted items.
2nd Part: This prevents from selling any noted/stackable item which pretty much fixes all the null amount selling.
Step 1:
Open up your Command.java
Search for:
if (itemAmount > freeSpace && !Engine.items.stackable(itemID)) {
After:
!Engine.items.stackable(itemID)
and before the last
)
add:
&& !Engine.items.noted(itemID))
Step 2:
Search for:
if (cmd[0].equals("sellitem")) {
Look for:
if (price == 0 || Engine.items.isUntradable(itemID)) {
p.getActionSender().sendMessage(p, "This item cannot be sold.");
p.getActionSender().addSoundEffect(p, 4039, 1, 0, 0);
Change it to:
if (price == 0 || Engine.items.isUntradable(itemID) || Engine.items.stackable(itemID) || Engine.items.noted(itemID)) {
p.getActionSender().sendMessage(p, "This item cannot be sold.");
p.getActionSender().addSoundEffect(p, 4039, 1, 0, 0);
There you go.
Difficulty: 9/10
Classes Modified: Command.class
Information: The first step makes it so you can spawn noted items for more than you have in your inventory.
Ex: If I have 27 spots left in my inventory, I can spawn more than 27 noted items.
2nd Part: This prevents from selling any noted/stackable item which pretty much fixes all the null amount selling.
Step 1:
Open up your Command.java
Search for:
if (itemAmount > freeSpace && !Engine.items.stackable(itemID)) {
After:
!Engine.items.stackable(itemID)
and before the last
)
add:
&& !Engine.items.noted(itemID))
Step 2:
Search for:
if (cmd[0].equals("sellitem")) {
Look for:
if (price == 0 || Engine.items.isUntradable(itemID)) {
p.getActionSender().sendMessage(p, "This item cannot be sold.");
p.getActionSender().addSoundEffect(p, 4039, 1, 0, 0);
Change it to:
if (price == 0 || Engine.items.isUntradable(itemID) || Engine.items.stackable(itemID) || Engine.items.noted(itemID)) {
p.getActionSender().sendMessage(p, "This item cannot be sold.");
p.getActionSender().addSoundEffect(p, 4039, 1, 0, 0);
There you go.