07-07-2012, 10:58 PM
Пытался написать квест. Вот код
При компиляции выдает 2 ошибки
Как можно устранить эти ошибки и будет ли работать квест вообще, писал сам по аналогии других. Заранее благодарен.
Код
package quests;
import l2p.gameserver.model.instances.NpcInstance;
import l2p.gameserver.model.quest.Quest;
import l2p.gameserver.model.quest.QuestState;
import l2p.gameserver.scripts.ScriptFile;
import org.apache.commons.lang3.ArrayUtils;
public class _474_WaitingfortheSummer extends Quest implements ScriptFile {
//Шанс дропа
private static final int chance = 80;
//Квест итем
private static int bufalo_meat = 19490;
private static int ursus_meat = 19491;
private static int ueti_meat = 19492;
//Монстры
private static final int[] mobstohunt = {22093, 22094};
private static final int[] mobstohunt2 = {22095, 22096};
private static final int[] mobstohunt3 = {22097, 22098};
//НПСы
private static final int advent = 33463;
private static final int captain = 31981;
@Override
public void onLoad() {
}
@Override
public void onReload() {
}
@Override
public void onShutdown() {
}
public _474_WaitingfortheSummer() {
super(PARTY_ONE);
addStartNpc(advent);
addTalkId(advent);
addTalkId(captain);
addKillId(mobstohunt);
addQuestItem(bufalo_meat);
addKillId(mobstohunt2);
addQuestItem(ursus_meat);
addKillId(mobstohunt3);
addQuestItem(ueti_meat);
addLevelCheck(60, 64);
}
@Override
public String onEvent(String event, QuestState st, NpcInstance npc) {
String htmltext = event;
if (event.equalsIgnoreCase("quest_ac")) {
st.setState(STARTED);
st.setCond(1);
st.playSound(SOUND_ACCEPT);
htmltext = "";
}
return htmltext;
}
@Override
public String onTalk(NpcInstance npc, QuestState st) {
int cond = st.getCond();
int npcId = npc.getNpcId();
String htmltext = "noquest";
if (npcId == advent) {
if (cond == 0) {
if (isAvailableFor(st.getPlayer())) {
if (st.isNowAvailableByTime())
htmltext = "";
else
htmltext = "";
} else
htmltext = TODO_FIND_HTML;
} else if (cond == 1 || cond == 2)
htmltext = "";
} else if (npcId == captain) {
if (cond == 0) {
if (isAvailableFor(st.getPlayer())) {
if (st.isNowAvailableByTime())
htmltext = TODO_FIND_HTML;
else
htmltext = "";
} else
htmltext = TODO_FIND_HTML;
} else if (cond == 1)
htmltext = TODO_FIND_HTML;
else if (cond == 2) {
htmltext = "";
st.takeAllItems(19490, 19491, 19492);
st.exitCurrentQuest(this);
st.playSound(SOUND_FINISH);
st.getPlayer().addExpAndSp(1879400 , 1782000);
st.giveItems(57, 194000);
}
}
return htmltext;
}
@Override
public String onKill(NpcInstance npc, QuestState st) {
int npcId = npc.getNpcId();
if (st.getCond() == 1 && ArrayUtils.contains(mobstohunt, npcId) && st.getQuestItemsCount(bufalo_meat) < 30) {
st.rollAndGive(bufalo_meat, 1, chance);
st.playSound(SOUND_ITEMGET);
}
if (st.getQuestItemsCount(bufalo_meat) >= 30) {
st.setCond(2);
st.playSound(SOUND_MIDDLE);
}
return null;
}
public String onKill(NpcInstance npc, QuestState st) {
int npcId = npc.getNpcId();
if (st.getCond() == 1 && ArrayUtils.contains(mobstohunt2, npcId) && st.getQuestItemsCount(ursus_meat) < 30) {
st.rollAndGive(ursus_meat, 1, chance);
st.playSound(SOUND_ITEMGET);
}
if (st.getQuestItemsCount(ursus_meat) >= 30) {
st.setCond(2);
st.playSound(SOUND_MIDDLE);
}
return null;
}
public String onKill(NpcInstance npc, QuestState st) {
int npcId = npc.getNpcId();
if (st.getCond() == 1 && ArrayUtils.contains(mobstohunt3, npcId) && st.getQuestItemsCount(ueti_meat) < 30) {
st.rollAndGive(ueti_meat, 1, chance);
st.playSound(SOUND_ITEMGET);
}
if (st.getQuestItemsCount(ueti_meat) >= 30) {
st.setCond(2);
st.playSound(SOUND_MIDDLE);
}
return null;
}
}
import l2p.gameserver.model.instances.NpcInstance;
import l2p.gameserver.model.quest.Quest;
import l2p.gameserver.model.quest.QuestState;
import l2p.gameserver.scripts.ScriptFile;
import org.apache.commons.lang3.ArrayUtils;
public class _474_WaitingfortheSummer extends Quest implements ScriptFile {
//Шанс дропа
private static final int chance = 80;
//Квест итем
private static int bufalo_meat = 19490;
private static int ursus_meat = 19491;
private static int ueti_meat = 19492;
//Монстры
private static final int[] mobstohunt = {22093, 22094};
private static final int[] mobstohunt2 = {22095, 22096};
private static final int[] mobstohunt3 = {22097, 22098};
//НПСы
private static final int advent = 33463;
private static final int captain = 31981;
@Override
public void onLoad() {
}
@Override
public void onReload() {
}
@Override
public void onShutdown() {
}
public _474_WaitingfortheSummer() {
super(PARTY_ONE);
addStartNpc(advent);
addTalkId(advent);
addTalkId(captain);
addKillId(mobstohunt);
addQuestItem(bufalo_meat);
addKillId(mobstohunt2);
addQuestItem(ursus_meat);
addKillId(mobstohunt3);
addQuestItem(ueti_meat);
addLevelCheck(60, 64);
}
@Override
public String onEvent(String event, QuestState st, NpcInstance npc) {
String htmltext = event;
if (event.equalsIgnoreCase("quest_ac")) {
st.setState(STARTED);
st.setCond(1);
st.playSound(SOUND_ACCEPT);
htmltext = "";
}
return htmltext;
}
@Override
public String onTalk(NpcInstance npc, QuestState st) {
int cond = st.getCond();
int npcId = npc.getNpcId();
String htmltext = "noquest";
if (npcId == advent) {
if (cond == 0) {
if (isAvailableFor(st.getPlayer())) {
if (st.isNowAvailableByTime())
htmltext = "";
else
htmltext = "";
} else
htmltext = TODO_FIND_HTML;
} else if (cond == 1 || cond == 2)
htmltext = "";
} else if (npcId == captain) {
if (cond == 0) {
if (isAvailableFor(st.getPlayer())) {
if (st.isNowAvailableByTime())
htmltext = TODO_FIND_HTML;
else
htmltext = "";
} else
htmltext = TODO_FIND_HTML;
} else if (cond == 1)
htmltext = TODO_FIND_HTML;
else if (cond == 2) {
htmltext = "";
st.takeAllItems(19490, 19491, 19492);
st.exitCurrentQuest(this);
st.playSound(SOUND_FINISH);
st.getPlayer().addExpAndSp(1879400 , 1782000);
st.giveItems(57, 194000);
}
}
return htmltext;
}
@Override
public String onKill(NpcInstance npc, QuestState st) {
int npcId = npc.getNpcId();
if (st.getCond() == 1 && ArrayUtils.contains(mobstohunt, npcId) && st.getQuestItemsCount(bufalo_meat) < 30) {
st.rollAndGive(bufalo_meat, 1, chance);
st.playSound(SOUND_ITEMGET);
}
if (st.getQuestItemsCount(bufalo_meat) >= 30) {
st.setCond(2);
st.playSound(SOUND_MIDDLE);
}
return null;
}
public String onKill(NpcInstance npc, QuestState st) {
int npcId = npc.getNpcId();
if (st.getCond() == 1 && ArrayUtils.contains(mobstohunt2, npcId) && st.getQuestItemsCount(ursus_meat) < 30) {
st.rollAndGive(ursus_meat, 1, chance);
st.playSound(SOUND_ITEMGET);
}
if (st.getQuestItemsCount(ursus_meat) >= 30) {
st.setCond(2);
st.playSound(SOUND_MIDDLE);
}
return null;
}
public String onKill(NpcInstance npc, QuestState st) {
int npcId = npc.getNpcId();
if (st.getCond() == 1 && ArrayUtils.contains(mobstohunt3, npcId) && st.getQuestItemsCount(ueti_meat) < 30) {
st.rollAndGive(ueti_meat, 1, chance);
st.playSound(SOUND_ITEMGET);
}
if (st.getQuestItemsCount(ueti_meat) >= 30) {
st.setCond(2);
st.playSound(SOUND_MIDDLE);
}
return null;
}
}
При компиляции выдает 2 ошибки
Ошибки
[javac] E:\L2\trunk\Lineage 2 Goddess of Destruction\dist\gameserver\data\sc
ripts\quests\_474_WaitingfortheSummer.java:124: error: method onKill(NpcInstance
,QuestState) is already defined in class _474_WaitingfortheSummer
[javac] public String onKill(NpcInstance npc, QuestState st) {
[javac] ^
[javac] E:\L2\trunk\Lineage 2 Goddess of Destruction\dist\gameserver\data\sc
ripts\quests\_474_WaitingfortheSummer.java:137: error: method onKill(NpcInstance
,QuestState) is already defined in class _474_WaitingfortheSummer
[javac] public String onKill(NpcInstance npc, QuestState st) {
ripts\quests\_474_WaitingfortheSummer.java:124: error: method onKill(NpcInstance
,QuestState) is already defined in class _474_WaitingfortheSummer
[javac] public String onKill(NpcInstance npc, QuestState st) {
[javac] ^
[javac] E:\L2\trunk\Lineage 2 Goddess of Destruction\dist\gameserver\data\sc
ripts\quests\_474_WaitingfortheSummer.java:137: error: method onKill(NpcInstance
,QuestState) is already defined in class _474_WaitingfortheSummer
[javac] public String onKill(NpcInstance npc, QuestState st) {
Как можно устранить эти ошибки и будет ли работать квест вообще, писал сам по аналогии других. Заранее благодарен.