Advertisement
warc222

[Share] Advanced GatekeeperElfocrash

Sep 17th, 2015
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.53 KB | None | 0 0
  1. /* This program is free software; you can redistribute it and/or modify
  2. * it under the terms of the GNU General Public License as published by
  3. * the Free Software Foundation; either version 2, or (at your option)
  4. * any later version.
  5. *
  6. * This program is distributed in the hope that it will be useful,
  7. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. * GNU General Public License for more details.
  10. *
  11. * You should have received a copy of the GNU General Public License
  12. * along with this program; if not, write to the Free Software
  13. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
  14. * 02111-1307, USA.
  15. *
  16. * http://www.gnu.org/copyleft/gpl.html
  17. */
  18. package com.l2jfrozen.gameserver.model.actor.instance;
  19.  
  20. import com.l2jfrozen.gameserver.ai.CtrlIntention;
  21. import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
  22. import com.l2jfrozen.gameserver.network.serverpackets.MyTargetSelected;
  23. import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
  24. import com.l2jfrozen.gameserver.network.serverpackets.ValidateLocation;
  25. import com.l2jfrozen.gameserver.model.zone.L2ZoneType;
  26. import com.l2jfrozen.gameserver.model.zone.L2ZoneManager;
  27. import com.l2jfrozen.gameserver.model.L2Character;
  28. import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
  29. import com.l2jfrozen.gameserver.templates.L2NpcTemplate;
  30. import com.l2jfrozen.gameserver.managers.TownManager;
  31.  
  32. import javolution.text.TextBuilder;
  33.  
  34. public class L2ElfokeeperInstance extends L2FolkInstance
  35. {
  36. public L2ElfokeeperInstance(int objectId, L2NpcTemplate template)
  37. {
  38. super(objectId, template);
  39. }
  40.  
  41. public void onBypassFeedback(L2PcInstance player, String command)
  42. {
  43. if(player == null)
  44. {
  45. return;
  46. }
  47.  
  48. if(command.startsWith("giran"))
  49. {
  50. player.teleToLocation(82698, 148638, -3473);
  51. }
  52.  
  53. if(command.startsWith("aden"))
  54. {
  55. player.teleToLocation(147456, 26886, -2207);
  56. }
  57.  
  58. if(command.startsWith("goddard"))
  59. {
  60. player.teleToLocation(147725, -56517, -2780);
  61. }
  62.  
  63. if(command.startsWith("ti"))
  64. {
  65. player.teleToLocation(-83838, 242732, -3732);
  66. }
  67.  
  68. if(command.startsWith("elv"))
  69. {
  70. player.teleToLocation(45873, 49288, -3059);
  71. }
  72.  
  73. if(command.startsWith("delv"))
  74. {
  75. player.teleToLocation(12428, 16551, -4588);
  76. }
  77.  
  78. if(command.startsWith("dwarf"))
  79. {
  80. player.teleToLocation(116551, -182493, -1525);
  81. }
  82.  
  83. if(command.startsWith("orc"))
  84. {
  85. player.teleToLocation(-44133, -113911, -244);
  86. }
  87.  
  88. if(command.startsWith("oren"))
  89. {
  90. player.teleToLocation(82321, 55139, -1529);
  91. }
  92.  
  93. if(command.startsWith("dion"))
  94. {
  95. player.teleToLocation(18748, 145437, -3132);
  96. }
  97.  
  98. if(command.startsWith("heine"))
  99. {
  100. player.teleToLocation(111383, 219107, -3546);
  101. }
  102.  
  103. if(command.startsWith("gludio"))
  104. {
  105. player.teleToLocation(-14225, 123540, -3121);
  106. }
  107.  
  108. if(command.startsWith("stut"))
  109. {
  110. player.teleToLocation(87358, -141982, -1336);
  111. }
  112.  
  113. if(command.startsWith("gludin"))
  114. {
  115. player.teleToLocation(-83063, 150791, -3128);
  116. }
  117.  
  118. if(command.startsWith("floran"))
  119. {
  120. player.teleToLocation(17144, 170156, -3502);
  121. }
  122.  
  123. if(command.startsWith("rune"))
  124. {
  125. player.teleToLocation(44070, -50243, -796);
  126. }
  127.  
  128. }
  129.  
  130. public void onAction(L2PcInstance player)
  131. {
  132. if (!canTarget(player)) {
  133. return;
  134. }
  135.  
  136. if (this != player.getTarget())
  137. {
  138. player.setTarget(this);
  139.  
  140. player.sendPacket(new MyTargetSelected(getObjectId(), 0));
  141.  
  142. player.sendPacket(new ValidateLocation(this));
  143. }
  144. else if (!canInteract(player))
  145. {
  146. player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this);
  147. }
  148. else
  149. {
  150. showHtmlWindow(player);
  151. }
  152.  
  153. player.sendPacket(new ActionFailed());
  154. }
  155.  
  156. private void showHtmlWindow(L2PcInstance activeChar)
  157. {
  158. NpcHtmlMessage nhm = new NpcHtmlMessage(5);
  159. TextBuilder tb = new TextBuilder("");
  160.  
  161. tb.append("<html><head><title>Elfokeeper</title></head><body>");
  162. tb.append("<center>");
  163. tb.append("<table width=\"250\" cellpadding=\"5\" bgcolor=\"000000\">");
  164. tb.append("<tr>");
  165. tb.append("<td width=\"45\" valign=\"top\" align=\"center\"><img src=\"L2ui_ch3.menubutton4\" width=\"38\" height=\"38\"></td>");
  166. tb.append("<td valign=\"top\"><font color=\"FF6600\">Advanced Gatekeeper</font>");
  167. tb.append("<br1><font color=\"00FF00\">"+activeChar.getName()+"</font>, here you can spy who's where.</td>");
  168. tb.append("</tr>");
  169. tb.append("</table>");
  170. tb.append("</center>");
  171. tb.append("<center>");
  172. tb.append("<td valign=\"top\"><font color=\"FF6600\">Where you gonna teleport " + activeChar.getName()+".</font><br>");
  173. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Talking I. : " + pewpew(2)+".</font>");
  174. tb.append("<button value=\"Talking I.\" action=\"bypass -h npc_" + getObjectId() + "_ti\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  175. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Elven V. : " + pewpew(3)+".</font>");
  176. tb.append("<button value=\"Elven V.\" action=\"bypass -h npc_" + getObjectId() + "_elv\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  177. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside D.Elven V. : " + pewpew(1)+".</font>");
  178. tb.append("<button value=\"D.Elven V.\" action=\"bypass -h npc_" + getObjectId() + "_delv\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  179. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Orc V. : " + pewpew(4)+".</font>");
  180. tb.append("<button value=\"Orc V.\" action=\"bypass -h npc_" + getObjectId() + "_orc\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  181. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Dwarven V. : " + pewpew(6)+".</font>");
  182. tb.append("<button value=\"Dwarven V.\" action=\"bypass -h npc_" + getObjectId() + "_dwarf\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  183. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Giran : " + pewpew(9)+".</font>");
  184. tb.append("<button value=\"Giran\" action=\"bypass -h npc_" + getObjectId() + "_giran\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  185. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Aden : " + pewpew(12)+".</font>");
  186. tb.append("<button value=\"Aden\" action=\"bypass -h npc_" + getObjectId() + "_aden\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  187. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Gludio : " + pewpew(7)+".</font>");
  188. tb.append("<button value=\"Gludio\" action=\"bypass -h npc_" + getObjectId() + "_gludio\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  189. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Gludin : " + pewpew(5)+".</font>");
  190. tb.append("<button value=\"Gludin\" action=\"bypass -h npc_" + getObjectId() + "_gludin\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  191. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Dion : " + pewpew(8)+".</font>");
  192. tb.append("<button value=\"Dion\" action=\"bypass -h npc_" + getObjectId() + "_dion\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  193. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Oren : " + pewpew(10)+".</font>");
  194. tb.append("<button value=\"Oren\" action=\"bypass -h npc_" + getObjectId() + "_oren\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  195. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Heine : " + pewpew(15)+".</font>");
  196. tb.append("<button value=\"Heine\" action=\"bypass -h npc_" + getObjectId() + "_heine\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  197. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Rune : " + pewpew(14)+".</font>");
  198. tb.append("<button value=\"Rune\" action=\"bypass -h npc_" + getObjectId() + "_rune\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  199. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Goddard : " + pewpew(13)+".</font>");
  200. tb.append("<button value=\"Goddard\" action=\"bypass -h npc_" + getObjectId() + "_goddard\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  201. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Schuttgart : " + pewpew(17)+".</font>");
  202. tb.append("<button value=\"Schuttgart\" action=\"bypass -h npc_" + getObjectId() + "_stut\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  203. tb.append("<td valign=\"top\"><font color=\"FF6600\">Players Inside Floran : " + pewpew(16)+".</font>");
  204. tb.append("<button value=\"Floran\" action=\"bypass -h npc_" + getObjectId() + "_floran\" width=70 height=21 back=\"L2UI.DefaultButton_click\" fore=\"L2UI.DefaultButton\"><br>");
  205. tb.append("</center>");
  206. tb.append("<center>");
  207. tb.append("<img src=\"l2ui_ch3.herotower_deco\" width=256 height=32 align=center>");
  208. tb.append("<font color=\"FF6600\">By Elfocrash</font>");
  209. tb.append("</center>");
  210. tb.append("</body></html>");
  211.  
  212. nhm.setHtml(tb.toString());
  213. activeChar.sendPacket(nhm);
  214.  
  215. activeChar.sendPacket(new ActionFailed());
  216. }
  217.  
  218. public static int pewpew(int bitch)
  219. {
  220. L2ZoneType zone = TownManager.getInstance().getTown(bitch);
  221. int i = 0;
  222. if(zone != null)
  223. {
  224. for (L2Character character : zone.getCharactersInside().values())
  225. if (character instanceof L2PcInstance)
  226. i++;
  227. return i;
  228. }
  229. return -1;
  230. }
  231.  
  232.  
  233.  
  234. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement