Advertisement
Guest User

ShopAssistant.Java

a guest
Sep 10th, 2013
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.41 KB | None | 0 0
  1. package server.model.shops;
  2.  
  3. import server.Config;
  4. import server.Server;
  5. import server.model.items.Item;
  6. import server.model.players.Client;
  7.  
  8. public class ShopAssistant {
  9.  
  10. private Client c;
  11.  
  12. public ShopAssistant(Client client) {
  13. this.c = client;
  14. }
  15.  
  16. /**
  17. *Shops
  18. **/
  19.  
  20. public void openShop(int ShopID){
  21. c.getItems().resetItems(3823);
  22. resetShop(ShopID);
  23. c.isShopping = true;
  24. c.myShopId = ShopID;
  25. c.getPA().sendFrame248(3824, 3822);
  26. c.getPA().sendFrame126(Server.shopHandler.ShopName[ShopID], 3901);
  27. }
  28.  
  29. public boolean shopSellsItem(int itemID) {
  30. for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) {
  31. if(itemID == (Server.shopHandler.ShopItems[c.myShopId][i] - 1)) {
  32. return true;
  33. }
  34. }
  35. return false;
  36. }
  37.  
  38. public void updatePlayerShop() {
  39. for (int i = 1; i < Config.MAX_PLAYERS; i++) {
  40. if (Server.playerHandler.players[i] != null) {
  41. if (Server.playerHandler.players[i].isShopping == true && Server.playerHandler.players[i].myShopId == c.myShopId && i != c.playerId) {
  42. Server.playerHandler.players[i].updateShop = true;
  43. }
  44. }
  45. }
  46. }
  47.  
  48.  
  49. public void updateshop(int i){
  50. resetShop(i);
  51. }
  52.  
  53. public void resetShop(int ShopID) {
  54. synchronized(c) {
  55. int TotalItems = 0;
  56. for (int i = 0; i < Server.shopHandler.MaxShopItems; i++) {
  57. if (Server.shopHandler.ShopItems[ShopID][i] > 0) {
  58. TotalItems++;
  59. }
  60. }
  61. if (TotalItems > Server.shopHandler.MaxShopItems) {
  62. TotalItems = Server.shopHandler.MaxShopItems;
  63. }
  64. c.getOutStream().createFrameVarSizeWord(53);
  65. c.getOutStream().writeWord(3900);
  66. c.getOutStream().writeWord(TotalItems);
  67. int TotalCount = 0;
  68. for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) {
  69. if (Server.shopHandler.ShopItems[ShopID][i] > 0 || i <= Server.shopHandler.ShopItemsStandard[ShopID]) {
  70. if (Server.shopHandler.ShopItemsN[ShopID][i] > 254) {
  71. c.getOutStream().writeByte(255);
  72. c.getOutStream().writeDWord_v2(Server.shopHandler.ShopItemsN[ShopID][i]);
  73. } else {
  74. c.getOutStream().writeByte(Server.shopHandler.ShopItemsN[ShopID][i]);
  75. }
  76. if (Server.shopHandler.ShopItems[ShopID][i] > Config.ITEM_LIMIT || Server.shopHandler.ShopItems[ShopID][i] < 0) {
  77. Server.shopHandler.ShopItems[ShopID][i] = Config.ITEM_LIMIT;
  78. }
  79. c.getOutStream().writeWordBigEndianA(Server.shopHandler.ShopItems[ShopID][i]);
  80. TotalCount++;
  81. }
  82. if (TotalCount > TotalItems) {
  83. break;
  84. }
  85. }
  86. c.getOutStream().endFrameVarSizeWord();
  87. c.flushOutStream();
  88. }
  89. }
  90.  
  91.  
  92. public double getItemShopValue(int ItemID, int Type, int fromSlot) {
  93. if(c.myShopId == 7390){
  94. return c.myShopClient.playerShopP[fromSlot];
  95. }
  96. double ShopValue = 1;
  97. double Overstock = 0;
  98. double TotPrice = 0;
  99. for (int i = 0; i < Config.ITEM_LIMIT; i++) {
  100. if (Server.itemHandler.ItemList[i] != null) {
  101. if (Server.itemHandler.ItemList[i].itemId == ItemID) {
  102. ShopValue = Server.itemHandler.ItemList[i].ShopValue;
  103. }
  104. }
  105. }
  106.  
  107. TotPrice = ShopValue;
  108.  
  109. if (Server.shopHandler.ShopBModifier[c.myShopId] == 1) {
  110. TotPrice *= 1;
  111. TotPrice *= 1;
  112. if (Type == 1) {
  113. TotPrice *= 1;
  114. }
  115. } else if (Type == 1) {
  116. TotPrice *= 1;
  117. }
  118. return TotPrice;
  119. }
  120.  
  121. public void openPlayerShop(Client o){
  122. if(o == null || o.properLogout)
  123. return;
  124. c.getItems().resetItems(3823);
  125. resetShop(o);
  126. c.myShopClient = o;
  127. c.myShopId = 7390;
  128. c.isShopping = true;
  129. c.getPA().sendFrame248(3824, 3822);
  130. c.getPA().sendFrame126(o.playerName+"'s Shop!", 3901);
  131. }
  132. public int[] fixArray(int[] array){
  133. int arrayPos = 0;
  134. int[] newArray = new int[array.length];
  135. for(int x = 0; x < array.length; x++){
  136. if(array[x] != 0){
  137. newArray[arrayPos] = array[x];
  138. arrayPos++;
  139. }
  140. }
  141. return newArray;
  142. }
  143.  
  144. public void fixShop(Client o){
  145. o.playerShop = fixArray(o.playerShop);
  146. o.playerShopN = fixArray(o.playerShopN);
  147. o.playerShopP = fixArray(o.playerShopP);
  148. }
  149.  
  150. public void resetShop(Client o) {
  151. synchronized(c) {
  152. fixShop(o);
  153. for (int x = 0; x < 10; x++) {
  154. if (o.playerShopN[x] <= 0) {
  155. o.playerShop[x] = 0;
  156. }
  157. }
  158. int TotalItems = 0;
  159. for (int i = 0; i < 10; i++) {
  160. if (o.playerShop[i] > 0) {
  161. TotalItems++;
  162. }
  163. }
  164. if (TotalItems > 10) {
  165. TotalItems = 10;
  166. }
  167. c.getOutStream().createFrameVarSizeWord(53);
  168. c.getOutStream().writeWord(3900);
  169. c.getOutStream().writeWord(TotalItems);
  170. int TotalCount = 0;
  171. for (int i = 0; i < o.playerShop.length; i++) {
  172. if (o.playerShop[i] > 0) {
  173. if (o.playerShopN[i] > 254) {
  174. c.getOutStream().writeByte(255);
  175. c.getOutStream().writeDWord_v2(o.playerShopN[i]);
  176. } else {
  177. c.getOutStream().writeByte(o.playerShopN[i]);
  178. }
  179. c.getOutStream().writeWordBigEndianA((o.playerShop[i]+1));
  180. TotalCount++;
  181. }
  182. if (TotalCount > TotalItems) {
  183. break;
  184. }
  185. }
  186. c.getOutStream().endFrameVarSizeWord();
  187. c.flushOutStream();
  188. }
  189. }
  190.  
  191. public int getItemShopValue(int itemId) {
  192. for (int i = 0; i < Config.ITEM_LIMIT; i++) {
  193. if (Server.itemHandler.ItemList[i] != null) {
  194. if (Server.itemHandler.ItemList[i].itemId == itemId) {
  195. return (int)Server.itemHandler.ItemList[i].ShopValue;
  196. }
  197. }
  198. }
  199. return 0;
  200. }
  201.  
  202.  
  203.  
  204. /**
  205. *buy item from shop (Shop Price)
  206. **/
  207.  
  208. public void buyFromShopPrice(int removeId, int removeSlot){
  209. int ShopValue = (int)Math.floor(getItemShopValue(removeId, 0, removeSlot));
  210. ShopValue *= 1;
  211. String ShopAdd = "";
  212. if (c.myShopId == 88) {
  213. c.sendMessage("This item current costs " + getPrestigeItemValue(removeId) + " Prestige Points.");
  214. return;
  215. }
  216. if (c.myShopId == 7390 && c.myShopClient != null && !c.myShopClient.playerName.equals(c.playerName)) {
  217. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + c.myShopClient.playerShopP[removeSlot] + " coins.");
  218. return;
  219. }else if (c.myShopId == 7390 && c.myShopClient != null && c.myShopClient.playerName.equals(c.playerName)) {
  220. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + c.playerShopP[removeSlot] + " coins.");
  221. return;
  222. }
  223. if (c.myShopId == 54) {
  224. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Vote Points");
  225. return;
  226. }
  227. if (c.myShopId == 200) {
  228. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " 2B Points");
  229. return;
  230. }
  231. if (c.myShopId == 20) {
  232. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Rune-X-Scape Points!");
  233. return;
  234. }
  235. if (c.myShopId == 18) {
  236. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Rune-X-Scape Points!");
  237. return;
  238. }
  239. if (c.myShopId == 84) {
  240. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Dungeoneering Tokens.");
  241. return;
  242. }
  243. if (c.myShopId == 16) {
  244. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Agility Points.");
  245. return;
  246. }
  247. if (c.myShopId == 43) {
  248. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Dominion Tower Points.");
  249. return;
  250. }
  251. if (c.myShopId == 100) {
  252. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Assault Points.");
  253. return;
  254. }
  255. if (c.myShopId == 85) {
  256. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " Dungeoneering Tokens.");
  257. return;
  258. }
  259. if (c.myShopId == 17) {
  260. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs " + getSpecialItemValue(removeId) + " mage Points.");
  261. return;
  262. }
  263. if (c.myShopId == 15) {
  264. c.sendMessage("This item current costs " + c.getItems().getUntradePrice(removeId) + " coins.");
  265. return;
  266. }
  267. if (ShopValue >= 1000 && ShopValue < 1000000) {
  268. ShopAdd = " (" + (ShopValue / 1000) + "K)";
  269. } else if (ShopValue >= 1000000) {
  270. ShopAdd = " (" + (ShopValue / 1000000) + " million)";
  271. }
  272. c.sendMessage(c.getItems().getItemName(removeId)+": currently costs "+ShopValue+" coins"+ShopAdd);
  273. }
  274. public int getPrestigeItemValue(int id) {
  275. switch (id) {
  276. case 11696:
  277. case 11698:
  278. case 11700:
  279. return 2600;
  280.  
  281. case 11938:
  282. return 1000;
  283.  
  284. case 18778:
  285. return 600;
  286.  
  287. case 19311:
  288. return 1100;
  289.  
  290. case 19335:
  291. case 20072:
  292. return 900;
  293.  
  294. case 9470:
  295. case 9472:
  296. return 400;
  297.  
  298. case 13362:
  299. case 13358:
  300. case 13360:
  301. return 3000;
  302.  
  303. case 2572:
  304. case 6583:
  305. case 7927:
  306. return 250;
  307.  
  308. case 13738:
  309. case 13740:
  310. case 13742:
  311. case 13744:
  312. return 2000;
  313.  
  314. case 16711:
  315. case 17259:
  316. case 16689:
  317. case 16667:
  318. case 17361:
  319. case 16955:
  320. case 16403:
  321. case 16909:
  322. case 15773:
  323. return 3000;
  324.  
  325. case 18338:
  326. return 1000;
  327.  
  328. case 11858:
  329. case 11860:
  330. case 11862:
  331. return 6000;
  332.  
  333.  
  334. case 11846:
  335. case 11848:
  336. case 11850:
  337. case 11852:
  338. case 11854:
  339. case 11856:
  340. return 700;
  341.  
  342. case 5698:
  343. case 5699:
  344. return 100;
  345. case 15441:
  346. case 15442:
  347. case 15443:
  348. case 15444:
  349. return 500;
  350.  
  351. case 14484:
  352. return 4200;
  353.  
  354.  
  355. case 4151:
  356. return 500;
  357.  
  358. case 2441:
  359. case 2435:
  360. case 2429:
  361. return 25;
  362.  
  363. case 19336:
  364. case 19337:
  365. case 19338:
  366. case 19339:
  367. case 19340:
  368. return 500;
  369.  
  370. case 6731:
  371. case 6733:
  372. case 6735:
  373. case 6737:
  374. return 350;
  375.  
  376. }
  377. return 0;
  378. }
  379.  
  380. public int getSpecialItemValue(int id) {
  381. switch (id) {
  382. //Dominion minigame shop prices
  383. case 18349:
  384. return 2000;
  385. case 18353:
  386. return 2000;
  387. case 18351:
  388. return 2000;
  389. case 18355:
  390. return 2000;
  391. case 18357:
  392. return 2000;
  393. case 18359:
  394. return 2000;
  395. case 18365:
  396. return 1000;
  397. case 18367:
  398. return 1000;
  399. //Vote Point Shop
  400. case 13362:
  401. return 40;
  402. case 13358:
  403. return 60;
  404. case 15441:
  405. case 15442:
  406. case 15443:
  407. case 15444:
  408. return 500;
  409. case 13360:
  410. return 70;
  411. case 14001:
  412. return 30;
  413. case 4566:
  414. return 2;
  415. case 14002:
  416. return 40;
  417. case 10550: // range hat
  418. return 65;
  419. case 10548: // fight hat
  420. return 65;
  421. case 10551: // torso
  422. return 75;
  423. case 11730: // sara sword
  424. return 75;
  425. case 1897: // chocolate cake XD hack3rtest
  426. return 75;
  427.  
  428. case 13344: // ancient blah blah helm
  429. return 135;
  430. case 13342:
  431. return 200;
  432. case 13340:
  433. return 150;
  434.  
  435. case 10552: // torso
  436. return 75;
  437.  
  438.  
  439. //END OF ASSAULT
  440.  
  441. case 1767:
  442. case 1765:
  443. case 1771:
  444. case 5559:
  445. return 30;
  446. case 15486:
  447. return 250;
  448. case 6889:
  449. return 45;
  450. case 6916:
  451. case 6918:
  452. case 6920:
  453. case 6922:
  454. case 6924:
  455. return 70;
  456. case 19790:
  457. return 140;
  458. case 11663:
  459. case 11664:
  460. case 11665:
  461. case 8842:
  462. return 40;
  463. case 17020:
  464. return 70;
  465. case 17004:
  466. case 17003:
  467. case 17005:
  468. case 17002:
  469. return 50;
  470. case 15308:
  471. case 15312:
  472. case 15316:
  473. case 15320:
  474. case 15324:
  475. return 4;
  476. case 11696:
  477. case 11698:
  478. case 11700:
  479. return 600;
  480. case 11694:
  481. return 800;
  482. case 10499:
  483. return 30;
  484. case 13887:
  485. case 13893:
  486. return 580;
  487. case 18017:
  488. case 18018:
  489. case 18019:
  490. case 18020:
  491. return 3;
  492. case 14508:
  493. return 250;
  494. case 8845:
  495. return 10;
  496. case 8846:
  497. return 10;
  498. case 8847:
  499. return 15;
  500. case 8848:
  501. return 20;
  502. case 8849:
  503. case 8850:
  504. return 25;
  505. case 6570:
  506. return 75;
  507. case 10887:
  508. return 250;
  509. case 11851:
  510. case 12210:
  511. case 12213:
  512. case 12216:
  513. case 12219:
  514. case 12222:
  515. return 100;
  516. case 11724:
  517. return 1200;
  518. case 11728:
  519. return 250;
  520. case 11720:
  521. return 1000;
  522. case 11722:
  523. return 900;
  524. case 11726:
  525. return 1100;
  526. case 15126:
  527. return 200;
  528. case 13263:
  529. return 200;
  530. case 18335:
  531. return 700;
  532. case 19780:
  533. return 1000;
  534. case 6585:
  535. return 15;
  536. case 16713:
  537. return 400;
  538. case 15017:
  539. case 15018:
  540. return 850;
  541. case 13870:
  542. case 13873:
  543. return 300;
  544. case 13876:
  545. return 250;
  546. case 15055:
  547. return 5;
  548. case 15031:
  549. return 600;
  550. case 15007:
  551. case 15006:
  552. return 700;
  553. case 15005:
  554. case 15004:
  555. return 850;
  556. case 15003:
  557. case 15002:
  558. case 15001:
  559. case 15000:
  560. return 300;
  561. case 16689:
  562. return 1000;
  563. case 17259:
  564. return 1000;
  565. case 17361:
  566. return 1000;
  567. case 16711:
  568. return 900;
  569. case 11821:
  570. return 1000;
  571. case 11822:
  572. return 1000;
  573. case 11820:
  574. return 800;
  575. case 15022:
  576. case 15026:
  577. return 750;
  578. case 15021:
  579. case 15023:
  580. return 850;
  581. case 13350:
  582. return 2200;
  583. case 15332:
  584. return 7;
  585. case 15220:
  586. return 150;
  587. case 13351:
  588. return 2200;
  589. case 15025:
  590. return 230;
  591. case 15024:
  592. return 170;
  593. case 15043:
  594. case 15042:
  595. return 790;
  596. case 15041:
  597. case 15040:
  598. return 650;
  599. case 15051:
  600. return 500;
  601. case 15050:
  602. return 700;
  603. case 19785:
  604. return 160;
  605. case 19786:
  606. return 140;
  607. case 13858:
  608. case 13861:
  609. return 300;
  610. case 1555:
  611. case 7584:
  612. case 1556:
  613. case 1557:
  614. case 1558:
  615. return 150;
  616. case 13738:
  617. case 13742:
  618. case 13744:
  619. return 500;
  620. case 13740:
  621. return 650;
  622. case 13890:
  623. case 13884:
  624. return 400;
  625. case 13899:
  626. return 600;
  627. case 13896:
  628. return 350;
  629. case 13902:
  630. return 550;
  631. case 15505:
  632. return 45;
  633. case 15507:
  634. return 45;
  635. case 15509:
  636. case 15511:
  637. return 35;
  638. case 15073:
  639. return 55;
  640. case 15074:
  641. return 55;
  642. case 17025:
  643. return 35;
  644. case 17018:
  645. return 90;
  646. case 17019:
  647. return 80;
  648. case 19784:
  649. return 1000;
  650. case 15054:
  651. return 200;
  652. case 1038:
  653. case 1040:
  654. return 50;
  655. case 1050:
  656. return 50;
  657. case 3801:
  658. return 200;
  659. case 3803:
  660. return 300;
  661. case 3805:
  662. return 500;
  663. case 3789:
  664. return 70;
  665. case 3791:
  666. return 60;
  667. case 3793:
  668. return 90;
  669. case 3795:
  670. return 80;
  671. case 1057:
  672. return 30;
  673. case 17271:
  674. return 150;
  675. case 14936:
  676. return 300;
  677. case 14938:
  678. return 250;
  679. case 15090:
  680. case 15091:
  681. case 15092:
  682. case 15093:
  683. case 15094:
  684. case 15095:
  685. case 15096:
  686. case 15097:
  687. case 15098:
  688. return 350;
  689. case 15085:
  690. return 1300;
  691. case 15081:
  692. return 1150;
  693. case 15080:
  694. return 1150;
  695. case 15083:
  696. return 600;
  697. case 13352:
  698. case 13353:
  699. case 13354:
  700. return 700;
  701. // START OF AGILITY STORE
  702. case 10400: // ELEGANT TOP
  703. case 10432: // green
  704. case 10428:
  705. case 10404:
  706. return 300;
  707. case 10402: // ELEGANT SKIRT
  708. case 10430: // blue skirt
  709. case 10434:
  710. case 10406:
  711. return 250;
  712. case 10766: // BLACK BOATER
  713. case 10764: // blue boater
  714. case 10758: // redboater
  715. case 10762: // green boater
  716. return 220;
  717. case 13661: // adze
  718. return 600; // adze
  719. case 16222:
  720. return 1100;
  721. case 14497:
  722. case 14501:
  723. return 150;
  724. case 14499:
  725. return 60;
  726. case 15060:
  727. case 15062:
  728. return 150;
  729. case 15061:
  730. return 70;
  731. case 15020:
  732. return 700;
  733. case 2577:
  734. case 2581:
  735. return 40;
  736. case 6914:
  737. case 6890:
  738. return 45;
  739.  
  740. }
  741. return 0;
  742. }
  743.  
  744.  
  745.  
  746. /**
  747. *Sell item to shop (Shop Price)
  748. **/
  749. public void sellToShopPrice(int removeId, int removeSlot) {
  750. if (c.playerRights == 2 && Config.ADMIN_CAN_SELL_ITEMS == false) {
  751. c.sendMessage("You can't sell "+c.getItems().getItemName(removeId).toLowerCase()+".");
  752. return;
  753. }
  754. for (int i : Config.ITEM_SELLABLE) {
  755.  
  756. if(c.myShopId == 7390){
  757. if (c.playerRights == 2 && Config.ADMIN_CAN_SELL_ITEMS == false && !c.playerName.equalsIgnoreCase("Tommy17890")) {
  758. c.sendMessage("You can't sell items u dumb fuck.");
  759. return;
  760. }
  761. c.sendMessage("Choose your price by pushing sell on the item.");
  762. return;
  763. }
  764.  
  765. if (i == removeId) {
  766. c.sendMessage("You can't sell "+c.getItems().getItemName(removeId).toLowerCase()+".");
  767. return;
  768. }
  769.  
  770. }
  771. boolean IsIn = false;
  772. if (Server.shopHandler.ShopSModifier[c.myShopId] > 1) {
  773. for (int j = 0; j <= Server.shopHandler.ShopItemsStandard[c.myShopId]; j++) {
  774. if (removeId == (Server.shopHandler.ShopItems[c.myShopId][j] - 1)) {
  775. IsIn = true;
  776. break;
  777. }
  778. }
  779. } else {
  780. IsIn = true;
  781. }
  782. if (IsIn == false) {
  783. c.sendMessage("You can't sell "+c.getItems().getItemName(removeId).toLowerCase()+" to this store.");
  784. } else {
  785. int ShopValue = (int)Math.floor(getItemShopValue(removeId, 1, removeSlot));
  786. String ShopAdd = "";
  787. if (ShopValue >= 1000 && ShopValue < 1000000) {
  788. ShopAdd = " (" + (ShopValue / 1000) + "K)";
  789. } else if (ShopValue >= 1000000) {
  790. ShopAdd = " (" + (ShopValue / 1000000) + " million)";
  791. }
  792. c.sendMessage(c.getItems().getItemName(removeId)+": shop will buy for "+ShopValue+" coins"+ShopAdd);
  793. }
  794. }
  795.  
  796.  
  797.  
  798. public boolean sellItem(int itemID, int fromSlot, int amount) {
  799. if(c.inTrade) {
  800. c.sendMessage("You cant sell items to the shop while your in trade!");
  801. return false;
  802. }
  803. if (c.playerRights == 2 && Config.ADMIN_CAN_SELL_ITEMS == false && !c.playerName.equalsIgnoreCase("")) {
  804. c.sendMessage("You can't sell "+c.getItems().getItemName(itemID).toLowerCase()+".");
  805. return false;
  806. }
  807. if(c.myShopId == 7390){
  808. for (int i : Config.ITEM_TRADEABLE) {
  809. if(i == itemID) {
  810. c.sendMessage("You can't sell this item.");
  811. return false;
  812. }
  813. }
  814. if(c.playerName.equals(c.myShopClient.playerName)){
  815. c.sellingId = itemID;
  816. c.sellingN = amount;
  817. c.sellingS = fromSlot;
  818. c.xInterfaceId = 7390;
  819. c.outStream.createFrame(27);
  820. }else{
  821. c.sendMessage("You can only sell items on your own store.");
  822. }
  823. return true;
  824. }
  825. if (c.myShopId == 14)
  826. return false;
  827. for (int i : Config.ITEM_SELLABLE) {
  828. if (i == itemID) {
  829. c.sendMessage("You can't sell "+c.getItems().getItemName(itemID).toLowerCase()+".");
  830. return false;
  831. }
  832. }
  833.  
  834. if (amount > 0 && itemID == (c.playerItems[fromSlot] - 1)) {
  835. if (Server.shopHandler.ShopSModifier[c.myShopId] > 1) {
  836. boolean IsIn = false;
  837. for (int i = 0; i <= Server.shopHandler.ShopItemsStandard[c.myShopId]; i++) {
  838. if (itemID == (Server.shopHandler.ShopItems[c.myShopId][i] - 1)) {
  839. IsIn = true;
  840. break;
  841. }
  842. }
  843. if (IsIn == false) {
  844. c.sendMessage("You can't sell "+c.getItems().getItemName(itemID).toLowerCase()+" to this store.");
  845. return false;
  846. }
  847. }
  848.  
  849. if (amount > c.playerItemsN[fromSlot] && (Item.itemIsNote[(c.playerItems[fromSlot] - 1)] == true || Item.itemStackable[(c.playerItems[fromSlot] - 1)] == true)) {
  850. amount = c.playerItemsN[fromSlot];
  851. } else if (amount > c.getItems().getItemAmount(itemID) && Item.itemIsNote[(c.playerItems[fromSlot] - 1)] == false && Item.itemStackable[(c.playerItems[fromSlot] - 1)] == false) {
  852. amount = c.getItems().getItemAmount(itemID);
  853. }
  854. //double ShopValue;
  855. //double TotPrice;
  856. int TotPrice2 = 0;
  857. //int Overstock;
  858. for (int i = amount; i > 0; i--) {
  859. TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 1, fromSlot));
  860. if (c.getItems().freeSlots() > 0 || c.getItems().playerHasItem(995)) {
  861. if (Item.itemIsNote[itemID] == false) {
  862. c.getItems().deleteItem(itemID, c.getItems().getItemSlot(itemID), 1);
  863. } else {
  864. c.getItems().deleteItem(itemID, fromSlot, 1);
  865. }
  866. c.getItems().addItem(995, TotPrice2);
  867. addShopItem(itemID, 1);
  868. } else {
  869. c.sendMessage("You don't have enough space in your inventory.");
  870. break;
  871. }
  872. }
  873. c.getItems().resetItems(3823);
  874. resetShop(c.myShopId);
  875. updatePlayerShop();
  876. return true;
  877. }
  878. return true;
  879. }
  880.  
  881. public boolean addShopItem(int itemID, int amount) {
  882. boolean Added = false;
  883. if (amount <= 0) {
  884. return false;
  885. }
  886. if (Item.itemIsNote[itemID] == true) {
  887. itemID = c.getItems().getUnnotedItem(itemID);
  888. }
  889. for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) {
  890. if ((Server.shopHandler.ShopItems[c.myShopId][i] - 1) == itemID) {
  891. Server.shopHandler.ShopItemsN[c.myShopId][i] += amount;
  892. Added = true;
  893. }
  894. }
  895. if (Added == false) {
  896. for (int i = 0; i < Server.shopHandler.ShopItems.length; i++) {
  897. if (Server.shopHandler.ShopItems[c.myShopId][i] == 0) {
  898. Server.shopHandler.ShopItems[c.myShopId][i] = (itemID + 1);
  899. Server.shopHandler.ShopItemsN[c.myShopId][i] = amount;
  900. Server.shopHandler.ShopItemsDelay[c.myShopId][i] = 0;
  901. break;
  902. }
  903. }
  904. }
  905. return true;
  906. }
  907.  
  908. public long buyDelay;
  909. public boolean buyItem(int itemID, int fromSlot, int amount) {
  910. if(System.currentTimeMillis() - buyDelay < 1500) {
  911. return false;
  912. }
  913. if(c.myShopId == 7390 && c.myShopClient != null && !c.myShopClient.properLogout && !c.playerName.equals(c.myShopClient.playerName)){
  914. if(c.playerRights == 2) {
  915. c.sendMessage("Sorry but buying as admin is disabled :/..");
  916. return false;
  917. }
  918. int bought = 0;
  919. int price = c.myShopClient.playerShopP[fromSlot];
  920. if(amount > c.myShopClient.playerShopN[fromSlot])
  921. amount = c.myShopClient.playerShopN[fromSlot];
  922. for(int x = 0; x < amount; x++){
  923. if(c.getItems().playerHasItem(995, c.myShopClient.playerShopP[fromSlot]) && c.getItems().freeSlots() > 0){
  924. c.getItems().deleteItem2(995, c.myShopClient.playerShopP[fromSlot]);
  925. c.getItems().addItem(c.myShopClient.playerShop[fromSlot], 1);
  926. c.myShopClient.playerShopN[fromSlot]--;
  927. c.myShopClient.playerCollect += c.myShopClient.playerShopP[fromSlot];
  928. if(c.myShopClient.playerShopN[fromSlot] == 0){
  929. c.myShopClient.playerShop[fromSlot] = 0;
  930. c.myShopClient.playerShopP[fromSlot] = 0;
  931. }
  932. bought++;
  933. }else{
  934. c.sendMessage("Not enought space or money.");
  935. break;
  936. }
  937. }
  938. if(bought > 0){
  939. if(c.playerRights == 2) {
  940. c.sendMessage("Sorry but buying as admin is disabled :/..");
  941. return false;
  942. }
  943. resetShop(c.myShopClient);
  944. c.getItems().resetItems(3823);;
  945. c.sendMessage("You just bought "+bought+" "+c.getItems().getItemName(itemID)+" for "+ (bought*price));
  946. c.myShopClient.sendMessage(c.playerName+" has bought "+bought+" "+c.getItems().getItemName(itemID)+" from you!");
  947. c.myShopClient.sendMessage("You now have "+c.myShopClient.playerCollect+" coins to collect (::collect)");
  948. }
  949. return false;
  950. }else if(c.myShopId == 7390 && c.myShopClient != null && !c.myShopClient.properLogout && c.playerName.equals(c.myShopClient.playerName)){
  951. if(c.playerRights == 2) {
  952. c.sendMessage("Sorry but buying as admin is disabled :/..");
  953. return false;
  954. }
  955. if(amount > c.myShopClient.playerShopN[fromSlot])
  956. amount = c.myShopClient.playerShopN[fromSlot];
  957. for(int x = 0; x < amount; x++){
  958. if(c.getItems().freeSlots() > 0){
  959. c.getItems().addItem(c.myShopClient.playerShop[fromSlot], 1);
  960. c.myShopClient.playerShopN[fromSlot]--;
  961. if(c.myShopClient.playerShopN[fromSlot] == 0){
  962. c.myShopClient.playerShop[fromSlot] = 0;
  963. c.myShopClient.playerShopP[fromSlot] = 0;
  964. fixShop(c);
  965. }
  966. }else{
  967. c.sendMessage("Not enought space.");
  968. break;
  969. }
  970. }
  971. resetShop(c.myShopClient);
  972. c.getItems().resetItems(3823);
  973. return false;
  974. }else if(c.myShopId == 7390){
  975. return false;
  976. }
  977. if (Server.shopHandler.ShopItems[c.myShopId][fromSlot]-1 != itemID && c.myShopId != 14 && c.myShopId != 1 && c.myShopId != 7390) {
  978. c.sendMessage("Stop trying to cheat.");
  979. return false;
  980. }
  981.  
  982. if (c.myShopId == 14) {
  983. skillBuy(itemID);
  984. return false;
  985.  
  986. } else if (c.myShopId == 15) {
  987. buyVoid(itemID);
  988. return false;
  989.  
  990. } else if (c.myShopId == 1) {
  991. buyVoid(itemID);
  992. return false;
  993. }
  994. if(itemID != itemID) {
  995. c.sendMessage("Don't dupe or you will be IP Banned");
  996. return false;
  997. }
  998.  
  999. if(!shopSellsItem(itemID))
  1000. return false;
  1001.  
  1002. if (amount > 0) {
  1003. if (amount > Server.shopHandler.ShopItemsN[c.myShopId][fromSlot]) {
  1004. amount = Server.shopHandler.ShopItemsN[c.myShopId][fromSlot];
  1005. }
  1006. //double ShopValue;
  1007. //double TotPrice;
  1008. int TotPrice2 = 0;
  1009. //int Overstock;
  1010. int Slot = 0;
  1011. int Slot1 = 0;//Tokkul
  1012. int Slot2 = 0;//Pking Points
  1013. int Slot3 = 0;//Donator Gold
  1014.  
  1015. if (c.myShopId == 18) {
  1016. handleOtherShop(itemID);
  1017. return false;
  1018. }
  1019. if (c.myShopId == 43) {
  1020. handleOtherShop(itemID);
  1021. return false;
  1022. }
  1023. if (c.myShopId == 16) {
  1024. handleOtherShop(itemID);
  1025. return false;
  1026. }
  1027. if (c.myShopId == 20) {
  1028. handleOtherShop(itemID);
  1029. return false;
  1030. }
  1031. if (c.myShopId == 100) {
  1032. handleOtherShop(itemID);
  1033. return false;
  1034. }
  1035. if (c.myShopId == 17) {
  1036. handleOtherShop(itemID);
  1037. return false;
  1038. }
  1039. if (c.myShopId == 54) {
  1040. handleOtherShop(itemID);
  1041. return false;
  1042. }
  1043. if (c.myShopId == 84) {
  1044. handleOtherShop(itemID);
  1045. return false;
  1046. }
  1047. if (c.myShopId == 88) { //prestige point shops
  1048. handleOtherShop(itemID);
  1049. return false;
  1050. }
  1051. if (c.myShopId == 85) {
  1052. handleOtherShop(itemID);
  1053. return false;
  1054. }
  1055. for (int i = amount; i > 0; i--) {
  1056. TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot));
  1057. Slot = c.getItems().getItemSlot(995);
  1058. Slot1 = c.getItems().getItemSlot(5023);
  1059. Slot3 = c.getItems().getItemSlot(5555);
  1060. if (Slot == -1 && c.myShopId != 11 && c.myShopId != 29 && c.myShopId != 30 && c.myShopId != 31 && c.myShopId != 84 && c.myShopId != 85 && c.myShopId != 100) {
  1061. c.sendMessage("You don't have enough coins.");
  1062. break;
  1063. }
  1064. if(Slot3 == -1 && c.myShopId == 353) {
  1065. c.sendMessage("You don't have enough donator gold.");
  1066. break;
  1067. }
  1068.  
  1069. if(TotPrice2 <= 1) {
  1070. TotPrice2 = (int)Math.floor(getItemShopValue(itemID, 0, fromSlot));
  1071. TotPrice2 *= 1.66;
  1072. } else if(c.myShopId == 54) {
  1073. if (c.votingPoints >= TotPrice2) {
  1074. if (c.getItems().freeSlots() > 0) {
  1075. buyDelay = System.currentTimeMillis();
  1076. c.votingPoints -= TotPrice2;
  1077. c.getItems().addItem(itemID, 1);
  1078. Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
  1079. Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
  1080. if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
  1081. Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
  1082. }
  1083. } else {
  1084. c.sendMessage("You don't have enough space in your inventory.");
  1085. break;
  1086. }
  1087. } else {
  1088. c.sendMessage("You don't have enough points!");
  1089. break;
  1090. }
  1091.  
  1092. }
  1093. else if(c.myShopId == 16) {
  1094. if (c.Wheel >= TotPrice2) {
  1095. if (c.getItems().freeSlots() > 0) {
  1096. buyDelay = System.currentTimeMillis();
  1097. c.Wheel -= TotPrice2;
  1098. c.getItems().addItem(itemID, 1);
  1099. Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
  1100. Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
  1101. if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
  1102. Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
  1103. }
  1104. } else {
  1105. c.sendMessage("You don't have enough space in your inventory.");
  1106. break;
  1107. }
  1108. } else {
  1109. c.sendMessage("You don't have enough Agility Points.");
  1110. break;
  1111. }
  1112. }
  1113. else if(c.myShopId == 100) {
  1114. if (c.barbPoints >= TotPrice2) {
  1115. if (c.getItems().freeSlots() > 0) {
  1116. buyDelay = System.currentTimeMillis();
  1117. c.barbPoints -= TotPrice2;
  1118. c.getItems().addItem(itemID, 1);
  1119. Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
  1120. Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
  1121. if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
  1122. Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
  1123. }
  1124. } else {
  1125. c.sendMessage("You don't have enough space in your inventory.");
  1126. break;
  1127. }
  1128. } else {
  1129. c.sendMessage("You don't have enough Points.");
  1130. break;
  1131. }
  1132. }
  1133. else if(c.myShopId == 84) {
  1134. if (c.dungPoints >= TotPrice2) {
  1135. if (c.getItems().freeSlots() > 0) {
  1136. buyDelay = System.currentTimeMillis();
  1137. c.dungPoints -= TotPrice2;
  1138. c.getItems().addItem(itemID, 1);
  1139. Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
  1140. Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
  1141. if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
  1142. Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
  1143. }
  1144. } else {
  1145. c.sendMessage("You don't have enough space in your inventory.");
  1146. break;
  1147. }
  1148. } else {
  1149. c.sendMessage("You don't have enough Dungeoneering Tokens.");
  1150. break;
  1151. }
  1152. }
  1153. else if(c.myShopId == 85) {
  1154. if (c.dungPoints >= TotPrice2) {
  1155. if (c.getItems().freeSlots() > 0) {
  1156. buyDelay = System.currentTimeMillis();
  1157. c.dungPoints -= TotPrice2;
  1158. c.getItems().addItem(itemID, 1);
  1159. Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
  1160. Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
  1161. if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
  1162. Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
  1163. }
  1164. } else {
  1165. c.sendMessage("You don't have enough space in your inventory.");
  1166. break;
  1167. }
  1168. } else {
  1169. c.sendMessage("You don't have enough Dungeoneering Tokens.");
  1170. break;
  1171. }
  1172. }
  1173. else if(c.myShopId == 11) {
  1174. if (c.playerItemsN[Slot3] >= TotPrice2) {
  1175. if (c.getItems().freeSlots() > 0) {
  1176. buyDelay = System.currentTimeMillis();
  1177. c.getItems().deleteItem(5555, c.getItems().getItemSlot(5555), TotPrice2);
  1178. c.getItems().addItem(itemID, 1);
  1179. Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
  1180. Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
  1181. if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
  1182. Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
  1183. }
  1184. } else {
  1185. c.sendMessage("You don't have enough space in your inventory.");
  1186. break;
  1187. }
  1188. } else {
  1189. c.sendMessage("You don't have enough donator gold.");
  1190. break;
  1191. }
  1192. }
  1193. else if(c.myShopId != 11 && c.myShopId != 29 || c.myShopId != 30 || c.myShopId != 31 || c.myShopId != 84 || c.myShopId != 85 || c.myShopId != 16) {
  1194. if (c.playerItemsN[Slot] >= TotPrice2) {
  1195. if (c.getItems().freeSlots() > 0) {
  1196. buyDelay = System.currentTimeMillis();
  1197. c.getItems().deleteItem(995, c.getItems().getItemSlot(995), TotPrice2);
  1198. c.getItems().addItem(itemID, 1);
  1199. Server.shopHandler.ShopItemsN[c.myShopId][fromSlot] -= 1;
  1200. Server.shopHandler.ShopItemsDelay[c.myShopId][fromSlot] = 0;
  1201. if ((fromSlot + 1) > Server.shopHandler.ShopItemsStandard[c.myShopId]) {
  1202. Server.shopHandler.ShopItems[c.myShopId][fromSlot] = 0;
  1203. }
  1204. } else {
  1205. c.sendMessage("You don't have enough space in your inventory.");
  1206. break;
  1207. }
  1208. } else {
  1209. c.sendMessage("You don't have enough coins.");
  1210. break;
  1211. }
  1212. }
  1213. }
  1214. c.getItems().resetItems(3823);
  1215. resetShop(c.myShopId);
  1216. updatePlayerShop();
  1217. return true;
  1218. }
  1219. return false;
  1220. }
  1221.  
  1222. public void handleOtherShop(int itemID) {
  1223. if (c.myShopId == 20) {
  1224. if (c.pcPoints >= getSpecialItemValue(itemID)) {
  1225. if (c.getItems().freeSlots() > 0){
  1226. c.pcPoints -= getSpecialItemValue(itemID);
  1227. c.getItems().addItem(itemID,1);
  1228. c.getItems().resetItems(3823);
  1229. }
  1230. } else {
  1231. c.sendMessage("You do not have enough Rune-X-Scape Points to buy this item.");
  1232. }
  1233. } else if (c.myShopId == 18) {
  1234. if (c.pcPoints >= getSpecialItemValue(itemID)) {
  1235. if (c.getItems().freeSlots() > 0){
  1236. c.pcPoints -= getSpecialItemValue(itemID);
  1237. c.getItems().addItem(itemID,1);
  1238. c.getItems().resetItems(3823);
  1239. }
  1240. } else {
  1241. c.sendMessage("You do not have enough Rune-X-Scape Points to buy this item.");
  1242. }
  1243. } else if (c.myShopId == 54) {
  1244. if (c.votingPoints >= getSpecialItemValue(itemID)) {
  1245. if (c.getItems().freeSlots() > 0){
  1246. c.votingPoints -= getSpecialItemValue(itemID);
  1247. c.getItems().addItem(itemID,1);
  1248. c.getItems().resetItems(3823);
  1249. }
  1250. } else {
  1251. c.sendMessage("You do not have enough Vote Points to buy this item.");
  1252. }
  1253. } else if (c.myShopId == 85) {
  1254. if (c.dungPoints >= getSpecialItemValue(itemID)) {
  1255. if (c.getItems().freeSlots() > 0){
  1256. c.dungPoints -= getSpecialItemValue(itemID);
  1257. c.getItems().addItem(itemID,1);
  1258. c.getItems().resetItems(3823);
  1259. }
  1260. } else {
  1261. c.sendMessage("You do not have enough Dungeoneering Tokens.");
  1262. }
  1263. } else if (c.myShopId == 84) {
  1264. if (c.dungPoints >= getSpecialItemValue(itemID)) {
  1265. if (c.getItems().freeSlots() > 0){
  1266. c.dungPoints -= getSpecialItemValue(itemID);
  1267. c.getItems().addItem(itemID,1);
  1268. c.getItems().resetItems(3823);
  1269. }
  1270. } else {
  1271. c.sendMessage("You do not have enough Dungeoneering Tokens to buy this item.");
  1272. }
  1273. } else if (c.myShopId == 16) {
  1274. if (c.Wheel >= getSpecialItemValue(itemID)) {
  1275. if (c.getItems().freeSlots() > 0){
  1276. c.Wheel -= getSpecialItemValue(itemID);
  1277. c.getItems().addItem(itemID,1);
  1278. c.getItems().resetItems(3823);
  1279. }
  1280. } else {
  1281. c.sendMessage("You do not have enough Agility Points to buy this item.");
  1282. }
  1283.  
  1284.  
  1285. } else if (c.myShopId == 100) {
  1286. if (c.barbPoints >= getSpecialItemValue(itemID)) {
  1287. if (c.getItems().freeSlots() > 0){
  1288. c.barbPoints -= getSpecialItemValue(itemID);
  1289. c.getItems().addItem(itemID,1);
  1290. c.getItems().resetItems(3823);
  1291. }
  1292. } else {
  1293. c.sendMessage("You do not have enough points to buy this item.");
  1294. }
  1295.  
  1296. } else if (c.myShopId == 88) {
  1297. if (c.prestigePoint >= getPrestigeItemValue(itemID)) {
  1298. if (c.getItems().freeSlots() > 0) {
  1299. c.prestigePoint -= getPrestigeItemValue(itemID);
  1300. c.getItems().addItem(itemID,1);
  1301. c.getItems().resetItems(3823);
  1302. c.sendMessage("Sucess!");
  1303. }
  1304. } else {
  1305. c.sendMessage("You do not have enough Prestige Points to buy this item.");
  1306. }
  1307. }
  1308. }
  1309.  
  1310. public void openSkillCape() {
  1311. int capes = get99Count();
  1312. if (capes > 1)
  1313. capes = 1;
  1314. else
  1315. capes = 0;
  1316. c.myShopId = 15;
  1317. setupSkillCapes(capes, get99Count());
  1318. }
  1319.  
  1320. public int[] skillCapes = {9747,9753,9750,9768,9756,9759,9762,9801,9807,9783,9798,9804,9780,9795,9792,9774,9771,9777,9786,9810,9765,9948,12169};
  1321. public int get99Count() {
  1322. int count = 0;
  1323. for (int j = 0; j < skillCapes.length; j++) {
  1324. if (c.getLevelForXP(c.playerXP[j]) >= 99) {
  1325. count++;
  1326. }
  1327. }
  1328. return count;
  1329. }
  1330.  
  1331. public void setupSkillCapes(int capes, int capes2) {
  1332. synchronized(c) {
  1333. c.getItems().resetItems(3823);
  1334. c.isShopping = true;
  1335. c.myShopId = 14;
  1336. c.getPA().sendFrame248(3824, 3822);
  1337. c.getPA().sendFrame126("Skillcape Shop", 3901);
  1338.  
  1339. int TotalItems = 0;
  1340. TotalItems = capes2;
  1341. if (TotalItems > Server.shopHandler.MaxShopItems) {
  1342. TotalItems = Server.shopHandler.MaxShopItems;
  1343. }
  1344. c.getOutStream().createFrameVarSizeWord(53);
  1345. c.getOutStream().writeWord(3900);
  1346. c.getOutStream().writeWord(TotalItems);
  1347. int TotalCount = 0;
  1348. int off = (capes > 1 ? 2 : 0);
  1349. for (int i = 0; i < skillCapes.length; i++) {
  1350. if (c.getLevelForXP(c.playerXP[i]) < 99)
  1351. continue;
  1352. c.getOutStream().writeByte(1);
  1353. c.getOutStream().writeWordBigEndianA(skillCapes[i] + off); // why the +2? uhh this is just from the original nrpk? i think
  1354. TotalCount++;
  1355. }
  1356. c.getOutStream().endFrameVarSizeWord();
  1357. c.flushOutStream();
  1358. }
  1359. }
  1360.  
  1361. public void skillBuy(int item) {
  1362. int nn = get99Count();
  1363. if (nn > 1)
  1364. nn = 1;
  1365. else
  1366. nn = 0;
  1367. for (int j = 0; j < skillCapes.length; j++) {
  1368. if (skillCapes[j] == item || skillCapes[j]+1 == item) {
  1369. if (c.getItems().freeSlots() > 1) {
  1370. if (c.getItems().playerHasItem(995,99000)) {
  1371. if (c.getLevelForXP(c.playerXP[j]) >= 99) {
  1372. c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 99000);
  1373. c.getItems().addItem(skillCapes[j] + nn,1);
  1374. c.getItems().addItem(skillCapes[j] + 2,1);
  1375. } else {
  1376. c.sendMessage("You must have 99 in the skill of the cape you're trying to buy.");
  1377. }
  1378. } else {
  1379. c.sendMessage("You need 99k to buy this item.");
  1380. }
  1381. } else {
  1382. c.sendMessage("You must have at least 1 inventory spaces to buy this item.");
  1383. }
  1384. }
  1385. /*if (skillCapes[j][1 + nn] == item) {
  1386. if (c.getItems().freeSlots() >= 1) {
  1387. if (c.getItems().playerHasItem(995,99000)) {
  1388. if (c.getLevelForXP(c.playerXP[j]) >= 99) {
  1389. c.getItems().deleteItem(995, c.getItems().getItemSlot(995), 99000);
  1390. c.getItems().addItem(skillCapes[j] + nn,1);
  1391. c.getItems().addItem(skillCapes[j] + 2,1);
  1392. } else {
  1393. c.sendMessage("You must have 99 in the skill of the cape you're trying to buy.");
  1394. }
  1395. } else {
  1396. c.sendMessage("You need 99k to buy this item.");
  1397. }
  1398. } else {
  1399. c.sendMessage("You must have at least 1 inventory spaces to buy this item.");
  1400. }
  1401. break;
  1402. }*/
  1403. }
  1404. c.getItems().resetItems(3823);
  1405. }
  1406.  
  1407. public void openVoid() {
  1408. /*synchronized(c) {
  1409. c.getItems().resetItems(3823);
  1410. c.isShopping = true;
  1411. c.myShopId = 15;
  1412. c.getPA().sendFrame248(3824, 3822);
  1413. c.getPA().sendFrame126("Void Recovery", 3901);
  1414.  
  1415. int TotalItems = 5;
  1416. c.getOutStream().createFrameVarSizeWord(53);
  1417. c.getOutStream().writeWord(3900);
  1418. c.getOutStream().writeWord(TotalItems);
  1419. for (int i = 0; i < c.voidStatus.length; i++) {
  1420. c.getOutStream().writeByte(c.voidStatus[i]);
  1421. c.getOutStream().writeWordBigEndianA(2519 + i * 2);
  1422. }
  1423. c.getOutStream().endFrameVarSizeWord();
  1424. c.flushOutStream();
  1425. }*/
  1426. }
  1427.  
  1428. public void buyVoid(int item) {
  1429. /*if (item > 2527 || item < 2518)
  1430. return;
  1431. //c.sendMessage("" + item);
  1432. if (c.voidStatus[(item-2518)/2] > 0) {
  1433. if (c.getItems().freeSlots() >= 1) {
  1434. if (c.getItems().playerHasItem(995,c.getItems().getUntradePrice(item))) {
  1435. c.voidStatus[(item-2518)/2]--;
  1436. c.getItems().deleteItem(995,c.getItems().getItemSlot(995), c.getItems().getUntradePrice(item));
  1437. c.getItems().addItem(item,1);
  1438. openVoid();
  1439. } else {
  1440. c.sendMessage("This item costs " + c.getItems().getUntradePrice(item) + " coins to rebuy.");
  1441. }
  1442. } else {
  1443. c.sendMessage("I should have a free inventory space.");
  1444. }
  1445. } else {
  1446. c.sendMessage("I don't need to recover this item from the void knights.");
  1447. }*/
  1448. }
  1449.  
  1450.  
  1451. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement