Всем привет.
Есть скрипт, квест на ПВ софте Wings
Если я беру квест и потом к примеру я передумал, нажимаю удалить квест , тот якобы удаляется,но после обновления вкладки квесты снова появляется..
Кто поможет?
Надо чтобы если отменил квест он удалялся...
package quests.Wings;
import net.sf.l2j.gameserver.model.L2Party;
import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
import net.sf.l2j.gameserver.model.quest.QuestState;
import net.sf.l2j.gameserver.model.quest.State;
import net.sf.l2j.gameserver.model.quest.jython.QuestJython;
import net.sf.l2j.util.Rnd;
public class Wings extends QuestJython
{
//NPC
private final static int npcid = 15023;
private final static int[] MOBS = {38211};
private final static int RaidBoss = 38806;
//QuestItem
private final static int BLACK_FEATHER = 50003;
private final static int ITEM_FROM_RB = 50004;
//Chance from mobs
private final static int chance1 = 100;
//Chance from RB
private final static int chance2 = 100;
//Item
private final static int FEATHER = 50007;
private int count;
//Разрешено ли повторять квест?
private static boolean REPEATABLE = true;
private int cond = 0;
private State STARTED = new State("Started", this);
public Wings(int questId, String name, String descr)
{
super(questId, name, descr, 1);
State st = new State("Start", this);
this.setInitialState(st);
addStartNpc(npcid);
addTalkId(npcid);
for (int mobs : MOBS)
addKillId(mobs);
addKillId(RaidBoss);
}
public String onEvent(String event, QuestState st)
{
L2PcInstance player = st.getPlayer();
if (event.equalsIgnoreCase("start"))
{
st.set("cond","1");
event = "15023-2.htm";
st.setState(STARTED);
}
else if (event.equalsIgnoreCase("sobral"))
{
count = player.getInventory().getInventoryItemCount(BLACK_FEATHER,0);
if (count < 500)
event = "15023-no.htm";
else
{
st.takeItems(BLACK_FEATHER,500);
st.set("cond","2");
event = "15023-4.htm";
}
}
else if (event.equalsIgnoreCase("item_RB"))
{
count = player.getInventory().getInventoryItemCount(ITEM_FROM_RB,0);
if (count < 1)
event = "15023-no1.htm";
else
{
st.takeItems(ITEM_FROM_RB,1);
st.giveItems(FEATHER,1);
st.exitQuest(REPEATABLE);
event = "<html><body>THANK YOU!!! GOOD LUCK!!!</body><html>";
}
}
else if (event.equalsIgnoreCase("otmena"))
{
event = "<html><body>KBECT OTMEHEH</body></html>";
st.exitQuest(true);
}
return event;
}
public String onTalk(L2NpcInstance npc, L2PcInstance talker)
{
QuestState st = talker.getQuestState(getName());
String htmltext = "<html><body>You are either not on a quest that involves this NPC, or you don't meet this NPC's minimum quest requirements.</body></html>";
if(st == null) return htmltext;
int npcId = npc.getNpcId();
cond = st.getInt("cond");
if(npcId == npcid)
{
if (cond == 0)
htmltext = "15023-1.htm";
else if (cond == 1)
htmltext = "15023-3.htm";
else if (cond == 2)
htmltext = "15023-5.htm";
}
return htmltext;
}
public String onKill (L2NpcInstance npc, L2PcInstance killer, boolean isPet)
{
QuestState st = killer.getQuestState(getName());
if(st == null) return null;
int npcId = npc.getNpcId();
int cond = st.getInt("cond");
L2Party party = killer.getParty();
switch(cond)
{
case 1:
for (int id : MOBS)
if (npcId == id)
if (Rnd.get(100) < chance1)
if (st.getPlayer().getInventory().getInventoryItemCount(BLACK_FEATHER,0) < 500)
st.giveItems(BLACK_FEATHER,1);
break;
case 2:
if (npcId == RaidBoss)
if (Rnd.get(100) < chance2)
if (party != null)
for (L2PcInstance member : party.getPartyMembers())
if (member.getInventory().getInventoryItemCount(ITEM_FROM_RB,0) < 1)
member.getQuestState(getName()).giveItems(ITEM_FROM_RB,1);
else
if (killer.getInventory().getInventoryItemCount(ITEM_FROM_RB,0) < 1)
st.giveItems(ITEM_FROM_RB,1);
break;
}
return null;
}
public static void main(String[] args)
{
new Wings(125, "Wings", "custom");
}
}