hi i can create one scrip to exchange x item for random items, and he remove all items "x", dont see where is error can help me?
package custom;
import l2.commons.util.Rnd;
import l2.gameserver.model.instances.NpcInstance;
import l2.gameserver.model.quest.Quest;
import l2.gameserver.model.quest.QuestState;
import l2.gameserver.scripts.ScriptFile;
public class _900_CofreMid extends Quest implements ScriptFile {
public static final int[] Runa24Hs = new int[] { 9345, 9346, 9347, 9348 };
public static final int[] Runa10Dias = new int[] { 9349, 9350, 9351, 9352 };
public static final int[] Skines = new int[] { 9496, 9497, 9498, 9499, 9500, 9501, 9502, 9503, 9504, 9505, 9506 };
public static final int[] Dyes = new int[] { 7002, 70003, 7004, 7005, 7006, 7007, 7008, 7009, 7010, 7011, 7012, 7013 };
public static final int[] SoulCrystal12 = new int[] { 5577, 5578, 5579 };
public static final int[] SoulCrystal13 = new int[] { 5580, 5581, 5582 };
public static final int[] CofreID = new int[] { 9361, 9362, 9363 };
public _900_CofreMid() {
super(1);
addStartNpc(60000);
}
public void onLoad() {System.out.println("Probando Fix Cofres------------====---------()");}
public void onReload() {}
public void onShutdown() {}
public String onEvent(String paramString, QuestState paramQuestState, NpcInstance paramNpcInstance)
{
String str = paramString;
int i = paramNpcInstance.getNpcId();
if (paramString.equalsIgnoreCase("reply_1"))
{
switch (i)
{
case 60000:
if (paramQuestState.getQuestItemsCount(9361) >= 1L)
{
int k = Rnd.get(10);
if (k == 1) {
str = "low-manapotion.htm";
paramQuestState.playSound("ItemSound.quest_finish");
paramQuestState.giveItems(728, 20L);
paramQuestState.takeItems(9361, -1L);
}
if (k == 2) {
str = "low-manapotion.htm";
paramQuestState.playSound("ItemSound.quest_finish");
paramQuestState.giveItems(726, 20L);
paramQuestState.takeItems(9361, -1L);
break;
}
if (k == 3) {
str = "low-manapotion.htm";
paramQuestState.playSound("ItemSound.quest_finish");
paramQuestState.giveItems(Runa24Hs[Rnd.get(Runa24Hs.length)], 1L);
paramQuestState.takeItems(9361, -1L);
break;
}
if (k == 4) {
str = "low-manapotion.htm";
paramQuestState.playSound("ItemSound.quest_finish");
paramQuestState.giveItems(5965, 20L);
paramQuestState.takeItems(9361, -1L);
break;
}
if (k == 5) {
str = "low-manapotion.htm";
paramQuestState.playSound("ItemSound.quest_finish");
paramQuestState.giveItems(5951, 20L);
paramQuestState.takeItems(9361, -1L);
break;
}
if (k == 6) {
str = "low-manapotion.htm";
paramQuestState.playSound("ItemSound.quest_finish");
paramQuestState.giveItems(3874, 1L);
paramQuestState.takeItems(9361, -1L);
break;
}
if (k == 7) {
str = "low-manapotion.htm";
paramQuestState.playSound("ItemSound.quest_finish");
paramQuestState.giveItems(9313, 5L);
paramQuestState.takeItems(9361, -1L);
break;
}
if (k == 8) {
str = "low-manapotion.htm";
paramQuestState.playSound("ItemSound.quest_finish");
paramQuestState.giveItems(2148, 1L);
paramQuestState.takeItems(9361, -1L);
break;
}
if (k == 9) {
str = "low-manapotion.htm";
paramQuestState.playSound("ItemSound.quest_finish");
paramQuestState.giveItems(9366, 2L);
paramQuestState.takeItems(9361, -1L);
break;
}
if (k == 10) {
str = "low-manapotion.htm";
paramQuestState.playSound("ItemSound.quest_finish");
paramQuestState.giveItems(9365, 2L);
paramQuestState.takeItems(9361, -1L);
break;
}
}
}
}
else if (paramString.equalsIgnoreCase("reply_2"))
{
paramQuestState.takeItems(9362, -1L);
switch (i)
{
case 60000:
if (paramQuestState.getQuestItemsCount(9362) >= 1L)
{
int k = Rnd.get(10);
if (k == 1) {
paramQuestState.giveItems(Skines[Rnd.get(Skines.length)], 1L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 2) {
paramQuestState.giveItems(Dyes[Rnd.get(Dyes.length)], 10L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 3) {
paramQuestState.giveItems(728, 20L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 4) {
paramQuestState.giveItems(4198, 1L);
paramQuestState.giveItems(4120, 15L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 5) {
paramQuestState.giveItems(4193, 2L);
paramQuestState.giveItems(4115, 13L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 6) {
paramQuestState.giveItems(9308, 1L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 7) {
paramQuestState.giveItems(8297, 2L);
paramQuestState.giveItems(8330, 13L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 8) {
paramQuestState.giveItems(8305, 2L);
paramQuestState.giveItems(8336, 13L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 9) {
paramQuestState.giveItems(4199, 2L);
paramQuestState.giveItems(4121, 13L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 10) {
paramQuestState.giveItems(4192, 2L);
paramQuestState.giveItems(4114, 13L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
}
break;
}
}
else if (paramString.equalsIgnoreCase("reply_3"))
{
paramQuestState.takeItems(9363, -1L);
switch (i)
{
case 60000:
if (paramQuestState.getQuestItemsCount(9363) >= 1L)
{
int k = Rnd.get(3);
if (k == 1) {
paramQuestState.giveItems(9367, 2L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 2) {
paramQuestState.giveItems(Skines[Rnd.get(Skines.length)], 1L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 3) {
paramQuestState.giveItems(Runa10Dias[Rnd.get(Runa10Dias.length)], 1L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 5) {
paramQuestState.giveItems(6013, 200L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 6) {
paramQuestState.giveItems(6012, 50L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 7) {
paramQuestState.giveItems(4673, 1L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 8) {
paramQuestState.giveItems(SoulCrystal12[Rnd.get(SoulCrystal12.length)], 1L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
if (k == 9) {
paramQuestState.giveItems(SoulCrystal13[Rnd.get(SoulCrystal12.length)], 1L);
paramQuestState.playSound("ItemSound.quest_finish");
break;
}
}
break;
}
}
return str;
}
public String onTalk(NpcInstance paramNpcInstance, QuestState paramQuestState)
{
String str = "no-quest";
int j = paramNpcInstance.getNpcId();
if (j == 60000)
{
if (paramQuestState.getQuestItemsCount(CofreID) == 0L)
{
str = "no-item.htm";
}
if (paramQuestState.getQuestItemsCount(CofreID) != 0L)
{
str = "dindin_q0688_01.htm";
}
}
return str;
}
}