Hey guys, there has been another similar post to this but I think people look at how many replies it has and continue on with their day. Since I have yet to post a thread I assume it is fine with me doing so, as I plan on hopefully expanding the issue so that the next person searching the web will be able to find a solution.
I am using the Eriewin II source found here.
The issue is that if you attempt to use the chisel on a gem, or simply click "craft" on a gem it does nothing. In the last thread it was simplified down to the stream is being read first, then calling the method, so the stream was empty and the method couldnt assign the variables from the stream (Thanks Arham for figuring this bit out).
This is where the previous thread stopped. Sadly, I am a novice coder and do not have the slightest clue where to start from there. I have done the "silly" things such as rearranging code etc, but have failed to have any success in figuring this out.
If someone could edge me in the right direction, I would love to be able to figure out the workings of this while solving the situation overall.
Here are the codes:
IventoryOptionsHandler.java:
Code:
//Gem Cutting
else if (contains(1755, Gem.LIMESTONE.getUncut(), itemUsed, usedWith))
GemCutting.cut(player, Gem.LIMESTONE);
else if (contains(1755, Gem.OPAL.getUncut(), itemUsed, usedWith)) {
GemCutting.cut(player, Gem.OPAL);
player.getPackets().sendGameMessage("Testing");
}
else if (contains(1755, Gem.JADE.getUncut(), itemUsed, usedWith))
GemCutting.cut(player, Gem.JADE);
else if (contains(1755, Gem.RED_TOPAZ.getUncut(), itemUsed, usedWith))
GemCutting.cut(player, Gem.RED_TOPAZ);
else if (contains(1755, Gem.SAPPHIRE.getUncut(), itemUsed, usedWith))
GemCutting.cut(player, Gem.SAPPHIRE);
else if (contains(1755, Gem.EMERALD.getUncut(), itemUsed, usedWith))
GemCutting.cut(player, Gem.EMERALD);
else if (contains(1755, Gem.RUBY.getUncut(), itemUsed, usedWith))
GemCutting.cut(player, Gem.RUBY);
else if (contains(1755, Gem.DIAMOND.getUncut(), itemUsed, usedWith))
GemCutting.cut(player, Gem.DIAMOND);
else if (contains(1755, Gem.DRAGONSTONE.getUncut(), itemUsed, usedWith))
GemCutting.cut(player, Gem.DRAGONSTONE);
else if (contains(1755, Gem.ONYX.getUncut(), itemUsed, usedWith))
GemCutting.cut(player, Gem.ONYX);
//Bolt Tip Making
else if (contains(1755, BoltTips.OPAL.getGemName(), itemUsed, usedWith))
BoltTipFletching.boltFletch(player, BoltTips.OPAL);
else if (contains(1755, BoltTips.JADE.getGemName(), itemUsed, usedWith))
BoltTipFletching.boltFletch(player, BoltTips.JADE);
else if (contains(1755, BoltTips.RED_TOPAZ.getGemName(), itemUsed, usedWith))
BoltTipFletching.boltFletch(player, BoltTips.RED_TOPAZ);
else if (contains(1755, BoltTips.SAPPHIRE.getGemName(), itemUsed, usedWith))
BoltTipFletching.boltFletch(player, BoltTips.SAPPHIRE);
else if (contains(1755, BoltTips.EMERALD.getGemName(), itemUsed, usedWith))
BoltTipFletching.boltFletch(player, BoltTips.EMERALD);
else if (contains(1755, BoltTips.RUBY.getGemName(), itemUsed, usedWith))
BoltTipFletching.boltFletch(player, BoltTips.RUBY);
else if (contains(1755, BoltTips.DIAMOND.getGemName(), itemUsed, usedWith))
BoltTipFletching.boltFletch(player, BoltTips.DIAMOND);
else if (contains(1755, BoltTips.DRAGONSTONE.getGemName(), itemUsed, usedWith))
BoltTipFletching.boltFletch(player, BoltTips.DRAGONSTONE);
else if (contains(1755, BoltTips.ONYX.getGemName(), itemUsed, usedWith))
BoltTipFletching.boltFletch(player, BoltTips.ONYX);
GemCutting.java
Code:
package com.rs.game.player.actions;
import com.rs.cache.loaders.ItemDefinitions;
import com.rs.game.Animation;
import com.rs.game.item.Item;
import com.rs.game.player.Player;
import com.rs.game.player.Skills;
public class GemCutting extends Action {
/**
* Enum for gems
*
* @author Raghav
*
*/
public enum Gem {
OPAL(1625, 1609, 15.0, 1, 886),
JADE(1627, 1611, 20, 13, 886),
RED_TOPAZ(1629, 1613, 25, 16, 887),
SAPPHIRE(1623, 1607, 50, 20, 888),
EMERALD(1621, 1605, 67, 27, 889),
RUBY(1619, 1603, 85, 34, 887),
DIAMOND(1617, 1601, 107.5, 43, 890),
DRAGONSTONE(1631, 1615, 137.5, 55, 885),
ONYX(6571, 6573, 167.5, 67, 2717),
LIMESTONE(3211, 3420, 10, 12, 2717);
private double experience;
private int levelRequired;
private int uncut, cut;
private int emote;
private Gem(int uncut, int cut, double experience, int levelRequired,
int emote) {
this.uncut = uncut;
this.cut = cut;
this.experience = experience;
this.levelRequired = levelRequired;
this.emote = emote;
}
public int getLevelRequired() {
return levelRequired;
}
public double getExperience() {
return experience;
}
public int getUncut() {
return uncut;
}
public int getCut() {
return cut;
}
public int getEmote() {
return emote;
}
}
public static void cut(Player player, Gem gem) {
if (player.getInventory().getItems()
.getNumberOf(new Item(gem.getUncut(), 1)) <= 1) // contains just
// 1 lets start
player.getActionManager().setAction(new GemCutting(gem, 1));
else
player.getDialogueManager().startDialogue("GemCuttingD", gem);
}
private Gem gem;
private int quantity;
public GemCutting(Gem gem, int quantity) {
this.gem = gem;
this.quantity = quantity;
}
public boolean checkAll(Player player) {
if (player.getSkills().getLevel(Skills.CRAFTING) < gem
.getLevelRequired()) {
player.getDialogueManager().startDialogue(
"SimpleMessage",
"You need a crafting level of " + gem.getLevelRequired()
+ " to cut that gem.");
return false;
}
if (!player.getInventory().containsOneItem(gem.getUncut())) {
player.getDialogueManager().startDialogue(
"SimpleMessage",
"You don't have any "
+ ItemDefinitions
.getItemDefinitions(gem.getUncut())
.getName().toLowerCase() + " to cut.");
return false;
}
return true;
}
@Override
public boolean start(Player player) {
if (checkAll(player)) {
setActionDelay(player, 1);
player.setNextAnimation(new Animation(gem.getEmote()));
return true;
}
return false;
}
@Override
public boolean process(Player player) {
return checkAll(player);
}
@Override
public int processWithDelay(Player player) {
player.getInventory().deleteItem(gem.getUncut(), 1);
player.getInventory().addItem(gem.getCut(), 1);
//if (gem.getUncut() == 1617)
//player.cutDiamonds++;
//player.randomevent(player);
player.getSkills().addXp(Skills.CRAFTING, gem.getExperience());
player.getPackets().sendGameMessage(
"You cut the "
+ ItemDefinitions.getItemDefinitions(gem.getUncut())
.getName().toLowerCase() + ".", true);
quantity--;
if (quantity <= 0)
return -1;
player.setNextAnimation(new Animation(gem.getEmote())); // start the
// emote and add
// 2 delay
return 0;
}
@Override
public void stop(final Player player) {
setActionDelay(player, 3);
}
}
GemCuttingD.java
Code:
package com.rs.game.player.dialogues;
import com.rs.game.player.actions.GemCutting;
import com.rs.game.player.actions.GemCutting.Gem;
import com.rs.game.player.content.SkillsDialogue;
public class GemCuttingD extends Dialogue {
private Gem gem;
@Override
public void start() {
this.gem = (Gem) parameters[0];
SkillsDialogue
.sendSkillsDialogue(
player,
SkillsDialogue.CUT,
"Choose how many you wish to cut,<br>then click on the item to begin.",
player.getInventory().getItems()
.getNumberOf(gem.getUncut()),
new int[] { gem.getUncut() }, null);
}
@Override
public void run(int interfaceId, int componentId) {
player.getActionManager().setAction(
new GemCutting(gem, SkillsDialogue.getQuantity(player)));
end();
}
@Override
public void finish() {
}
}
Related post: [718] GemCutting/ItemonItem not working
If you need something that I have left out please comment below, also I have done everything leading up to the point of Arham's comment so the tool belt thing is fully functional and I tried with it.