Sveiki, gal kas mokantis galėtų man pagelbet su questu? Pasiemiau jau esamą quest'ą kaip šabloną, pakeičiau id, rewardus ir t.t. Principas toks, pasiemi iš npc q, pamuši mobus, grįžti pas tą patį npc reward, quest done. Tačiau man reikia padaryti, kad kai grįžęs pas npc questo nebaigsi, o gausi antrą užduotį iškirst dar vienus mobus, o juos užmušęs questas baigiamas visiškai.
package net.sf.l2j.gameserver.scripting.quests;
import net.sf.l2j.commons.random.Rnd;
import net.sf.l2j.gameserver.model.actor.Npc;
import net.sf.l2j.gameserver.model.actor.instance.Player;
import net.sf.l2j.gameserver.scripting.Quest;
import net.sf.l2j.gameserver.scripting.QuestState;
public class Q689_Training1 extends Quest
{
private static final String qn = "Q689_Training1";
// Item
private static final int DUMMY_ROPE = 7590;
public Q689_Training1()
{
super(689, "Training - Part 1");
setItemsIds(DUMMY_ROPE);
addStartNpc(30008); // Roien
addTalkId(30008);
addKillId(1006); // Training Dummy
}
@Override
public String onAdvEvent(String event, Npc npc, Player player)
{
String htmltext = event;
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;
if (event.equalsIgnoreCase("30008-03.htm"))
{
st.setState(STATE_STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
}
return htmltext;
}
@Override
public String onTalk(Npc npc, Player player)
{
String htmltext = getNoQuestMsg();
QuestState st = player.getQuestState(qn);
if (st == null)
return htmltext;
switch (st.getState())
{
case STATE_CREATED:
htmltext = (player.getLevel() < 34) ? "30008-01.htm" : "30008-02.htm";
break;
case STATE_STARTED:
final int count = st.getQuestItemsCount(DUMMY_ROPE);
if (count < 15)
htmltext = "30008-04.htm";
else
{
htmltext = "30008-05.htm";
st.takeItems(DUMMY_ROPE, -1);
st.rewardExpAndSp(6682479, 3341239);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
}
break;
case STATE_COMPLETED:
htmltext = getAlreadyCompletedMsg();
break;
}
return htmltext;
}
@Override
public String onKill(Npc npc, Player player, boolean isPet)
{
QuestState st = checkPlayerCondition(player, npc, "cond", "1");
if (st == null)
return null;
if (st.dropItemsAlways(DUMMY_ROPE, (Rnd.get(5) < 4) ? 1 : 1, 15))
st.set("cond", "2");
return null;
}
}
Paskutinį kartą redagavo: 22 Gruodžio 2017 - 22:13