Advertisement
Guest User

Untitled

a guest
Mar 28th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.49 KB | None | 0 0
  1. /*
  2. * This program is free software: you can redistribute it and/or modify it under
  3. * the terms of the GNU General Public License as published by the Free Software
  4. * Foundation, either version 3 of the License, or (at your option) any later
  5. * version.
  6. *
  7. * This program is distributed in the hope that it will be useful, but WITHOUT
  8. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  9. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  10. * details.
  11. *
  12. * You should have received a copy of the GNU General Public License along with
  13. * this program. If not, see <http://www.gnu.org/licenses/>.
  14. */
  15. package ai.individual.raidboss;
  16.  
  17. import java.util.List;
  18.  
  19. import ai.group_template.L2AttackableAIScript;
  20.  
  21. import com.l2dc.gameserver.model.L2ItemInstance;
  22. import com.l2dc.gameserver.model.actor.L2Npc;
  23. import com.l2dc.gameserver.model.actor.instance.L2PcInstance;
  24. import com.l2dc.gameserver.model.quest.QuestState;
  25. import com.l2dc.gameserver.network.SystemMessageId;
  26. import com.l2dc.gameserver.util.Util;
  27. import com.l2dc.util.Rnd;
  28.  
  29. /**
  30. * @author InsOmnia
  31. */
  32. public class Baylor extends L2AttackableAIScript
  33. {
  34. private static final int BAYLOR = 29099;
  35. // s13 / s14 / s cursed 14
  36. private static final int RED13[] = { 5908, 9570, 10160 };
  37. private static final int GREEN13[] = { 5911, 9572, 10162 };
  38. private static final int BLUE13[] = { 5914, 9571, 10161 };
  39.  
  40. public Baylor(int questId, String name, String descr)
  41. {
  42. super(questId, name, descr);
  43. int[] mobs = new int[] { BAYLOR };
  44. this.registerMobs(mobs, false, true, false, false, false, false, false);
  45. }
  46.  
  47. @Override
  48. public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
  49. {
  50. if (npc != null && npc.getNpcId() == BAYLOR)
  51. {
  52. if (killer.getParty() != null)
  53. {
  54. List<L2PcInstance> party = killer.getParty().getPartyMembers();
  55. for (L2PcInstance member : party)
  56. {
  57. if (Util.checkIfInRange(1500, npc, member, true))
  58. crystalCheck(member);
  59. }
  60. }
  61. else
  62. crystalCheck(killer);
  63. }
  64. return super.onKill(npc, killer, isPet);
  65. }
  66.  
  67. private void crystalCheck(L2PcInstance member)
  68. {
  69. QuestState st = member.getQuestState(getName());
  70. if (st == null)
  71. st = this.newQuestState(member);
  72. boolean lvled = false;
  73. L2ItemInstance[] inventory = member.getInventory().getItems();
  74. for (L2ItemInstance item : inventory)
  75. {
  76. int itemId = item.getItemId();
  77. if (!lvled && (itemId == RED13[0] || itemId == GREEN13[0] || itemId == BLUE13[0]))
  78. {
  79. int rnd = Rnd.get(1000);
  80. if (!lvled && itemId == RED13[0])
  81. {
  82. if (!lvled && (rnd > 850))
  83. { // 15% chance to get Soul Crystal Stage 14
  84. st.takeItems(RED13[0], 1);
  85. st.giveItems(RED13[1], 1);
  86. lvled = true;
  87. }
  88. else if (!lvled && (rnd > 700))
  89. { // 30% chance to get Cursed Soul Crystal Stage 14
  90. st.takeItems(RED13[0], 1);
  91. st.giveItems(RED13[2], 1);
  92. member.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_SUCCEEDED);
  93. lvled = true;
  94. }
  95. else
  96. {
  97. member.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_REFUSED);
  98. lvled = true;
  99. }
  100. }
  101. else if (!lvled && itemId == GREEN13[0])
  102. {
  103. if (!lvled && (rnd > 850))
  104. { // 15% chance to get Soul Crystal Stage 14
  105. st.takeItems(GREEN13[0], 1);
  106. st.giveItems(GREEN13[1], 1);
  107. lvled = true;
  108. }
  109. else if (!lvled && (rnd > 700))
  110. { // 30% chance to get Cursed Soul Crystal Stage 14
  111. st.takeItems(GREEN13[0], 1);
  112. st.giveItems(GREEN13[2], 1);
  113. member.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_SUCCEEDED);
  114. lvled = true;
  115. }
  116. else
  117. {
  118. member.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_REFUSED);
  119. lvled = true;
  120. }
  121. }
  122. else if (!lvled && itemId == BLUE13[0])
  123. {
  124. if (!lvled && (rnd > 850))
  125. { // 15% chance to get Soul Crystal Stage 14
  126. st.takeItems(BLUE13[0], 1);
  127. st.giveItems(BLUE13[1], 1);
  128. lvled = true;
  129. }
  130. else if (!lvled && (rnd > 700))
  131. { // 30% chance to get Cursed Soul Crystal Stage 14
  132. st.takeItems(BLUE13[0], 1);
  133. st.giveItems(BLUE13[2], 1);
  134. member.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_SUCCEEDED);
  135. lvled = true;
  136. }
  137. else
  138. {
  139. member.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_REFUSED);
  140. lvled = true;
  141. }
  142. }
  143. }
  144. }
  145. }
  146.  
  147. public static void main(String[] args)
  148. {
  149. new Baylor(-1, "Baylor", "ai");
  150. }
  151. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement