Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
public QuestState exitQuest(boolean repeatable) {
_player.removeNotifyQuestOfDeath(this);
if (!isStarted()) {
return this;
}
// Clean registered quest items
getQuest().removeRegisteredQuestItems(_player);
Quest.deleteQuestInDb(this, repeatable);
if (repeatable) {
_player.delQuestState(getQuestName());
_player.sendPacket(new QuestList());
} else {
setState(State.COMPLETED);
}
_vars = null;
return this;
}
А код квеста можно?
/*
* This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation, either version 3 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
package quests.Q157_RecoverSmuggledGoods;
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.Quest;
import net.sf.l2j.gameserver.model.quest.QuestState;
import net.sf.l2j.gameserver.model.quest.State;
public class Q157_RecoverSmuggledGoods extends Quest
{
// NPCs
private static final int WILFORD = 60021;
private static final int TOAD = 672;
// Item
private static final int ADAMANTITE_ORE = 17550;
// Reward
private static final int BUCKLER = 17551;
public static void main(String[] args)
{
new Q157_RecoverSmuggledGoods();
}
public Q157_RecoverSmuggledGoods()
{
super(157, Q157_RecoverSmuggledGoods.class.getSimpleName(), "Recover Smuggled Goods");
setItemsIds(ADAMANTITE_ORE);
addStartNpc(WILFORD);
addTalkId(WILFORD);
addKillId(TOAD);
}
@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player)
{
String htmltext = event;
QuestState st = player.getQuestState(getName());
if (st == null)
return htmltext;
if (event.equalsIgnoreCase("7005-05.htm"))
{
st.setState(State.STARTED);
st.set("cond", "1");
st.playSound(QuestState.SOUND_ACCEPT);
}
return htmltext;
}
@Override
public String onTalk(L2NpcInstance npc, L2PcInstance player)
{
QuestState st = player.getQuestState(getName());
String htmltext = getNoQuestMsg();
if (st == null)
return htmltext;
switch (st.getState())
{
case State.CREATED:
htmltext = (player.getLevel() < 5) ? "7005-02.htm" : "7005-03.htm";
break;
case State.STARTED:
int cond = st.getInt("cond");
if (cond == 1)
htmltext = "7005-06.htm";
else if (cond == 2)
{
htmltext = "7005-07.htm";
st.takeItems(ADAMANTITE_ORE, -1);
st.giveItems(BUCKLER, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(false);
}
break;
case State.COMPLETED:
htmltext = getAlreadyCompletedMsg();
break;
}
return htmltext;
}
@Override
public String onKill(L2NpcInstance npc, L2PcInstance killer, boolean isPet)
{
final QuestState st = checkPlayerCondition(killer, npc, "cond", "1");
if (st == null)
return null;
if (st.dropItems(ADAMANTITE_ORE, 1, 25, 400000))
st.set("cond", "2");
return null;
}
}
public QuestState exitQuest(boolean repeatable) {
_player.removeNotifyQuestOfDeath(this);
if (!isStarted()) {
return this;
}
// Clean registered quest items
getQuest().removeRegisteredQuestItems(_player);
Quest.deleteQuestInDb(this, repeatable);
if (repeatable) {
_player.delQuestState(getQuestName());
_player.sendPacket(new QuestList());
} else {
setState(State.COMPLETED);
}
_vars = null;
return this;
}
st.exitQuest(true);
Скорее всего удалит запись о прохождении квеста из базы данных и его можно будет взять снова.
Да, вот этот метод.
Java:public QuestState exitQuest(boolean repeatable) { _player.removeNotifyQuestOfDeath(this); if (!isStarted()) { return this; } // Clean registered quest items getQuest().removeRegisteredQuestItems(_player); Quest.deleteQuestInDb(this, repeatable); if (repeatable) { _player.delQuestState(getQuestName()); _player.sendPacket(new QuestList()); } else { setState(State.COMPLETED); } _vars = null; return this; }
htmltext = "7005-07.htm";
st.takeItems(ADAMANTITE_ORE, -1);
st.giveItems(BUCKLER, 1);
st.playSound(QuestState.SOUND_FINISH);
st.exitQuest(true);
Возможно стоит удалить из базы данных отметку о прохождении, которую вы получили ДО изменения кода.Код:htmltext = "7005-07.htm"; st.takeItems(ADAMANTITE_ORE, -1); st.giveItems(BUCKLER, 1); st.playSound(QuestState.SOUND_FINISH); st.exitQuest(true);
так не работает
пишет, что квест уже выполнен
И то верно, спасибо огромное тебе человечищеВозможно стоит удалить из базы данных отметку о прохождении, которую вы получили ДО изменения кода.