Guest User

Untitled

a guest
Feb 20th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 49.17 KB | None | 0 0
  1. package org.dementhium.content;
  2.  
  3. import java.io.BufferedWriter;
  4. import java.io.File;
  5. import java.io.FileWriter;
  6. import java.util.ArrayList;
  7. import java.util.List;
  8.  
  9. import org.dementhium.RS2ServerBootstrap;
  10. import org.dementhium.UpdateHandler;
  11. import org.dementhium.content.activity.ActivityManager;
  12. import org.dementhium.content.activity.impl.DuelActivity;
  13. import org.dementhium.content.areas.Area;
  14. import org.dementhium.content.cutscenes.impl.TestScene;
  15. //import org.dementhium.content.cutscenes.impl.TutorialScene;
  16. import org.dementhium.content.interfaces.ItemsKeptOnDeath;
  17. import org.dementhium.model.Container;
  18. import org.dementhium.model.Item;
  19. import org.dementhium.model.Location;
  20. import org.dementhium.model.Mob;
  21. import org.dementhium.model.Projectile;
  22. import org.dementhium.model.World;
  23. import org.dementhium.model.combat.MeleeFormulae;
  24. import org.dementhium.model.combat.RangeFormulae;
  25. import org.dementhium.model.definition.ItemDefinition;
  26. import org.dementhium.model.definition.NPCDefinition;
  27. import org.dementhium.model.definition.PlayerDefinition;
  28. import org.dementhium.model.map.Region;
  29. import org.dementhium.model.map.path.DefaultPathFinder;
  30. import org.dementhium.model.map.path.ProjectilePathFinder;
  31. import org.dementhium.model.misc.GroundItem;
  32. import org.dementhium.model.misc.GroundItemManager;
  33. import org.dementhium.model.misc.IconManager;
  34. import org.dementhium.model.misc.ProjectileManager;
  35. import org.dementhium.model.npc.NPC;
  36. import org.dementhium.model.player.Player;
  37. import org.dementhium.model.player.Skills;
  38. import org.dementhium.net.ActionSender;
  39. import org.dementhium.tickable.Tick;
  40. import org.dementhium.util.InterfaceSettings;
  41. import org.dementhium.util.Misc;
  42. import org.dementhium.util.misc.Sounds;
  43.  
  44. /**
  45. * @author 'Mystic Flow
  46. */
  47. public final class Commands {
  48.  
  49. private static boolean teleToAdminDisabled = false;
  50.  
  51. public static boolean diceChance;
  52.  
  53. public static void handle(Player player, String[] command) {
  54. try {
  55. if (player.getRights() < 1 && player.getPlayerArea().inWilderness()) {
  56. player.sendMessage("Sorry but you can't use commands while in the wilderness.");
  57. return;
  58. }
  59. if (player.getRights() >= 0) {
  60. playerCommands(player, command);
  61. }
  62. if (player.getRights() >= 1) {
  63. modCommands(player, command);
  64. }
  65. if (player.getRights() == 2) {
  66. adminCommands(player, command);
  67. }
  68. if (player.getDonor() > 0 || player.getRights() >= 1) {
  69. donorCommands(player, command);
  70. }
  71. } catch (Throwable e) {
  72. e.printStackTrace();
  73. }
  74. }
  75.  
  76. public static void donorCommands(final Player player, String[] command) {
  77. if (command[0].equals("yell")) {
  78. String yell = getCompleteString(command, 1);
  79. for(Player pl : World.getWorld().getPlayers()) {
  80. if (player.getUsername().equals("mrpwnage")) {
  81. pl.sendMessage("<col=FF3333>[Server Owner]<img=2>: <col=FF3333>" + yell);
  82. }
  83. }
  84. }
  85. }
  86. // [16:24:24] 1836 - 3145729 (0x300001) > 1048579 (0x100003)
  87. public static void playerCommands(final Player player, String[] command) {
  88. if (command[0].equals("commands") || command[0].equals("help")) {
  89. BookManager.proceedBook(player, 4);
  90. }
  91. if (command[0].equals("yell") && player.getRights() < 1
  92. && player.getDonor() == 0) {
  93. player.sendMessage("The yell command is a donor only privilege.");
  94. }
  95. if (command[0].equals("ancients")) {
  96. player.setSpellBook(193);
  97. }
  98. if (command[0].equals("modern")) {
  99. player.setSpellBook(192);
  100. }
  101. if (command[0].equals("lunar")) {
  102. player.setSpellBook(430);
  103. }
  104. if (command[0].equals("godwars")) {
  105. player.sendMessage("Tie the rope. You only have to do this once!");
  106. player.getInventory().addItem(954, 1);
  107. player.teleport(2916, 3747, 0);
  108. }
  109. if (command[0].equals("td")) {
  110. player.teleport(2601, 5745, 0);
  111. }
  112. if (command[0].equals("skills")) {
  113. player.teleport(2423, 3528, 0);
  114. }
  115. if (command[0].equals("edge")) {
  116. player.teleport(3087, 3493, 0);
  117. }
  118. if (command[0].equals("mindaltar")) {
  119. player.teleport(2784, 4836, 0);
  120. }
  121. if (command[0].equals("airaltar")) {
  122. player.teleport(2845, 4832, 0);
  123. }
  124. if (command[0].equals("earthaltar")) {
  125. player.teleport(2660, 4839, 0);
  126. }
  127. if (command[0].equals("firealtar")) {
  128. player.teleport(2584, 4836, 0);
  129. }
  130. if (command[0].equals("bodyaltar")) {
  131. player.teleport(2527, 4833, 0);
  132. }
  133. if (command[0].equals("lawaltar")) {
  134. player.teleport(2464, 4834, 0);
  135. }
  136. if (command[0].equals("naturealtar")) {
  137. player.teleport(2398, 4841, 0);
  138. }
  139. if (command[0].equals("shops")) {
  140. player.sendMessage("Have fun shopping!");
  141. player.teleport(3449, 3728, 0);
  142. }
  143. if (command[0].equals("wc")) {
  144. player.sendMessage("You can now Woodcut at ::skills");
  145. player.teleport(2724, 3493, 0);
  146. }
  147. if (command[0].equals("drags")) {
  148. player.teleport(2709, 9467, 0);
  149. }
  150. if (command[0].equals("agility")) {
  151. player.teleport(2467, 3435, 0);
  152. }
  153. if (command[0].equals("agility2")) {
  154. player.teleport(2552, 3557, 0);
  155. }
  156. if (command[0].equals("curses")) {
  157. player.getPrayer().setAnctientCurses(
  158. Boolean.parseBoolean(command[1]));
  159. ActionSender.sendConfig(player, 1584, player.getPrayer()
  160. .isAncientCurses() ? 1 : 0);
  161. }
  162. if (command[0].equals("players")) {
  163. player.sendMessage("There are currently "
  164. + World.getWorld().getPlayers().size()
  165. + " players online. Currently "
  166. + World.getWorld().getLobbyPlayers().size()
  167. + " players in lobby.");
  168. }
  169. if (command[0].equals("train")) {
  170. player.teleport(1860, 5243, 0);
  171. }
  172. if (command[0].equals("home")) {
  173. player.teleport(2389, 4450, 0);
  174. }
  175. if (command[0].equals("nex")) {
  176. player.teleport(2912, 5203, 0);
  177. }
  178. if (command[0].equals("corp")) {
  179. player.teleport(2974, 4382, 2);
  180. }
  181. if (command[0].equals("commands")) {
  182. player.sendMessage("<col=cc0066>Below is a list of Commands that you may use:");
  183. player.sendMessage("<col=cc0066>::players, ::train, ::ancients, ::lunar, ::modern, ::shops, ::nex, ::td, ::corp");
  184. player.sendMessage("<col=cc0066>::curses true/false, ::drags, ::godwars, ::wc, ::skills, ::agility, ::agility2, ::naturealtar");
  185. player.sendMessage("<col=cc0066>::mindaltar, ::airaltar, ::earthaltar, ::firealtar, ::bodyaltar, ::lawaltar");
  186. }
  187.  
  188. }
  189.  
  190. public static void modCommands(final Player player, String[] command) {
  191. if (player.getUsername().equalsIgnoreCase("sir pk p00n")
  192. || player.getUsername().equalsIgnoreCase("stacx"))
  193. return;
  194. if (command[0].equals("pos")) {
  195. player.sendMessage(player.getLocation().toString());
  196. System.out.println(player.getLocation().getX() + " "
  197. + player.getLocation().getY());
  198. }
  199. if (command[0].equals("modzone")) {
  200. player.teleport(1868, 5347, 0);
  201. }
  202. if (command[0].equals("kick")) {
  203. Player other = World.getWorld().getPlayerInServer(
  204. getCompleteString(command, 1).substring(0,
  205. getCompleteString(command, 1).length() - 1));
  206. if (other != null) {
  207. ActionSender.sendLogout(other, 10);
  208. World.getWorld().unregister(other);
  209. }
  210. }
  211. if (command[0].equals("mute")) {
  212. Player other = World.getWorld().getPlayerInServer(
  213. getCompleteString(command, 1).substring(0,
  214. getCompleteString(command, 1).length() - 1));
  215. if (other != null)
  216. World.getWorld().getPunishHandler().addMuted(other, false);
  217. }
  218. if (command[0].equals("unmute")) {
  219. World.getWorld()
  220. .getPunishHandler()
  221. .unMute(getCompleteString(command, 1).substring(0,
  222. getCompleteString(command, 1).length() - 1), false);
  223. }
  224. if (command[0].equals("ban")) {
  225. Player other = World.getWorld().getPlayerInServer(
  226. getCompleteString(command, 1).substring(0,
  227. getCompleteString(command, 1).length() - 1));
  228. if (other != null) {
  229. World.getWorld().getPunishHandler().addBan(other, false);
  230. other.getConnection().getChannel().disconnect();
  231. } else {
  232. World.getWorld()
  233. .getPunishHandler()
  234. .addBan(getCompleteString(command, 1).substring(0,
  235. getCompleteString(command, 1).length() - 1));
  236. }
  237. }
  238. if (command[0].equals("unban")) {
  239. World.getWorld()
  240. .getPunishHandler()
  241. .unBan(getCompleteString(command, 1).substring(0,
  242. getCompleteString(command, 1).length() - 1), false);
  243. }
  244. if (command[0].equals("sound")) {
  245. int id = Integer.parseInt(command[1]);
  246. Sounds.playSound(player.getLocation(), id, 17);
  247. }
  248. if (command[0].equals("ipmute")) {
  249. Player other = World.getWorld().getPlayerInServer(
  250. getCompleteString(command, 1).substring(0,
  251. getCompleteString(command, 1).length() - 1));
  252. if (other != null)
  253. World.getWorld().getPunishHandler().addMuted(other, true);
  254. }
  255. if (command[0].equals("unipmute")) {
  256. Player other = World.getWorld().getPlayerInServer(
  257. getCompleteString(command, 1).substring(0,
  258. getCompleteString(command, 1).length() - 1)
  259. .replaceAll("_", " "));
  260. if (other != null) {
  261. World.getWorld().getPunishHandler().unMute(other, true);
  262. } else {
  263. other = new Player(null, new PlayerDefinition(
  264. getCompleteString(command, 1).substring(0,
  265. getCompleteString(command, 1).length() - 1)
  266. .replaceAll("_", " "), null));
  267. World.getWorld().getPlayerLoader().load(other);
  268. World.getWorld().getPunishHandler()
  269. .unMute(other.getLastConnectIp(), true);
  270. }
  271. }
  272. if (command[0].equals("checkplayer")) {
  273. Player victim = World.getWorld().getPlayerInServer(command[1]);
  274. int itemid = Integer.parseInt(command[2]);
  275. if (victim.getBank().contains(itemid)) {
  276. player.sendMessage(victim.getUsername() + " bank contains "
  277. + victim.getBank().getContainer().getItemCount(itemid)
  278. + " of item id [" + itemid + "]");
  279. }
  280. if (victim.getInventory().contains(itemid)) {
  281. player.sendMessage(victim.getUsername()
  282. + " inventory contains "
  283. + victim.getInventory().getContainer()
  284. .getItemCount(itemid) + " of item id ["
  285. + itemid + "]");
  286. }
  287. if (victim.getEquipment().contains(itemid)) {
  288. player.sendMessage(victim.getUsername()
  289. + " is currently wearing "
  290. + victim.getEquipment().getContainer()
  291. .getItemCount(itemid) + " of item id ["
  292. + itemid + "]");
  293. } else {
  294. player.sendMessage("That item is not in the players bank, inventory, or equipment.");
  295. }
  296. }
  297. if (command[0].equals("viewbank")) {
  298. Player victim = World.getWorld().getPlayerInServer(command[1]);
  299. ActionSender.sendItems(player, 93, player.getInventory()
  300. .getContainer(), false);
  301. player.getBank().openPlayerBank(victim);
  302. }
  303.  
  304. }
  305.  
  306. public static void adminCommands(final Player player, String[] command) {
  307. if (command[0].equals("shopfree")) {
  308. ActionSender.sendConfig(player, 118, 4);
  309. ActionSender.sendConfig(player, 1496, -1);
  310. ActionSender.sendConfig(player, 532, 995);
  311. ActionSender.sendItems(player, 4, player.getInventory()
  312. .getContainer(), false);
  313. ActionSender.sendBConfig(player, 199, -1);
  314. ActionSender.sendBConfig(player, 1241, 16750848);
  315. ActionSender.sendBConfig(player, 1242, 15439903);
  316. ActionSender.sendBConfig(player, 741, -1);
  317. ActionSender.sendBConfig(player, 743, -1);
  318. ActionSender.sendAMask(player, 0, 449, 21, -1, -1);
  319. ActionSender.sendBConfig(player, 744, 0);
  320. Object[] params = new Object[] { "Sell 50", "Sell 10", "Sell 5",
  321. "Sell 1", "Value", -1, 1, 7, 4, 93, 40697856 };
  322. ActionSender.sendClientScript(player, 149, params, "IviiiIsssss");
  323. ActionSender.sendAMask(player, 2360382, 621, 0, 27, 28);
  324. ActionSender.sendAMask(player, 1150, 620, 25, 240, 243);
  325. ActionSender.sendInterfaceConfig(player, 620, 19, true);
  326. ActionSender.sendInterface(player, 620);
  327. ActionSender.sendInventoryInterface(player, 621);
  328. }
  329. if (command[0].equals("train")) {
  330. player.teleport(1860, 5243, 0);
  331. }
  332. if (command[0].equals("home")) {
  333. player.teleport(2389, 4450, 0);
  334. }
  335. if (command[0].equals("tp")) {
  336. ActionSender.sendItemOnInterface(player, 25, 3, 1, 4153);
  337. ActionSender.sendString(player, 25, 1, "Emperor owns");
  338. //Child id: 2, 3, 5 for possibilities.
  339. //Sequence: 6, 7, 8
  340. System.out.println("Sent item on interface.");
  341. }
  342. if (command[0].equals("gesell")) {
  343. /*
  344. * Config ID: 1112 Value: 0 Config ID: 1113 Value: 1
  345. */
  346. ActionSender.sendConfig(player, 1112, 0);
  347. ActionSender.sendConfig(player, 1113, 1);
  348. ActionSender.sendBConfig(player, 199, -1);
  349. // Accessmask set: 1026, interface: 107 child: 18 start 0, length: 0
  350. // Interface config: interf: 105, child: 196, hidden: false You are
  351. // trying to sell an item for far less than its worth
  352. // Client script: IviiiIsssss parameters: [149, 7012370, 93, 4, 7,
  353. // 0, -1, Offer, , , , ]
  354. Object[] params = new Object[] { "", "", "", "", "Offer", -1, 0, 7,
  355. 4, 93, 7012370 };
  356. ActionSender.sendClientScript(player, 149, params, "IviiiIsssss");
  357. ActionSender.sendAMask(player, 1026, 107, 18, 0, 28);
  358. ActionSender.sendInterfaceConfig(player, 105, 196, false);
  359. ActionSender.sendInterface(player, 105);
  360. ActionSender.sendInventoryInterface(player, 107);
  361. ActionSender.sendItems(player, 4, player.getInventory()
  362. .getContainer(), false);
  363. }
  364. if (command[0].equals("dbox")) {
  365. /*
  366. * Client script: IviiiIsssss parameters: [149, 720913, 93, 7, 4, 0,
  367. * 720913, Deposit-1<col=ff9040>, Deposit-5<col=ff9040>,
  368. * Deposit-10<col=ff9040>, Deposit-All<col=ff9040>,
  369. * Deposit-X<col=ff9040>] Accessmask set: 1086, interface: 11 child:
  370. * 17 start 0, length: 0 Accessmask set: 0, interface: 548 child:
  371. * 132 start 0, length: -1 Accessmask set: 0, interface: 548 child:
  372. * 133 start 0, length: -1
  373. */// ActionSender.sendAMask(player, 0, 548, 132, 0, -1);
  374. // ActionSender.sendAMask(player, 0, 548, 133, 0, -1);
  375. // ActionSender.sendInventoryInterface(player, 93);
  376. ActionSender.sendBlankClientScript(player, 3286);
  377. Object[] params = new Object[] { "Deposit-X<col=ff9040>",
  378. "Deposit-All<col=ff9040>", "Deposit-10<col=ff9040>",
  379. "Deposit-5<col=ff9040>", "Deposit-1<col=ff9040>", 720913,
  380. 0, 4, 7, 93, 720913 };
  381. ActionSender.sendBConfig(player, 199, -1);
  382. ActionSender.sendClientScript(player, 149, params, "IviiiIsssss");
  383. ActionSender.sendAMask(player, 1086, 11, 17, 0, 28);
  384. ActionSender.sendInterface(player, 11);
  385. }
  386. if (command[0].equals("geitem")) {
  387. /*
  388. * BCONFIG ID: 1001 VALUE: 3 BCONFIG ID: 199 VALUE: -1 Send
  389. * interface - show id: 0, window id: 548, interfaceId: 18, child
  390. * id: 885. Client script: isi parameters: [1169, 1, 40 gp, 0]
  391. * Accessmask set: 2, interface: 885 child: 16 start 0, length: 0
  392. * Client script: isi parameters: [1169, 3, 146 gp, 1] Accessmask
  393. * set: 2, interface: 885 child: 16 start 0, length: 2 Client
  394. * script: isi parameters: [1169, 5, 28 gp, 2] Accessmask set: 2,
  395. * interface: 885 child: 16 start 0, length: 4 Client script: isi
  396. * parameters: [1169, 7, 14 gp, 3] Accessmask set: 2, interface: 885
  397. * child: 16 start 0, length: 6 Client script: isi parameters:
  398. * [1169, 9, 70 gp, 4] Accessmask set: 2, interface: 885 child: 16
  399. * start 0, length: 8 Client script: isi parameters: [1169, 11, 36
  400. * gp, 5] Accessmask set: 2, interface: 885 child: 16 start 0,
  401. * length: 10 Client script: isi parameters: [1169, 13, 302 gp, 6]
  402. * Accessmask set: 2, interface: 885 child: 16 start 0, length: 12
  403. * Client script: isi parameters: [1169, 15, 67 gp, 7] Accessmask
  404. * set: 2, interface: 885 child: 16 start 0, length: 14 Client
  405. * script: isi parameters: [1169, 17, 363 gp, 8] Accessmask set: 2,
  406. * interface: 885 child: 16 start 0, length: 16 Client script: isi
  407. * parameters: [1169, 19, 413 gp, 9] Accessmask set: 2, interface:
  408. * 885 child: 16 start 0, length: 18 Client script: isi parameters:
  409. * [1169, 21, 1,326 gp, 10] Accessmask set: 2, interface: 885 child:
  410. * 16 start 0, length: 20
  411. */
  412. ActionSender.sendBConfig(player, 1001, 3);
  413. ActionSender.sendBConfig(player, 199, -1);
  414. Object[] params = new Object[] { 1, "40 gp", 0 };
  415. ActionSender.sendClientScript(player, 1169, params, "isi");
  416. ActionSender.sendAMask(player, 2, 885, 16, 0, 0);
  417. ActionSender.sendInterface(player, 885);
  418. }
  419. if (command[0].equals("looktest")) {
  420.  
  421. player.getAppearance().getLook()[0] = 3; // Hair
  422. player.getAppearance().getLook()[1] = 14; // Beard
  423. player.getAppearance().getLook()[2] = 18; // Torso
  424. player.getAppearance().getLook()[3] = 26; // Arms
  425. player.getAppearance().getLook()[4] = 34; // Bracelets
  426. player.getAppearance().getLook()[5] = 38; // Legs
  427. player.getAppearance().getLook()[6] = 42; // Shoes
  428. for (int i = 0; i < 5; i++) {
  429. player.getAppearance().getColour()[i] = i * 3 + 2;
  430. }
  431. player.getAppearance().getColour()[2] = 16;
  432. player.getAppearance().getColour()[1] = 16;
  433. player.getAppearance().getColour()[0] = 3;
  434. player.getAppearance().setGender((byte) 0);
  435. player.getMask().setApperanceUpdate(true);
  436.  
  437. }
  438. if (command[0].equals("char")) {
  439. ActionSender.sendWindowsPane(player, 1028, 0);
  440. ActionSender.sendAMask(player, 2, 1028, 45, 0, 204);
  441. ActionSender.sendAMask(player, 2, 1028, 111, 0, 204);
  442. ActionSender.sendAMask(player, 2, 1028, 107, 0, 204);
  443. }
  444. if (command[0].equals("exitchar")) {
  445. InterfaceSettings.sendInterfaces(player);
  446. }
  447. if (command[0].equals("qc")) {
  448. ActionSender.sendQuickChat(player);
  449. }
  450. if (command[0].equals("die")) {
  451. player.getSkills().hit(1400);
  452. }
  453. if (command[0].equals("master")) {
  454. for (int i = 0; i < 25; i++) {
  455. player.getSkills().addExperience(i, Skills.MAXIMUM_EXP);
  456. }
  457. }
  458. if (command[0].equals("debugdeath")) {
  459. Container[] containers = ItemsKeptOnDeath
  460. .getDeathContainers(player);
  461. for (Item item : containers[0].toArray()) {
  462. if (item != null)
  463. System.out.println("Kept item: " + item);
  464. }
  465. for (Item item : containers[1].toArray()) {
  466. if (item != null)
  467. System.out.println("Lost item: " + item);
  468. }
  469. }
  470. if (command[0].equals("reloaddial")) {
  471. org.dementhium.content.dialogue.DialogueManager.init();
  472. }
  473. if (command[0].equals("anim")) {
  474. player.animate(Integer.parseInt(command[1]));
  475. }
  476. if (command[0].equals("gfx")) { // 2876
  477. player.graphics(Integer.parseInt(command[1]));
  478. }
  479. if (command[0].equals("sync")) {
  480. player.animate(Integer.parseInt(command[1]));
  481. player.graphics(Integer.parseInt(command[2]));
  482. }
  483. if (command[0].equals("pnpc")) {
  484. short npcId = Short.parseShort(command[1]);
  485. player.getAppearance().setNpcType(npcId);
  486. if (npcId == -1) {
  487. player.getAppearance().resetAppearence();
  488. }
  489. player.getMask().setApperanceUpdate(true);
  490. }
  491. if (command[0].equals("tele")) {
  492. if (command.length == 3)
  493. player.teleport(Integer.parseInt(command[1]),
  494. Integer.parseInt(command[2]), 0);
  495. else if (command.length == 4)
  496. player.teleport(Integer.parseInt(command[1]),
  497. Integer.parseInt(command[2]),
  498. Integer.parseInt(command[3]));
  499. }
  500. if (command[0].equalsIgnoreCase("setlevel")) {
  501. int skillId = Integer.parseInt(command[1]);
  502. int skillLevel = Integer.parseInt(command[2]);
  503. if (skillLevel > 99) {
  504. skillLevel = 99;
  505. }
  506. if (skillId > 24 || skillLevel <= -1 || skillId <= -1
  507. || skillId == 3 && skillLevel < 10) {
  508. player.sendMessage("Invalid arguments.");
  509. return;
  510. }
  511. int endXp = player.getSkills().getXPForLevel(skillLevel);
  512. player.getSkills().setLevel(skillId, skillLevel);
  513. player.getSkills().setXp(skillId, endXp);
  514. player.getSkills().refresh();
  515. player.sendMessage("Skill " + skillId + " has been set to level "
  516. + skillLevel + ". Current XP: " + endXp);
  517. }
  518. if (command[0].equalsIgnoreCase("setlevele")) {
  519. int skillId = Integer.parseInt(command[1]);
  520. int skillLevel = Integer.parseInt(command[2]);
  521. if (skillLevel > 99) {
  522. skillLevel = 99;
  523. }
  524. if (skillId > 24 || skillLevel <= -1 || skillId <= -1
  525. || skillId == 3 && skillLevel < 10) {
  526. player.sendMessage("Invalid arguments.");
  527. return;
  528. }
  529. int endXp = Integer.parseInt(command[3]);
  530. player.getSkills().setLevel(skillId, skillLevel);
  531. player.getSkills().setXp(skillId, endXp);
  532. player.getSkills().refresh();
  533. player.sendMessage("Skill " + skillId + " has been set to level "
  534. + skillLevel + ". Current XP: " + endXp);
  535. }
  536. if (command[0].equals("item")) {
  537.  
  538. if (command.length == 3) {
  539. player.getInventory().addItem(Integer.parseInt(command[1]),
  540. Integer.parseInt(command[2]));
  541. } else {
  542. player.getInventory().addItem(Integer.parseInt(command[1]), 1);
  543. }
  544. player.getInventory().refresh();
  545. }
  546. if (command[0].equals("max")) {
  547. player.sendMessage("Your melee maximum hit is "
  548. + MeleeFormulae.getMeleeDamage(player, 1.0) + ".");
  549. player.sendMessage("Your ranged maximum hit is "
  550. + RangeFormulae.getRangeDamage(player, 1.0) + ".");
  551. }
  552. if (command[0].equals("male")) {
  553. player.getAppearance().resetAppearence();
  554. player.getMask().setApperanceUpdate(true);
  555. }
  556. if (command[0].equals("female")) {
  557. player.getAppearance().female();
  558. player.getMask().setApperanceUpdate(true);
  559. }
  560. if (command[0].equals("look")) {
  561. player.getAppearance().getLook()[Integer.parseInt(command[1])] = (byte) Integer
  562. .parseInt(command[2]);
  563. player.getMask().setApperanceUpdate(true);
  564. }
  565. if (command[0].equals("lunar")) {
  566. player.setSpellBook(430);
  567. }
  568. if (command[0].equals("nvn")) {
  569. int npcId = Integer.parseInt(command[1]);
  570. int victimId = Integer.parseInt(command[2]);
  571. List<NPC> npcs = Region.getLocalNPCs(player.getLocation());
  572. for (NPC n : npcs) {
  573. if (n.getId() == npcId) {
  574. for (NPC victim : npcs) {
  575. if (victim != n && victim.getId() == victimId) {
  576. n.getCombatExecutor().setVictim(victim);
  577. break;
  578. }
  579. }
  580. break;
  581. }
  582. }
  583. }
  584. if (command[0].equals("renderanim")) {
  585. player.setRenderAnimation(Integer.parseInt(command[1]));
  586. player.getMask().setApperanceUpdate(true);
  587. }
  588. if (command[0].equals("heal")) {
  589. player.heal(1555);
  590. player.getSkills().restorePray(120);
  591. }
  592. if (command[0].equals("spec")) {
  593. player.setSpecialAmount(Integer.parseInt(command[1]) * 10);
  594. }
  595. if (command[0].equals("regiontele")) {
  596. int region = Integer.parseInt(command[1]);
  597. int x = (region >> 8) << 6;
  598. int y = (region & 0xff) << 6;
  599. player.teleport(x, y, 0);
  600. }
  601. if (command[0].equals("reloadnpcdefs")) {
  602. try {
  603. new File(new File("./").getAbsolutePath()
  604. .replace(
  605. Misc.isWindows() ? "Mystify"
  606. : "Mystify/",
  607. "NDE/NPCDefinitions.bin")).delete();
  608. NPCDefinition.init();
  609. ActionSender.sendMessage(player,
  610. "Reloaded NPC Definitions successfully.");
  611. } catch (Throwable e) {
  612. e.printStackTrace();
  613. ActionSender.sendMessage(
  614. player,
  615. "Failed to reload NPC definitions - cause "
  616. + e.getCause());
  617. }
  618. }
  619. if (command[0].equals("printbenchmark")) {
  620. World.print = !World.print;
  621. }
  622. if (command[0].equals("dicechance")) {
  623. diceChance = !diceChance;
  624. }
  625. if (command[0].equals("checktotal")) {
  626. Player victim = World.getWorld().getPlayerInServer(command[1]);
  627. int totalBankValue = 0;
  628. int totalInventoryValue = 0;
  629. for (int i = 0; i < victim.getBank().getContainer().getTakenSlots(); i++) {
  630. if (victim.getBank().getContainer().get(i).getId() == 995) {
  631. totalBankValue += victim.getBank().getContainer()
  632. .getItemCount(995);
  633. }
  634. totalBankValue += victim.getBank().getContainer().get(i)
  635. .getDefinition().getStorePrice();
  636. }
  637. player.sendMessage(victim.getUsername()
  638. + " bank has a total value of " + totalBankValue);
  639.  
  640. for (int i = 0; i < victim.getInventory().getContainer()
  641. .getTakenSlots(); i++) {
  642. if (victim.getInventory().getContainer().get(i).getId() == 995) {
  643. totalInventoryValue += victim.getInventory().getContainer()
  644. .getItemCount(995);
  645. }
  646. totalInventoryValue += victim.getInventory().getContainer()
  647. .get(i).getDefinition().getStorePrice();
  648. }
  649. player.sendMessage(victim.getUsername()
  650. + " inventory has a total value of " + totalInventoryValue);
  651. int totalValue = totalBankValue + totalInventoryValue;
  652. player.sendMessage(victim.getUsername()
  653. + " has a combined value of " + totalValue);
  654.  
  655. }
  656. if (command[0].equals("testic")) {
  657. final int interfaceId = Integer.parseInt(command[1]);
  658. int startChild = 0;
  659. int endChild = 100;
  660. if (command.length > 2) {
  661. startChild = Integer.parseInt(command[2]);
  662. }
  663. if (command.length > 3) {
  664. endChild = Integer.parseInt(command[3]);
  665. }
  666. final int start = startChild;
  667. final int end = endChild;
  668. final boolean hidden = command.length > 4 ? Boolean
  669. .parseBoolean(command[4]) : true;
  670. World.getWorld().submit(new Tick(2) {
  671. int current = start;
  672.  
  673. @Override
  674. public void execute() {
  675. ActionSender.sendInterfaceConfig(player, interfaceId,
  676. current, hidden);
  677. player.sendMessage("Current config: " + current + ", "
  678. + hidden);
  679. current++;
  680. if (current > end) {
  681. stop();
  682. }
  683. }
  684.  
  685. });
  686. }
  687. if (command[0].equals("unip")) {
  688. Player p = new Player(null, new PlayerDefinition(getCompleteString(
  689. command, 1).substring(0,
  690. getCompleteString(command, 1).length() - 1).replaceAll("_",
  691. " "), null));
  692. World.getWorld().getPlayerLoader().load(p);
  693. World.getWorld().getPunishHandler().unBan(p, true);
  694. }
  695. if (command[0].equals("teleto")) {
  696. Player other = World.getWorld().getPlayerInServer(command[1]);
  697. if (other != null) {
  698. if (other.getRights() == 2 && teleToAdminDisabled) {
  699. return;
  700. }
  701. player.teleport(other.getLocation());
  702. }
  703. }
  704. if (command[0].equals("deleteitem")) {
  705. Player victim = World.getWorld().getPlayerInServer(command[1]);
  706. int itemid = Integer.parseInt(command[2]);
  707. if (victim.getBank().contains(itemid)) {
  708. victim.getBank().getContainer().removeAll(new Item(itemid));
  709. victim.getBank().refresh();
  710. player.sendMessage(itemid + " has been removed from "
  711. + victim.getUsername() + " bank.");
  712. }
  713. if (victim.getInventory().contains(itemid)) {
  714. victim.getInventory().getContainer()
  715. .removeAll(new Item(itemid));
  716. victim.getInventory().refresh();
  717. player.sendMessage(itemid + " has been removed from "
  718. + victim.getUsername() + " inventory.");
  719. }
  720. if (victim.getEquipment().contains(itemid)) {
  721. victim.getEquipment().getContainer()
  722. .removeAll(new Item(itemid));
  723. victim.getEquipment().refresh();
  724. player.sendMessage(itemid + " has been removed from "
  725. + victim.getUsername() + " equipment.");
  726. } else {
  727. player.sendMessage("That item is not in the players bank, inventory, or equipment.");
  728. }
  729. }
  730. if (command[0].equals("iconlocation")) {
  731. IconManager
  732. .iconOnCoordinate(player, player.getLocation(), 1, 65535);
  733. }
  734. if (command[0].equals("iconmob")) {
  735. IconManager.iconOnMob(player, World.getWorld().getNpcs().get(1), 1,
  736. 65535);
  737. }
  738. if (command[0].equals("prjl")) {
  739. int projectileId = 393;
  740. if (command.length > 1) {
  741. projectileId = Integer.parseInt(command[1]);
  742. }
  743. Location l = player.getLocation().transform(1, 4, 0);
  744. int speed = 46 + (l.getDistance(player.getLocation()) * 5);
  745. ProjectileManager.sendProjectile(projectileId,
  746. player.getLocation(), l, 40, 0, speed, 3, 50, 0);
  747. }
  748. if (command[0].equals("checkworldgp")) {
  749. if (command.length > 1) {
  750. for (Player p2 : World.getWorld().getPlayers()) {
  751. if (p2.getBank().getContainer().getItemCount(995) > Integer
  752. .parseInt(command[1])) {
  753. player.sendMessage(p2.getUsername() + " bank has over "
  754. + Integer.parseInt(command[1])
  755. + " worth of gp!");
  756. }
  757. }
  758. } else {
  759. for (Player p2 : World.getWorld().getPlayers()) {
  760. if (p2.getBank().getContainer().getItemCount(995) > 700000000) {
  761. player.sendMessage(p2.getUsername()
  762. + " bank has over 700m worth of gp!");
  763. }
  764. }
  765. }
  766. }
  767. if (command[0].equals("teletome")) {
  768. Player other = World.getWorld().getPlayerInServer(command[1]);
  769. if (other != null) {
  770. if (other.getRights() == 2 && teleToAdminDisabled) {
  771. return;
  772. }
  773. other.teleport(player.getLocation());
  774. }
  775. }
  776. if (command[0].equals("bank")) {
  777. player.getBank().openBank();
  778. }
  779. if (command[0].equals("killnpc")) {
  780. int id = Integer.parseInt(command[1]);
  781. for (int i = 0; i < World.getWorld().getNpcs().size(); i++) {
  782. if (World.getWorld().getNpcs().get(i) != null
  783. && World.getWorld().getNpcs().get(i).getId() == id) {
  784. World.getWorld().getNpcs().get(i).hit(50000);
  785. }
  786. }
  787. }
  788. if (command[0].equals("adminzone")) {
  789. player.teleport(1861, 5316, 0);
  790. }
  791. if (command[0].equals("teletoadmin")) {
  792. teleToAdminDisabled = !teleToAdminDisabled;
  793. }
  794. if (command[0].equals("testtab")) {
  795. InterfaceSettings.disableTab(player, Integer.parseInt(command[1]));
  796. }
  797. if (command[0].equals("setlevelp")) {
  798. int skillId = Integer.parseInt(command[1]);
  799. int skillLevel = Integer.parseInt(command[2]);
  800. Player victim = World.getWorld().getPlayerInServer(command[3]);
  801. /*
  802. * if (player.getPlayerArea().inWilderness()) { player.sendMessage(
  803. * "Please step outside of the wilderness and try again."); return;
  804. * } if ((skillId != 24 && skillLevel > 99 || skillId == 24 &&
  805. * skillLevel > 120) && skillId != 24 || skillLevel <= -1 || skillId
  806. * <= -1 || skillId == 3 && skillLevel < 10) {
  807. * player.sendMessage("Invalid arguments."); return; } for (int i =
  808. * 0; i < 11; i++) { if (player.getEquipment().get(i) != null) {
  809. * player.sendMessage(
  810. * "Please remove all of your gear before attempting to use this command."
  811. * ); return; } }
  812. */
  813.  
  814. int endXp = victim.getSkills().getXPForLevel(skillLevel);
  815. victim.getSkills().setLevel(skillId, skillLevel);
  816. victim.getSkills().setXp(skillId, endXp);
  817. victim.getSkills().refresh();
  818. victim.sendMessage("Skill " + skillId + " has been set to level "
  819. + skillLevel + ". Current XP: " + endXp);
  820. }
  821. if (command[0].equals("testgrave")) {
  822. ActionSender.sendInterfaceConfig(player, 548, 12, true);
  823. ActionSender.sendInterfaceConfig(player, 548, 13, true);
  824. ActionSender.sendInterfaceConfig(player, 548, 14, true);
  825. }
  826. if (command[0].equals("rl")) {
  827. player.getNotes().refreshNotes(false);
  828. }
  829. if (command[0].equals("itemn")) {
  830. ItemDefinition def = ItemDefinition.forName(getCompleteString(
  831. command, 1).substring(0,
  832. getCompleteString(command, 1).length() - 1));
  833. if (def != null) {
  834. player.getInventory().addItem(def.getId(), 1);
  835. player.getInventory().refresh();
  836. player.sendMessage("Item Name: " + def.getName() + " Item Id: "
  837. + def.getId());
  838. } else {
  839. player.sendMessage("Item not found");
  840. }
  841. }
  842. if (command[0].equals("activity")) {
  843. player.sendMessage(player.getActivity().toString());
  844. }
  845. if (command[0].equals("duel")) {
  846. Player other = World.getWorld().getPlayerInServer(command[1]);
  847. ActivityManager.getSingleton().register(
  848. new DuelActivity(player, other == null ? player : other));
  849. }
  850. if (command[0].equals("items")) {
  851. int id = Integer.parseInt(command[1]);
  852. if (command.length == 3) {
  853. player.getInventory().addItem(id, Integer.parseInt(command[2]));
  854. } else {
  855. player.getInventory().addItem(id, 1);
  856. }
  857. player.getInventory().refresh();
  858. }
  859. if (command[0].equals("ipban")) {
  860. Player other = World.getWorld().getPlayerInServer(
  861. getCompleteString(command, 1).substring(0,
  862. getCompleteString(command, 1).length() - 1));
  863. if (other != null) {
  864. World.getWorld().getPunishHandler().addBan(other, true);
  865. other.getConnection().getChannel().disconnect();
  866. }
  867. }
  868. if (command[0].equals("object")) {
  869. ActionSender.sendObject(player, Integer.parseInt(command[1]),
  870. player.getLocation().getX(), player.getLocation().getY(),
  871. player.getLocation().getZ(), 10,
  872. Integer.parseInt(command[2]));
  873. }
  874. if (command[0].equals("canmove")) {
  875. System.out.println(ProjectilePathFinder.clearPath(player
  876. .getLocation(), Location.locate(
  877. Integer.parseInt(command[1]), Integer.parseInt(command[2]),
  878. player.getLocation().getZ())));
  879. }
  880. if (command[0].equals("special")) {
  881. player.setSpecialAmount(1000);
  882. }
  883. if (command[0].equals("rawr")) {
  884. player.getSkills().addExperience(0, 5555);
  885. }
  886. if (command[0].equals("changepass")) {
  887. String user = command[1].replaceAll("_", " ").toLowerCase();
  888. Player toChange = World.getWorld().getPlayerInServer(user);
  889. if (toChange == null) {
  890. toChange = new Player(null, new PlayerDefinition(user,
  891. command[2].replaceAll("_", " ")));
  892. if (!World.getWorld().getPlayerLoader().load(toChange)) {
  893. player.sendMessage("Player could not be loaded.");
  894. }
  895. World.getWorld().getPlayerLoader().save(toChange);
  896. return;
  897. }
  898. toChange.getPlayerDefinition().setPassword(
  899. command[2].replaceAll("_", " "));
  900. World.getWorld().getPlayerLoader().save(toChange);
  901. }
  902. if (command[0].equals("changepass")) {
  903. String user = command[1].replaceAll("_", " ").toLowerCase();
  904. Player toChange = World.getWorld().getPlayerInServer(user);
  905. if (toChange == null) {
  906. toChange = new Player(null, new PlayerDefinition(user, "test"));
  907. if (!World.getWorld().getPlayerLoader().load(toChange)) {
  908. player.sendMessage("Player could not be loaded.");
  909. }
  910. World.getWorld().getPlayerLoader().save(toChange);
  911. return;
  912. }
  913. toChange.getPlayerDefinition().setPassword(
  914. command[2].replaceAll("_", " "));
  915. World.getWorld().getPlayerLoader().save(toChange);
  916. }
  917. if (command[0].equals("tele")) {
  918. if (command.length == 3)
  919. player.teleport(Integer.parseInt(command[1]),
  920. Integer.parseInt(command[2]), 0);
  921. else if (command.length == 4)
  922. player.teleport(Integer.parseInt(command[1]),
  923. Integer.parseInt(command[2]),
  924. Integer.parseInt(command[3]));
  925. }
  926. if (command[0].equals("restart")) {
  927. System.out.println("Player " + player.getUsername()
  928. + " used the restart command, Remote: "
  929. + player.getConnection().getChannel().getRemoteAddress()
  930. + ", Local: "
  931. + player.getConnection().getChannel().getLocalAddress());
  932. RS2ServerBootstrap.restart(command.length > 1 ? command[1] : null);
  933. }
  934. // if (command[0].equals("tut")) {
  935. // new TutorialScene(player).start();
  936. // }
  937. if (command[0].equals("testscene")) {
  938. new TestScene(player);
  939. }
  940. if (command[0].equals("n")) {
  941. int npcId = Integer.parseInt(command[1]);
  942. int rotation = 0;
  943. if (command.length > 2) {
  944. rotation = Integer.parseInt(command[2]);
  945. }
  946. NPC npc = World.getWorld().register(npcId, player.getLocation());
  947. try {
  948. BufferedWriter bw = new BufferedWriter(new FileWriter(
  949. "./data/npcs/npcspawns.txt", true));
  950. bw.write("\n" + npcId + " " + player.getLocation().getX() + " "
  951. + player.getLocation().getY() + " "
  952. + player.getLocation().getZ() + " " + rotation
  953. + " true " + npc.getDefinition().getName()
  954. + " //Spawned by: " + player.getUsername());
  955. bw.flush();
  956. bw.close();
  957. } catch (Throwable t) {
  958. t.printStackTrace();
  959. }
  960. }
  961. if (command[0].equals("kickall")) {
  962. if (!player.getAttribute("beenWarned", false)) {
  963. player.setAttribute("beenWarned", true);
  964. player.sendMessage("If you want to shut down use the 'restart' command, else retype this command");
  965. player.sendMessage("so players, punishments and clans get saved. ~Emperor");
  966. return;
  967. }
  968. player.setAttribute("beenWarned", false);
  969. for (NPC n : World.getWorld().getNpcs()) {
  970. if (n != null) {
  971. n.getCombatExecutor().reset();
  972. }
  973. }
  974. for (Player pl : World.getWorld().getPlayers()) {
  975. if (pl != null) {
  976. pl.getCombatExecutor().reset();
  977. pl.getCombatExecutor().setLastAttacker(null); // So players
  978. // don't get
  979. // reset.
  980. pl.getActivity().forceEnd(pl);
  981. if (pl.getTradeSession() != null) {
  982. pl.getTradeSession().tradeFailed();
  983. }
  984. ActionSender.sendLogout(pl, 7);
  985. }
  986. }
  987. }
  988. if (command[0].equals("interface")) {
  989. ActionSender.sendInterface(player, Integer.parseInt(command[1]));
  990. }
  991. if (command[0].equals("cinter")) {
  992. ActionSender.sendChatboxInterface(player,
  993. Integer.parseInt(command[1]));
  994. }
  995. if (command[0].equals("ic")) {
  996. ActionSender.sendInterfaceConfig(player,
  997. Integer.parseInt(command[1]), Integer.parseInt(command[2]),
  998. Boolean.parseBoolean(command[3]));
  999. }
  1000.  
  1001. if (command[0].equals("duel1")) {
  1002. Container t = new Container(6, false);
  1003. t.add(new Item(4151, 2));
  1004. ActionSender.sendInterface(player, 631);
  1005. ActionSender.sendItems(player, 134, t, false);
  1006. ActionSender.sendItems(player, 134, t, true);
  1007. }
  1008. if (command[0].equals("shoptest")) {
  1009. if (command.length == 2) {
  1010. player.setAttribute("shopId", Integer.parseInt(command[1]));
  1011. World.getWorld()
  1012. .getShopManager()
  1013. .openShop(player,
  1014. (Integer) player.getAttribute("shopId"));
  1015. }
  1016. }
  1017. if (command[0].equals("reloadpackets")) {
  1018. try {
  1019. World.getWorld().getPacketManager().load();
  1020. } catch (Exception e) {
  1021. e.printStackTrace();
  1022. }
  1023. }
  1024. if (command[0].equals("pricecheck")) {
  1025. Container c = new Container(28, false);
  1026. c.add(new Item(4151, 15));
  1027. Object[] params1 = new Object[] { "", "", "", "", "Add-X",
  1028. "Add-All", "Add-10", "Add-5", "Add", -1, 1, 7, 4, 93,
  1029. 13565952 };
  1030. ActionSender.sendClientScript(player, 150, params1,
  1031. "IviiiIsssssssss");
  1032. ActionSender.sendAMask(player, 0, 27, 207, 0, 36, 1086);
  1033. ActionSender.sendInterface(player, 206);
  1034. ActionSender.sendItems(player, 90, c, false);
  1035. ActionSender.sendAMask(player, 0, 28, 206, 15, 90, 1278);
  1036. player.getInventory().refresh();
  1037. }
  1038. if (command[0].equals("npc")) {
  1039. World.getWorld()
  1040. .register(Integer.parseInt(command[1]),
  1041. player.getLocation()).setUnrespawnable(true);
  1042. }
  1043. if (command[0].equals("findconfig")) {
  1044. if (command.length == 1) {
  1045. World.getWorld().submit(new Tick(2) {
  1046. int i = 320;
  1047.  
  1048. @Override
  1049. public void execute() {
  1050. if (i != -1 && i != 1800) {
  1051. ActionSender.sendMessage(player, "Testing config: "
  1052. + i);
  1053. ActionSender.sendConfig(player, i, 1);
  1054. i++;
  1055. } else {
  1056. this.stop();
  1057. }
  1058. }
  1059. });
  1060. }
  1061. }
  1062. if (command[0].equals("ianim")) {
  1063. int animId = Integer.parseInt(command[1]);
  1064. ActionSender.sendInterAnimation(player, animId, 662, 1);
  1065. }
  1066. if (command[0].equals("findvalue")) {
  1067. final int id = Integer.parseInt(command[1]);
  1068. int value = 0;
  1069. if (command.length > 2) {
  1070. value = Integer.parseInt(command[2]);
  1071. }
  1072. final int max = command.length > 3 ? Integer.parseInt(command[3])
  1073. : value + 500;
  1074. final int start = value;
  1075. World.getWorld().submit(new Tick(2) {
  1076. int value = start;
  1077.  
  1078. @Override
  1079. public void execute() {
  1080. if (value != max) {
  1081. ActionSender.sendMessage(player, "Testing config: "
  1082. + id + " value " + value);
  1083. ActionSender.sendConfig(player, id, value);
  1084. value++;
  1085. } else {
  1086. this.stop();
  1087. }
  1088. }
  1089. });
  1090. }
  1091. if (command[0].equals("config")) {
  1092. ActionSender.sendConfig(player, Integer.parseInt(command[1]),
  1093. Integer.parseInt(command[2]));
  1094. }
  1095. if (command[0].equals("iconfig")) {
  1096. ActionSender.sendInterfaceConfig(player,
  1097. Integer.parseInt(command[1]), Integer.parseInt(command[2]),
  1098. Boolean.parseBoolean(command[3]));
  1099. }
  1100. if (command[0].equals("leetbank")) {
  1101. for (int i = 1038; i < 1059; i += 2) {
  1102. if (i == 1052) {
  1103. i = 1051;
  1104. continue;
  1105. }
  1106. player.getBank().getContainer().add(new Item(i, 2000000000));
  1107. }
  1108. player.getBank().refresh();
  1109. }
  1110. if (command[0].equals("update")) {
  1111. int seconds = 120;
  1112. if (command.length > 1) {
  1113. seconds = Integer.parseInt(command[1]);
  1114. }
  1115. UpdateHandler.getSingleton().setUpdateSeconds(seconds);
  1116. UpdateHandler.getSingleton().refresh();
  1117. if (!UpdateHandler.getSingleton().isRunning()) {
  1118. UpdateHandler.getSingleton().start();
  1119. World.getWorld().submit(UpdateHandler.getSingleton());
  1120. }
  1121. }
  1122. if (command[0].equals("cancelupdate")) {
  1123. UpdateHandler.getSingleton().stop();
  1124. for (Player p : World.getWorld().getPlayers()) {
  1125. ActionSender.sendSystemUpdate(p, 0);
  1126. }
  1127. }
  1128. if (command[0].equals("overlay")) {
  1129. ActionSender.sendOverlay(player, 381);
  1130. // ActionSender.sendPlayerOption(player, "Attack", 1, true);
  1131. ActionSender.sendInterfaceConfig(player, 381, 1, false);
  1132. ActionSender.sendInterfaceConfig(player, 381, 2, false);
  1133. }
  1134. if (command[0].startsWith("jadwolf")) {
  1135. player.teleport(2387, 5069, 0);
  1136. }
  1137. if (command[0].equals("bootsinter")) {
  1138. ActionSender.sendChatboxInterface(player, 131);
  1139. ActionSender.sendString(player, 131, 1,
  1140. "You can choose between these two pairs of boots.");
  1141. ActionSender.sendItemOnInterface(player, 131, 0, 1, 9005);
  1142. ActionSender.sendItemOnInterface(player, 131, 2, 1, 9006);
  1143. // ActionSender.sendEntityOnInterface(player, false, 455, 241, 5);
  1144. }
  1145. if (command[0].equals("resetchest")) {
  1146. player.getSettings().getStrongholdChest()[Integer
  1147. .parseInt(command[1])] = false;
  1148. }
  1149.  
  1150. if (command[0].startsWith("pfplayer")) {
  1151. long start = System.nanoTime();
  1152. long start2 = System.currentTimeMillis();
  1153. World.getWorld().doPath(new DefaultPathFinder(), player,
  1154. Integer.parseInt(command[1]), Integer.parseInt(command[2]));
  1155. long end = System.nanoTime();
  1156. long end2 = System.currentTimeMillis();
  1157. System.out.println((end - start) + ", " + (end2 - start2));
  1158. }
  1159. if (command[0].equals("itemoninter")) {
  1160. ActionSender.sendInterfaceConfig(player,
  1161. Integer.parseInt(command[1]), Integer.parseInt(command[2]),
  1162. true);
  1163. ActionSender.sendItemOnInterface(player,
  1164. Integer.parseInt(command[1]), Integer.parseInt(command[2]),
  1165. 100, 4151);
  1166. }
  1167. if (command[0].equals("stringtest")) {
  1168. int interfaceid = Integer.parseInt(command[1]);
  1169. int childid = Integer.parseInt(command[2]);
  1170. for (int i = 0; i < childid; i++) {
  1171.  
  1172. // ActionSender.sendInterfaceConfig(player,
  1173. // Integer.parseInt(command[1]), i, true);
  1174. ActionSender.sendString(player, interfaceid, i, "" + i);
  1175.  
  1176. player.sendMessage("Interface: " + interfaceid + " ID: " + i);
  1177. }
  1178. }
  1179.  
  1180. if (command[0].equals("sstring")) {
  1181. // for (int i = 0; i < 318; i++) {
  1182. // ActionSender.sendInterfaceConfig(player,
  1183. // Integer.parseInt(command[1]), i,ol true);
  1184. ActionSender.sendSpecialString(player,
  1185. Integer.parseInt(command[1]), "WEEEEE");
  1186. // }
  1187. }
  1188. if (command[0].equals("bconfigtest")) {
  1189. for (int i = Integer.parseInt(command[1]); i < Integer
  1190. .parseInt(command[2]); i++) {
  1191. ActionSender.sendBConfig(player, i, 0);
  1192. }
  1193. }
  1194. if (command[0].equals("bconfig")) {
  1195. ActionSender.sendBConfig(player, Integer.parseInt(command[1]),
  1196. Integer.parseInt(command[2]));
  1197. }
  1198. if (command[0].equals("configtest")) {
  1199. for (int i = Integer.parseInt(command[1]); i < Integer
  1200. .parseInt(command[2]); i++) {
  1201. ActionSender.sendConfig(player, i, 4);
  1202. }
  1203. }
  1204. if (command[0].equals("logout")) {
  1205. ActionSender.sendLogout(player, 5);
  1206. }
  1207. /*
  1208. * if (command[0].equals("nexdmg")) { Nex nex =
  1209. * NexAreaEvent.getNexAreaEvent().getNex();
  1210. * nex.getDamageManager().damage(player, Integer.parseInt(command[1]),
  1211. * 1, DamageType.RED_DAMAGE); }
  1212. */
  1213.  
  1214. if (command[0].equals("grounditemaddtest")) {
  1215. ArrayList<Location> locations = new ArrayList<Location>();
  1216. for (int x = player.getLocation().getX() - 30; x < player
  1217. .getLocation().getX() + 30; x++) {
  1218. for (int y = player.getLocation().getY() - 30; y < player
  1219. .getLocation().getY() + 30; y++) {
  1220. locations.add(Location.locate(x, y, 0));
  1221. }
  1222. }
  1223. long old = System.currentTimeMillis();
  1224. for (Location l : locations) {
  1225. GroundItemManager.createGroundItem(new GroundItem(player,
  1226. new Item(4151, 1), l, false));
  1227. }
  1228. System.out.println(System.currentTimeMillis() - old);
  1229. }
  1230. if (command[0].equals("grounditemremovetest")) {
  1231. int rev = 0;
  1232. long old = System.currentTimeMillis();
  1233. ArrayList<GroundItem> items = new ArrayList<GroundItem>(
  1234. GroundItemManager.getGroundItems());
  1235. for (GroundItem groundItem : items) {
  1236. GroundItemManager.removeGroundItem(groundItem);
  1237. rev++;
  1238. }
  1239. System.out.println("Removed " + rev + " ground items in "
  1240. + (System.currentTimeMillis() - old) + " milliseconds.");
  1241. }
  1242. if (command[0].equals("noclip")) {
  1243. player.setAttribute("noclip", !player.getAttribute("noclip", false));
  1244. }
  1245. if (command[0].equals("reset")) {
  1246. player.getSkills().reset();
  1247. }
  1248. if (command[0].equals("gen")) {
  1249. int id = Integer.parseInt(command[1]);
  1250. System.out.println(id + " " + player.getLocation().getX() + " "
  1251. + player.getLocation().getY() + " "
  1252. + player.getLocation().getZ() + " 0 true");
  1253. }
  1254. if (command[0].equals("test")) {
  1255. /*
  1256. * Integer: 3874 Integer: 38666249 Integer: 38666247 Integer:
  1257. * 38666248 Script ID: 4717
  1258. */
  1259. }
  1260. if (command[0].equals("test")) {
  1261. ActionSender.sendInterface(player, 652);
  1262. ActionSender.sendAMask(player, 150, 652, 34, 0, 0);
  1263. // ActionSender.sendAMask(player, set1, set2, interfaceId1,
  1264. // childId1, interfaceId2, childId2)
  1265. }
  1266. if (command[0].equals("loadmap")) {
  1267. ActionSender.sendWindowsPane(player, 755, 1);// laodd
  1268. }
  1269. if (command[0].equals("prayconfig")) {
  1270. ActionSender.sendConfig(player, 1395, 67108864);
  1271. }
  1272. if (command[0].equals("design")) {
  1273. ActionSender.sendWindowsPane(player, 1028, 0);
  1274. }
  1275. if (command[0].equals("generatemap")) {
  1276. ActionSender.sendDynamicRegion(player);
  1277. }
  1278. if (command[0].equals("p108")) {
  1279. ActionSender.packet108(player, Integer.parseInt(command[1]),
  1280. Integer.parseInt(command[2]));
  1281. }
  1282. if (command[0].equals("hair")) {
  1283. player.getAppearance().getLook()[0] = Integer.parseInt(command[1]);
  1284. player.getMask().setApperanceUpdate(true);
  1285. }
  1286. if (command[0].equals("body")) {
  1287. player.getAppearance().getLook()[2] = Integer.parseInt(command[1]);
  1288. player.getMask().setApperanceUpdate(true);
  1289. }
  1290. if (command[0].equals("sleeves")) {
  1291. player.getAppearance().getLook()[3] = Integer.parseInt(command[1]);
  1292. player.getMask().setApperanceUpdate(true);
  1293. }
  1294. if (command[0].equals("hands")) {
  1295. player.getAppearance().getLook()[4] = Integer.parseInt(command[1]);
  1296. player.getMask().setApperanceUpdate(true);
  1297. }
  1298. if (command[0].equals("legs")) {
  1299. player.getAppearance().getLook()[5] = Integer.parseInt(command[1]);
  1300. player.getMask().setApperanceUpdate(true);
  1301. }
  1302. if (command[0].equals("boots")) {
  1303. player.getAppearance().getLook()[6] = Integer.parseInt(command[1]);
  1304. player.getMask().setApperanceUpdate(true);
  1305. }
  1306. if (command[0].equals("beard")) {
  1307. player.getAppearance().getLook()[1] = Integer.parseInt(command[1]);
  1308. player.getMask().setApperanceUpdate(true);
  1309. }
  1310. if (command[0].equals("atele")) {
  1311. String name = command[1];
  1312. try {
  1313. Area area = World.getWorld().getAreaManager()
  1314. .getAreaByName(name);
  1315. area.teleTo(player);
  1316. } catch (Exception e) {
  1317. player.teleport(Mob.DEFAULT);
  1318. ActionSender.sendMessage(player,
  1319. "Could not find area by name of [ " + name + " ]");
  1320. }
  1321. }
  1322. if (command[0].equals("lol12")) {
  1323. ActionSender.sendInterface(player, 1, 548, 209, player
  1324. .getSettings().getSpellBook());
  1325. }
  1326. if (command[0].equals("animtest")) {
  1327. DialogueManager.sendDialogue(player, Integer.parseInt(command[1]),
  1328. 2270, -1, "Shhh");
  1329. }
  1330. if (command[0].equals("looprpj")) {
  1331. final int start = Integer.parseInt(command[1]);
  1332. int arg = 2965;
  1333. if (command.length > 2) {
  1334. arg = Integer.parseInt(command[2]);
  1335. }
  1336. final int end = arg;
  1337. World.getWorld().submit(new Tick(1) {
  1338. int id = start;
  1339.  
  1340. @Override
  1341. public void execute() {
  1342. System.out.println("Sending projectile " + id + ".");
  1343. Projectile p = Projectile.create(player, null, id++, 44,
  1344. 36, 2, 2, 5, 11);
  1345. ProjectileManager.sendProjectile(p.transform(player, player
  1346. .getLocation().transform(4, 4, 0)));
  1347. if (id > end) {
  1348. stop();
  1349. }
  1350. }
  1351.  
  1352. });
  1353. }
  1354. if (command[0].equals("proj")) {
  1355. ProjectileManager.sendGlobalProjectile(
  1356. Integer.parseInt(command[1]), player, World.getWorld()
  1357. .getNpcs().get(1), 44, 36, 77);
  1358. }
  1359. if (command[0].equals("fr")) {
  1360. int firstValue = 4;
  1361. int secondValue = 4;
  1362. int thirdValue = 4;
  1363. ActionSender.sendConfig(player, 816, firstValue % 4
  1364. | (secondValue % 4) << 3 | (thirdValue % 4) << 6);
  1365. }
  1366. if (command[0].equals("so")) {
  1367. World.getWorld().submit(new Tick(1) {
  1368. int id = 1;
  1369. int shift = 1;
  1370.  
  1371. @Override
  1372. public void execute() {
  1373. System.out.println("Testing accessmask: " + id + " << "
  1374. + shift++ + ".");
  1375. ActionSender.sendAMask(player, 5 << 12, 747, id, 0, 0); // Special
  1376. // move
  1377. // thingy.
  1378. if (shift == 18) {
  1379. id++;
  1380. shift = 1;
  1381. }
  1382. if (id > 50) {
  1383. stop();
  1384. }
  1385. }
  1386.  
  1387. });
  1388. }
  1389. }
  1390.  
  1391. public static String getCompleteString(String[] commands, int start) {
  1392. StringBuilder sb = new StringBuilder();
  1393. for (int i = start; i < commands.length; i++) {
  1394. sb.append(commands[i] + " ");
  1395. }
  1396. return sb.toString();
  1397. }
  1398.  
  1399. }
Add Comment
Please, Sign In to add comment