AdminEventEngine.java 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634
  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 handlers.admincommandhandlers;
  16. import java.io.BufferedInputStream;
  17. import java.io.BufferedReader;
  18. import java.io.DataInputStream;
  19. import java.io.File;
  20. import java.io.FileInputStream;
  21. import java.io.FileOutputStream;
  22. import java.io.InputStreamReader;
  23. import java.io.PrintStream;
  24. import java.util.StringTokenizer;
  25. import com.l2jserver.gameserver.Announcements;
  26. import com.l2jserver.gameserver.GmListTable;
  27. import com.l2jserver.gameserver.handler.IAdminCommandHandler;
  28. import com.l2jserver.gameserver.instancemanager.TransformationManager;
  29. import com.l2jserver.gameserver.model.L2World;
  30. import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
  31. import com.l2jserver.gameserver.model.entity.L2Event;
  32. import com.l2jserver.gameserver.model.entity.L2Event.EventState;
  33. import com.l2jserver.gameserver.network.serverpackets.CharInfo;
  34. import com.l2jserver.gameserver.network.serverpackets.ExBrExtraUserInfo;
  35. import com.l2jserver.gameserver.network.serverpackets.ItemList;
  36. import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
  37. import com.l2jserver.gameserver.network.serverpackets.PlaySound;
  38. import com.l2jserver.gameserver.network.serverpackets.UserInfo;
  39. import com.l2jserver.util.StringUtil;
  40. /**
  41. * This class handles following admin commands:
  42. * - admin = shows menu
  43. *
  44. * @version $Revision: 1.3.2.1.2.4 $ $Date: 2005/04/11 10:06:06 $
  45. */
  46. public class AdminEventEngine implements IAdminCommandHandler
  47. {
  48. private static final String[] ADMIN_COMMANDS =
  49. {
  50. "admin_event",
  51. "admin_event_new",
  52. "admin_event_choose",
  53. "admin_event_store",
  54. "admin_event_set",
  55. "admin_event_change_teams_number",
  56. "admin_event_announce",
  57. "admin_event_panel",
  58. "admin_event_control_begin",
  59. "admin_event_control_teleport",
  60. "admin_add", "admin_event_see",
  61. "admin_event_del",
  62. "admin_delete_buffer",
  63. "admin_event_control_sit",
  64. "admin_event_name",
  65. "admin_event_control_kill",
  66. "admin_event_control_res",
  67. "admin_event_control_poly",
  68. "admin_event_control_unpoly",
  69. "admin_event_control_transform",
  70. "admin_event_control_untransform",
  71. "admin_event_control_prize",
  72. "admin_event_control_chatban",
  73. "admin_event_control_kick",
  74. "admin_event_control_finish"
  75. };
  76. private static String tempBuffer = "";
  77. private static String tempName = "";
  78. private static boolean npcsDeleted = false;
  79. public boolean useAdminCommand(String command, L2PcInstance activeChar)
  80. {
  81. try
  82. {
  83. if (command.equals("admin_event"))
  84. {
  85. if (L2Event.eventState != EventState.OFF)
  86. showEventControl(activeChar);
  87. else
  88. showMainPage(activeChar);
  89. }
  90. else if (command.equals("admin_event_new"))
  91. {
  92. showNewEventPage(activeChar);
  93. }
  94. else if (command.startsWith("admin_add"))
  95. {
  96. tempBuffer += command.substring(10);
  97. showNewEventPage(activeChar);
  98. }
  99. else if (command.startsWith("admin_event_see"))
  100. {
  101. String eventName = command.substring(16);
  102. try
  103. {
  104. NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
  105. DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream("data/events/" + eventName)));
  106. BufferedReader inbr = new BufferedReader(new InputStreamReader(in));
  107. final String replyMSG = StringUtil.concat(
  108. "<html><body>" +
  109. "<center><font color=\"LEVEL\">",
  110. eventName,
  111. "</font><font color=\"FF0000\"> bY ",
  112. inbr.readLine(),
  113. "</font></center><br>" +
  114. "<br>",
  115. inbr.readLine(),
  116. "</body></html>"
  117. );
  118. adminReply.setHtml(replyMSG);
  119. activeChar.sendPacket(adminReply);
  120. inbr.close();
  121. }
  122. catch (Exception e)
  123. {
  124. e.printStackTrace();
  125. }
  126. }
  127. else if (command.startsWith("admin_event_del"))
  128. {
  129. String eventName = command.substring(16);
  130. File file = new File("data/events/" + eventName);
  131. file.delete();
  132. showMainPage(activeChar);
  133. }
  134. else if (command.startsWith("admin_event_name"))
  135. {
  136. tempName += command.substring(17);
  137. showNewEventPage(activeChar);
  138. }
  139. else if (command.equalsIgnoreCase("admin_delete_buffer"))
  140. {
  141. try
  142. {
  143. tempBuffer += tempBuffer.substring(0, tempBuffer.length() - 10);
  144. showNewEventPage(activeChar);
  145. }
  146. catch (Exception e)
  147. {
  148. tempBuffer = "";
  149. }
  150. }
  151. else if (command.startsWith("admin_event_store"))
  152. {
  153. try
  154. {
  155. FileOutputStream file = new FileOutputStream("data/events/" + tempName);
  156. PrintStream p = new PrintStream(file);
  157. p.println(activeChar.getName());
  158. p.println(tempBuffer);
  159. file.close();
  160. p.close();
  161. }
  162. catch (Exception e)
  163. {
  164. e.printStackTrace();
  165. }
  166. tempBuffer = "";
  167. tempName = "";
  168. showMainPage(activeChar);
  169. }
  170. else if (command.startsWith("admin_event_set"))
  171. {
  172. L2Event._eventName = command.substring(16);
  173. showEventParameters(activeChar, 2);
  174. }
  175. else if (command.startsWith("admin_event_change_teams_number"))
  176. {
  177. showEventParameters(activeChar, Integer.parseInt(command.substring(32)));
  178. }
  179. else if (command.startsWith("admin_event_panel"))
  180. {
  181. showEventControl(activeChar);
  182. }
  183. else if (command.startsWith("admin_event_announce"))
  184. {
  185. StringTokenizer st = new StringTokenizer(command.substring(21));
  186. L2Event._npcId = Integer.parseInt(st.nextToken());
  187. L2Event._teamsNumber = Integer.parseInt(st.nextToken());
  188. String temp = " ";
  189. String temp2 = "";
  190. while (st.hasMoreElements())
  191. {
  192. temp += st.nextToken() + " ";
  193. }
  194. st = new StringTokenizer(temp, "-");
  195. Integer i = 1;
  196. while (st.hasMoreElements())
  197. {
  198. temp2 = st.nextToken();
  199. if (!temp2.equals(" "))
  200. {
  201. L2Event._teamNames.put(i++, temp2.substring(1, temp2.length() - 1));
  202. }
  203. }
  204. activeChar.sendMessage(L2Event.startEventParticipation());
  205. Announcements.getInstance().announceToAll(activeChar.getName() + " has started an event. You will find a participation NPC somewhere around you.");
  206. PlaySound _snd = new PlaySound(1, "B03_F", 0, 0, 0, 0, 0);
  207. activeChar.sendPacket(_snd);
  208. activeChar.broadcastPacket(_snd);
  209. NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
  210. final String replyMSG = StringUtil.concat(
  211. "<html><body>" +
  212. "<center><font color=\"LEVEL\">[ L2J EVENT ENGINE</font></center><br>" +
  213. "<center>The event <font color=\"LEVEL\">",
  214. L2Event._eventName,
  215. "</font> has been announced, now you can type //event_panel to see the event panel control</center><br>" +
  216. "</body></html>"
  217. );
  218. adminReply.setHtml(replyMSG);
  219. activeChar.sendPacket(adminReply);
  220. }
  221. else if (command.startsWith("admin_event_control_begin"))
  222. {
  223. // Starts the event and sends a message of the result
  224. activeChar.sendMessage(L2Event.startEvent());
  225. showEventControl(activeChar);
  226. }
  227. else if (command.startsWith("admin_event_control_finish"))
  228. {
  229. // Finishes the event and sends a message of the result
  230. activeChar.sendMessage(L2Event.finishEvent());
  231. }
  232. else if (command.startsWith("admin_event_control_teleport"))
  233. {
  234. StringTokenizer st = new StringTokenizer(command.substring(29), "-");
  235. while (st.hasMoreElements())
  236. {
  237. int teamId = Integer.parseInt(st.nextToken());
  238. for (L2PcInstance player : L2Event._teams.get(teamId))
  239. {
  240. player.setTitle(L2Event._teamNames.get(teamId));
  241. player.teleToLocation(activeChar.getX(), activeChar.getY(), activeChar.getZ(), true);
  242. player.setInstanceId(activeChar.getInstanceId());
  243. }
  244. }
  245. showEventControl(activeChar);
  246. }
  247. else if (command.startsWith("admin_event_control_sit"))
  248. {
  249. StringTokenizer st = new StringTokenizer(command.substring(24), "-");
  250. while (st.hasMoreElements())
  251. {
  252. // Integer.parseInt(st.nextToken()) == teamId
  253. for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken())))
  254. {
  255. if (player.getEventStatus() == null)
  256. continue;
  257. player.getEventStatus().eventSitForced = !player.getEventStatus().eventSitForced;
  258. if (player.getEventStatus().eventSitForced)
  259. player.sitDown();
  260. else
  261. player.standUp();
  262. }
  263. }
  264. showEventControl(activeChar);
  265. }
  266. else if (command.startsWith("admin_event_control_kill"))
  267. {
  268. StringTokenizer st = new StringTokenizer(command.substring(25), "-");
  269. while (st.hasMoreElements())
  270. {
  271. for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken())))
  272. player.reduceCurrentHp(player.getMaxHp() + player.getMaxCp() + 1, activeChar, null);
  273. }
  274. showEventControl(activeChar);
  275. }
  276. else if (command.startsWith("admin_event_control_res"))
  277. {
  278. StringTokenizer st = new StringTokenizer(command.substring(24), "-");
  279. while (st.hasMoreElements())
  280. {
  281. for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken())))
  282. {
  283. if (player == null || !player.isDead())
  284. continue;
  285. player.restoreExp(100.0);
  286. player.doRevive();
  287. player.setCurrentHpMp(player.getMaxHp(), player.getMaxMp());
  288. player.setCurrentCp(player.getMaxCp());
  289. }
  290. }
  291. showEventControl(activeChar);
  292. }
  293. else if (command.startsWith("admin_event_control_poly"))
  294. {
  295. StringTokenizer st0 = new StringTokenizer(command.substring(25));
  296. StringTokenizer st = new StringTokenizer(st0.nextToken(), "-");
  297. String id = st0.nextToken();
  298. while (st.hasMoreElements())
  299. {
  300. for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken())))
  301. {
  302. player.getPoly().setPolyInfo("npc", id);
  303. player.teleToLocation(player.getX(), player.getY(), player.getZ(), true);
  304. CharInfo info1 = new CharInfo(player);
  305. player.broadcastPacket(info1);
  306. UserInfo info2 = new UserInfo(player);
  307. player.sendPacket(info2);
  308. player.broadcastPacket(new ExBrExtraUserInfo(player));
  309. }
  310. }
  311. showEventControl(activeChar);
  312. }
  313. else if (command.startsWith("admin_event_control_unpoly"))
  314. {
  315. StringTokenizer st = new StringTokenizer(command.substring(27), "-");
  316. while (st.hasMoreElements())
  317. {
  318. for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken())))
  319. {
  320. player.getPoly().setPolyInfo(null, "1");
  321. player.decayMe();
  322. player.spawnMe(player.getX(), player.getY(), player.getZ());
  323. CharInfo info1 = new CharInfo(player);
  324. player.broadcastPacket(info1);
  325. UserInfo info2 = new UserInfo(player);
  326. player.sendPacket(info2);
  327. player.broadcastPacket(new ExBrExtraUserInfo(player));
  328. }
  329. }
  330. showEventControl(activeChar);
  331. }
  332. else if (command.startsWith("admin_event_control_transform"))
  333. {
  334. StringTokenizer st0 = new StringTokenizer(command.substring(30));
  335. StringTokenizer st = new StringTokenizer(st0.nextToken(), "-");
  336. while (st.hasMoreElements())
  337. {
  338. for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken())))
  339. {
  340. int id = Integer.parseInt(st0.nextToken());
  341. if (!TransformationManager.getInstance().transformPlayer(id, player))
  342. GmListTable.broadcastMessageToGMs("EventEngine: Unknow transformation id: " + id);
  343. }
  344. }
  345. showEventControl(activeChar);
  346. }
  347. else if (command.startsWith("admin_event_control_untransform"))
  348. {
  349. StringTokenizer st = new StringTokenizer(command.substring(32), "-");
  350. while (st.hasMoreElements())
  351. {
  352. for (L2PcInstance player : L2Event._teams.get(Integer.parseInt(st.nextToken())))
  353. player.stopTransformation(true);
  354. }
  355. showEventControl(activeChar);
  356. }
  357. else if (command.startsWith("admin_event_control_kick"))
  358. {
  359. StringTokenizer st = new StringTokenizer(command.substring(25), "-");
  360. if (st.hasMoreElements())
  361. {
  362. L2PcInstance player = L2World.getInstance().getPlayer(st.nextToken());
  363. if (player != null)
  364. L2Event.removeAndResetPlayer(player);
  365. }
  366. else
  367. {
  368. if (activeChar.getTarget() != null && activeChar.getTarget() instanceof L2PcInstance)
  369. L2Event.removeAndResetPlayer((L2PcInstance) activeChar.getTarget());
  370. }
  371. showEventControl(activeChar);
  372. }
  373. else if (command.startsWith("admin_event_control_prize"))
  374. {
  375. StringTokenizer st0 = new StringTokenizer(command.substring(26));
  376. StringTokenizer st = new StringTokenizer(st0.nextToken(), "-");
  377. String n = st0.nextToken();
  378. StringTokenizer st1 = new StringTokenizer(n, "*");
  379. n = st1.nextToken();
  380. String type = "";
  381. if (st1.hasMoreElements())
  382. type = st1.nextToken();
  383. String id = st0.nextToken();
  384. while (st.hasMoreElements())
  385. {
  386. rewardTeam(activeChar, Integer.parseInt(st.nextToken()), Integer.parseInt(n), Integer.parseInt(id), type);
  387. }
  388. showEventControl(activeChar);
  389. }
  390. }
  391. catch (Exception e)
  392. {
  393. e.printStackTrace();
  394. GmListTable.broadcastMessageToGMs("EventEngine: Error! Possible blank boxes while executing a command which requires a value in the box?");
  395. }
  396. return true;
  397. }
  398. public String[] getAdminCommandList()
  399. {
  400. return ADMIN_COMMANDS;
  401. }
  402. String showStoredEvents()
  403. {
  404. File dir = new File("data/events");
  405. String[] files = dir.list();
  406. if (files == null) {
  407. return "<font color=\"FF0000\"> No 'data/events' directory! <font> <BR>" +
  408. "<font color=\"FF0000\"> UNABLE TO CREATE AN EVENT!!! Please create this folder. <font>";
  409. }
  410. final StringBuilder result = new StringBuilder(files.length * 500);
  411. for (int i = 0; i < files.length; i++) {
  412. final File file = new File("data/events/" + files[i]);
  413. final String fileName = file.getName();
  414. StringUtil.append(result,
  415. "<font color=\"LEVEL\">",
  416. fileName,
  417. " </font><br><button value=\"select\" action=\"bypass -h admin_event_set ",
  418. fileName,
  419. "\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><button value=\"ver\" action=\"bypass -h admin_event_see ",
  420. fileName,
  421. "\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><button value=\"delete\" action=\"bypass -h admin_event_del ",
  422. fileName,
  423. "\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"><br><br>"
  424. );
  425. }
  426. return result.toString();
  427. }
  428. public void showMainPage(L2PcInstance activeChar)
  429. {
  430. NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
  431. final String replyMSG = StringUtil.concat(
  432. "<html><body>" +
  433. "<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br>" +
  434. "<br><center><button value=\"Create NEW event \" action=\"bypass -h admin_event_new\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" +
  435. "<center><br>Stored Events<br></center>",
  436. showStoredEvents(),
  437. "</body></html>"
  438. );
  439. adminReply.setHtml(replyMSG);
  440. activeChar.sendPacket(adminReply);
  441. }
  442. public void showNewEventPage(L2PcInstance activeChar)
  443. {
  444. NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
  445. final StringBuilder replyMSG = StringUtil.startAppend(500,
  446. "<html><body>" +
  447. "<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br>" +
  448. "<br><center>Event's Title <br><font color=\"LEVEL\">"
  449. );
  450. if (tempName.isEmpty())
  451. replyMSG.append("Use //event_name text to insert a new title");
  452. else
  453. replyMSG.append(tempName);
  454. replyMSG.append("</font></center><br><br>Event's description<br>");
  455. if (tempBuffer.isEmpty())
  456. replyMSG.append("Use //add text o //delete_buffer to modify this text field");
  457. else
  458. replyMSG.append(tempBuffer);
  459. if (!(tempName.isEmpty() && tempBuffer.isEmpty()))
  460. replyMSG.append("<br><button value=\"Crear\" action=\"bypass -h admin_event_store\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
  461. replyMSG.append("</body></html>");
  462. adminReply.setHtml(replyMSG.toString());
  463. activeChar.sendPacket(adminReply);
  464. }
  465. public void showEventParameters(L2PcInstance activeChar, int teamnumbers)
  466. {
  467. NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
  468. final StringBuilder replyMSG = StringUtil.startAppend(
  469. 1000 + teamnumbers * 150,
  470. "<html><body>" +
  471. "<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br>" +
  472. "<center><font color=\"LEVEL\">",
  473. L2Event._eventName,
  474. "</font></center><br>" +
  475. "<br><center><button value=\"Change number of teams to\" action=\"bypass -h admin_event_change_teams_number $event_teams_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"> <edit var=\"event_teams_number\" width=100 height=20><br><br>" +
  476. "<font color=\"LEVEL\">Team's Names</font><br>"
  477. );
  478. for (int i = 0; i < teamnumbers; i++) {
  479. StringUtil.append(replyMSG,
  480. String.valueOf(i + 1),
  481. ".- <edit var=\"event_teams_name",
  482. String.valueOf(i + 1),
  483. "\" width=100 height=20><br>");
  484. }
  485. StringUtil.append(replyMSG,
  486. "<br><br>Announcer NPC id<edit var=\"event_npcid\" width=100 height=20><br><br><button value=\"Announce Event!!\" action=\"bypass -h admin_event_announce $event_npcid ",
  487. String.valueOf(teamnumbers),
  488. " ");
  489. for (int i = 0; i < teamnumbers; i++) {
  490. StringUtil.append(replyMSG,
  491. "$event_teams_name",
  492. String.valueOf(i + 1),
  493. " - ");
  494. }
  495. replyMSG.append("\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">" +
  496. "</body></html>");
  497. adminReply.setHtml(replyMSG.toString());
  498. activeChar.sendPacket(adminReply);
  499. }
  500. private void showEventControl(L2PcInstance activeChar)
  501. {
  502. NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
  503. final StringBuilder replyMSG = StringUtil.startAppend(1000,
  504. "<html><body>" +
  505. "<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br><font color=\"LEVEL\">",
  506. L2Event._eventName,
  507. "</font><br><br><table width=200>" +
  508. "<tr><td>Apply this command to teams number </td><td><edit var=\"team_number\" width=100 height=15></td></tr>" +
  509. "<tr><td>&nbsp;</td></tr>"
  510. );
  511. if (!npcsDeleted) {
  512. replyMSG.append("<tr><td><button value=\"Start\" action=\"bypass -h admin_event_control_begin\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Destroys all event npcs so no more people can't participate now on</font></td></tr>");
  513. }
  514. replyMSG.append(
  515. "<tr><td>&nbsp;</td></tr>" +
  516. "<tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr>" +
  517. "<tr><td>&nbsp;</td></tr>" +
  518. "<tr><td><button value=\"Sit\" action=\"bypass -h admin_event_control_sit $team_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr>" +
  519. "<tr><td>&nbsp;</td></tr>" +
  520. "<tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr>" +
  521. "<tr><td>&nbsp;</td></tr>" +
  522. "<tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr>" +
  523. "<tr><td>&nbsp;</td></tr>" +
  524. "<tr><td><button value=\"Polymorph\" action=\"bypass -h admin_event_control_poly $team_number $poly_id\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><edit var=\"poly_id\" width=100 height=15><font color=\"LEVEL\">Polymorphs the team into the NPC with the id specified</font></td></tr>" +
  525. "<tr><td>&nbsp;</td></tr>" +
  526. "<tr><td><button value=\"UnPolymorph\" action=\"bypass -h admin_event_control_unpoly $team_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Unpolymorph the team</font></td></tr>" +
  527. "<tr><td>&nbsp;</td></tr>" +
  528. "<tr><td><button value=\"Transform\" action=\"bypass -h admin_event_control_transform $team_number $transf_id\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><edit var=\"transf_id\" width=100 height=15><font color=\"LEVEL\">Transforms the team into the transformation with the id specified</font></td></tr>" +
  529. "<tr><td>&nbsp;</td></tr>" +
  530. "<tr><td><button value=\"UnTransform\" action=\"bypass -h admin_event_control_untransform $team_number\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Untransforms the team</font></td></tr>" +
  531. "<tr><td>&nbsp;</td></tr>" +
  532. "<tr><td>&nbsp;</td></tr>" +
  533. "<tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"> number <edit var=\"n\" width=100 height=15> item id <edit var=\"id\" width=100 height=15></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr>" +
  534. "<tr><td>&nbsp;</td></tr>" +
  535. "<tr><td><button value=\"Kick Player\" action=\"bypass -h admin_event_control_kick $player_name\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><edit var=\"player_name\" width=100 height=15><font color=\"LEVEL\">Kicks the specified player from the event. Blank field kicks target.</font></td></tr>" +
  536. "<tr><td>&nbsp;</td></tr>" +
  537. "<tr><td><button value=\"End\" action=\"bypass -h admin_event_control_finish\" width=90 height=15 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr>" +
  538. "</table></body></html>");
  539. adminReply.setHtml(replyMSG.toString());
  540. activeChar.sendPacket(adminReply);
  541. }
  542. private void rewardTeam(L2PcInstance activeChar, int team, int n, int id, String type)
  543. {
  544. int num = n;
  545. for (L2PcInstance player : L2Event._teams.get(team))
  546. {
  547. if (type.equalsIgnoreCase("level"))
  548. num = n * player.getLevel();
  549. else if (type.equalsIgnoreCase("kills") && player.getEventStatus() != null)
  550. {
  551. num = n * player.getEventStatus().kills.size();
  552. }
  553. else
  554. num = n;
  555. player.getInventory().addItem("Event", id, num, player, activeChar);
  556. player.sendPacket(new ItemList(player, true));
  557. NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
  558. adminReply.setHtml(
  559. "<html><body>" +
  560. "CONGRATULATIONS, you should have a present in your inventory" +
  561. "</body></html>");
  562. player.sendPacket(adminReply);
  563. }
  564. }
  565. }