package custom.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.Quest;
import net.sf.l2j.gameserver.model.quest.QuestState;
import net.sf.l2j.gameserver.model.quest.State;
import net.sf.l2j.util.Rnd;
public class Wings extends Quest {
private static final String qn = "Wings";
private final static int npcId = 10501;
private final static int[] MOBS = {22123, 22124, 22126, 22128};
private final static int RaidBoss = 10500;
private final static int BLACK_FEATHER = 10006;
private final static int ITEM_FROM_RB = 10007;
private final static int chance1 = 85;
private final static int chance2 = 100;
private final static int FEATHER = 10030;
private int count;
private static boolean REPEATABLE = true;
private int cond = 0;
public Wings(int questId, String name, String descr) {
super(questId, name, descr);
addStartNpc(npcId);
addTalkId(npcId);
for (int mobs : MOBS) {
addKillId(mobs);
}
addKillId(RaidBoss);
}
@Override
public String onAdvEvent(String event, L2NpcInstance npc, L2PcInstance player) {
String htmltext = event;
QuestState st = player.getQuestState(qn);
if (st == null) {
return htmltext;
}
switch (npc.getNpcId()) {
case npcId:
if (event.equals("start")) {
st.set("cond", "1");
htmltext = "10501-2.htm";
st.setState(State.STARTED);
st.playSound("ItemSound.quest_accept");
} else if (event.equals("sobral")) {
count = player.getInventory().getInventoryItemCount(BLACK_FEATHER, 0);
if (count < 300) {
htmltext = "10501-no.htm";
} else {
st.takeItems(BLACK_FEATHER, 300);
st.set("cond", "2");
htmltext = "10501-4.htm";
}
} else if (event.equals("item_RB")) {
count = player.getInventory().getInventoryItemCount(ITEM_FROM_RB, 0);
if (count < 1) {
htmltext = "10501-no1.htm";
} else {
st.takeItems(ITEM_FROM_RB, 1);
st.giveItems(FEATHER, 1);
st.exitQuest(REPEATABLE);
htmltext = "<html><body>Quest for wings passed successfully.</body><html>";
}
} else if (event.equals("otmena")) {
htmltext = "<html><body>Quest for wings canceled.</body></html>";
st.exitQuest(true);
}
break;
}
return htmltext;
}
@Override
public String onTalk(L2NpcInstance npc, L2PcInstance player) {
QuestState st = player.getQuestState(getName());
String htmltext = "";
if (st == null) {
return htmltext;
}
int npcId = npc.getNpcId();
cond = st.getInt("cond");
if (npcId == npcId) {
if (cond == 0) {
htmltext = "10501-1.htm";
} else if (cond == 1) {
htmltext = "10501-3.htm";
} else if (cond == 2) {
htmltext = "10501-5.htm";
}
}
return htmltext;
}
@Override
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) < 300) {
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) == 0) {
member.getQuestState(getName()).giveItems(ITEM_FROM_RB, 1);
} else if (killer.getInventory().getInventoryItemCount(ITEM_FROM_RB, 0) == 0) {
st.giveItems(ITEM_FROM_RB, 1);
}
}
}
}
}
break;
}
return null;
}
public static void main(String[] args) {
new Wings(-1, qn, "custom");
}
}
Выдирнул квест на Крылья под себя поправь и норм будет