Fixed quest Hatchling Research (10534).

Contributed by Edoo.
This commit is contained in:
MobiusDevelopment 2020-02-05 15:58:22 +00:00
parent c699010fd2
commit 3e45c65973
5 changed files with 40 additions and 90 deletions

View File

@ -16,8 +16,6 @@
*/ */
package quests.Q10534_HatchlingResearch; package quests.Q10534_HatchlingResearch;
import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.enums.QuestSound;
import org.l2jmobius.gameserver.enums.QuestType; import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@ -35,11 +33,8 @@ public class Q10534_HatchlingResearch extends Quest
{ {
// NPC // NPC
private static final int STENA = 34221; private static final int STENA = 34221;
private static final int[] MONSTERS = private static final int DRAGON_HATCHING = 23434;
{ private static final int LEOPARD_DRAGON = 23435;
23434, // Dragon Hatchling
23435 // Leopard Dragon
};
// Item // Item
private static final int HATCHLING_FLASH = 46735; private static final int HATCHLING_FLASH = 46735;
// Misc // Misc
@ -51,7 +46,7 @@ public class Q10534_HatchlingResearch extends Quest
super(10534); super(10534);
addStartNpc(STENA); addStartNpc(STENA);
addTalkId(STENA); addTalkId(STENA);
addKillId(MONSTERS); addKillId(DRAGON_HATCHING, LEOPARD_DRAGON);
registerQuestItems(HATCHLING_FLASH); registerQuestItems(HATCHLING_FLASH);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "34221-08.htm"); addCondLevel(MIN_LEVEL, MAX_LEVEL, "34221-08.htm");
} }
@ -136,21 +131,16 @@ public class Q10534_HatchlingResearch extends Quest
} }
@Override @Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
final QuestState qs = getQuestState(player, false); final QuestState qs = getQuestState(killer, false);
if ((qs != null) && qs.isCond(1) && CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < 70)) if ((qs != null) && (qs.isCond(1)))
{ {
giveItems(player, HATCHLING_FLASH, 1); if (giveItemRandomly(killer, npc, HATCHLING_FLASH, 1, 50, 0.7, true))
if (getQuestItemsCount(player, HATCHLING_FLASH) >= 50)
{ {
qs.setCond(2, true); qs.setCond(2, true);
} }
else
{
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
}
} }
return super.onKill(npc, player, isSummon); return super.onKill(npc, killer, isSummon);
} }
} }

View File

@ -16,8 +16,6 @@
*/ */
package quests.Q10534_HatchlingResearch; package quests.Q10534_HatchlingResearch;
import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.enums.QuestSound;
import org.l2jmobius.gameserver.enums.QuestType; import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@ -35,11 +33,8 @@ public class Q10534_HatchlingResearch extends Quest
{ {
// NPC // NPC
private static final int STENA = 34221; private static final int STENA = 34221;
private static final int[] MONSTERS = private static final int DRAGON_HATCHING = 23434;
{ private static final int LEOPARD_DRAGON = 23435;
23434, // Dragon Hatchling
23435 // Leopard Dragon
};
// Item // Item
private static final int HATCHLING_FLASH = 46735; private static final int HATCHLING_FLASH = 46735;
// Misc // Misc
@ -51,7 +46,7 @@ public class Q10534_HatchlingResearch extends Quest
super(10534); super(10534);
addStartNpc(STENA); addStartNpc(STENA);
addTalkId(STENA); addTalkId(STENA);
addKillId(MONSTERS); addKillId(DRAGON_HATCHING, LEOPARD_DRAGON);
registerQuestItems(HATCHLING_FLASH); registerQuestItems(HATCHLING_FLASH);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "34221-08.htm"); addCondLevel(MIN_LEVEL, MAX_LEVEL, "34221-08.htm");
} }
@ -136,21 +131,16 @@ public class Q10534_HatchlingResearch extends Quest
} }
@Override @Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
final QuestState qs = getQuestState(player, false); final QuestState qs = getQuestState(killer, false);
if ((qs != null) && qs.isCond(1) && CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < 70)) if ((qs != null) && (qs.isCond(1)))
{ {
giveItems(player, HATCHLING_FLASH, 1); if (giveItemRandomly(killer, npc, HATCHLING_FLASH, 1, 50, 0.7, true))
if (getQuestItemsCount(player, HATCHLING_FLASH) >= 50)
{ {
qs.setCond(2, true); qs.setCond(2, true);
} }
else
{
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
}
} }
return super.onKill(npc, player, isSummon); return super.onKill(npc, killer, isSummon);
} }
} }

