Guest User

Untitled

a guest
Jan 21st, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.16 KB | None | 0 0
  1. prontera,155,175,6 script Active Points Trader#1 998,{
  2. function Add; function Chk; function Slot; function A_An;
  3.  
  4. if(.Shops$ != "") set .@i,1;
  5. else {
  6. set .@menu$,"";
  7. for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1)
  8. set .@menu$, .@menu$+.Shops$[.@i]+":";
  9. set .@i, select(.@menu$); }
  10. dispbottom "Select one item at a time.";
  11. callshop "qshop"+.@i,1;
  12. npcshopattach "qshop"+.@i;
  13. end;
  14.  
  15. function Add {
  16. if (getitemname(getarg(1))=="null") {
  17. debugmes "Quest reward #"+getarg(1)+" invalid (skipped)."; return; }
  18. for(set .@n,5; .@n<127; set .@n,.@n+2) {
  19. if (!getarg(.@n,0)) break;
  20. if (getitemname(getarg(.@n))=="null") {
  21. debugmes "Quest requirement #"+getarg(.@n)+" invalid (skipped)."; return; } }
  22. for(set .@i,2; .@i<.@n; set .@i,.@i+1)
  23. set getd(".q_"+getarg(1)+"["+(.@i-2)+"]"), getarg(.@i);
  24. npcshopadditem "qshop"+getarg(0),getarg(1),((.ShowZeny)?getarg(3):0);
  25. sleep 1;
  26. return; }
  27. function Chk {
  28. if (getarg(0)<getarg(1)) { set @qe0,1; return "^FF0000"; }
  29. else return "^00FF00"; }
  30. function Slot {
  31. set .@s$,getitemname(getarg(0));
  32. switch(.ShowSlot){
  33. case 1: if (!getitemslots(getarg(0))) return .@s$;
  34. case 2: if (getiteminfo(getarg(0),11)>0) return .@s$+" ["+getitemslots(getarg(0))+"]";
  35. default: return .@s$; } }
  36. function A_An {
  37. setarray .@A$[0],"a","e","i","o","u";
  38. set .@B$, "_"+getarg(0);
  39. for(set .@i,0; .@i<5; set .@i,.@i+1)
  40. if (compare(.@B$,"_"+.@A$[.@i])) return "an "+getarg(0);
  41. return "a "+getarg(0); }
  42.  
  43. OnBuyItem:
  44. set .@q[0],@bought_nameid;
  45. copyarray .@q[1],getd(".q_"+@bought_nameid+"[0]"),getarraysize(getd(".q_"+@bought_nameid+"[0]"));
  46. if (!.@q[1]) { message strcharinfo(0),"An error has occurred."; end; }
  47. mes "[Active Points Trader]";
  48. mes "Item Name: ^0055FF"+((.@q[1]>1)?.@q[1]+"x ":"")+Slot(.@q[0])+"^000000";
  49. mes "Cost:";
  50. if (.@q[2]) mes " > "+Chk(Zeny,.@q[2])+.@q[2]+" Zeny^000000";
  51. if (.@q[3]) mes " > "+Chk(getd(.Points$[0]),.@q[3])+.@q[3]+" "+.Points$[1]+" ("+getd(.Points$[0])+"/"+.@q[3]+")^000000";
  52. if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
  53. mes " > "+Chk(countitem(.@q[.@i]),.@q[.@i+1])+((.DisplayID)?"{"+.@q[.@i]+"} ":"")+Slot(.@q[.@i])+" ("+countitem(.@q[.@i])+"/"+.@q[.@i+1]+")^000000";
  54. next;
  55. set @qe1, getiteminfo(.@q[0],5); set @qe2, getiteminfo(.@q[0],11);
  56. addtimer 1000, strnpcinfo(1)+"::OnEnd";
  57. while(1){
  58. switch(select(" ~ Purchase ^0055FF"+getitemname(.@q[0])+"^000000:"+((((@qe1&1) || (@qe1&256) || (@qe1&512)) && @qe2>0 && !@qe6)?" ~ Preview...":"")+": ~ ^777777Cancel^000000")) {
  59. case 1:
  60. if (@qe0) {
  61. mes "[Active Points Trader]";
  62. mes "You do not have enough Points Balance.";
  63. close; }
  64. if (!checkweight(.@q[0],.@q[1])) {
  65. mes "[Active Points Trader]";
  66. mes "^FF0000You need "+(((.@q[1]*getiteminfo(.@q[0],6))+Weight-MaxWeight)/10)+" additional weight capacity to complete this trade.^000000";
  67. close; }
  68. if (.@q[2]) set Zeny, Zeny-.@q[2];
  69. if (.@q[3]) setd .Points$[0], getd(.Points$[0])-.@q[3];
  70. if (.@q[4]) for(set .@i,4; .@i<getarraysize(.@q); set .@i,.@i+2)
  71. delitem .@q[.@i],.@q[.@i+1];
  72. getitem .@q[0],.@q[1];
  73. if (.Announce) announce strcharinfo(0)+" has purchase "+A_An(getitemname(.@q[0]))+"!",0;
  74. specialeffect2 699;
  75. close;
  76. case 2:
  77. set @qe3, getlook(3); set @qe4, getlook(4); set @qe5, getlook(5);
  78. if (@qe1&1) atcommand "@changelook 3 "+@qe2;
  79. if (@qe1&256) atcommand "@changelook 1 "+@qe2;
  80. if (@qe1&512) atcommand "@changelook 2 "+@qe2;
  81. set @qe6,1;
  82. break;
  83. case 3:
  84. close; } }
  85. OnEnd:
  86. if (@qe6) { atcommand "@changelook 3 "+@qe3; atcommand "@changelook 1 "+@qe4; atcommand "@changelook 2 "+@qe5; }
  87. for(set .@i,0; .@i<7; set .@i,.@i+1) setd "@qe"+.@i,0;
  88. end;
  89. OnInit:
  90. // --------------------- Config ---------------------
  91. // Custom points, if needed: "<variable>","<name to display>"
  92. setarray .Points$[0],"#KAFRAPOINTS","Kafra Points";
  93.  
  94. set .Announce,1; // Announce quest completion? (1: yes / 0: no)
  95. set .ShowSlot,1; // Show item slots? (2: all equipment / 1: if slots > 0 / 0: never)
  96. set .DisplayID,0; // Show item IDs? (1: yes / 0: no)
  97. set .ShowZeny,0; // Show Zeny cost, if any? (1: yes / 0: no)
  98.  
  99. // Shop categories, if needed: "<Shop 1>","<Shop 2>"{,...};
  100. // Duplicate dummy data for any additional shops (bottom of script).
  101. // If no categories, use the second line instead (remove //).
  102.  
  103. //setarray .Shops$[1],"Headgears","Weapons","Other";
  104. set .Shops$,"n/a";
  105.  
  106. // Add(<shop number>,<reward ID>,<reward amount>,<Zeny cost>,<point cost>,
  107. // <required item ID>,<required item amount>{,...});
  108. // Shop number corresponds with order above (default is 1).
  109. // Note: Do NOT use a reward item more than once!
  110.  
  111. Add(1,30042,1,0,3000,0,0);
  112. Add(1,30037,1,0,500,0,0);
  113. Add(1,30025,1,0,3000,0,0);
  114. Add(1,29994,1,0,3000,0,0);
  115. Add(1,29992,1,0,3000,0,0);
  116. Add(1,29988,1,0,3000,0,0);
  117. Add(1,29986,1,0,3000,0,0);
  118. Add(1,29981,1,0,3000,0,0);
  119. Add(1,29979,1,0,3000,0,0);
  120. Add(1,29925,1,0,3000,0,0);
  121.  
  122. // --------------------------------------------------
  123. for(set .@i,1; .@i<=getarraysize(.Shops$); set .@i,.@i+1)
  124. npcshopdelitem "qshop"+.@i,909;
  125. end;
  126. }
  127.  
  128. // -------- Dummy data (duplicate as needed) --------
  129. - shop qshop1 -1,909:-1
Add Comment
Please, Sign In to add comment