I've been trying so figure out why the option 8 don't seems to work, I've also printed the component who is (26).
The array:
Code:
private static final int PRODUCTS[] = { 1919, 4527, 4522, 229, 6667, 567, 4542, 10973 };
To start the dialogue:
Code:
player.getDialogueManager().startDialogue("GlassBlowingD", Glass.forId(PRODUCTS[0]), Glass.forId(PRODUCTS[1]), Glass.forId(PRODUCTS[2]), Glass.forId(PRODUCTS[3]), Glass.forId(PRODUCTS[4]), Glass.forId(PRODUCTS[5]), Glass.forId(PRODUCTS[6]), Glass.forId(PRODUCTS[7]));
GlassBlowingD:
Code:
package com.rs.game.content.dialogues.impl.skills;
import com.rs.game.content.action.skills.Skills;
import com.rs.game.content.action.skills.crafting.GlassBlowing;
import com.rs.game.content.action.skills.crafting.GlassBlowing.Glass;
import com.rs.game.content.dialogues.Dialogue;
import com.rs.game.content.dialogues.impl.skills.SkillsDialogue.ItemNameFilter;
/**
* @author Stimulant
*
* 26 mars 2018
*/
public class GlassBlowingD extends Dialogue {
@Override
public void start() {
int[] items = new int[parameters.length];
for (int i = 0; i < items.length; i++) {
items[i] = ((Glass) parameters[i]).getProduct();
}
SkillsDialogue.sendSkillsDialogue(player, SkillsDialogue.MAKE, "Choose how many you wish to make,<br>then click on the item to begin.", 28, items, new ItemNameFilter() {
int count = 0;
@Override
public String rename(String name) {
Glass glass = Glass.values()[count++];
if (player.getSkills().getLevel(Skills.CRAFTING) < glass.getLevel()) {
name = "<col=ff0000>" + name + "<br><col=ff0000>Level " + glass.getLevel();
}
return name;
}
});
}
@Override
public void run(int interfaceId, int componentId) {
int option = SkillsDialogue.getItemSlot(componentId);
if (option > parameters.length) {
end();
return;
}
Glass glass = (Glass) parameters[option];
int quantity = SkillsDialogue.getQuantity(player);
int invQuantity = player.getInventory().getItems().getNumberOf(glass.getItemId());
if (quantity > invQuantity) {
quantity = invQuantity;
}
player.getActionManager().setAction(new GlassBlowing(glass, quantity));
end();
}
@Override
public void finish() {
}
}
SkillsDialogue, method "getItemSlot":
Code:
public static int getItemSlot(int componentId) {
if (componentId < 14) {
return 0;
}
return componentId - 14;
}