View File

@ -16,8 +16,6 @@
*/ */
package quests.Q10534_HatchlingResearch; package quests.Q10534_HatchlingResearch;
import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.enums.QuestSound;
import org.l2jmobius.gameserver.enums.QuestType; import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@ -35,11 +33,8 @@ public class Q10534_HatchlingResearch extends Quest
{ {
// NPC // NPC
private static final int STENA = 34221; private static final int STENA = 34221;
private static final int[] MONSTERS = private static final int DRAGON_HATCHING = 23434;
{ private static final int LEOPARD_DRAGON = 23435;
23434, // Dragon Hatchling
23435 // Leopard Dragon
};
// Item // Item
private static final int HATCHLING_FLASH = 46735; private static final int HATCHLING_FLASH = 46735;
// Misc // Misc
@ -51,7 +46,7 @@ public class Q10534_HatchlingResearch extends Quest
super(10534); super(10534);
addStartNpc(STENA); addStartNpc(STENA);
addTalkId(STENA); addTalkId(STENA);
addKillId(MONSTERS); addKillId(DRAGON_HATCHING, LEOPARD_DRAGON);
registerQuestItems(HATCHLING_FLASH); registerQuestItems(HATCHLING_FLASH);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "34221-08.htm"); addCondLevel(MIN_LEVEL, MAX_LEVEL, "34221-08.htm");
} }
@ -136,21 +131,16 @@ public class Q10534_HatchlingResearch extends Quest
} }
@Override @Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
final QuestState qs = getQuestState(player, false); final QuestState qs = getQuestState(killer, false);
if ((qs != null) && qs.isCond(1) && CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < 70)) if ((qs != null) && (qs.isCond(1)))
{ {
giveItems(player, HATCHLING_FLASH, 1); if (giveItemRandomly(killer, npc, HATCHLING_FLASH, 1, 50, 0.7, true))
if (getQuestItemsCount(player, HATCHLING_FLASH) >= 50)
{ {
qs.setCond(2, true); qs.setCond(2, true);
} }
else
{
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
}
} }
return super.onKill(npc, player, isSummon); return super.onKill(npc, killer, isSummon);
} }
} }

View File

@ -16,8 +16,6 @@
*/ */
package quests.Q10534_HatchlingResearch; package quests.Q10534_HatchlingResearch;
import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.enums.QuestSound;
import org.l2jmobius.gameserver.enums.QuestType; import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@ -35,11 +33,8 @@ public class Q10534_HatchlingResearch extends Quest
{ {
// NPC // NPC
private static final int STENA = 34221; private static final int STENA = 34221;
private static final int[] MONSTERS = private static final int DRAGON_HATCHING = 23434;
{ private static final int LEOPARD_DRAGON = 23435;
23434, // Dragon Hatchling
23435 // Leopard Dragon
};
// Item // Item
private static final int HATCHLING_FLASH = 46735; private static final int HATCHLING_FLASH = 46735;
// Misc // Misc
@ -51,7 +46,7 @@ public class Q10534_HatchlingResearch extends Quest
super(10534); super(10534);
addStartNpc(STENA); addStartNpc(STENA);
addTalkId(STENA); addTalkId(STENA);
addKillId(MONSTERS); addKillId(DRAGON_HATCHING, LEOPARD_DRAGON);
registerQuestItems(HATCHLING_FLASH); registerQuestItems(HATCHLING_FLASH);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "34221-08.htm"); addCondLevel(MIN_LEVEL, MAX_LEVEL, "34221-08.htm");
} }
@ -136,21 +131,16 @@ public class Q10534_HatchlingResearch extends Quest
} }
@Override @Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
final QuestState qs = getQuestState(player, false); final QuestState qs = getQuestState(killer, false);
if ((qs != null) && qs.isCond(1) && CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < 70)) if ((qs != null) && (qs.isCond(1)))
{ {
giveItems(player, HATCHLING_FLASH, 1); if (giveItemRandomly(killer, npc, HATCHLING_FLASH, 1, 50, 0.7, true))
if (getQuestItemsCount(player, HATCHLING_FLASH) >= 50)
{ {
qs.setCond(2, true); qs.setCond(2, true);
} }
else
{
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
}
} }
return super.onKill(npc, player, isSummon); return super.onKill(npc, killer, isSummon);
} }
} }

View File

@ -16,8 +16,6 @@
*/ */
package quests.Q10534_HatchlingResearch; package quests.Q10534_HatchlingResearch;
import org.l2jmobius.commons.util.CommonUtil;
import org.l2jmobius.gameserver.enums.QuestSound;
import org.l2jmobius.gameserver.enums.QuestType; import org.l2jmobius.gameserver.enums.QuestType;
import org.l2jmobius.gameserver.model.actor.Npc; import org.l2jmobius.gameserver.model.actor.Npc;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance; import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@ -35,11 +33,8 @@ public class Q10534_HatchlingResearch extends Quest
{ {
// NPC // NPC
private static final int STENA = 34221; private static final int STENA = 34221;
private static final int[] MONSTERS = private static final int DRAGON_HATCHING = 23434;
{ private static final int LEOPARD_DRAGON = 23435;
23434, // Dragon Hatchling
23435 // Leopard Dragon
};
// Item // Item
private static final int HATCHLING_FLASH = 46735; private static final int HATCHLING_FLASH = 46735;
// Misc // Misc
@ -51,7 +46,7 @@ public class Q10534_HatchlingResearch extends Quest
super(10534); super(10534);
addStartNpc(STENA); addStartNpc(STENA);
addTalkId(STENA); addTalkId(STENA);
addKillId(MONSTERS); addKillId(DRAGON_HATCHING, LEOPARD_DRAGON);
registerQuestItems(HATCHLING_FLASH); registerQuestItems(HATCHLING_FLASH);
addCondLevel(MIN_LEVEL, MAX_LEVEL, "34221-08.htm"); addCondLevel(MIN_LEVEL, MAX_LEVEL, "34221-08.htm");
} }
@ -136,21 +131,16 @@ public class Q10534_HatchlingResearch extends Quest
} }
@Override @Override
public String onKill(Npc npc, PlayerInstance player, boolean isSummon) public String onKill(Npc npc, PlayerInstance killer, boolean isSummon)
{ {
final QuestState qs = getQuestState(player, false); final QuestState qs = getQuestState(killer, false);
if ((qs != null) && qs.isCond(1) && CommonUtil.contains(MONSTERS, npc.getId()) && (getRandom(100) < 70)) if ((qs != null) && (qs.isCond(1)))
{ {
giveItems(player, HATCHLING_FLASH, 1); if (giveItemRandomly(killer, npc, HATCHLING_FLASH, 1, 50, 0.7, true))
if (getQuestItemsCount(player, HATCHLING_FLASH) >= 50)
{ {
qs.setCond(2, true); qs.setCond(2, true);
} }
else
{
playSound(player, QuestSound.ITEMSOUND_QUEST_ITEMGET);
}
} }
return super.onKill(npc, player, isSummon); return super.onKill(npc, killer, isSummon);
} }
} }