fork download
  1. var status = -1;
  2. var eqs = [
  3. [1302030, [1302064, 1402039]], // Maple Soul Singer -> Maple Glory Sword / Maple Soul Rohen
  4. [1332025, [1332056, 1332055]], // Maple Wagner -> Maple Asura Dagger / Maple Dark Mate
  5. [1382012, [1382039, 1372034]], // Maple Lama Staff -> Maple Wisdom Staff / Maple Shine Wand
  6. [1412011, [1312032, 1412027]], // Maple Dragon Axe -> Maple Steel Axe / Maple Demon Axe
  7. [1422014, [1422029]], // Maple Doom Singer -> Maple Belzet
  8. [1432012, [1432040]], // Maple Impaler -> Maple Soul Spear
  9. [1442024, [1442051]], // Maple Scorpio -> Maple Karstan
  10. [1452022, [1452045]], // Maple Soul Searcher -> Maple Kandiva Bow
  11. [1462019, [1462040]], // Maple Crossbow -> Maple Nishada
  12. [1472032, [1472055]], // Maple Kandayo -> Maple Skanda
  13. [1482021, [1482022]], // Maple Storm Finger -> Maple Golden Claw
  14. [1492021, [1492022]] // Maple Storm Pistol -> Maple Cannon Shooter
  15. ];
  16. var reqs = [
  17. [4001126, 200], // Maple Leaf
  18. [4033440, 50], // Basic White Essence Stones
  19. [4033439, 25], // Basic Pink Essence Stones
  20. [4033433, 25] // Basic Red Essence Stones
  21. ];
  22. var selEq;
  23.  
  24. function start() {
  25. cm.sendNext("Lucky you, #h #! You’ve arrived just in time for an incoming stock of new Maple weapons made by the Resistance. They are quite a mighty upgrade from the old weapons provided by Claudine, would you care to take a look? #v1402039#, #v1302064#, #v1332056#, #v1332055#, #v1382039#, #v1372034#, #v1312032#, #v1412027#, #v1422029#, #v1432040#, #v1442051#, #v1452045#, #v1462040#, #v1472055#, #v1482022#, #v1492022#.");
  26. }
  27.  
  28. function action(mode, type, selection) {
  29. if (mode == 0 && status == 2) {
  30. cm.sendOk("Well it's while stocks last anyway. Come back when you are ready.");
  31. cm.dispose();
  32. return;
  33. } else if (mode < 1) {
  34. cm.dispose();
  35. return;
  36. }
  37. status++;
  38. if (status == 0) {
  39. var text = "We will issue one of these weapons out to you for a price!\r\n";
  40. text += "\r\nThe requirements are:";
  41. text += "\r\nThe level 43 Maple weapon you want to upgrade.";
  42. text += "\r\n\t#v4001126# 200 Maple Leaves from monsters all over Commerci.";
  43. text += "\r\n\t#v4033440# 50 Basic White Essence Stones from mining in Ardentmill.";
  44. text += "\r\n\t#v4033439# 25 Basic Pink Essence Stones from mining in Ardentmill.";
  45. text += "\r\n\t#v4033433# 25 Basic Red Essence Stones from mining in Ardentmill.";
  46. if (haveEq()) {
  47. cm.sendNext(text);
  48. } else {
  49. cm.sendOk(text);
  50. cm.dispose();
  51. }
  52. } else if (status == 1) {
  53. var selText = "Which equip would you like to upgrade? (The equip chosen will be the top one in your inventory).\r\n";
  54. for (var i = 0; i < eqs.length; i++) {
  55. if (cm.haveItem(eqs[i][0])) {
  56. selText += "\r\n#L" + i + "##i" + eqs[i][0] + "##z" + eqs[i][0] + "#";
  57. }
  58. }
  59. cm.sendSimple(selText);
  60. } else if (status == 2) {
  61. selEq = selection;
  62. var selText = "With a #i" + eqs[selEq][0] + "#, you can get ";
  63. if (eqs[selEq][1].length == 1) {
  64. selText += "a #i" + eqls[selEq][1][0] + "#";
  65. } else {
  66. selText += "either a #i" + eqls[selEq][1][0] + "# or a #i" + eqls[selEq][1][0] + "#.";
  67. }
  68. if (haveReq(selEq)) {
  69. selText += "\r\n\r\nWould you like to exchange a #i" + eqs[selEq][0] + "#?";
  70. cm.sendYesNo(selText);
  71. } else {
  72. cm.sendOk(selText);
  73. cm.dispose();
  74. }
  75. } else if (status == 3) {
  76. if (haveReq(selEq)) {
  77. if (cm.canHold(1302007)) {
  78. takeReq(selEq);
  79. cm.gainItem(eqs[selEq][0], 1, true);
  80. } else {
  81. cm.sendOk("Do you even have space to receive the weapon? Come back when you're ready!");
  82. cm.dispose();
  83. }
  84. } else {
  85. cm.dispose();
  86. }
  87. }
  88. }
  89.  
  90. function haveReq(item) {
  91. if (!cm.haveItem(eqs[item][0])) {
  92. return false;
  93. }
  94. for (var i = 0; i < reqs.length; i++) {
  95. if (cm.haveItem(reqs[i][0], reqs[i][1])) {
  96. return false;
  97. }
  98. }
  99. return true;
  100. }
  101.  
  102. function takeReq(item) {
  103. cm.gainItem(eqs[item][0], -1);
  104. for (var i = 0; i < reqs.length; i++) {
  105. cm.gainItem(reqs[i][0], -reqs[i][1])
  106. }
  107. return true;
  108. }
  109.  
  110. function haveEq() {
  111. for (var i = 0; i < eqs.length; i++) {
  112. if (cm.haveItem(eqs[i][0])) {
  113. return true;
  114. }
  115. }
  116. return false;
  117. }
Success #stdin #stdout 0.45s 44796KB
stdin
Standard input is empty
stdout
Standard output is empty