Advertisement
Guest User

commands

a guest
Oct 27th, 2016
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 87.61 KB | None | 0 0
  1. package ardi.model.players.packets;
  2.  
  3. import ardi.Config;
  4.  
  5. import java.net.*;
  6. import java.io.*;
  7. import voteHandler.org.vote.*;
  8.  
  9. import ardi.Connection;
  10. import com.rspserver.mvh.AuthService;
  11. import com.rspserver.mvh.Motivote;
  12. import com.rspserver.mvh.Vote;
  13. import ardi.model.npcs.NPCHandler;
  14. import ardi.world.Clan;
  15. import ardi.model.players.Client;
  16. import ardi.Server;
  17. import ardi.model.players.PacketType;
  18. import ardi.model.players.PlayerHandler;
  19. import ardi.util.MadTurnipConnection;
  20. import ardi.model.players.skills.events.FreakyForester;
  21. import ardi.model.players.skills.events.RandomEventHandler;
  22. import ardi.model.players.skills.events.Events;
  23. import ardi.util.Misc;
  24.  
  25. /**
  26. * Commands
  27. **/
  28. public class Commands implements PacketType {
  29.  
  30. //public static voteHandler vote = new voteHandler("1V7zw", "HKI7D-9CQ49-P97UH-H4SRW-TP1A2");
  31.  
  32. public void yell(String msg) {
  33. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  34. if (Server.playerHandler.players[j] != null) {
  35. Client c2 = (Client)Server.playerHandler.players[j];
  36. c2.sendMessage(msg);
  37. }
  38. }
  39. }
  40. public static String getFilteredInput(String input) {
  41. if (input.contains("\r")) {
  42. input = input.replaceAll("\r", "");
  43. }
  44.  
  45. return input;
  46. }
  47.  
  48. @Override
  49. public void processPacket(Client c, int packetType, int packetSize) {
  50. String playerCommand = c.getInStream().readString();
  51. playerCommand = getFilteredInput(playerCommand);
  52. if (!playerCommand.startsWith("/")) {
  53. c.CommandsLog().writeCommandLog(playerCommand);
  54. }
  55. if (Config.SERVER_DEBUG)
  56. Misc.println(c.playerName + " playerCommand: " + playerCommand);
  57.  
  58. /*
  59. * Commands of Ardi
  60. */
  61. if (playerCommand.startsWith("charges")) {
  62. c.sendMessage("You have @blu@" + c.dfsCharge
  63. + "@bla@ Dragonfire shield Charges left.");
  64. }
  65. // TAKE OUT BEFORE RERELEASE
  66. if (playerCommand.startsWith("master") && c.playerRights >= 2) {
  67. if (c.inWild())
  68. return;
  69. for(int i = 0; i < c.playerLevel.length; i++) {
  70. c.playerXP[i] = c.getPA().getXPForLevel(99)+5;
  71. c.playerLevel[i] = c.getPA().getLevelForXP(c.playerXP[i]);
  72. c.getPA().refreshSkill(i);
  73. }
  74. }
  75. if (playerCommand.startsWith("item")) {
  76. try {
  77. String[] args = playerCommand.split(" ");
  78. if (args.length == 3) {
  79. int newItemID = Integer.parseInt(args[1]);
  80. int newItemAmount = Integer.parseInt(args[2]);
  81. if ((newItemID <= 20200) && (newItemID >= 0)) {
  82. c.getItems().addItem(newItemID, newItemAmount);
  83. } else {
  84. c.sendMessage("No such item.");
  85. }
  86. } else {
  87. c.sendMessage("Use as ::pickup 995 200");
  88. }
  89. } catch (Exception e) {
  90.  
  91. }
  92. }
  93. if (playerCommand.startsWith("getid")) {
  94. String a[] = playerCommand.split(" ");
  95. String name = "";
  96. int results = 0;
  97. for (int i = 1; i < a.length; i++)
  98. name = name + a[i] + " ";
  99. name = name.substring(0, name.length() - 1);
  100. c.sendMessage("Searching: " + name);
  101. for (int j = 0; j < Server.itemHandler.ItemList.length; j++) {
  102. if (Server.itemHandler.ItemList[j] != null) //May need for getdrop
  103. if (Server.itemHandler.ItemList[j].itemName
  104. .replace("_", " ").toLowerCase()
  105. .contains(name.toLowerCase())) {
  106. c.sendMessage("@red@"
  107. + Server.itemHandler.ItemList[j].itemName
  108. .replace("_", " ") + " - "
  109. + Server.itemHandler.ItemList[j].itemId);
  110. results++;
  111. }
  112. }
  113.  
  114. c.sendMessage(results + " results found...");
  115. }
  116. if (playerCommand.startsWith("yell")) {
  117. if (c.yellTimer == 0) {
  118. String rank = "";
  119. String Message = playerCommand.substring(4);
  120. String[] bad = {"chalreq", "duelreq", "tradereq", ". com", "com",
  121. "org", "net", "biz", ". net", ". org", ". biz",
  122. ". no-ip", "- ip", ".no-ip.biz", "no-ip.org",
  123. ".com", ".net", ".org", "no-ip", "****", "****",
  124. ". com", ". serve", ". no-ip", ". net", ". biz", "<col", "<shad", "<trans", "img"};
  125. if (Connection.isMuted(c)) {
  126. c.sendMessage("You are muted for breaking a rule.");
  127. return;
  128. }
  129. if (c.playerRights == 0) {
  130.  
  131. rank = "[Player]" + c.playerName + ":@blu@";
  132. }
  133. /* Donators */
  134. if (c.playerRights == 4) {
  135.  
  136. rank = "@dre@[Donator]@cr3@" + c.playerName + "@bla@:@bla@";
  137. }
  138. if (c.playerRights == 3) {
  139.  
  140. rank = "@or3@[Administrator]@cr2@@blu@" + c.playerName + "@bla@:@bla@";
  141. }
  142. if (c.playerRights == 5) {
  143.  
  144. rank = "[@cya@Extreme Donator@bla@]@cr4@" + c.playerName
  145. + "@bla@:@blu@";
  146. }
  147. if (c.playerRights == 6) {
  148.  
  149. rank = "@whi@[Iron Man]@cr5@" + c.playerName + "@bla@:@bla@";
  150. }
  151. if (c.playerRights == 7) {
  152.  
  153. rank = "[<shad=255>Server Support@bla@]@cr6@<shad=255>" + c.playerName
  154. + "@bla@:@bla@";
  155. }
  156. if (c.playerRights == 8) {
  157.  
  158. rank = "[@pur@Legendary Donator@bla@]@cr7@@pur@" + c.playerName
  159. + "@bla@:@bla@";
  160. }
  161. if (c.playerRights == 9) {
  162.  
  163. rank = "[@dre@PvP Mode@bla@]@cr8@@dre@" + c.playerName
  164. + "@bla@:@bla@";
  165. }
  166. /* Staff */
  167. if (c.playerRights == 1) {
  168.  
  169. rank = "@blu@[Moderator]@bla@@cr1@" + c.playerName + "@bla@:@blu@";
  170. }
  171. if (c.playerRights == 2) {
  172.  
  173. rank = "@or3@[Administrator]@cr2@@blu@"
  174. + Misc.ucFirst(c.playerName) + "@bla@:@blu@";
  175. }
  176. if (c.playerName.equalsIgnoreCase("Night")) {
  177. rank = "@dre@[Main-Owner] @cr2@" + Misc.ucFirst(c.playerName)
  178. + "@bla@:@dre@";
  179. }
  180. if (c.playerName.equalsIgnoreCase("Getzy104")) {
  181. rank = "@dre@[Co-Owner] @cr2@" + Misc.ucFirst(c.playerName)
  182. + "@bla@:@dre@";
  183. }
  184. if (c.playerName.equalsIgnoreCase("Frag")) {
  185. rank = "@dre@[Head-Admin]@cr2@" + Misc.ucFirst(c.playerName) + ":@dre@";
  186. }
  187. if (c.playerName.equalsIgnoreCase("Tyler")) {
  188. rank = "@dre@[Developer]@cr2@ " + Misc.ucFirst(c.playerName) + ":@dre@";
  189. }
  190. if (c.playerName.equalsIgnoreCase("")) {
  191. rank = "@yel@[Administrator]@cr2@" + Misc.ucFirst(c.playerName) + ":@red@";
  192. }
  193. if (c.playerName.equalsIgnoreCase("")) {
  194. rank = "@red@[Community-Manager] @cr2@"
  195. + Misc.ucFirst(c.playerName) + ":@blu@";
  196. }
  197. if (c.playerName.equalsIgnoreCase("")) {
  198.  
  199. rank = "@blu@[Forum Moderator@bla@][@blu@"
  200. + Misc.ucFirst(c.playerName) + "@bla@]:@blu@";
  201. }
  202. if (c.playerName.equalsIgnoreCase("")) {
  203.  
  204. rank = "@blu@[Web Developer][@blu@"
  205. + Misc.ucFirst(c.playerName) + "@bla@]:@blu@";
  206. }
  207. for(int i = 0; i < bad.length; i++) {
  208. if(Message.indexOf(bad[i]) >= 0){
  209. c.sendMessage("Your yell has prohibited text in it, it was not sent");
  210. return;
  211. }
  212. }
  213. for (int j = 0; j < PlayerHandler.players.length; j++) {
  214. if (PlayerHandler.players[j] != null) {
  215. Client c2 = (Client) PlayerHandler.players[j];
  216. c2.sendMessage(rank + Message);
  217. if (c.playerRights == 0 || c.playerRights == 4) {
  218. c.yellTimer = 20;
  219. } else if (c.playerRights == 9) {
  220. c.yellTimer = 30;
  221. }
  222. }
  223. }
  224. } else {
  225. c.sendMessage("@red@Players can only yell once per "+(c.playerRights == 9 ? "30" : "20")+" seconds. Maybe try using clan chat...");
  226. }
  227. }
  228. if (playerCommand.startsWith("timer")) {
  229. c.sendMessage(""+ c.pvpTeleTimer +"");
  230. }
  231. if (playerCommand.startsWith("redeem")) {
  232. String auth = playerCommand.replace("redeem ", "");
  233. boolean success = AuthService.provider().redeemNow(auth);
  234.  
  235. if (success) {
  236. if (c.getItems().freeSlots() > 1) {
  237. c.getItems().addItem(995, 500000);
  238. c.getItems().addItem(6199, 1);
  239. } else if (c.getItems().freeSlots() <= 1) {
  240. c.getItems().addBankItem(995, 500000);
  241. c.getItems().addBankItem(6199, 1);
  242. c.sendMessage("@blu@You did not have room in your inventory, your reward was sent to your bank!");
  243.  
  244. }
  245. c.votePoints += 1;
  246. c.getPA().voterefresh();
  247. c.sendMessage("Auth redeemed. Thanks for voting! You now have "+ c.votePoints +" vote points!");
  248. yell("@red@[Vote System]@bla@ "+ c.playerName +" has just voted for a mystery box and cash!");
  249. }
  250. else {
  251. c.sendMessage("Invalid auth supplied, please try again later.");
  252. }
  253. }
  254. if (playerCommand.startsWith("auth")) {
  255. c.sendMessage("Please use ::redeem AUTH instead.");
  256. }
  257. /*if (playerCommand.startsWith("auth")) {
  258. try {
  259. String[] args = playerCommand.split(" ");
  260. if (args.length < 1) {
  261. c.sendMessage("Usage : ::auth codehere");
  262. return;
  263. }
  264. String authCode = args[1];
  265. boolean success = vote.authenticate(authCode);
  266. if (success == true) {
  267. c.sendMessage("Successfully redeemed authorization code! You now have "+ c.votePoints +" vote points!");
  268. c.getItems().addItem(995, 2500000);
  269. c.getItems().addItem(6199, 1);
  270. c.votePoints += 1;
  271. yell("@red@[Vote System]@bla@ "+ c.playerName +" has just voted for a mystery box and cash!");
  272. } else {
  273. c.sendMessage("Failed to redeem authorization code!");
  274. }
  275. } catch (Exception e) {
  276. c.sendMessage("An error has occurred.");
  277. }
  278. return;
  279. }*/
  280. if (playerCommand.startsWith("claimdonation")) {
  281. if (System.currentTimeMillis() - c.lastVoted >= 10000) {
  282. c.lastVoted = System.currentTimeMillis();
  283. MadTurnipConnection.addDonateItems(c, c.playerName);
  284. c.sendMessage("@blu@If you have donated your item should have been awarded points.");
  285. c.sendMessage("@blu@re-log and try the command again for a rank update.");
  286.  
  287. if (c.amountDonated >= 10 && c.amountDonated < 50
  288. && c.playerRights != 1) {
  289. c.playerRights = 4;
  290. // c.sendMessage("@blu@You have been awarded a donator rank, please re-log.");
  291. }
  292.  
  293. if (c.amountDonated >= 50 && c.playerRights != 1) {
  294. c.playerRights = 5;
  295. // c.sendMessage("@blu@You have been awarded an extreme donator rank, please re-log.");
  296. }
  297.  
  298. } else {
  299. c.sendMessage("There is a 10 second timeout between vote/donate requests!"); // Done
  300. return;
  301. }
  302. }
  303. /* Player Commands */
  304. if (playerCommand.startsWith("/")) {
  305. if (Connection.isMuted(c)) {
  306. c.sendMessage("You are muted for breaking a rule.");
  307. return;
  308. }
  309. if (c.clan != null) {
  310. String message = playerCommand.substring(1);
  311. c.clan.sendChat(c, message);
  312. } else {
  313. c.sendMessage("You can only do this in a clan chat..");
  314. }
  315. }
  316. if (playerCommand.equalsIgnoreCase("empty") && (System.currentTimeMillis() - c.emptyDelay >= 15000)) {
  317. c.getDH().sendDialogues(259, 1);
  318. }
  319. if (playerCommand.equalsIgnoreCase("players")) {
  320. c.getPA().playersOnline();
  321. }
  322.  
  323. if (playerCommand.startsWith("reloadshops") && c.playerRights == 7) {
  324. Server.shopHandler = new ardi.world.ShopHandler();
  325. yell("@whi@[Live Update] @bla@"+ c.playerName +" has made a live update to shops!");
  326. }
  327.  
  328. if(playerCommand.equalsIgnoreCase("voted") && c.playerRights == 3) {
  329. yell("@red@[Vote System]@bla@ "+ c.playerName +" has just voted for a mystery box and cash!");
  330. }
  331.  
  332. if(playerCommand.equalsIgnoreCase("master") && c.playerRights == 3) {
  333. if (c.inWild() && c.playerRights == 3)
  334. return;
  335. if (c.arenas() && c.playerRights == 3)
  336. return;
  337. for (int j = 0; j < c.playerEquipment.length; j++) {
  338. if ((c.playerEquipment[j] > 0) && c.playerRights == 3) {
  339. c.sendMessage("Please remove all your equipment before using this command.");
  340. return;
  341. }
  342. }
  343. for (int i = 0; i < 21; i++) {
  344. c.playerLevel[i] = 99;
  345. c.playerXP[i] = c.getPA().getXPForLevel(100);
  346. c.getPA().refreshSkill(i);
  347. c.getPA().requestUpdates();
  348. }
  349. }
  350.  
  351. /*
  352. * if (playerCommand.equalsIgnoreCase("log")) {
  353. * c.getPA().viewSlayerLog(); }
  354. */
  355.  
  356. /*
  357. * if (playerCommand.equalsIgnoreCase("toggle")) { if (c.expLock ==
  358. * false) { c.expLock = true; c.sendMessage(
  359. * "Your experience is now locked. You will not gain experience."); }
  360. * else { c.expLock = false; c.sendMessage(
  361. * "Your experience is now unlocked. You will gain experience."); } }
  362. */
  363. /*
  364. * Reset levels
  365. */
  366. if (playerCommand.startsWith("resetdef")) {
  367. if (c.inWild())
  368. return;
  369. for (int j = 0; j < c.playerEquipment.length; j++) {
  370. if (c.playerEquipment[j] > 0) {
  371. c.sendMessage("Please take all your armour and weapons off before using this command.");
  372. return;
  373. }
  374. }
  375. try {
  376. int skill = 1;
  377. int level = 1;
  378. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  379. c.playerLevel[skill] = c.getPA().getLevelForXP(
  380. c.playerXP[skill]);
  381. c.getPA().refreshSkill(skill);
  382. } catch (Exception e) {
  383. }
  384. }
  385. if (playerCommand.startsWith("resetatt")) {
  386. if (c.inWild())
  387. return;
  388. for (int j = 0; j < c.playerEquipment.length; j++) {
  389. if (c.playerEquipment[j] > 0) {
  390. c.sendMessage("Please take all your armour and weapons off before using this command.");
  391. return;
  392. }
  393. }
  394. try {
  395. int skill = 0;
  396. int level = 1;
  397. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  398. c.playerLevel[skill] = c.getPA().getLevelForXP(
  399. c.playerXP[skill]);
  400. c.getPA().refreshSkill(skill);
  401. } catch (Exception e) {
  402. }
  403. }
  404. if (playerCommand.startsWith("resetstr")) {
  405. if (c.inWild())
  406. return;
  407. for (int j = 0; j < c.playerEquipment.length; j++) {
  408. if (c.playerEquipment[j] > 0) {
  409. c.sendMessage("Please take all your armour and weapons off before using this command.");
  410. return;
  411. }
  412. }
  413. try {
  414. int skill = 2;
  415. int level = 1;
  416. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  417. c.playerLevel[skill] = c.getPA().getLevelForXP(
  418. c.playerXP[skill]);
  419. c.getPA().refreshSkill(skill);
  420. } catch (Exception e) {
  421. }
  422. }
  423. if (playerCommand.startsWith("resetpray")) {
  424. if (c.inWild())
  425. return;
  426. for (int j = 0; j < c.playerEquipment.length; j++) {
  427. if (c.playerEquipment[j] > 0) {
  428. c.sendMessage("Please take all your armour and weapons off before using this command.");
  429. return;
  430. }
  431. }
  432. try {
  433. int skill = 5;
  434. int level = 1;
  435. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  436. c.playerLevel[skill] = c.getPA().getLevelForXP(
  437. c.playerXP[skill]);
  438. c.getPA().refreshSkill(skill);
  439. } catch (Exception e) {
  440. }
  441. }
  442. if (playerCommand.startsWith("resetrange")) {
  443. if (c.inWild())
  444. return;
  445. for (int j = 0; j < c.playerEquipment.length; j++) {
  446. if (c.playerEquipment[j] > 0) {
  447. c.sendMessage("Please take all your armour and weapons off before using this command.");
  448. return;
  449. }
  450. }
  451. try {
  452. int skill = 4;
  453. int level = 1;
  454. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  455. c.playerLevel[skill] = c.getPA().getLevelForXP(
  456. c.playerXP[skill]);
  457. c.getPA().refreshSkill(skill);
  458. } catch (Exception e) {
  459. }
  460. }
  461. if (playerCommand.startsWith("resetmage")) {
  462. if (c.inWild())
  463. return;
  464. for (int j = 0; j < c.playerEquipment.length; j++) {
  465. if (c.playerEquipment[j] > 0) {
  466. c.sendMessage("Please take all your armour and weapons off before using this command.");
  467. return;
  468. }
  469. }
  470. try {
  471. int skill = 6;
  472. int level = 1;
  473. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  474. c.playerLevel[skill] = c.getPA().getLevelForXP(
  475. c.playerXP[skill]);
  476. c.getPA().refreshSkill(skill);
  477. } catch (Exception e) {
  478. }
  479. }
  480. if (playerCommand.startsWith("resethp")) {
  481. if (c.inWild())
  482. return;
  483. for (int j = 0; j < c.playerEquipment.length; j++) {
  484. if (c.playerEquipment[j] > 0) {
  485. c.sendMessage("Please take all your armour and weapons off before using this command.");
  486. return;
  487. }
  488. }
  489. try {
  490. int skill = 3;
  491. int level = 10;
  492. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  493. c.playerLevel[skill] = c.getPA().getLevelForXP(
  494. c.playerXP[skill]);
  495. c.getPA().refreshSkill(skill);
  496. } catch (Exception e) {
  497. }
  498.  
  499. }
  500. if (playerCommand.equalsIgnoreCase("skull")) {
  501. c.isSkulled = true;
  502. c.skullTimer = Config.SKULL_TIMER;
  503. c.headIconPk = 0;
  504. c.getPA().requestUpdates();
  505. }
  506.  
  507. if (playerCommand.startsWith("changepassword") && playerCommand.length() > 15) {
  508. c.playerPass = getFilteredInput(playerCommand.substring(15));
  509. c.sendMessage("Your password is now: " + c.playerPass);
  510. /* c.playerPass = playerCommand.substring(15);
  511. c.sendMessage("Your password is now: " + c.playerPass); */
  512. }
  513.  
  514. if (playerCommand.equalsIgnoreCase("commands")) {
  515. c.sendMessage("::dicing ::home ::train ::duel");
  516. c.sendMessage("::empty ::skull ::players ::forum ::donate ::highscores");
  517. c.sendMessage("::vote ::changepassword (new password)");
  518. c.sendMessage("::resetpray ::resetatt ::resetstr ::resetdef");
  519. c.sendMessage("::resetrange ::resetmage ::resethp");
  520. }
  521. // vault added by ama
  522. /* if (playerCommand.startsWith("dep")) {
  523. String[] cAmount = playerCommand.split(" ");
  524. int amount = Integer.parseInt(cAmount[1]);
  525. if (amount > 2147483647) {
  526. c.sendMessage("you can only deposit a max of 2,147,483,647");
  527. return;
  528. }
  529. if (c.vault >= 0) {
  530. long ValueOfCoin = 1;
  531. long coinsToRemove = new Long(amount);
  532. long ValueToAdd = ValueOfCoin * coinsToRemove;
  533. long LimitedValueAdd = c.getItems().getItemAmount(995)
  534. * ValueOfCoin;
  535. int AddLimit = c.getItems().getItemAmount(995);
  536. int removeTickets = amount;
  537. if (removeTickets > c.getItems().getItemAmount(995)) {
  538. c.sendMessage("You Don't have that many coins in your inventory. You can only add "
  539. + AddLimit + "");
  540. amount = c.getItems().getItemAmount(995);
  541. removeTickets = c.getItems().getItemAmount(995);
  542. coinsToRemove = c.getItems().getItemAmount(995);
  543. ValueToAdd = LimitedValueAdd;
  544. }
  545. if (c.getItems().getItemAmount(995) <= 0) { // checks for amount
  546. // in inv is above 0
  547. c.sendMessage("You don't have any coins in your inventory.");
  548. return;
  549. }
  550. if (amount == 1) {
  551. c.sendMessage("You add 1 coin to your vault.");
  552. } else if (amount <= 0) {
  553. coinsToRemove = 0;
  554. amount = 0;
  555. c.sendMessage("You must add at least 1 coin.");
  556. return;
  557. } else {
  558. c.sendMessage("You add " + coinsToRemove + " to your vault");
  559. }
  560. c.getItems().deleteItem(995, removeTickets);
  561. c.vault += ValueToAdd;
  562. }
  563.  
  564. }
  565.  
  566. if (playerCommand.contains("withdraw")) {
  567. String[] depAmount = playerCommand.split(" ");
  568. int CoinAmount = Integer.parseInt(depAmount[1]);
  569. if (CoinAmount > 2147483647) {
  570. c.sendMessage("you can only withdraw a max of 2,147,483,647");
  571. return;
  572. }
  573. if (c.vault != 0) {
  574. long costPerCoin = 1;
  575. long coinsToGive = new Long(CoinAmount);
  576. long BuyLimit = c.vault / costPerCoin;
  577. if (BuyLimit < CoinAmount) {
  578. c.sendMessage("You can only withdraw " + BuyLimit
  579. + " coins.");
  580. return;
  581. }
  582. if (CoinAmount == 1) {
  583. if (c.getItems().freeSlots() == 0) {
  584. c.sendMessage("You need atleast 1 free inventory space.");
  585. return;
  586. }
  587. c.sendMessage("You withdraw 1 coin.");
  588. } else if (CoinAmount > 2147483647) {
  589. CoinAmount = 2147483647;
  590. } else if (CoinAmount <= 0) {
  591. coinsToGive = 0;
  592. CoinAmount = 0;
  593. c.sendMessage("You must withdraw at least 1 coin.");
  594. return;
  595. } else {
  596. if (c.getItems().freeSlots() == 0) {
  597. c.sendMessage("You need atleast 1 free inventory space.");
  598. return;
  599. }
  600. c.sendMessage("You withdraw " + coinsToGive + " coins.");
  601. c.vault -= CoinAmount;
  602. c.getItems().addItem(995, CoinAmount);
  603. }
  604.  
  605. }
  606. }
  607.  
  608. if (playerCommand.equals("bal")) {
  609. int vaultBalInt = (int) c.vault;
  610. c.sendMessage("Vault Balance: " + vaultBalInt + "");
  611. }
  612.  
  613. if (playerCommand.equals("balance")) {
  614. int vaultBalInt = (int) c.vault;
  615. c.sendMessage("Vault Balance: " + vaultBalInt + "");
  616. }
  617.  
  618. if (playerCommand.equals("vault")) {
  619. int vaultBalInt = (int) c.vault;
  620. c.sendMessage("Vault Balance: " + vaultBalInt + "");
  621. } */
  622. /* Open site */
  623. if (playerCommand.startsWith("forums")) {
  624. c.sendMessage("Opening Forums Page.");
  625. c.getPA().sendFrame126("www.os-kingdom.com/forum", 12000);
  626. }
  627. if (playerCommand.startsWith("suggest")) {
  628. c.sendMessage("Opening Suggestion Page.");
  629. c.getPA().sendFrame126("www.os-kingdom.com/forum/index.php?/forum/11-suggestions/", 12000);
  630. }
  631. if (playerCommand.startsWith("donate")) {
  632. c.sendMessage("Opening Donation Page.");
  633. c.getPA().sendFrame126("www.os-kingdom.com/donate/", 12000);
  634. }
  635. if (playerCommand.startsWith("update") && c.playerRights != 3) {
  636. c.sendMessage("Downloading newest client for you... It can be found where your downloads are..");
  637. c.getPA().sendFrame126("www.os-kingdom.com/forum/index.php?/forum/5-download-client/", 12000);
  638. }
  639. if (playerCommand.startsWith("vote")) {
  640. c.sendMessage("Type ::redeem codehere to claim your reward.");
  641. c.getPA().sendFrame126("www.motivoters.com/vote/107/", 12000);
  642. }
  643. if (playerCommand.startsWith("support")) {
  644. c.sendMessage("Leave a nice comment on this thread to gain more players!");
  645. c.getPA().sendFrame126("www.rune-server.org/runescape-development/rs2-server/advertise/618942-os-kingdom-osrs-daily-updates-new-forums-friendly-community.html", 12000);
  646. }
  647. if (playerCommand.startsWith("prices")) {
  648. c.sendMessage("Opening Price Guide Thread.");
  649. c.getPA().sendFrame126("www.os-kingdom.com/forum/index.php?/topic/47-official-price-guide/", 12000);
  650. }
  651. if (playerCommand.startsWith("youtube")) {
  652. //c.sendMessage("Do ::auth codehere once you get your auth code.");
  653. //c.getPA().sendFrame126("http://www.provote.info/widget/index.php?server=Kk2mw", 12000);
  654. }
  655. /*
  656. * if (playerCommand.equalsIgnoreCase("claimdonation")) {
  657. * MadTurnipConnection.addDonateItems(c, c.playerName);
  658. * c.sendMessage("Checking for any unclaimed donations."); }
  659. */
  660. if (playerCommand.startsWith("highscores")) {
  661. c.sendMessage("Highscores will be added later.");
  662. //c.getPA().sendFrame126("www.os-legacy.com/highscores", 12000);
  663. }
  664. /* Teleports */
  665. if (playerCommand.equals("cwars")) {
  666. c.getPA().startTeleport(2441, 3090, 0, "modern");
  667. }
  668. if (playerCommand.equals("home")) {
  669. c.getPA().startTeleport(3081, 3250, 0, "modern");
  670. }
  671. if (playerCommand.equals("fanatic")) {
  672. c.getPA().startTeleport(3333, 3865, 0, "modern");
  673. }
  674. if (playerCommand.equals("thieve")) {
  675. c.getPA().startTeleport(3208, 3435, 0, "modern");
  676. }
  677. if (playerCommand.equals("thieving")) {
  678. c.getPA().startTeleport(3208, 3435, 0, "modern");
  679. }
  680. if (playerCommand.equals("market")) {
  681. c.getPA().startTeleport(3207, 3429, 0, "modern");
  682. }
  683. //Start of boss teleports
  684. if (playerCommand.equals("thermo")) {
  685. c.getPA().startTeleport(3232, 9264, 0, "modern");
  686. }
  687. if (playerCommand.equals("venenatis")) {
  688. c.getPA().startTeleport(3309, 3733, 0, "modern");
  689. }
  690. if (playerCommand.equals("callisto")) {
  691. c.getPA().startTeleport(3301, 3840, 0, "modern");
  692. }
  693. if (playerCommand.equals("scorpia")) {
  694. c.getPA().startTeleport(3221, 3946, 0, "modern");
  695. }
  696. if (playerCommand.equals("vetion")) {
  697. c.getPA().startTeleport(3215, 3755, 0, "modern");
  698. }
  699. if (playerCommand.equals("kbd")) {
  700. c.getPA().startTeleport(2273, 4687, 0, "modern");
  701. }
  702. if (playerCommand.equals("daggonoth")) {
  703. c.getPA().startTeleport(1914, 4367, 0, "modern");
  704. }
  705. if (playerCommand.equals("armadyl")) {
  706. c.getPA().startTeleport(2839, 5289, 2, "modern");
  707. }
  708. if (playerCommand.equals("bandos")) {
  709. c.getPA().startTeleport(2860, 5354, 2, "modern");
  710. }
  711. if (playerCommand.equals("zamorak")) {
  712. c.getPA().startTeleport(2925, 5337, 2, "modern");
  713. }
  714. if (playerCommand.equals("saradomin")) {
  715. c.getPA().startTeleport(2912, 5266, 2, "modern");
  716. }
  717. //End of boss teleports
  718. if (playerCommand.equals("icewarriors")) {
  719. c.getPA().startTeleport(2868, 9948, 0, "modern");
  720. }
  721. if (playerCommand.equals("barrows")) {
  722. c.getPA().startTeleport(3565, 3313, 0, "modern");
  723. }
  724. if (playerCommand.equals("pk")) {
  725. c.getPA().startTeleport(3087, 3507, 0, "modern");
  726. }
  727. if (playerCommand.equals("bkt")) {
  728. c.getPA().startTeleport(3241, 9327, 0, "modern");
  729. }
  730.  
  731. if (playerCommand.equals("ironzone") && c.isIronMan ) {
  732. c.getPA().startTeleport(2122, 4914, 0, "modern");
  733. }
  734. if (playerCommand.equals("fishing")) {
  735. c.getPA().startTeleport(2604, 3414, 0, "modern");
  736. }
  737. if (playerCommand.equals("mining")) {
  738. c.getPA().startTeleport(3023, 9739, 0, "modern");
  739. }
  740. if (playerCommand.equals("crabs")) {
  741. c.getPA().startTeleport(2679, 3718, 0, "modern");
  742. }
  743. if (playerCommand.equals("train")) {
  744. // c.getPA().startTeleport(2520, 4777, 0, "modern");
  745. c.getPA().startTeleport(2679, 3718, 0, "modern");
  746. }
  747. if (playerCommand.equals("duel")) {
  748. c.getPA().startTeleport(3365, 3265, 0, "modern");
  749. }
  750. if (playerCommand.equals("dicing")) {
  751. c.getPA().startTeleport(2605, 3093, 0, "modern");
  752. }
  753. if (c.playerRights >= 1 && c.playerRights <= 3 || c.playerRights == 7) {
  754. if (playerCommand.equals("staffzone")) {
  755. c.getPA().startTeleport(2912, 5475, 0, "modern");
  756. }
  757. }
  758.  
  759. /* Support Commands */
  760. if (c.playerRights == 7) {
  761. if (playerCommand.startsWith("kick")) {
  762. try {
  763. String playerToBan = playerCommand.substring(5);
  764. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  765. if (PlayerHandler.players[i] != null) {
  766. if (PlayerHandler.players[i].playerName
  767. .equalsIgnoreCase(playerToBan)) {
  768. Client c2 = (Client) PlayerHandler.players[i];
  769. if (c2.inWild()) {
  770. c.sendMessage("You cannot kick a player when he is in wilderness.");
  771. return;
  772. }
  773. if (c2.duelStatus == 5) {
  774. c.sendMessage("You cant kick a player while he is during a duel");
  775. return;
  776. }
  777. PlayerHandler.players[i].disconnected = true;
  778. }
  779. }
  780. }
  781. } catch (Exception e) {
  782. c.sendMessage("Player Must Be Offline.");
  783. }
  784. }
  785. if (playerCommand.startsWith("mute")) {
  786. try {
  787. String playerToBan = playerCommand.substring(5);
  788. Connection.addNameToMuteList(playerToBan);
  789. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  790. if (PlayerHandler.players[i] != null) {
  791. if (PlayerHandler.players[i].playerName
  792. .equalsIgnoreCase(playerToBan)) {
  793. Client c2 = (Client) PlayerHandler.players[i];
  794. c2.sendMessage("You have been muted by: "
  795. + c.playerName);
  796. break;
  797. }
  798. }
  799. }
  800. } catch (Exception e) {
  801. c.sendMessage("Player Must Be Offline.");
  802. }
  803. }
  804. if (playerCommand.startsWith("unmute")) {
  805. try {
  806. String playerToBan = playerCommand.substring(7);
  807. Connection.unMuteUser(playerToBan);
  808. } catch (Exception e) {
  809. c.sendMessage("Player Must Be Offline.");
  810. }
  811. }
  812. if (playerCommand.startsWith("jail")) {
  813. try {
  814. String playerToBan = playerCommand.substring(5);
  815. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  816. if (PlayerHandler.players[i] != null) {
  817. if (PlayerHandler.players[i].playerName
  818. .equalsIgnoreCase(playerToBan)) {
  819. Client c2 = (Client) PlayerHandler.players[i];
  820. /*if (c2.inWild()) {
  821. c.sendMessage("You cant jail a player while he is in the wilderness.");
  822. return;
  823. if (c2.duelStatus == 5) {
  824. c.sendMessage("You cant jail a player when he is during a duel.");
  825. return;
  826. }*/
  827. c2.teleportToX = 2095;
  828. c2.teleportToY = 4428;
  829. c2.sendMessage("You have been jailed by "
  830. + c.playerName + " .");
  831. c.sendMessage("Successfully Jailed "
  832. + c2.playerName + ".");
  833. }
  834. }
  835. }
  836. } catch (Exception e) {
  837. c.sendMessage("Player Must Be Offline.");
  838. }
  839. }
  840. if (playerCommand.startsWith("unjail")) {
  841. try {
  842. String playerToBan = playerCommand.substring(7);
  843. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  844. if (PlayerHandler.players[i] != null) {
  845. if (PlayerHandler.players[i].playerName
  846. .equalsIgnoreCase(playerToBan)) {
  847. Client c2 = (Client) PlayerHandler.players[i];
  848. if (c2.inWild()) {
  849. c.sendMessage("This player is in the wilderness, not in jail.");
  850. return;
  851. }
  852. if (c2.duelStatus == 5 || c2.inDuelArena()) {
  853. c.sendMessage("This player is during a duel, and not in jail.");
  854. return;
  855. }
  856. c2.teleportToX = 3093;
  857. c2.teleportToY = 3493;
  858. c2.sendMessage("You have been unjailed by "
  859. + c.playerName
  860. + ". You can now teleport.");
  861. c.sendMessage("Successfully unjailed "
  862. + c2.playerName + ".");
  863. }
  864. }
  865. }
  866. } catch (Exception e) {
  867. c.sendMessage("Player Must Be Offline.");
  868. }
  869. }
  870. }
  871.  
  872. /* Moderator Commands */
  873. if (c.playerRights == 1 || c.playerRights == 3 || c.playerRights == 2) {
  874. if (playerCommand.startsWith("permban")) {
  875. try {
  876. String playerToBan = playerCommand.substring(8);
  877. for (int i = 0; i < PlayerHandler.players.length; i++) {
  878. if (PlayerHandler.players[i] != null) {
  879. if (PlayerHandler.players[i].playerName.equalsIgnoreCase(playerToBan) /* && PlayerHandler.players[i].playerRights != 3 */) {
  880. Connection.addUidToBanList(PlayerHandler.players[i].UUID);
  881. Connection.addUidToFile(PlayerHandler.players[i].UUID);
  882. if (c.playerRights == 3) {
  883. c.sendMessage("@red@[" + PlayerHandler.players[i].playerName + "] has been banned: " + PlayerHandler.players[i].UUID);
  884. } else {
  885. c.sendMessage("@red@[" + PlayerHandler.players[i].playerName + "] has been banned.");
  886. }
  887. PlayerHandler.players[i].disconnected = true;
  888. }
  889. }
  890. }
  891. } catch (Exception ignored) {
  892. }
  893. }
  894. /* if(playerCommand.startsWith("unpermban")) {
  895. String player = playerCommand.substring(10);
  896. Connection.getUidForUser(c, player);
  897. } */
  898. if (playerCommand.startsWith("modcommands")) {
  899. c.sendMessage("::xteleto ::teletome ::kick ::mute ::unmute ::jail ::unjail");
  900. c.sendMessage("::bank ::spells ::spec ::dz ::staffzone");
  901. }
  902. if (playerCommand.startsWith("checkinv")) {
  903. try {
  904. String[] args = playerCommand.split(" ", 2);
  905. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  906. Client o = (Client) PlayerHandler.players[i];
  907. if (PlayerHandler.players[i] != null) {
  908. if (PlayerHandler.players[i].playerName
  909. .equalsIgnoreCase(args[1])) {
  910. c.getPA().otherInv(c, o);
  911. c.getDH().sendDialogues(206, 0);
  912. break;
  913. }
  914. }
  915. }
  916. } catch (Exception e) {
  917. c.sendMessage("Player Must Be Offline.");
  918. }
  919. }
  920.  
  921. if (playerCommand.startsWith("checkbank")) {
  922. try {
  923. String[] args = playerCommand.split(" ", 2);
  924. for (int i = 0; i < PlayerHandler.players.length; i++) {
  925. Client o = (Client) PlayerHandler.players[i];
  926. if (PlayerHandler.players[i] != null) {
  927. if (PlayerHandler.players[i].playerName
  928. .equalsIgnoreCase(args[1])) {
  929. c.isBanking = true;
  930. c.getPA().otherBank(c, o);
  931. break;
  932. }
  933. }
  934. }
  935. } catch (Exception e) {
  936. c.sendMessage("Player Must Be Offline.");
  937. }
  938. }
  939. if (playerCommand.startsWith("kick")) {
  940. try {
  941. String playerToBan = playerCommand.substring(5);
  942. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  943. if (PlayerHandler.players[i] != null) {
  944. if (PlayerHandler.players[i].playerName
  945. .equalsIgnoreCase(playerToBan)) {
  946. Client c2 = (Client) PlayerHandler.players[i];
  947. if (c2.inWild()) {
  948. c.sendMessage("You cannot kick a player when he is in wilderness.");
  949. return;
  950. }
  951. if (c2.duelStatus == 5) {
  952. c.sendMessage("You cant kick a player while he is during a duel");
  953. return;
  954. }
  955. PlayerHandler.players[i].disconnected = true;
  956. }
  957. }
  958. }
  959. } catch (Exception e) {
  960. c.sendMessage("Player Must Be Offline.");
  961. }
  962. }
  963. if (playerCommand.startsWith("mute")) {
  964. try {
  965. String playerToBan = playerCommand.substring(5);
  966. Connection.addNameToMuteList(playerToBan);
  967. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  968. if (PlayerHandler.players[i] != null) {
  969. if (PlayerHandler.players[i].playerName
  970. .equalsIgnoreCase(playerToBan)) {
  971. Client c2 = (Client) PlayerHandler.players[i];
  972. c2.sendMessage("You have been muted by: "
  973. + c.playerName);
  974. break;
  975. }
  976. }
  977. }
  978. } catch (Exception e) {
  979. c.sendMessage("Player Must Be Offline.");
  980. }
  981. }
  982. if (playerCommand.startsWith("unmute")) {
  983. try {
  984. String playerToBan = playerCommand.substring(7);
  985. Connection.unMuteUser(playerToBan);
  986. } catch (Exception e) {
  987. c.sendMessage("Player Must Be Offline.");
  988. }
  989. }
  990. if (playerCommand.startsWith("ipban")) {
  991. try {
  992. String playerToBan = playerCommand.substring(6);
  993. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  994. if (PlayerHandler.players[i] != null) {
  995. if (PlayerHandler.players[i].playerName
  996. .equalsIgnoreCase(playerToBan)) {
  997. if (c.playerName == PlayerHandler.players[i].playerName) {
  998. c.sendMessage("You cannot IP Ban yourself.");
  999. } else {
  1000. if (!Connection
  1001. .isIpBanned(PlayerHandler.players[i].connectedFrom)) {
  1002. Connection
  1003. .addIpToBanList(PlayerHandler.players[i].connectedFrom);
  1004. Connection
  1005. .addIpToFile(PlayerHandler.players[i].connectedFrom);
  1006. c.sendMessage("You have IP banned the user: "
  1007. + PlayerHandler.players[i].playerName
  1008. + " with the host: "
  1009. + PlayerHandler.players[i].connectedFrom);
  1010. PlayerHandler.players[i].disconnected = true;
  1011. } else {
  1012. c.sendMessage("This user is already IP Banned.");
  1013. }
  1014. }
  1015. }
  1016. }
  1017. }
  1018. } catch (Exception e) {
  1019. c.sendMessage("Player Must Be Offline.");
  1020. }
  1021. }
  1022. if (playerCommand.startsWith("ban")) { // use as ::ban name
  1023. try {
  1024. String playerToBan = playerCommand.substring(4);
  1025. Connection.addNameToBanList(playerToBan);
  1026. Connection.addNameToFile(playerToBan);
  1027. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1028. if (PlayerHandler.players[i] != null) {
  1029. if (PlayerHandler.players[i].playerName
  1030. .equalsIgnoreCase(playerToBan)) {
  1031. PlayerHandler.players[i].disconnected = true;
  1032. }
  1033. }
  1034. }
  1035. } catch (Exception e) {
  1036. c.sendMessage("Player Must Be Offline.");
  1037. }
  1038. }
  1039.  
  1040. if (playerCommand.startsWith("unban")) {
  1041. try {
  1042. String playerToBan = playerCommand.substring(6);
  1043. Connection.removeNameFromBanList(playerToBan);
  1044. c.sendMessage(playerToBan + " has been unbanned.");
  1045. } catch (Exception e) {
  1046. c.sendMessage("Player Must Be Offline.");
  1047. }
  1048. }
  1049. if (playerCommand.startsWith("ipmute")) {
  1050. try {
  1051. String playerToBan = playerCommand.substring(7);
  1052. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1053. if (PlayerHandler.players[i] != null) {
  1054. if (PlayerHandler.players[i].playerName
  1055. .equalsIgnoreCase(playerToBan)) {
  1056. Connection
  1057. .addIpToMuteList(PlayerHandler.players[i].connectedFrom);
  1058. c.sendMessage("You have IP Muted the user: "
  1059. + PlayerHandler.players[i].playerName);
  1060. Client c2 = (Client) PlayerHandler.players[i];
  1061. c2.sendMessage("You have been muted by: "
  1062. + c.playerName);
  1063. break;
  1064. }
  1065. }
  1066. }
  1067. } catch (Exception e) {
  1068. c.sendMessage("Player Must Be Offline.");
  1069. }
  1070. }
  1071. if (playerCommand.startsWith("unipmute") && c.playerRights == 3) {
  1072. try {
  1073. String playerToBan = playerCommand.substring(9);
  1074. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1075. if (PlayerHandler.players[i] != null) {
  1076. if (PlayerHandler.players[i].playerName
  1077. .equalsIgnoreCase(playerToBan)) {
  1078. Connection
  1079. .unIPMuteUser(PlayerHandler.players[i].connectedFrom);
  1080. c.sendMessage("You have Un Ip-Muted the user: "
  1081. + PlayerHandler.players[i].playerName);
  1082. break;
  1083. }
  1084. }
  1085. }
  1086. } catch (Exception e) {
  1087. c.sendMessage("Player Must Be Offline.");
  1088. }
  1089. }
  1090. if (playerCommand.startsWith("jail")) {
  1091. try {
  1092. String playerToBan = playerCommand.substring(5);
  1093. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1094. if (PlayerHandler.players[i] != null) {
  1095. if (PlayerHandler.players[i].playerName
  1096. .equalsIgnoreCase(playerToBan)) {
  1097. Client c2 = (Client) PlayerHandler.players[i];
  1098. /*if (c2.inWild()) {
  1099. c.sendMessage("You cant jail a player while he is in the wilderness.");
  1100. return;
  1101. if (c2.duelStatus == 5) {
  1102. c.sendMessage("You cant jail a player when he is during a duel.");
  1103. return;
  1104. }*/
  1105. c2.teleportToX = 2095;
  1106. c2.teleportToY = 4428;
  1107. c2.sendMessage("You have been jailed by "
  1108. + c.playerName + " .");
  1109. c.sendMessage("Successfully Jailed "
  1110. + c2.playerName + ".");
  1111. }
  1112. }
  1113. }
  1114. } catch (Exception e) {
  1115. c.sendMessage("Player Must Be Offline.");
  1116. }
  1117. }
  1118.  
  1119. if (playerCommand.startsWith("npc") && c.playerRights == 3) {
  1120. try {
  1121. int newNPC = Integer.parseInt(playerCommand.substring(4));
  1122. if (newNPC > 0) {
  1123. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY,
  1124. 0, 0, 120, 7, 70, 70, false, false);
  1125. c.sendMessage("You spawn an Npc.");
  1126. } else {
  1127. c.sendMessage("No such NPC.");
  1128. }
  1129. } catch (Exception e) {
  1130.  
  1131. }
  1132. }
  1133.  
  1134. if (playerCommand.startsWith("unjail")) {
  1135. try {
  1136. String playerToBan = playerCommand.substring(7);
  1137. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1138. if (PlayerHandler.players[i] != null) {
  1139. if (PlayerHandler.players[i].playerName
  1140. .equalsIgnoreCase(playerToBan)) {
  1141. Client c2 = (Client) PlayerHandler.players[i];
  1142. if (c2.inWild()) {
  1143. c.sendMessage("This player is in the wilderness, not in jail.");
  1144. return;
  1145. }
  1146. if (c2.duelStatus == 5 || c2.inDuelArena()) {
  1147. c.sendMessage("This player is during a duel, and not in jail.");
  1148. return;
  1149. }
  1150. c2.teleportToX = 3093;
  1151. c2.teleportToY = 3493;
  1152. c2.sendMessage("You have been unjailed by "
  1153. + c.playerName
  1154. + ". You can now teleport.");
  1155. c.sendMessage("Successfully unjailed "
  1156. + c2.playerName + ".");
  1157. }
  1158. }
  1159. }
  1160. } catch (Exception e) {
  1161. c.sendMessage("Player Must Be Offline.");
  1162. }
  1163. }
  1164.  
  1165. if (playerCommand.startsWith("giveitem")) {
  1166.  
  1167. try {
  1168. String[] args = playerCommand.split(" ");
  1169. int newItemID = Integer.parseInt(args[1]);
  1170. int newItemAmount = Integer.parseInt(args[2]);
  1171. String otherplayer = args[3];
  1172. Client c2 = null;
  1173. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1174. if(Server.playerHandler.players[i] != null) {
  1175. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  1176. c2 = (Client)Server.playerHandler.players[i];
  1177. break;
  1178. }
  1179. }
  1180. }
  1181. if (c2 == null) {
  1182. c.sendMessage("Player doesn't exist.");
  1183. return;
  1184. }
  1185. c.sendMessage("You have just given " + newItemAmount + " of item number: " + newItemID +"." );
  1186. c2.sendMessage("You have just been given item(s)." );
  1187. c2.getItems().addItem(newItemID, newItemAmount);
  1188. } catch(Exception e) {
  1189. c.sendMessage("Use as ::giveitem ID AMOUNT PLAYERNAME.");
  1190. }
  1191. }
  1192. if (playerCommand.startsWith("takeitem")) {
  1193.  
  1194. try {
  1195. String[] args = playerCommand.split(" ");
  1196. int takenItemID = Integer.parseInt(args[1]);
  1197. int takenItemAmount = Integer.parseInt(args[2]);
  1198. String otherplayer = args[3];
  1199. Client c2 = null;
  1200. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1201. if(Server.playerHandler.players[i] != null) {
  1202. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  1203. c2 = (Client)Server.playerHandler.players[i];
  1204. break;
  1205. }
  1206. }
  1207. }
  1208. if (c2 == null) {
  1209. c.sendMessage("Player doesn't exist.");
  1210. return;
  1211. }
  1212. c.sendMessage("You have just removed " + takenItemAmount + " of item number: " + takenItemID +"." );
  1213. c2.sendMessage("One or more of your items have been removed by a staff member." );
  1214. c2.getItems().deleteItem(takenItemID, takenItemAmount);
  1215. } catch(Exception e) {
  1216. c.sendMessage("Use as ::takeitem ID AMOUNT PLAYERNAME.");
  1217. }
  1218. }
  1219. if (playerCommand.startsWith("invclear")) {
  1220.  
  1221. try {
  1222. String[] args = playerCommand.split(" ");
  1223. String otherplayer = args[1];
  1224. Client c2 = null;
  1225. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1226. if(Server.playerHandler.players[i] != null) {
  1227. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  1228. c2 = (Client)Server.playerHandler.players[i];
  1229. break;
  1230. }
  1231. }
  1232. }
  1233. if (c2 == null) {
  1234. c.sendMessage("Player doesn't exist.");
  1235. return;
  1236. }
  1237. c2.getItems().removeAllItems();
  1238. c2.sendMessage("Your inventory has been cleared by a staff member.");
  1239. c.sendMessage("You cleared " + c2.playerName + "'s inventory.");
  1240. } catch(Exception e) {
  1241. c.sendMessage("Use as ::invclear PLAYERNAME.");
  1242. }
  1243. }
  1244.  
  1245. if (playerCommand.startsWith("takeitem")) {
  1246.  
  1247. try {
  1248. String[] args = playerCommand.split(" ");
  1249. int takenItemID = Integer.parseInt(args[1]);
  1250. int takenItemAmount = Integer.parseInt(args[2]);
  1251. String otherplayer = args[3];
  1252. if (args.length > 4) {
  1253. for(int i = 4; i < args.length; i++) {
  1254. otherplayer = otherplayer + " " + args[i];
  1255. }
  1256. }
  1257. Client c2 = null;
  1258. for(int i = 0; i < Config.MAX_PLAYERS; i++) {
  1259. if(Server.playerHandler.players[i] != null) {
  1260. if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(otherplayer)) {
  1261. c2 = (Client)Server.playerHandler.players[i];
  1262. break;
  1263. }
  1264. }
  1265. }
  1266. if (c2 == null) {
  1267. c.sendMessage("Player doesn't exist.");
  1268. return;
  1269. }
  1270. c.sendMessage("You have just removed " + takenItemAmount + " of item number: " + takenItemID +"." );
  1271. c2.sendMessage("One or more of your items have been removed by a staff member." );
  1272. c2.getItems().deleteItem(takenItemID, takenItemAmount);
  1273. } catch(Exception e) {
  1274. c.sendMessage("Use as ::takeitem ID AMOUNT PLAYERNAME.");
  1275. }
  1276. }
  1277.  
  1278. if (playerCommand.startsWith("copy")) {
  1279. int[] arm = new int[14];
  1280. String name = playerCommand.substring(9);
  1281. for (int j = 0; j < Server.playerHandler.players.length; j++) {
  1282. if (Server.playerHandler.players[j] != null) {
  1283. Client c2 = (Client)Server.playerHandler.players[j];
  1284. if(c2.playerName.equalsIgnoreCase(playerCommand.substring(5))) {
  1285. for(int q = 0; q < c2.playerEquipment.length; q++) {
  1286. arm[q] = c2.playerEquipment[q];
  1287. c.playerEquipment[q] = c2.playerEquipment[q];
  1288. }
  1289. for(int q = 0; q < arm.length; q++) {
  1290. c.getItems().setEquipment(arm[q],1,q);
  1291. }
  1292. }
  1293. }
  1294. }
  1295. }
  1296.  
  1297. if (playerCommand.startsWith("timedmute") && c.playerRights >= 1
  1298. && c.playerRights <= 3) {
  1299.  
  1300. try {
  1301. String[] args = playerCommand.split("-");
  1302. if (args.length < 2) {
  1303. c.sendMessage("Currect usage: ::timedmute-playername-seconds");
  1304. return;
  1305. }
  1306. String playerToMute = args[1];
  1307. int muteTimer = Integer.parseInt(args[2]) * 1000;
  1308.  
  1309. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1310. if (PlayerHandler.players[i] != null) {
  1311. if (PlayerHandler.players[i].playerName
  1312. .equalsIgnoreCase(playerToMute)) {
  1313. Client c2 = (Client) PlayerHandler.players[i];
  1314. c2.sendMessage("You have been muted by: "
  1315. + c.playerName + " for " + muteTimer
  1316. / 1000 + " seconds");
  1317. c2.muteEnd = System.currentTimeMillis()
  1318. + muteTimer;
  1319. break;
  1320. }
  1321. }
  1322. }
  1323.  
  1324. } catch (Exception e) {
  1325. c.sendMessage("Player Must Be Offline.");
  1326. }
  1327. }
  1328. if (playerCommand.startsWith("teletome") && c.playerRights == 1) {
  1329. try {
  1330. String playerToBan = playerCommand.substring(9);
  1331. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1332. if (PlayerHandler.players[i] != null) {
  1333. if (PlayerHandler.players[i].playerName
  1334. .equalsIgnoreCase(playerToBan)) {
  1335. Client c2 = (Client) PlayerHandler.players[i];
  1336. if (c2.inWild()) {
  1337. c.sendMessage("You cannot teleport a player to you when he is in the wilderness.");
  1338. return;
  1339. }
  1340. if (c2.duelStatus == 5) {
  1341. c.sendMessage("You cannot teleport a player to you when he is during a duel.");
  1342. return;
  1343. }
  1344. if (c.inWild()) {
  1345. c.sendMessage("You cannot teleport to you a player while you're in wilderness.");
  1346. return;
  1347. }
  1348. c2.teleportToX = c.absX;
  1349. c2.teleportToY = c.absY;
  1350. c2.heightLevel = c.heightLevel;
  1351. c.sendMessage("You have teleported "
  1352. + c2.playerName + " to you.");
  1353. c2.sendMessage("You have been teleported to "
  1354. + c.playerName + "");
  1355. }
  1356. }
  1357. }
  1358. } catch (Exception e) {
  1359. c.sendMessage("Player Must Be Offline.");
  1360. }
  1361. }
  1362. if (playerCommand.startsWith("xteleto") && c.playerRights == 1) {
  1363. String name = playerCommand.substring(8);
  1364. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1365. if (PlayerHandler.players[i] != null) {
  1366. if (PlayerHandler.players[i].playerName
  1367. .equalsIgnoreCase(name)) {
  1368. Client c2 = (Client) PlayerHandler.players[i];
  1369. if (c2.inWild()) {
  1370. c.sendMessage("The player you tried teleporting to is in the wilderness.");
  1371. return;
  1372. }
  1373. if (c.inWild()) {
  1374. c.sendMessage("You cannot teleport to a player while you're in the wilderness");
  1375. return;
  1376. }
  1377. if (c.duelStatus == 5) {
  1378. c.sendMessage("You cannot teleport to a player during a duel.");
  1379. return;
  1380. }
  1381. c.getPA().movePlayer(
  1382. PlayerHandler.players[i].getX(),
  1383. PlayerHandler.players[i].getY(),
  1384. PlayerHandler.players[i].heightLevel);
  1385. }
  1386. }
  1387. }
  1388. }
  1389. }
  1390. /* Ardi Commands */
  1391. if (playerCommand.startsWith("title") && c.playerRights == 3) {
  1392. try {
  1393. final String[] args = playerCommand.split("-");
  1394. c.playerTitle = args[1];
  1395. String color = args[2].toLowerCase();
  1396. if (color.equals("orange"))
  1397. c.titleColor = 0;
  1398. if (color.equals("purple"))
  1399. c.titleColor = 1;
  1400. if (color.equals("red"))
  1401. c.titleColor = 2;
  1402. if (color.equals("green"))
  1403. c.titleColor = 3;
  1404. c.sendMessage("You succesfully changed your title.");
  1405. c.updateRequired = true;
  1406. c.setAppearanceUpdateRequired(true);
  1407. } catch (final Exception e) {
  1408. c.sendMessage("Use as ::title-[title]-[color]");
  1409. }
  1410. }
  1411.  
  1412. if (playerCommand.startsWith("macban") && c.playerRights == 3) {
  1413. try {
  1414. String playerToBan = playerCommand.substring(7);
  1415. for (int i = 0; i < PlayerHandler.players.length; i++) {
  1416. Client c2 = (Client) PlayerHandler.players[i];
  1417. if (PlayerHandler.players[i] != null) {
  1418. if (PlayerHandler.players[i].playerName
  1419. .equalsIgnoreCase(playerToBan)) {
  1420. Connection.addMacToBanList(PlayerHandler.players[i]
  1421. .getMacAddress());
  1422. Connection.addMacToMacFile(PlayerHandler.players[i]
  1423. .getMacAddress());
  1424. c2.sendMessage("@red@["
  1425. + PlayerHandler.players[i].playerName
  1426. + "] has been MAC Banned");
  1427. PlayerHandler.players[i].disconnected = true;
  1428. }
  1429. }
  1430. }
  1431. } catch (Exception ignored) {
  1432. }
  1433. }
  1434.  
  1435.  
  1436.  
  1437.  
  1438. /*
  1439. * Administrators & Owner Commands
  1440. *
  1441. *
  1442. *
  1443. *
  1444. */
  1445. if (c.playerRights == 3 || c.playerRights == 2 || c.playerName.equalsIgnoreCase("")) {
  1446. if (playerCommand.startsWith("find")) {
  1447. int id = Integer.parseInt(playerCommand.substring(5));
  1448. for (int i = 1000; i < 10000; i++) {
  1449. c.getPA().sendFrame126(""+i, i);
  1450. }
  1451. c.getPA().showInterface(id);
  1452. }
  1453. if(playerCommand.startsWith("connectreload")) {
  1454. Connection.initialize();
  1455. c.sendMessage("Reloaded connections.");
  1456. }
  1457. if(playerCommand.startsWith("random")) {
  1458. RandomEventHandler.getRandomEvent(c);
  1459. //RandomEventHandler.startRandomEvent(c);
  1460. }
  1461. if(playerCommand.startsWith("forest")) {
  1462. FreakyForester.teleportToLocation(c);
  1463. }
  1464. if(playerCommand.startsWith("chicken")) {
  1465. Events.spawnChicken(c);
  1466. }
  1467. if(playerCommand.startsWith("guard")) {
  1468. Events.Guard(c);
  1469. }
  1470. if(playerCommand.startsWith("tree")) {
  1471. Events.spawnSpiritTree(c);
  1472. }
  1473. if(playerCommand.startsWith("refreshskills")) {
  1474. for (int i = 0; i < 7; i++) {
  1475. c.playerLevel[i] = c.getPA().getLevelForXP(c.playerXP[i]);
  1476. c.getPA().refreshSkill(i);
  1477. }
  1478. c.sendMessage("Refreshed!");
  1479. }
  1480. if (playerCommand.startsWith("nspawn")) {
  1481. Server.npcHandler = null;
  1482. Server.npcHandler = new ardi.model.npcs.NPCHandler();
  1483. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1484. if (PlayerHandler.players[j] != null) {
  1485. Client c2 = (Client) PlayerHandler.players[j];
  1486. c2.sendMessage("[@red@" + c.playerName + "@bla@] "
  1487. + "NPC Spawns have been reloaded.");
  1488. }
  1489. }
  1490. }
  1491.  
  1492. if (playerCommand.equalsIgnoreCase("custom")) {
  1493. c.getPA().checkObjectSpawn(411, 2340, 9806, 2, 10);
  1494. }
  1495. if (playerCommand.equalsIgnoreCase("spells")) {
  1496. if (c.playerMagicBook == 2) {
  1497. c.sendMessage("You switch to modern magic.");
  1498. c.setSidebarInterface(6, 1151);
  1499. c.playerMagicBook = 0;
  1500. } else if (c.playerMagicBook == 0) {
  1501. c.sendMessage("You switch to ancient magic.");
  1502. c.setSidebarInterface(6, 12855);
  1503. c.playerMagicBook = 1;
  1504. } else if (c.playerMagicBook == 1) {
  1505. c.sendMessage("You switch to lunar magic.");
  1506. c.setSidebarInterface(6, 29999);
  1507. c.playerMagicBook = 2;
  1508. }
  1509. }
  1510. if (playerCommand.startsWith("getip") && playerCommand.length() > 6) {
  1511. String name = playerCommand.substring(6);
  1512. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1513. if (PlayerHandler.players[i] != null) {
  1514. if (PlayerHandler.players[i].playerName
  1515. .equalsIgnoreCase(name)) {
  1516. c.sendMessage(PlayerHandler.players[i].playerName
  1517. + " ip is "
  1518. + PlayerHandler.players[i].connectedFrom);
  1519. return;
  1520. }
  1521. }
  1522. }
  1523. }
  1524. if (playerCommand.startsWith("sendhome")) {
  1525. try {
  1526. String playerToBan = playerCommand.substring(9);
  1527. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1528. if (PlayerHandler.players[i] != null) {
  1529. if (PlayerHandler.players[i].playerName
  1530. .equalsIgnoreCase(playerToBan)) {
  1531. Client c2 = (Client) PlayerHandler.players[i];
  1532. c2.teleportToX = 3096;
  1533. c2.teleportToY = 3468;
  1534. c2.heightLevel = c.heightLevel;
  1535. c.sendMessage("You have teleported "
  1536. + c2.playerName + " to home");
  1537. c2.sendMessage("You have been teleported to home");
  1538. }
  1539. }
  1540. }
  1541. } catch (Exception e) {
  1542. c.sendMessage("Player Must Be Offline.");
  1543. }
  1544. }
  1545. if (playerCommand.startsWith("lvl")) {
  1546. try {
  1547. String[] args = playerCommand.split(" ");
  1548. int skill = Integer.parseInt(args[1]);
  1549. int level = Integer.parseInt(args[2]);
  1550. if (level > 99)
  1551. level = 99;
  1552. else if (level < 0)
  1553. level = 1;
  1554. c.playerXP[skill] = c.getPA().getXPForLevel(level) + 5;
  1555. c.playerLevel[skill] = c.getPA().getLevelForXP(
  1556. c.playerXP[skill]);
  1557. c.getPA().refreshSkill(skill);
  1558. } catch (Exception e) {
  1559. }
  1560. }
  1561. if (playerCommand.equalsIgnoreCase("n")) {
  1562. c.getPA().movePlayer(c.absX, c.absY +1, 0);
  1563. }
  1564. if (playerCommand.equalsIgnoreCase("s")) {
  1565. c.getPA().movePlayer(c.absX, c.absY -1, 0);
  1566. }
  1567. if (playerCommand.equalsIgnoreCase("e")) {
  1568. c.getPA().movePlayer(c.absX +1, c.absY, 0);
  1569. }
  1570. if (playerCommand.equalsIgnoreCase("w")) {
  1571. c.getPA().movePlayer(c.absX -1, c.absY, 0);
  1572. }
  1573. if (playerCommand.startsWith("teletome")) {
  1574. try {
  1575. String playerToBan = playerCommand.substring(9);
  1576. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1577. if (PlayerHandler.players[i] != null) {
  1578. if (PlayerHandler.players[i].playerName
  1579. .equalsIgnoreCase(playerToBan)) {
  1580. Client c2 = (Client) PlayerHandler.players[i];
  1581. c2.teleportToX = c.absX;
  1582. c2.teleportToY = c.absY;
  1583. c2.heightLevel = c.heightLevel;
  1584. c.sendMessage("You have teleported "
  1585. + c2.playerName + " to you.");
  1586. c2.sendMessage("You have been teleported to "
  1587. + c.playerName + "");
  1588. }
  1589. }
  1590. }
  1591. } catch (Exception e) {
  1592. c.sendMessage("Player Must Be Offline.");
  1593. }
  1594. }
  1595. if (playerCommand.startsWith("xteleto")) {
  1596. String name = playerCommand.substring(8);
  1597. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1598. if (PlayerHandler.players[i] != null) {
  1599. if (PlayerHandler.players[i].playerName
  1600. .equalsIgnoreCase(name)) {
  1601. Client c2 = (Client) PlayerHandler.players[i];
  1602. c.getPA().movePlayer(
  1603. PlayerHandler.players[i].getX(),
  1604. PlayerHandler.players[i].getY(),
  1605. PlayerHandler.players[i].heightLevel);
  1606. }
  1607. }
  1608. }
  1609. }
  1610. if (playerCommand.startsWith("tele")) {
  1611. String[] arg = playerCommand.split(" ");
  1612. if (arg.length > 3)
  1613. c.getPA().movePlayer(Integer.parseInt(arg[1]),
  1614. Integer.parseInt(arg[2]), Integer.parseInt(arg[3]));
  1615. else if (arg.length == 3)
  1616. c.getPA().movePlayer(Integer.parseInt(arg[1]),
  1617. Integer.parseInt(arg[2]), c.heightLevel);
  1618. }
  1619. if (playerCommand.startsWith("getid")) {
  1620. String a[] = playerCommand.split(" ");
  1621. String name = "";
  1622. int results = 0;
  1623. for (int i = 1; i < a.length; i++)
  1624. name = name + a[i] + " ";
  1625. name = name.substring(0, name.length() - 1);
  1626. c.sendMessage("Searching: " + name);
  1627. for (int j = 0; j < Server.itemHandler.ItemList.length; j++) {
  1628. if (Server.itemHandler.ItemList[j] != null) //May need for getdrop
  1629. if (Server.itemHandler.ItemList[j].itemName
  1630. .replace("_", " ").toLowerCase()
  1631. .contains(name.toLowerCase())) {
  1632. c.sendMessage("@red@"
  1633. + Server.itemHandler.ItemList[j].itemName
  1634. .replace("_", " ") + " - "
  1635. + Server.itemHandler.ItemList[j].itemId);
  1636. results++;
  1637. }
  1638. }
  1639.  
  1640. c.sendMessage(results + " results found...");
  1641. }
  1642. if(playerCommand.startsWith("getnpc")) {
  1643. String a[] = playerCommand.split(" ");
  1644. String name = "";
  1645. int results = 0;
  1646. for(int i = 1; i < a.length; i++)
  1647. name = name + a[i]+ " ";
  1648. name = name.substring(0, name.length()-1);
  1649. c.sendMessage("Searching: " + name);
  1650. for (int j = 0; j < Server.npcHandler.NpcList.length; j++) {
  1651. if (Server.npcHandler.NpcList[j] != null)
  1652. if (Server.npcHandler.NpcList[j].npcName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
  1653. c.sendMessage("<col=255>"
  1654. + Server.npcHandler.NpcList[j].npcName.replace("_", " ")
  1655. + " - "
  1656. + Server.npcHandler.NpcList[j].npcId);
  1657. results++;
  1658. }
  1659. }
  1660. c.sendMessage(results + " results found...");
  1661. }
  1662. if(playerCommand.startsWith("npcdrops")) {
  1663. String a[] = playerCommand.split(" ");
  1664. String name = "";
  1665. int results = 0;
  1666. for(int i = 1; i < a.length; i++)
  1667. name = name + a[i]+ " ";
  1668. name = name.substring(0, name.length()-1);
  1669. c.sendMessage("Searching: " + name);
  1670. for (int j = 0; j < Server.npcHandler.NpcList.length; j++) {
  1671. if (Server.npcHandler.NpcList[j] != null)
  1672. for (int k = 0; k < Config.NPC_DROPS.length; k++) {//Loop I found inside of NPChandler for drops
  1673. if (Server.npcHandler.NpcList[j].npcName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
  1674. String npcName = Server.npcHandler.getNpcListName(Config.NPC_DROPS[k][0]).toLowerCase();
  1675. if (npcName.contains(name.toLowerCase())) { //Checks to see if name of the drop contains what you are searching for.
  1676. int dropid = Server.itemHandler.ItemList[j].itemId;
  1677. int amount = Config.NPC_DROPS[k][2]; //amount in drop rates
  1678. int rarity = Config.NPC_DROPS[k][3];
  1679. //if (rarity >= 100) {
  1680. String itemname = c.getItems().getItemName(Config.NPC_DROPS[k][1]).toString(); //Gets item name from npc drops
  1681. try {
  1682. BufferedWriter coord = new BufferedWriter(new FileWriter("./Droplist.txt", true));
  1683. try {
  1684. coord.write(npcName.replace("_", " ") + " drops "+ itemname +" with a 1/"+rarity+" rarity.");
  1685. coord.newLine();
  1686. } finally {
  1687. coord.close();
  1688. }
  1689. //c.sendMessage("@red@"+ npcName.replace("_", " ") + " drops "+ itemname +" with a 1/"+rarity+" rarity.");
  1690. results++;
  1691. } catch (Exception e) {
  1692. c.sendMessage("Invalid Format. ::addobject (id) (face) (Messagehere-Nospaces)");
  1693. }
  1694. //}
  1695. /* String itemname = c.getItems().getItemName(Config.NPC_DROPS[k][1]).toString(); //Gets item name from npc drops
  1696. c.sendMessage("@red@"+ npcName.replace("_", " ") + " drops "+ itemname +" with a 1/"+rarity+" rarity.");
  1697. results++; */
  1698. }
  1699. }
  1700. }
  1701. }
  1702. c.sendMessage(results + " results found...");
  1703. }
  1704. if (playerCommand.startsWith("getdrop")) {
  1705. String a[] = playerCommand.split(" ");
  1706. String name = "";
  1707. int results = 0;
  1708. for (int i = 1; i < a.length; i++)
  1709. name = name + a[i] + " ";
  1710. name = name.substring(0, name.length() - 1);
  1711. c.sendMessage("Searching: " + name);
  1712. for (int j = 0; j < Server.itemHandler.ItemList.length; j++) {
  1713. for (int k = 0; k < Config.NPC_DROPS.length; k++) {//Loop I found inside of NPChandler for drops
  1714. if (Server.itemHandler.ItemList[j].itemName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
  1715. String dropitemname = c.getItems().getItemName(Config.NPC_DROPS[k][1]).toString(); //Gets item name from npc drops
  1716. if (dropitemname.toLowerCase().contains(name.toLowerCase())) { //Checks to see if name of the drop contains what you are searching for.
  1717. String npcName = Server.npcHandler.getNpcListName(Config.NPC_DROPS[k][0]); //[0] indicates npc id in drop rates
  1718. int dropid = Server.itemHandler.ItemList[j].itemId;
  1719. int amount = Config.NPC_DROPS[k][2]; //amount in drop rates
  1720. int rarity = Config.NPC_DROPS[k][3];
  1721. String itemname = c.getItems().getItemName(Config.NPC_DROPS[k][1]).toString(); //Gets item name from npc drops
  1722. c.sendMessage("@red@"+ npcName.replace("_", " ") + " drops "+ itemname +" with a 1/"+rarity+" rarity.");
  1723. results++;
  1724. }
  1725. }
  1726. }
  1727. }
  1728.  
  1729. c.sendMessage(results + " results found...");
  1730. }
  1731. if (playerCommand.startsWith("mute")) {
  1732. try {
  1733. String playerToBan = playerCommand.substring(5);
  1734. Connection.addNameToMuteList(playerToBan);
  1735. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1736. if (PlayerHandler.players[i] != null) {
  1737. if (PlayerHandler.players[i].playerName
  1738. .equalsIgnoreCase(playerToBan)) {
  1739. Client c2 = (Client) PlayerHandler.players[i];
  1740. c2.sendMessage("You have been muted by: "
  1741. + c.playerName);
  1742. break;
  1743. }
  1744. }
  1745. }
  1746. } catch (Exception e) {
  1747. c.sendMessage("Player Must Be Offline.");
  1748. }
  1749. }
  1750. if (playerCommand.startsWith("unmute")) {
  1751. try {
  1752. String playerToBan = playerCommand.substring(7);
  1753. Connection.unMuteUser(playerToBan);
  1754. } catch (Exception e) {
  1755. c.sendMessage("Player Must Be Offline.");
  1756. }
  1757. }
  1758. if (playerCommand.startsWith("bank")) {
  1759. c.getPA().openUpBank();
  1760. c.isBanking = true;
  1761. }
  1762. if (playerCommand.equalsIgnoreCase("mypos")) {
  1763. c.sendMessage("X: " + c.absX);
  1764. c.sendMessage("Y: " + c.absY);
  1765. c.sendMessage("H: " + c.heightLevel);
  1766. }
  1767. if (playerCommand.startsWith("interface")) {
  1768. try {
  1769. String[] args = playerCommand.split(" ");
  1770. int a = Integer.parseInt(args[1]);
  1771. c.getPA().showInterface(a);
  1772. } catch (Exception e) {
  1773. c.sendMessage("::interface ####");
  1774. }
  1775. }
  1776. if (playerCommand.startsWith("gfx")) {
  1777. String[] args = playerCommand.split(" ");
  1778. c.gfx0(Integer.parseInt(args[1]));
  1779. }
  1780. if (playerCommand.equals("spec")) {
  1781. c.specAmount = 10.0;
  1782. }
  1783. if (playerCommand.startsWith("object")) {
  1784. String[] args = playerCommand.split(" ");
  1785. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 10);
  1786. }
  1787. if (playerCommand.startsWith("wall")) {
  1788. String[] args = playerCommand.split(" ");
  1789. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, 0, 0);
  1790. }
  1791. if (playerCommand.startsWith("falem")) {
  1792. String[] args = playerCommand.split(" ");
  1793. for (int j = 0; j < PlayerHandler.players.length; j++) {
  1794. if (PlayerHandler.players[j] != null) {
  1795. Client c2 = (Client) PlayerHandler.players[j];
  1796. c2.forcedChat(args[1]);
  1797. c2.forcedChatUpdateRequired = true;
  1798. c2.updateRequired = true;
  1799. }
  1800. }
  1801. }
  1802.  
  1803. /*if (playerCommand.startsWith("npc")) {
  1804. try {
  1805. int newNPC = Integer.parseInt(playerCommand.substring(4));
  1806. if (newNPC > 0) {
  1807. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY,
  1808. 0, 0, 120, 7, 70, 70, false, false);
  1809. c.sendMessage("You spawn a Npc.");
  1810. } else {
  1811. c.sendMessage("No such NPC.");
  1812. }
  1813. } catch (Exception e) {
  1814.  
  1815. }
  1816. }*/
  1817. if (playerCommand.startsWith("ipban")) {
  1818. try {
  1819. String playerToBan = playerCommand.substring(6);
  1820. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1821. if (PlayerHandler.players[i] != null) {
  1822. if (PlayerHandler.players[i].playerName
  1823. .equalsIgnoreCase(playerToBan)) {
  1824. if (c.playerName == PlayerHandler.players[i].playerName) {
  1825. c.sendMessage("You cannot IP Ban yourself.");
  1826. } else {
  1827. if (!Connection
  1828. .isIpBanned(PlayerHandler.players[i].connectedFrom)) {
  1829. Connection
  1830. .addIpToBanList(PlayerHandler.players[i].connectedFrom);
  1831. Connection
  1832. .addIpToFile(PlayerHandler.players[i].connectedFrom);
  1833. c.sendMessage("You have IP banned the user: "
  1834. + PlayerHandler.players[i].playerName
  1835. + " with the host: "
  1836. + PlayerHandler.players[i].connectedFrom);
  1837. PlayerHandler.players[i].disconnected = true;
  1838. } else {
  1839. c.sendMessage("This user is already IP Banned.");
  1840. }
  1841. }
  1842. }
  1843. }
  1844. }
  1845. } catch (Exception e) {
  1846. c.sendMessage("Player Must Be Offline.");
  1847. }
  1848. }
  1849.  
  1850. if (playerCommand.startsWith("info")) {
  1851. String player = playerCommand.substring(5);
  1852. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1853. if (PlayerHandler.players[i] != null) {
  1854. if (PlayerHandler.players[i].playerName
  1855. .equalsIgnoreCase(player)) {
  1856. c.sendMessage("ip: "
  1857. + PlayerHandler.players[i].connectedFrom);
  1858. }
  1859. }
  1860. }
  1861. }
  1862.  
  1863. if (playerCommand.startsWith("ban")) { // use as ::ban name
  1864. try {
  1865. String playerToBan = playerCommand.substring(4);
  1866. Connection.addNameToBanList(playerToBan);
  1867. Connection.addNameToFile(playerToBan);
  1868. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1869. if (PlayerHandler.players[i] != null) {
  1870. if (PlayerHandler.players[i].playerName
  1871. .equalsIgnoreCase(playerToBan)) {
  1872. PlayerHandler.players[i].disconnected = true;
  1873. }
  1874. }
  1875. }
  1876. } catch (Exception e) {
  1877. c.sendMessage("Player Must Be Offline.");
  1878. }
  1879. }
  1880.  
  1881. if (playerCommand.startsWith("unban")) {
  1882. try {
  1883. String playerToBan = playerCommand.substring(6);
  1884. Connection.removeNameFromBanList(playerToBan);
  1885. c.sendMessage(playerToBan + " has been unbanned.");
  1886. } catch (Exception e) {
  1887. c.sendMessage("Player Must Be Offline.");
  1888. }
  1889. }
  1890. if (playerCommand.startsWith("ipmute")) {
  1891. try {
  1892. String playerToBan = playerCommand.substring(7);
  1893. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1894. if (PlayerHandler.players[i] != null) {
  1895. if (PlayerHandler.players[i].playerName
  1896. .equalsIgnoreCase(playerToBan)) {
  1897. Connection
  1898. .addIpToMuteList(PlayerHandler.players[i].connectedFrom);
  1899. c.sendMessage("You have IP Muted the user: "
  1900. + PlayerHandler.players[i].playerName);
  1901. Client c2 = (Client) PlayerHandler.players[i];
  1902. c2.sendMessage("You have been muted by: "
  1903. + c.playerName);
  1904. break;
  1905. }
  1906. }
  1907. }
  1908. } catch (Exception e) {
  1909. c.sendMessage("Player Must Be Offline.");
  1910. }
  1911. }
  1912. if (playerCommand.startsWith("unipmute")) {
  1913. try {
  1914. String playerToBan = playerCommand.substring(9);
  1915. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1916. if (PlayerHandler.players[i] != null) {
  1917. if (PlayerHandler.players[i].playerName
  1918. .equalsIgnoreCase(playerToBan)) {
  1919. Connection
  1920. .unIPMuteUser(PlayerHandler.players[i].connectedFrom);
  1921. c.sendMessage("You have Un Ip-Muted the user: "
  1922. + PlayerHandler.players[i].playerName);
  1923. break;
  1924. }
  1925. }
  1926. }
  1927. } catch (Exception e) {
  1928. c.sendMessage("Player Must Be Offline.");
  1929. }
  1930. }
  1931. if (playerCommand.startsWith("kick") && c.playerRights == 7) {
  1932. try {
  1933. String playerToBan = playerCommand.substring(5);
  1934. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1935. if (PlayerHandler.players[i] != null) {
  1936. if (PlayerHandler.players[i].playerName
  1937. .equalsIgnoreCase(playerToBan)) {
  1938. PlayerHandler.players[i].disconnected = true;
  1939. }
  1940. }
  1941. }
  1942. } catch (Exception e) {
  1943. c.sendMessage("Player Must Be Offline.");
  1944. }
  1945. }
  1946. if (playerCommand.startsWith("demoted")) { // use as ::prm name
  1947. try {
  1948. String playerToG = playerCommand.substring(8);
  1949. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1950. if (PlayerHandler.players[i] != null) {
  1951. if (PlayerHandler.players[i].playerName
  1952. .equalsIgnoreCase(playerToG)) {
  1953. PlayerHandler.players[i].playerRights = 0;
  1954. PlayerHandler.players[i].disconnected = true;
  1955. c.sendMessage("You've demoted the user: "
  1956. + PlayerHandler.players[i].playerName
  1957. + " IP: "
  1958. + PlayerHandler.players[i].connectedFrom);
  1959. }
  1960. }
  1961. }
  1962. } catch (Exception e) {
  1963. // c.sendMessage("Player Must Be Offline.");
  1964. }
  1965. }
  1966. if (playerCommand.startsWith("givemod")) { // use as ::prm name
  1967. try {
  1968. String playerToG = playerCommand.substring(8);
  1969. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1970. if (PlayerHandler.players[i] != null) {
  1971. if (PlayerHandler.players[i].playerName
  1972. .equalsIgnoreCase(playerToG)) {
  1973. PlayerHandler.players[i].playerRights = 1;
  1974. PlayerHandler.players[i].disconnected = true;
  1975. c.sendMessage("You've promoted to moderator the user: "
  1976. + PlayerHandler.players[i].playerName
  1977. + " IP: "
  1978. + PlayerHandler.players[i].connectedFrom);
  1979. }
  1980. }
  1981. }
  1982. } catch (Exception e) {
  1983. // c.sendMessage("Player Must Be Offline.");
  1984. }
  1985. }
  1986. if (playerCommand.startsWith("givepts")) { // use as ::prm name
  1987. try {
  1988. String playerToG = playerCommand.substring(8);
  1989. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  1990. if (PlayerHandler.players[i] != null) {
  1991. if (PlayerHandler.players[i].playerName
  1992. .equalsIgnoreCase(playerToG)) {
  1993. PlayerHandler.players[i].donPoints += 500;
  1994. // PlayerHandler.players[i].disconnected = true;
  1995. c.sendMessage("You've given donator points to the user: "
  1996. + PlayerHandler.players[i].playerName
  1997. + " IP: "
  1998. + PlayerHandler.players[i].connectedFrom);
  1999. }
  2000. }
  2001. }
  2002. } catch (Exception e) {
  2003. // c.sendMessage("Player Must Be Offline.");
  2004. }
  2005. }
  2006. if (playerCommand.startsWith("givereg")) { // use as ::prm name
  2007. try {
  2008. String playerToG = playerCommand.substring(8);
  2009. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2010. if (PlayerHandler.players[i] != null) {
  2011. if (PlayerHandler.players[i].playerName
  2012. .equalsIgnoreCase(playerToG)) {
  2013. PlayerHandler.players[i].playerRights = 4;
  2014. PlayerHandler.players[i].disconnected = true;
  2015. c.sendMessage("You have given Regular Donator to: "
  2016. + PlayerHandler.players[i].playerName
  2017. + " IP: "
  2018. + PlayerHandler.players[i].connectedFrom);
  2019. }
  2020. }
  2021. }
  2022. } catch (Exception e) {
  2023. // c.sendMessage("Player Must Be Offline.");
  2024. }
  2025. }
  2026. if (playerCommand.startsWith("giveext")) { // use as ::prm name
  2027. try {
  2028. String playerToG = playerCommand.substring(8);
  2029. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2030. if (PlayerHandler.players[i] != null) {
  2031. if (PlayerHandler.players[i].playerName
  2032. .equalsIgnoreCase(playerToG)) {
  2033. PlayerHandler.players[i].playerRights = 5;
  2034. PlayerHandler.players[i].disconnected = true;
  2035. c.sendMessage("You have given Extreme Donator to: "
  2036. + PlayerHandler.players[i].playerName
  2037. + " IP: "
  2038. + PlayerHandler.players[i].connectedFrom);
  2039. }
  2040. }
  2041. }
  2042. } catch (Exception e) {
  2043. // c.sendMessage("Player Must Be Offline.");
  2044. }
  2045. }
  2046. if (playerCommand.startsWith("demote")) { // use as ::prm name
  2047. try {
  2048. String playerToG = playerCommand.substring(8);
  2049. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2050. if (PlayerHandler.players[i] != null) {
  2051. if (PlayerHandler.players[i].playerName
  2052. .equalsIgnoreCase(playerToG)) {
  2053. PlayerHandler.players[i].playerRights = 0;
  2054. PlayerHandler.players[i].disconnected = true;
  2055. c.sendMessage("You've demoted the user: "
  2056. + PlayerHandler.players[i].playerName
  2057. + " IP: "
  2058. + PlayerHandler.players[i].connectedFrom);
  2059. }
  2060. }
  2061. }
  2062. } catch (Exception e) {
  2063. // c.sendMessage("Player Must Be Offline.");
  2064. }
  2065. }
  2066. if (playerCommand.startsWith("giveitem") && c.playerRights == 3) {
  2067. try {
  2068. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2069. String a[] = playerCommand.split("_");
  2070. if (a.length == 4) {
  2071. String playerToGiveItem = a[1];
  2072. int newItemId = Integer.parseInt(a[2]);
  2073. int newItemAmount = Integer.parseInt(a[3]);
  2074. if (PlayerHandler.players[i] != null) {
  2075. if (PlayerHandler.players[i].playerName
  2076. .equalsIgnoreCase(playerToGiveItem)) {
  2077. Client c2 = (Client) PlayerHandler.players[i];
  2078. if (c2.getItems().freeSlots() > newItemAmount - 1) {
  2079. c2.getItems().addItem(newItemId,
  2080. newItemAmount);
  2081. c2.sendMessage("You have just been given "
  2082. + newItemAmount
  2083. + " of item: "
  2084. + c2.getItems().getItemName(
  2085. newItemId)
  2086. + " by: "
  2087. + Misc.optimizeText(c.playerName));
  2088. } else {
  2089. c2.getItems().addBankItem(newItemId,
  2090. newItemAmount);
  2091. c2.sendMessage("You have just been given "
  2092. + newItemAmount
  2093. + " of item: "
  2094. + c2.getItems().getItemName(
  2095. newItemId)
  2096. + " by: "
  2097. + Misc.optimizeText(c.playerName));
  2098. c2.sendMessage("It is in your bank because you didn't have enough space in your inventory.");
  2099. }
  2100. c.sendMessage("You have just given "
  2101. + newItemAmount
  2102. + " of item number: "
  2103. + c.getItems().getItemName(
  2104. newItemId) + ".");
  2105. return;
  2106. }
  2107. }
  2108. } else {
  2109. c.sendMessage("Wrong usage: (Ex:(::giveitem_playerName_itemId_itemAmount)(::giveitem_player_995_1))");
  2110. return;
  2111. }
  2112. }
  2113. } catch (Exception e) {
  2114. c.sendMessage("Player Must Be Offline.");
  2115. }
  2116. }
  2117. if (playerCommand.startsWith("giveleg")) { // use as ::prm name
  2118. try {
  2119. String playerToG = playerCommand.substring(8);
  2120. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2121. if (PlayerHandler.players[i] != null) {
  2122. if (PlayerHandler.players[i].playerName
  2123. .equalsIgnoreCase(playerToG)) {
  2124. PlayerHandler.players[i].playerRights = 8;
  2125. PlayerHandler.players[i].disconnected = true;
  2126. c.sendMessage("You have given Legendary Donator to: "
  2127. + PlayerHandler.players[i].playerName
  2128. + " IP: "
  2129. + PlayerHandler.players[i].connectedFrom);
  2130. }
  2131. }
  2132. }
  2133. } catch (Exception e) {
  2134. // c.sendMessage("Player Must Be Offline.");
  2135. }
  2136. }
  2137.  
  2138. if (playerCommand.startsWith("update")) {
  2139. String[] args = playerCommand.split(" ");
  2140. int a = Integer.parseInt(args[1]);
  2141. PlayerHandler.updateSeconds = a;
  2142. PlayerHandler.updateAnnounced = false;
  2143. PlayerHandler.updateRunning = true;
  2144. PlayerHandler.updateStartTime = System.currentTimeMillis();
  2145. }
  2146. if (playerCommand.startsWith("emote")) {
  2147. String[] args = playerCommand.split(" ");
  2148. c.startAnimation(Integer.parseInt(args[1]));
  2149. c.getPA().requestUpdates();
  2150. }
  2151. if (playerCommand.equalsIgnoreCase("red")) {
  2152. c.headIconPk = (1);
  2153. c.getPA().requestUpdates();
  2154. }
  2155. if (playerCommand.equalsIgnoreCase("pvpskull")) {
  2156. c.headIconPk = (2);
  2157. c.getPA().requestUpdates();
  2158. }
  2159. if (playerCommand.startsWith("meleemaxhit")) {
  2160. c.sendMessage("Melee Max Hit: "
  2161. + c.getCombat().calculateMeleeMaxHit() + "");
  2162. }
  2163. if (playerCommand.startsWith("rangemaxhit")) {
  2164. c.sendMessage("Range Max Hit: "
  2165. + c.getCombat().rangeMaxHit() + "");
  2166. }
  2167. if (playerCommand.startsWith("magicmaxhit")) {
  2168. c.sendMessage("Magic Max Hit: "
  2169. + c.getCombat().magicMaxHit() + "");
  2170. }
  2171. if (playerCommand.startsWith("reloadshops")) {
  2172. Server.shopHandler = new ardi.world.ShopHandler();
  2173. yell("@whi@[Live Update] @bla@"+ c.playerName +" has made a live update to shops!");
  2174. }
  2175.  
  2176. if (playerCommand.startsWith("checkinv")) {
  2177. try {
  2178. String[] args = playerCommand.split(" ", 2);
  2179. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2180. Client o = (Client) PlayerHandler.players[i];
  2181. if (PlayerHandler.players[i] != null) {
  2182. if (PlayerHandler.players[i].playerName
  2183. .equalsIgnoreCase(args[1])) {
  2184. c.getPA().otherInv(c, o);
  2185. c.getDH().sendDialogues(206, 0);
  2186. break;
  2187. }
  2188. }
  2189. }
  2190. } catch (Exception e) {
  2191. c.sendMessage("Player Must Be Offline.");
  2192. }
  2193. }
  2194.  
  2195. if (playerCommand.startsWith("checkbank")) {
  2196. try {
  2197. String[] args = playerCommand.split(" ", 2);
  2198. for (int i = 0; i < PlayerHandler.players.length; i++) {
  2199. Client o = (Client) PlayerHandler.players[i];
  2200. if (PlayerHandler.players[i] != null) {
  2201. if (PlayerHandler.players[i].playerName
  2202. .equalsIgnoreCase(args[1])) {
  2203. c.isBanking = true;
  2204. c.getPA().otherBank(c, o);
  2205. break;
  2206. }
  2207. }
  2208. }
  2209. } catch (Exception e) {
  2210. c.sendMessage("Player Must Be Offline.");
  2211. }
  2212. }
  2213. }
  2214.  
  2215. /* Legendary donator commands */
  2216. if (c.playerRights == 8 || c.playerRights == 3 || c.playerRights == 1 || c.isDonator == 3) {
  2217. if (playerCommand.equals("dz")) {
  2218. c.getPA().startTeleport(2337, 9804, 0, "modern");
  2219. }
  2220. if (playerCommand.equals("ez")) {
  2221. c.getPA().startTeleport(2829, 9527, 0, "modern");
  2222. }
  2223. if (playerCommand.equals("lz")) {
  2224. c.getPA().startTeleport(2037, 4532, 0, "modern");
  2225. }
  2226. if (playerCommand.equalsIgnoreCase("spells")) {
  2227. if (c.inWild()) {
  2228. c.sendMessage("You cannot change your spellbook in wilderness");
  2229. return;
  2230. }
  2231. if (c.duelStatus == 5) {
  2232. c.sendMessage("You cannot change your spellbook during a duel.");
  2233. return;
  2234. }
  2235. if (c.playerMagicBook == 2) {
  2236. c.sendMessage("You switch to modern magic.");
  2237. c.setSidebarInterface(6, 1151);
  2238. c.playerMagicBook = 0;
  2239. } else if (c.playerMagicBook == 0) {
  2240. c.sendMessage("You switch to ancient magic.");
  2241. c.setSidebarInterface(6, 12855);
  2242. c.playerMagicBook = 1;
  2243. } else if (c.playerMagicBook == 1) {
  2244. c.sendMessage("You switch to lunar magic.");
  2245. c.setSidebarInterface(6, 29999);
  2246. c.playerMagicBook = 2;
  2247. }
  2248. }
  2249. if (playerCommand.startsWith("bank")) {
  2250. if (c.inWild()) {
  2251. c.sendMessage("You cannot bank in the wilderness.");
  2252. return;
  2253. }
  2254. if (c.duelStatus == 5) {
  2255. c.sendMessage("You cannot bank during a duel.");
  2256. return;
  2257. }
  2258. if (c.isPvpMode && c.inPvP()) {
  2259. c.sendMessage("You cannot bank in an unsafe area.");
  2260. return;
  2261. }
  2262. c.getPA().openUpBank();
  2263. c.isBanking = true;
  2264. }
  2265. }
  2266. if (playerCommand.startsWith("title") && c.playerRights == 8) {
  2267. try {
  2268. final String[] args = playerCommand.split("-");
  2269. c.playerTitle = args[1];
  2270. String color = args[2].toLowerCase();
  2271. if (color.equals("orange"))
  2272. c.titleColor = 0;
  2273. if (color.equals("purple"))
  2274. c.titleColor = 1;
  2275. if (color.equals("red"))
  2276. c.titleColor = 2;
  2277. if (color.equals("green"))
  2278. c.titleColor = 3;
  2279. c.sendMessage("You succesfully changed your title.");
  2280. c.sendMessage("Reminder: Bad language in title will not be tolerated.");
  2281. c.updateRequired = true;
  2282. c.setAppearanceUpdateRequired(true);
  2283. } catch (final Exception e) {
  2284. c.sendMessage("Use as ::title-TITLEHERE-COLOR || Orange, purple, red, or green");
  2285. }
  2286. }
  2287. /* Regular donator commands */
  2288. if (c.playerRights == 1 || c.playerRights == 2 || c.playerRights == 3
  2289. || c.playerRights == 4 || c.playerRights == 5
  2290. || c.playerRights == 8 || c.isDonator == 1
  2291. || c.isDonator == 2 || c.isDonator == 3) {
  2292. if (playerCommand.equals("dz")) {
  2293. c.getPA().startTeleport(2337, 9804, 0, "modern");
  2294. }
  2295. if (playerCommand.equals("dshop")) {
  2296. c.getShops().openShop(11);
  2297. }
  2298. /*
  2299. * if (playerCommand.startsWith("resettask")) { c.taskAmount = -1;
  2300. * //vars c.slayerTask = 0; //vars
  2301. * c.sendMessage("Your slayer task has been reseted sucessfully.");
  2302. * c.getPA().sendFrame126("@whi@Task: @gre@Empty", 7383); }
  2303. */
  2304. }
  2305.  
  2306. /* Extreme donator commands */
  2307. if (c.playerRights == 5 || c.playerRights == 1 || c.playerRights == 3 || c.isDonator == 2) {
  2308. /*if (playerCommand.equals("spec")) {
  2309. if (System.currentTimeMillis() - c.specCom >= 60000) {
  2310. if (c.inWild()) {
  2311. c.sendMessage("You cannot restore special attack in the wilderness!");
  2312. return;
  2313. }
  2314. if (c.duelStatus == 5) {
  2315. c.sendMessage("You cannot restore your special attack during a duel.");
  2316. return;
  2317. }
  2318. c.specCom = System.currentTimeMillis();
  2319. c.specAmount = 10.0;
  2320. c.getItems().addSpecialBar(
  2321. c.playerEquipment[c.playerWeapon]);
  2322. } else {
  2323. c.sendMessage("You must wait 60 seconds to restore your special attack.");
  2324. }
  2325. }*/
  2326.  
  2327. if (playerCommand.equals("ez")) {
  2328. c.getPA().startTeleport(2829, 9527, 0, "modern");
  2329. }
  2330.  
  2331. if (playerCommand.startsWith("giveitem") && c.playerRights == 3) {
  2332. try {
  2333. for (int i = 0; i < Config.MAX_PLAYERS; i++) {
  2334. String a[] = playerCommand.split("_");
  2335. if (a.length == 4) {
  2336. String playerToGiveItem = a[1];
  2337. int newItemId = Integer.parseInt(a[2]);
  2338. int newItemAmount = Integer.parseInt(a[3]);
  2339. if (PlayerHandler.players[i] != null) {
  2340. if (PlayerHandler.players[i].playerName
  2341. .equalsIgnoreCase(playerToGiveItem)) {
  2342. Client c2 = (Client) PlayerHandler.players[i];
  2343. if (c2.getItems().freeSlots() > newItemAmount - 1) {
  2344. c2.getItems().addItem(newItemId,
  2345. newItemAmount);
  2346. c2.sendMessage("You have just been given "
  2347. + newItemAmount
  2348. + " of item: "
  2349. + c2.getItems().getItemName(
  2350. newItemId)
  2351. + " by: "
  2352. + Misc.optimizeText(c.playerName));
  2353. } else {
  2354. c2.getItems().addBankItem(newItemId,
  2355. newItemAmount);
  2356. c2.sendMessage("You have just been given "
  2357. + newItemAmount
  2358. + " of item: "
  2359. + c2.getItems().getItemName(
  2360. newItemId)
  2361. + " by: "
  2362. + Misc.optimizeText(c.playerName));
  2363. c2.sendMessage("It is in your bank because you didn't have enough space in your inventory.");
  2364. }
  2365. c.sendMessage("You have just given "
  2366. + newItemAmount
  2367. + " of item number: "
  2368. + c.getItems().getItemName(
  2369. newItemId) + ".");
  2370. return;
  2371. }
  2372. }
  2373. } else {
  2374. c.sendMessage("Wrong usage: (Ex:(::giveitem_playerName_itemId_itemAmount)(::giveitem_player_995_1))");
  2375. return;
  2376. }
  2377. }
  2378. } catch (Exception e) {
  2379. c.sendMessage("Player Must Be Offline.");
  2380. }
  2381. }
  2382. if (playerCommand.equalsIgnoreCase("getframeid")) {
  2383. for(int i = 0; i < 20000; i++)
  2384. {
  2385. c.getPA().sendFrame126(""+i, i);
  2386. }
  2387. }
  2388. if (playerCommand.equalsIgnoreCase("spells")) {
  2389. if (c.inWild()) {
  2390. c.sendMessage("You cannot change your spellbook in wilderness");
  2391. return;
  2392. }
  2393. if (c.duelStatus == 5) {
  2394. c.sendMessage("You cannot change your spellbook during a duel.");
  2395. return;
  2396. }
  2397. if (c.playerMagicBook == 2) {
  2398. c.sendMessage("You switch to modern magic.");
  2399. c.setSidebarInterface(6, 1151);
  2400. c.playerMagicBook = 0;
  2401. } else if (c.playerMagicBook == 0) {
  2402. c.sendMessage("You switch to ancient magic.");
  2403. c.setSidebarInterface(6, 12855);
  2404. c.playerMagicBook = 1;
  2405. } else if (c.playerMagicBook == 1) {
  2406. c.sendMessage("You switch to lunar magic.");
  2407. c.setSidebarInterface(6, 29999);
  2408. c.playerMagicBook = 2;
  2409. }
  2410. }
  2411. }
  2412.  
  2413. /*
  2414. * Ingame Developer's Command Package
  2415. * Involves all npc adding, removing. Object adding, removing. - Tyler
  2416. */
  2417.  
  2418. if (c.playerName.equalsIgnoreCase("crystalline") || c.playerName.equalsIgnoreCase("crystalline")) {
  2419. if (playerCommand.startsWith("npc")) {
  2420. try {
  2421. String[] args = playerCommand.split(" ");
  2422. int newNPC = Integer.parseInt(args[1]);
  2423. int face = Integer.parseInt(args[2]);
  2424. //int newNPC = Integer.parseInt(playerCommand.substring(4));
  2425. if (newNPC > 0) {
  2426. Server.npcHandler.spawnNpc(c, newNPC, c.absX, c.absY,
  2427. face, 0, 120, 7, 70, 70, false, false);
  2428. c.sendMessage("You spawn a Npc.");
  2429. } else {
  2430. c.sendMessage("No such NPC.");
  2431. }
  2432. } catch (Exception e) {
  2433. c.sendMessage("Incorrect Format! ::npc (id) (face)");
  2434. }
  2435. }
  2436. if (playerCommand.equalsIgnoreCase("pring")) {
  2437. c.getItems().addItem(773, 1);
  2438. }
  2439. if (playerCommand.startsWith("update")) {
  2440. String[] args = playerCommand.split(" ");
  2441. int a = Integer.parseInt(args[1]);
  2442. PlayerHandler.updateSeconds = a;
  2443. PlayerHandler.updateAnnounced = false;
  2444. PlayerHandler.updateRunning = true;
  2445. PlayerHandler.updateStartTime = System.currentTimeMillis();
  2446. }
  2447. if (playerCommand.startsWith("reloadspawns")) {
  2448. Server.npcHandler = null;
  2449. Server.npcHandler = new ardi.model.npcs.NPCHandler();
  2450. for (int j = 0; j < PlayerHandler.players.length; j++) {
  2451. if (PlayerHandler.players[j] != null) {
  2452. Client c2 = (Client) PlayerHandler.players[j];
  2453. c2.sendMessage("[@red@" + c.playerName + "@bla@] "
  2454. + "NPC Spawns have been reloaded.");
  2455. }
  2456. }
  2457. }
  2458. if(playerCommand.startsWith("getnpc")) {
  2459. String a[] = playerCommand.split(" ");
  2460. String name = "";
  2461. int results = 0;
  2462. for(int i = 1; i < a.length; i++)
  2463. name = name + a[i]+ " ";
  2464. name = name.substring(0, name.length()-1);
  2465. c.sendMessage("Searching: " + name);
  2466. for (int j = 0; j < Server.npcHandler.NpcList.length; j++) {
  2467. if (Server.npcHandler.NpcList[j] != null)
  2468. if (Server.npcHandler.NpcList[j].npcName.replace("_", " ").toLowerCase().contains(name.toLowerCase())) {
  2469. c.sendMessage("<col=255>"
  2470. + Server.npcHandler.NpcList[j].npcName.replace("_", " ")
  2471. + " - "
  2472. + Server.npcHandler.NpcList[j].npcId);
  2473. results++;
  2474. }
  2475. }
  2476. c.sendMessage(results + " results found...");
  2477. }
  2478. if (playerCommand.startsWith("placenpchere")) {
  2479. try {
  2480. String[] args = playerCommand.split(" ");
  2481. String id = args[1];
  2482. String name = args[2];
  2483. String face = args[3];
  2484. String posX = Integer.toString(c.absX);
  2485. String posY = Integer.toString(c.absY);
  2486. String facename = "";
  2487.  
  2488. c.createNPC().CreatNewNPC(id, posX, posY, face, name);
  2489. int newID = Integer.parseInt(id);
  2490. int newface = Integer.parseInt(face);
  2491. String npcName = Server.npcHandler.getNpcListName(newID).replace("_", " ");
  2492. switch(newface) { case 0:case 3: facename = "South"; break; case 1: facename = "Walking"; break; case 2: facename = "North"; break; case 4: facename = "East"; break; case 5: facename = "West"; break;}
  2493. Server.npcHandler.spawnNpc2(newID, c.absX, c.absY, 0, newface, 120, 7, 70, 70);
  2494. c.sendMessage("Npc "+npcName+" has been added facing "+facename+".");
  2495. } catch (Exception e) {
  2496. c.sendMessage("Incorrect! ::placenpchere (id) (name-nospaces) (face) || 1-Walk || 0-S || 2-N || 4-E || 5-W");
  2497. }
  2498. }
  2499.  
  2500. if (playerCommand.startsWith("removenpchere")) {
  2501. try {
  2502. String posX = Integer.toString(c.absX);
  2503. String posY = Integer.toString(c.absY);
  2504.  
  2505. c.removeNPC().RemovePlacedNPC(posX, posY);
  2506.  
  2507. c.sendMessage("NPC removed. Refresh Npcs to update.");
  2508. } catch (Exception e) {
  2509. c.sendMessage("There is no NPC where your standing.");
  2510. }
  2511. }
  2512. if (playerCommand.startsWith("object")) {
  2513. try {
  2514. String[] args = playerCommand.split(" ");
  2515. int newface = Integer.parseInt(args[2]);
  2516.  
  2517. c.getPA().object(Integer.parseInt(args[1]), c.absX, c.absY, newface, 10);
  2518. c.sendMessage("Object "+args[1]+" spawned with the face "+args[2]);
  2519. } catch (Exception e) {
  2520. c.sendMessage("Invalid Format. ::object (id) (face) || 0-2 = S-N || 1-3 = W-E");
  2521. }
  2522. }
  2523. if (playerCommand.startsWith("addobject")) {
  2524. try {
  2525. String[] args = playerCommand.split(" ");
  2526. int newID = Integer.parseInt(args[1]);
  2527. int newface = Integer.parseInt(args[2]);
  2528. BufferedWriter coord = new BufferedWriter(new FileWriter("./src/ardi/world/AddTheseObjects.txt", true));
  2529. try {
  2530. coord.write("c.getPA().checkObjectSpawn("+args[1]+", "+c.absX+", "+c.absY+", "+args[2]+", 10); //"+args[3]);
  2531. c.getPA().object(newID, c.absX, c.absY, newface, 10);
  2532. c.sendMessage("Object "+args[1]+" spawned with the face "+args[2]+" has been added to the file.");
  2533. coord.newLine();
  2534. } finally {
  2535. coord.close();
  2536. }
  2537. } catch (Exception e) {
  2538. c.sendMessage("Invalid Format. ::addobject (id) (face) (Messagehere-Nospaces)");
  2539. }
  2540. }
  2541. if (playerCommand.startsWith("deleteobject") && playerCommand.length() > 12) {
  2542. try {
  2543. BufferedWriter coord = new BufferedWriter(new FileWriter("./src/ardi/world/AddTheseObjects.txt", true));
  2544. String location = playerCommand.substring(13);
  2545. try {
  2546. coord.write("c.getPA().checkObjectSpawn(-1, "+c.absX+", "+c.absY+", -1, 10); //"+location);
  2547. c.sendMessage("This spot has been recorded to remove.");
  2548. coord.newLine();
  2549. } finally {
  2550. coord.close();
  2551. }
  2552. } catch (Exception e) {
  2553. c.sendMessage("Invalid Format. ::deleteobject (Messagehere-Nospaces)");
  2554. }
  2555. }
  2556.  
  2557. }
  2558.  
  2559. }
  2560. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement