Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.05 KB | None | 0 0
  1. package ai;
  2.  
  3. import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
  4. import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
  5. import net.sf.l2j.gameserver.model.quest.jython.QuestJython;
  6. import net.sf.l2j.util.Rnd;
  7. import net.sf.l2j.gameserver.datatables.SkillTable;
  8. import net.sf.l2j.gameserver.model.L2Party;
  9.  
  10. public class sethero extends QuestJython
  11. {
  12. //Босс Иды
  13. private final static int[] BossIds = {60000};
  14. //Выдавать награду всей пати?
  15. private static boolean PartyDrop = false;
  16. //Включить награду нублом?
  17. private static boolean NOBLE = false;
  18. //Включить награду хиро?
  19. private static boolean HERO = true;
  20. //На сколько давать хиро
  21. private final static int DayHero = 1;
  22. //Включить награду премиум?
  23. private static boolean PREMIUM = false;
  24. //На сколько давать премиум
  25. private final static int DayPremium = 1;
  26. //Включить награду итемом?
  27. private static boolean RewardItem = false;
  28. //Итем ид
  29. private final static int RewardItemId = 57;
  30. //Количество
  31. private final static int RewardItemCount = 1;
  32. //Шанс дропа предмета
  33. private final static int chance = 20;
  34. //Сколько разрешено иметь в инве таких предметов
  35. private final static int count = 1;
  36. //Включить награду скилами?
  37. private static boolean RewardSkill = false;
  38. //Скилл ид
  39. private final static int RewardSkillId = 2;
  40. //Скилл лвл
  41. private final static int RewardSkillLvl = 1;
  42.  
  43. public sethero(int questId, String name, String descr)
  44. {
  45. super(questId, name, descr, 1);
  46.  
  47. for (int boss : BossIds)
  48. addKillId(boss);
  49. }
  50.  
  51. @Override
  52. public String onKill(L2NpcInstance npc, L2PcInstance xzkaknazvat, boolean isPet)
  53. {
  54. int npcId = npc.getNpcId();
  55. for (int id : BossIds)
  56. if (npcId == id)
  57. if (HERO)
  58. {
  59. L2Party party = xzkaknazvat.getParty();
  60. if (party != null && PartyDrop)
  61. for (L2PcInstance xzkaknazvatpaty : party.getPartyMembers())
  62. {
  63. xzkaknazvatpaty.setHero(DayHero);
  64. xzkaknazvatpaty.sendMessage("\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 \u0433\u0435\u0440\u043e\u044f.");
  65. }
  66. else
  67. {
  68. xzkaknazvat.setHero(DayHero);
  69. xzkaknazvat.sendMessage("\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u0441\u0442\u0430\u0442\u0443\u0441 \u0433\u0435\u0440\u043e\u044f.");
  70. }
  71. }
  72. if (PREMIUM)
  73. {
  74. L2Party party = xzkaknazvat.getParty();
  75. if (party != null && PartyDrop)
  76. for (L2PcInstance xzkaknazvatpaty : party.getPartyMembers())
  77. {
  78. xzkaknazvatpaty.storePremium(DayPremium);
  79. xzkaknazvatpaty.sendMessage("\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0435\u043c\u0438\u0443\u043c.");
  80. }
  81. else
  82. {
  83. xzkaknazvat.storePremium(DayPremium);
  84. xzkaknazvat.sendMessage("\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0435\u043c\u0438\u0443\u043c.");
  85. }
  86. }
  87. if (NOBLE)
  88. {
  89. L2Party party = xzkaknazvat.getParty();
  90. if (party != null && PartyDrop)
  91. for (L2PcInstance xzkaknazvatpaty : party.getPartyMembers())
  92. {
  93. xzkaknazvatpaty.setNoble(true);
  94. xzkaknazvatpaty.sendMessage("\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043d\u0443\u0431\u043b\u0435\u0441.");
  95. }
  96. else
  97. {
  98. xzkaknazvat.setNoble(true);
  99. xzkaknazvat.sendMessage("\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043d\u0443\u0431\u043b\u0435\u0441.");
  100. }
  101. }
  102. if (RewardItem)
  103. {
  104. L2Party party = xzkaknazvat.getParty();
  105. if (party != null && PartyDrop)
  106. for (L2PcInstance xzkaknazvatpaty : party.getPartyMembers())
  107. if (Rnd.get(100) < chance)
  108. if (xzkaknazvatpaty.getInventory().getInventoryItemCount(RewardItemId,0) < count)
  109. {
  110. xzkaknazvatpaty.getInventory().addItem("Reward", RewardItemId, RewardItemCount, xzkaknazvatpaty, null);
  111. xzkaknazvatpaty.sendMessage("\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043c\u0435\u0442.");
  112. xzkaknazvatpaty.broadcastUserInfo();
  113. }
  114. else
  115. {
  116. if (Rnd.get(100) < chance)
  117. if (xzkaknazvat.getInventory().getInventoryItemCount(RewardItemId,0) < count)
  118. xzkaknazvat.getInventory().addItem("Reward", RewardItemId, RewardItemCount, xzkaknazvat, null);
  119. xzkaknazvat.sendMessage("\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043f\u0440\u0435\u0434\u043c\u0435\u0442.");
  120. xzkaknazvat.broadcastUserInfo();
  121. }
  122. }
  123. if (RewardSkill)
  124. {
  125. L2Party party = xzkaknazvat.getParty();
  126. if (party != null && PartyDrop)
  127. for (L2PcInstance xzkaknazvatpaty : party.getPartyMembers())
  128. {
  129. xzkaknazvatpaty.removeSkill(SkillTable.getInstance().getInfo(RewardSkillId, RewardSkillLvl));
  130. xzkaknazvatpaty.addSkill(SkillTable.getInstance().getInfo(RewardSkillId, RewardSkillLvl), true);
  131. xzkaknazvatpaty.sendMessage("\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0441\u043a\u0438\u043b.");
  132. }
  133. else
  134. {
  135. xzkaknazvat.removeSkill(SkillTable.getInstance().getInfo(RewardSkillId, RewardSkillLvl));
  136. xzkaknazvat.addSkill(SkillTable.getInstance().getInfo(RewardSkillId, RewardSkillLvl), true);
  137. xzkaknazvat.sendMessage("\u0412\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0438 \u043d\u043e\u0432\u044b\u0439 \u0441\u043a\u0438\u043b.");
  138. }
  139. }
  140. return null;
  141. }
  142.  
  143. public static void main(String[] args)
  144. {
  145. new sethero(-1, "sethero", "ai");
  146. }
  147. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement