Advertisement
horato

rb instance

Oct 18th, 2011
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.32 KB | None | 0 0
  1. ### Eclipse Workspace Patch 1.0
  2. #P L2J_DataPack_BETA
  3. Index: data/scripts/custom/RBinstance/instance.htm
  4. ===================================================================
  5. --- data/scripts/custom/RBinstance/instance.htm (revision 0)
  6. +++ data/scripts/custom/RBinstance/instance.htm (revision 0)
  7. @@ -0,0 +1,10 @@
  8. +<html>
  9. +<body>
  10. +<center>
  11. +<img src="L2UI_CH3.herotower_deco" height="32" width="256" align="center">
  12. +<br>
  13. +<font color=ff3333>Some craps here</font><br>
  14. +<button value="Enter" action="bypass -h Quest RBinstance enter" width=180 height=25 back="L2UI_ct1.button_df" fore="L2UI_ct1.button_df">
  15. +</center>
  16. +</body>
  17. +</html>
  18. \ No newline at end of file
  19. Index: data/scripts/custom/RBinstance/RBinstance.java
  20. ===================================================================
  21. --- data/scripts/custom/RBinstance/RBinstance.java (revision 0)
  22. +++ data/scripts/custom/RBinstance/RBinstance.java (revision 0)
  23. @@ -0,0 +1,159 @@
  24. +/*
  25. + * This program is free software: you can redistribute it and/or modify it under
  26. + * the terms of the GNU General Public License as published by the Free Software
  27. + * Foundation, either version 3 of the License, or (at your option) any later
  28. + * version.
  29. + *
  30. + * This program is distributed in the hope that it will be useful, but WITHOUT
  31. + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  32. + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  33. + * details.
  34. + *
  35. + * You should have received a copy of the GNU General Public License along with
  36. + * this program. If not, see <http://www.gnu.org/licenses/>.
  37. + */
  38. +package custom.RBinstance;
  39. +
  40. +import java.util.Map;
  41. +
  42. +import javolution.util.FastMap;
  43. +
  44. +import com.l2jserver.gameserver.instancemanager.InstanceManager;
  45. +import com.l2jserver.gameserver.model.actor.L2Npc;
  46. +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  47. +import com.l2jserver.gameserver.model.quest.Quest;
  48. +import com.l2jserver.util.Rnd;
  49. +
  50. +public class RBinstance extends Quest
  51. +{
  52. + private static final int NpcId = 152035;
  53. + private static final int[] RbId = {
  54. + 25001,25004,25007,25010,25013,25016,25019,25020,25023,25026,25029,25032,25035,25038,
  55. + 25041,25044,25047,25050,25051,25054,25057,25060,25063,25064,25067,25070,25073,25076,
  56. + 25079,25082,25085,25088,25089,25092,25095,25098,25099,25102,25103,25106,25109,25112,
  57. + 25115,25118,25119,25122,25125,25126,25127,25128,25131,25134,25137,25140,25143,25146,
  58. + 25149,25152,25155,25158,25159,25162,25163,25166,25169,25170,25173,25176,25179,25182,
  59. + 25185,25188,25189,25192,25198,25199,25202,25205,25208,25211,25214,25217,25220,25223,
  60. + 25226,25229,25230,25233,25234,25235,25238,25241,25244,25245,25248,25249,25252,25255,
  61. + 25256,25259,25260,25263,25266,25269,25272,25273,25276,25277,25280,25281,25282,25283,
  62. + 25286,25290,25293,25296,25299,25302,25305,25306,25309,25312,25315,25316,25319,25322,
  63. + 25325,25328,25352,25354,25357,25360,25362,25365,25366,25369,25372,25373,25375,25378,
  64. + 25380,25383,25385,25388,25391,25392,25394,25395,25398,25401,25404,25407,25410,25412,
  65. + 25415,25418,25420,25423,25426,25429,25431,25434,25437,25438,25441,25444,25447,25450,
  66. + 25453,25456,25460,25463,25467,25470,25473,25475,25478,25481,25484,25487,25490,25493,
  67. + 25496,25498,25501,25504,25506,25509,25512,25514,25523,25524,25527,25528,25531,25532,
  68. + 25534,25536,25539,25540,25542,25544,25546,25549,25552,25553,25554,25557,25560,25563,
  69. + 25566,25569,25572,25575,25578,25579,25582,25585,25588,25589,25592,25593,25603,25609,
  70. + 25610,25611,25612,25616,25617,25618,25619,25620,25621,25622,25643,25644,25645,25646,
  71. + 25647,25648,25649,25650,25651,25652,25653,25654,25655,25659,25660,25661,25665,25666,
  72. + 25667,25668,25669,25670,25671,25674,25677,25680,25681,25684,25687,25690,25691,25692,
  73. + 25693,25694,25695,25696,25697,25698,25699,25700,25701,25703,25709,25710,25713,25714,
  74. + 25716,29030,29033,29036,29037,29040,29054,29056,29060,29062,29065,29095,29096,29129,
  75. + 29132,29135,29138,29141,29144,29147
  76. + };
  77. + private static final int[][] TELEPORTS =
  78. + {
  79. + { -88429, -220629, -7903 },
  80. + { -82464, -219532, -7899 },
  81. + { -10700, -174882, -10936 }, // -76280, -185540, -10936
  82. + { -89683, -213573, -8106 },
  83. + { -81413, -213568, -8104 },
  84. + { -10700, -174882, -10936 }, // -76280, -174905, -10936
  85. + { -89759, -206143, -8120 },
  86. + { -81415, -206078, -8107 },
  87. + { -10700, -174882, -10936 },
  88. + { -56999, -219856, -8117 },
  89. + { -48794, -220261, -8075 },
  90. + { -10700, -174882, -10936 },
  91. + { -56940, -212939, -8072 },
  92. + { -55566, -206139, -8120 },
  93. + { -10700, -174882, -10936 },
  94. + { -49805, -206139, -8117 },
  95. + { -10700, -174882, -10936 },
  96. + { -10700, -174882, -10936 },
  97. + { 22010, -174867, -10904 }
  98. + };
  99. + private static final Map<L2PcInstance,Integer> instances = new FastMap<L2PcInstance, Integer>();
  100. +
  101. + public RBinstance(int questId, String name, String descr)
  102. + {
  103. + super(questId, name, descr);
  104. + addFirstTalkId(NpcId);
  105. + addTalkId(NpcId);
  106. + addStartNpc(NpcId);
  107. + for(int id : RbId)
  108. + addKillId(id);
  109. + }
  110. +
  111. + @Override
  112. + public String onTalk(L2Npc npc, L2PcInstance player)
  113. + {
  114. + return "instance.htm";
  115. + }
  116. +
  117. + @Override
  118. + public String onFirstTalk(L2Npc npc, L2PcInstance player)
  119. + {
  120. + return "instance.htm";
  121. + }
  122. +
  123. + @Override
  124. + public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
  125. + {
  126. + if (event.equals("enter"))
  127. + {
  128. + if (checkEntryPersmision(player))
  129. + {
  130. + enter(player);
  131. + }
  132. + else
  133. + player.sendMessage("You can enter only 5 times per day");
  134. + }
  135. + return "";
  136. + }
  137. +
  138. + private void enter(L2PcInstance player)
  139. + {
  140. + instances.put(player, InstanceManager.getInstance().createDynamicInstance("coliseum.xml"));
  141. + InstanceManager.getInstance().getInstance(instances.get(player)).setEmptyDestroyTime(30000);
  142. + player.setInstanceId(instances.get(player));
  143. + int teleport = Rnd.get(TELEPORTS.length - 1);
  144. + player.teleToLocation(TELEPORTS[teleport][0], TELEPORTS[teleport][1], TELEPORTS[teleport][2]);
  145. + addSpawn(RbId[Rnd.get(RbId.length - 1)], TELEPORTS[teleport][0], TELEPORTS[teleport][1], TELEPORTS[teleport][2], 0, false, 0).setInstanceId(instances.get(player));
  146. + }
  147. +
  148. + private boolean checkEntryPersmision(L2PcInstance player)
  149. + {
  150. + return InstanceManager.getInstance().getInstanceTime(player.getObjectId(), 5004) == -1;
  151. + }
  152. +
  153. + @Override
  154. + public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
  155. + {
  156. + InstanceManager.getInstance().setInstanceTime(killer.getObjectId(), getInstanceId(killer), System.currentTimeMillis() + (24 * 60 * 60 * 1000));
  157. + InstanceManager.getInstance().getInstance(instances.get(killer)).setDuration(5*60*1000);
  158. + return super.onKill(npc, killer, isPet);
  159. + }
  160. +
  161. + private int getInstanceId(L2PcInstance killer)
  162. + {
  163. + if (InstanceManager.getInstance().getInstanceTime(killer.getObjectId(), 5000) > -1)
  164. + if (InstanceManager.getInstance().getInstanceTime(killer.getObjectId(), 5001) > -1)
  165. + if (InstanceManager.getInstance().getInstanceTime(killer.getObjectId(), 5002) > -1)
  166. + if (InstanceManager.getInstance().getInstanceTime(killer.getObjectId(), 5003) > -1)
  167. + return 5004;
  168. + else
  169. + return 5003;
  170. + else
  171. + return 5002;
  172. + else
  173. + return 5001;
  174. + else
  175. + return 5000;
  176. + }
  177. +
  178. + public static void main(String[] args)
  179. + {
  180. + new RBinstance(-1, "RBinstance", "custom");
  181. + }
  182. +}
  183.  
  184.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement