Advertisement
SilentLtu

dasdsadas

Jun 4th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.18 KB | None | 0 0
  1. /*
  2. * This file is part of the L2J Mobius project.
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. * General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. package quests.Q10417_DaimonTheWhiteEyed;
  18.  
  19. import java.util.HashSet;
  20. import java.util.Set;
  21.  
  22. import com.l2jmobius.commons.util.CommonUtil;
  23. import com.l2jmobius.gameserver.enums.QuestSound;
  24. import com.l2jmobius.gameserver.enums.QuestType;
  25. import com.l2jmobius.gameserver.enums.Race;
  26. import com.l2jmobius.gameserver.model.actor.L2Npc;
  27. import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
  28. import com.l2jmobius.gameserver.model.holders.NpcLogListHolder;
  29. import com.l2jmobius.gameserver.model.quest.Quest;
  30. import com.l2jmobius.gameserver.model.quest.QuestState;
  31. import com.l2jmobius.gameserver.model.quest.State;
  32. import com.l2jmobius.gameserver.network.NpcStringId;
  33.  
  34. import quests.Q10416_InSearchOfTheEyeOfArgos.Q10416_InSearchOfTheEyeOfArgos;
  35.  
  36. /**
  37. * Daimon the White-eyed (10417)
  38. * @author St3eT
  39. */
  40. public final class Q10417_DaimonTheWhiteEyed extends Quest
  41. {
  42. // Monsters
  43. private static final int[] MONSTERS =
  44. {
  45. 21294, // Canyon Antelope
  46. 21296, // Canyon Bandersnatch
  47. 23311, // Valley Buffalo
  48. 23312, // Valley Grendel
  49. 21295, // Canyon Antelope Slave
  50. 21297, // Canyon Bandersnatch Slave
  51. 21299, // Valley Buffalo Slave
  52. 21304 // Valley Grendel Slave
  53. };
  54. // NPCs
  55. private static final int EYE_OF_ARGOS = 31683;
  56. private static final int JANITT = 33851;
  57. private static final int DAIMON_THE_WHITEEYED = 27499;
  58. // Misc
  59. private static final int MIN_LEVEL = 70;
  60. private static final int MAX_LEVEL = 75;
  61. private static final String KILL_COUNT_VAR = "KillCount";
  62. private static final String KILL_COUNT_VAR1 = "KillCount1";
  63.  
  64. public Q10417_DaimonTheWhiteEyed()
  65. {
  66. super(10417);
  67. addStartNpc(EYE_OF_ARGOS);
  68. addTalkId(EYE_OF_ARGOS, JANITT);
  69. addKillId(MONSTERS);
  70. addKillId(DAIMON_THE_WHITEEYED);
  71. addCondNotRace(Race.ERTHEIA, "31683-09.html");
  72. addCondLevel(MIN_LEVEL, MAX_LEVEL, "31683-08.htm");
  73. addCondCompletedQuest(Q10416_InSearchOfTheEyeOfArgos.class.getSimpleName(), "31683-08.htm");
  74. }
  75.  
  76. @Override
  77. public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  78. {
  79. final QuestState st = getQuestState(player, false);
  80. if (st == null)
  81. {
  82. return null;
  83. }
  84.  
  85. String htmltext = null;
  86. switch (event)
  87. {
  88. case "31683-02.htm":
  89. case "31683-03.htm":
  90. {
  91. htmltext = event;
  92. break;
  93. }
  94. case "31683-04.htm":
  95. {
  96. st.startQuest();
  97. htmltext = event;
  98. break;
  99. }
  100. case "31683-07.html":
  101. {
  102. if (st.isCond(2))
  103. {
  104. st.setCond(3, true);
  105. htmltext = event;
  106. }
  107. break;
  108. }
  109. case "31683-03.html":
  110. {
  111. if (st.isCond(3))
  112. {
  113. if (player.getLevel() >= MIN_LEVEL)
  114. {
  115. addExpAndSp(player, 178_732_196, 261);
  116. giveStoryQuestReward(npc, player);
  117. st.exitQuest(QuestType.ONE_TIME, true);
  118. htmltext = event;
  119. }
  120. else
  121. {
  122. htmltext = getNoQuestLevelRewardMsg(player);
  123. }
  124. }
  125. break;
  126. }
  127. }
  128. return htmltext;
  129. }
  130.  
  131. @Override
  132. public String onTalk(L2Npc npc, L2PcInstance player)
  133. {
  134. final QuestState st = getQuestState(player, true);
  135. String htmltext = getNoQuestMsg(player);
  136.  
  137. if (st.getState() == State.CREATED)
  138. {
  139. if (npc.getId() == EYE_OF_ARGOS)
  140. {
  141. htmltext = "31683-01.htm";
  142. }
  143. }
  144. else if (st.getState() == State.STARTED)
  145. {
  146. switch (st.getCond())
  147. {
  148. case 1:
  149. {
  150. htmltext = npc.getId() == EYE_OF_ARGOS ? "31683-05.html" : "33851-01.html";
  151. break;
  152. }
  153. case 2:
  154. {
  155. htmltext = npc.getId() == EYE_OF_ARGOS ? "31683-06.html" : "33851-01.html";
  156. break;
  157. }
  158. case 3:
  159. {
  160. htmltext = npc.getId() == EYE_OF_ARGOS ? "31683-07.html" : "33851-02.html";
  161. break;
  162. }
  163. }
  164. }
  165. return htmltext;
  166. }
  167.  
  168. @Override
  169. public String onKill(L2Npc npc, L2PcInstance killer, boolean isSummon)
  170. {
  171. final QuestState st = getQuestState(killer, false);
  172. if ((st != null) && st.isCond(2))
  173. {
  174. if ((npc.getId() == DAIMON_THE_WHITEEYED) || (CommonUtil.contains(MONSTERS, npc.getId())))
  175. {
  176. int raidCount = st.getInt("KillCount_" + DAIMON_THE_WHITEEYED);
  177. int monsterCount = st.getInt("KillCount_" + MONSTERS);
  178.  
  179. if (npc.getId() == DAIMON_THE_WHITEEYED)
  180. {
  181. if (raidCount < 1)
  182. {
  183. st.set("KillCount_" + DAIMON_THE_WHITEEYED, ++raidCount);
  184. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  185. }
  186. }
  187. else if (monsterCount < 100)
  188. {
  189. st.set("KillCount_" + MONSTERS, ++monsterCount);
  190. playSound(killer, QuestSound.ITEMSOUND_QUEST_ITEMGET);
  191. }
  192.  
  193. if (monsterCount >= 100)
  194. {
  195. st.setCond(2, true);
  196. }
  197. else if ((monsterCount >= 100) && (raidCount >= 1))
  198. {
  199. st.setCond(3, true);
  200. }
  201. }
  202. }
  203. return super.onKill(npc, killer, isSummon);
  204. }
  205.  
  206. @Override
  207. public Set<NpcLogListHolder> getNpcLogList(L2PcInstance activeChar)
  208. {
  209. final QuestState st = getQuestState(activeChar, false);
  210. if ((st != null) && st.isCond(1))
  211. {
  212. final int killCount = st.getInt(KILL_COUNT_VAR);
  213. if (killCount > 0)
  214. {
  215. final Set<NpcLogListHolder> holder = new HashSet<>();
  216. holder.add(new NpcLogListHolder(NpcStringId.DEFEAT_THE_BEASTS_OF_THE_VALLEY, killCount));
  217. return holder;
  218. }
  219. else if ((st != null) && st.isCond(2))
  220. {
  221. final Set<NpcLogListHolder> npcLogList = new HashSet<>();
  222. npcLogList.add(new NpcLogListHolder(DAIMON_THE_WHITEEYED, false, st.getInt("KillCount_" + DAIMON_THE_WHITEEYED)));
  223. return npcLogList;
  224. }
  225. return super.getNpcLogList(activeChar);
  226. }
  227. return null;
  228. }
  229. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement