Advertisement
ManokStreZ

Npc Trader Euphy's

Mar 8th, 2021
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.00 KB | None | 0 0
  1. //===== rAthena Script =======================================
  2. //= Card Trader
  3. //===== By: ==================================================
  4. //= Euphy
  5. //===== Current Version: =====================================
  6. //= 1.1
  7. //===== Compatible With: =====================================
  8. //= rAthena SVN
  9. //===== Description: =========================================
  10. //= Exchange cards for points.
  11. //============================================================
  12.  
  13. amatsu,126,153,6 script Card Trader 90,{
  14. mes "[Card Trader]";
  15. mes "Hi, "+strcharinfo(0)+"!";
  16. mes "What can I do for you?";
  17. next;
  18. switch(select(" > Information: > Trade in cards: > Point shop (^0055FF"+getd(.Points$)+"^000000): > Leave")) {
  19. case 1:
  20. mes "[Card Trader]";
  21. mes "Do you find that you've got";
  22. mes "useless cards lying around?";
  23. mes "I'll be glad to take them off";
  24. mes "your hands!";
  25. next;
  26. mes "[Card Trader]";
  27. mes "I'll give you ^0055FF"+.Points[0]+" Point"+((.Points[0] == 1)?"":"s")+"^000000 for each";
  28. mes "card you give me, and";
  29. mes "^0055FF"+.Points[1]+" Points^000000 for MVP cards.";
  30. mes "You can trade those points";
  31. mes "for items later on.";
  32. mes "How does that sound?";
  33. emotion e_cash;
  34. close;
  35. case 2:
  36. mes "[Card Trader]";
  37. mes "Select the cards you";
  38. mes "want to trade in.";
  39. if (.Level) {
  40. mes " ";
  41. mes "They must be dropped";
  42. mes "by monsters of level";
  43. mes .Level+" and above.";
  44. }
  45. deletearray @sold_nameid[0],getarraysize(@sold_nameid);
  46. callshop "card_shop",2;
  47. npcshopattach "card_shop";
  48. end;
  49. case 3:
  50. mes "[Card Trader]";
  51. mes "You have ^0055FF"+getd(.Points$)+"^000000 Point"+((getd(.Points$) == 1)?".":"s.");
  52. callshop "card_shop",1;
  53. npcshopattach "card_shop";
  54. end;
  55. case 4:
  56. mes "[Card Trader]";
  57. mes "*yawn*";
  58. mes "See you later!";
  59. emotion e_yawn;
  60. close;
  61. }
  62.  
  63. OnSellItem:
  64. mes "Cards to sell:";
  65. mes "-----------------------------------";
  66. for(set .@i,0; .@i<getarraysize(@sold_nameid); set .@i,.@i+1)
  67. if (@sold_nameid[.@i] > 4000 && @sold_nameid[.@i] < 4700) {
  68. if (.Level) {
  69. query_sql("SELECT `LV` FROM `mob_db` WHERE `DropCardid` = "+@sold_nameid[.@i],.@lv);
  70. if (.@lv < .Level) {
  71. dispbottom getitemname(@sold_nameid[.@i])+" is under the minimum level.";
  72. continue;
  73. }
  74. }
  75. set .@card_id[getarraysize(.@card_id)], @sold_nameid[.@i];
  76. set .@card_amt[getarraysize(.@card_amt)], @sold_quantity[.@i];
  77. set .@mvp, compare(.MVP$,""+@sold_nameid[.@i]);
  78. mes ((.@mvp)?" ^FF0000":" ^777777")+@sold_quantity[.@i]+"x "+getitemname(@sold_nameid[.@i])+"^000000";
  79. set .@card_total, .@card_total+(@sold_quantity[.@i]*((.@mvp)?.Points[1]:.Points[0]));
  80. }
  81. deletearray @sold_nameid[0], getarraysize(@sold_nameid);
  82. deletearray @sold_quantity[0], getarraysize(@sold_quantity);
  83. if (!.@card_id) {
  84. mes " ^777777(none)^000000";
  85. emotion e_swt;
  86. close;
  87. }
  88. mes " ";
  89. mes "---------- Total: ^0055FF"+.@card_total+" pt.^000000 -------";
  90. next;
  91. if(select(" > ^0055FFComplete trade...^000000: > ^777777Cancel^000000") == 2) {
  92. mes "[Card Trader]";
  93. mes "Oh, okay...";
  94. emotion e_hmm;
  95. close;
  96. }
  97. for(set .@i,0; .@i<getarraysize(.@card_id); set .@i,.@i+1)
  98. delitem .@card_id[.@i],.@card_amt[.@i];
  99. setd .Points$, getd(.Points$)+.@card_total;
  100. mes "[Card Trader]";
  101. mes "All done!";
  102. emotion e_ho;
  103. close;
  104.  
  105. OnBuyItem:
  106. for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1)
  107. for(set .@j,0; .@j<getarraysize(.Shop); set .@j,.@j+2)
  108. if (@bought_nameid[.@i] == .Shop[.@j]) {
  109. set .@cost, .@cost+(.Shop[.@j+1]*@bought_quantity[.@i]);
  110. break;
  111. }
  112. if (.@cost > getd(.Points$)) {
  113. mes "[Card Trader]";
  114. mes "You don't have enough Points.";
  115. emotion e_omg;
  116. }
  117. else {
  118. mes "Items purchased:";
  119. mes "-----------------------------------";
  120. for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1) {
  121. getitem @bought_nameid[.@i], @bought_quantity[.@i];
  122. mes " ^777777"+@bought_quantity[.@i]+"x "+getitemname(@bought_nameid[.@i])+"^000000";
  123. }
  124. mes " ";
  125. mes "---------- Total: ^0055FF"+.@cost+" pt.^000000 -------";
  126. setd .Points$, getd(.Points$)-.@cost;
  127. emotion e_cash;
  128. }
  129. deletearray @bought_nameid[0], getarraysize(@bought_nameid);
  130. deletearray @bought_quantity[0], getarraysize(@bought_quantity);
  131. close;
  132.  
  133. OnInit:
  134. set .Level,0; // Minimum monster level to trade corresponding cards.
  135. set .Points$,"#Card_Points"; // Variable to store points.
  136. setarray .Shop[0], // Card Shop items: <ID>,<point cost>
  137. 663,1,4004,1,4033,1,4196,1,4197,25,4054,50,4174,75,4047,100;
  138. setarray .Points[0],1,5; // Points per <normal card>,<MVP card>
  139. set .MVP$, // List of MVP cards.
  140. "4121,4123,4128,4131,4132,4134,4135,4137,4142,4143,4144,4145,4146,4147,4148,4168,4236,"+
  141. "4241,4263,4276,4302,4305,4318,4324,4330,4342,4357,4359,4361,4363,4365,4399,4403,4407";
  142.  
  143. npcshopdelitem "card_shop",909;
  144. for(set .@i,0; .@i<getarraysize(.Shop); set .@i,.@i+2)
  145. npcshopadditem "card_shop",.Shop[.@i],.Shop[.@i+1];
  146. end;
  147. }
  148. - shop card_shop -1,909:-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement