card_trader.txt 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197
  1. //===== rAthena Script =======================================
  2. //= Card Trader
  3. //===== By: ==================================================
  4. //= Elias (og2)
  5. //===== Current Version: =====================================
  6. //= 1.3
  7. //===== Compatible With: =====================================
  8. //= rAthena SVN r15340+
  9. //===== Description: =========================================
  10. //= Card and Points Trader
  11. //===== Additional Comments: =================================
  12. //= v1.0 Translated from the Official [Elias]
  13. //= v1.1 Fixed variables and optimized script [Elias]
  14. //= v1.2 Fixed char being stuck with breaks [Elias] (bugreport:5374)
  15. //= v1.3 Optimized: reduced from 123kb to 7kb! [Euphy]
  16. //============================================================
  17. prontera,115,90,0 script Putty 90,{
  18. set .@points,oversea_event9;
  19. if (!.@points) {
  20. mes "[Putty]";
  21. mes "Hi there.";
  22. mes "I don't know if I can be";
  23. mes "of any assistance, but I";
  24. mes "am trying to help older veterans";
  25. mes "by exchaning the cards that";
  26. mes "they are no longer using.";
  27. next;
  28. switch(select("Ask for more information!","I don't have any cards right now.")) {
  29. case 1:
  30. mes "[Putty]";
  31. mes "I am giving 1 point for each card that you bring me.";
  32. mes "The points can be used to exchange for items that I have.";
  33. next;
  34. mes "[Putty]";
  35. mes "For ^CC0000100 points^000000: ^0000CC1 Old Card Album^000000.";
  36. mes "For ^CC000050 points^000000: ^0000CC20 Yggdrasil Berry^000000.";
  37. mes "For ^CC000020 points^000000: ^0000CC10 Blue Potion^000000.";
  38. mes "For ^CC00001 point^000000: ^0000CC4 Honey^000000.";
  39. next;
  40. break;
  41. case 2:
  42. mes "[Putty]";
  43. mes "Well, remember this offer!";
  44. close;
  45. break;
  46. }
  47. } else {
  48. mes "[Putty]";
  49. mes "Welcome back!";
  50. mes "I see you already have some";
  51. mes "trading points. Actually, you currently have ^00cc00" + .@points + "^000000.";
  52. next;
  53. mes "[Putty]";
  54. mes "Would you like to exchange these";
  55. mes "points now, or you would like to exchange more cards?";
  56. next;
  57. }
  58. switch(select("I would like to exchange cards.","Can I exchange the points?")) {
  59. case 1:
  60. mes "[Putty]";
  61. mes "Please tell me what card you want to exchange.";
  62. next;
  63. input .@i$;
  64. set .@input$, "_"+.@i$;
  65. set .@card,0;
  66. freeloop(1);
  67. for(set .@j,1; .@j<4; set .@j,.@j+1) {
  68. for(set .@i,0; .@i<.card[.@j]; set .@i,.@i+1)
  69. if (compare(.@input$,"_"+getitemname(getd(".card"+.@j+"["+.@i+"]")))) {
  70. set .@card, getd(".card"+.@j+"["+.@i+"]"); break; }
  71. sleep2 10; // For good measure
  72. if (.@card) break; }
  73. freeloop(0);
  74. mes "[Putty]";
  75. if (!.@card) mes "Please, come back here if you want to exchange a monster card.";
  76. else {
  77. set .@count, countitem(.@card);
  78. if (!.@count) {
  79. mes "You don't have any ^0055FF"+getitemname(.@card)+"s^000000 with you!";
  80. close; }
  81. mes "You've got ^0055FF"+.@count+" "+getitemname(.@card)+((.@count>1)?"s":"")+"^000000.";
  82. mes " ";
  83. mes "Would you like to exchange 1 point for each of them?";
  84. next;
  85. switch(select("Yes, please!","No, thank you.")) {
  86. case 1:
  87. delitem .@card,.@count;
  88. set oversea_event9, (.@points+.@count);
  89. mes "[Putty]";
  90. mes "Alright, you have received ^CC0000"+.@count+"^000000 points.";
  91. break;
  92. case 2:
  93. mes "[Putty]";
  94. mes "Okay, let me know if I can help you with something else.";
  95. break;
  96. }
  97. }
  98. close;
  99. case 2:
  100. if (.@points) {
  101. mes "[Putty]";
  102. mes "These are the items that I have.";
  103. next;
  104. switch(select("1 Old Card Album - 50 Points","20 Yggdrasil Berry - 50 Points","10 Blue Potion - 20 Points","4 Honey - 1 Point","^777777Nerver mind.^000000")) {
  105. case 1:
  106. if (.@points < 100) break;
  107. mes "[Putty]";
  108. mes "Great, I wish you the best";
  109. mes "of luck with this album. I have a";
  110. mes "very good feeling about this one!";
  111. set oversea_event9, .@points - 100;
  112. getitem 616,1;
  113. close;
  114. case 2:
  115. if (.@points < 50) break;
  116. mes "[Putty]";
  117. mes "Oh, you must like adventures.";
  118. mes "Here you go, just what you need!";
  119. set oversea_event9, .@points - 50;
  120. getitem 607,20;
  121. close;
  122. case 3:
  123. if (.@points < 20) break;
  124. mes "[Putty]";
  125. mes "Blue Potions? Are you sure?";
  126. mes "If that's what you want, here they are!";
  127. set oversea_event9, .@points - 20;
  128. getitem 505,10;
  129. close;
  130. case 4:
  131. if (.@points < 1) break;
  132. mes "[Putty]";
  133. mes "It took many bees";
  134. mes "to make all of this.";
  135. mes "Make good use of it.";
  136. set oversea_event9, .@points - 1;
  137. getitem 518,4;
  138. close;
  139. case 5:
  140. mes "[Putty]";
  141. mes "Alright, come back when you have more points.";
  142. close;
  143. }
  144. mes "[Putty]";
  145. mes "Sorry, but you don't have enough points.";
  146. close;
  147. } else {
  148. mes "[Putty]";
  149. mes "You have 0 points. You need at least 1 point to exchange.";
  150. }
  151. break;
  152. }
  153. close;
  154. OnInit:
  155. setarray .card1[0], 4001,4006,4009,4019,4075,4033,4012,4016,4026,4022,
  156. 4027,4028,4038,4025,4021,4050,4079,4081,4090,4094,
  157. 4101,4104,4110,4114,4119,4108,4095,4231,4280,4008,
  158. 4011,4013,4014,4015,4020,4032,4037,4039,4041,4045,
  159. 4046,4010,4023,4029,4052,4048,4056,4071,4093,4031,
  160. 4036,4034,4042,4055,4061,4087,4096,4116,4122,4170,
  161. 4215,4220,4228,4226,4212,4227,4267,4257,4278,4286,
  162. 4287,4292,4311,4315,4319,4322,4084,4078,4113,4149,
  163. 4153,4196,4240,4247,4256,4057,4066,4067,4112,4150,
  164. 4152,4186,4187,4181,4173,4167,4162,4176,4195,4193,
  165. 4200,4223,4194,4190,4189,4192,4224,4244,4248,4261,
  166. 4260,4259,4274,4275,4313,4299,4304,4294,4076,4127,
  167. 4154,4157,4156,4213,4214,4225,4235;
  168. setarray .card2[0], 4293,4297,4288,4283,4295,4307,4308,4309,4132,4326,
  169. 4341,4335,4337,4345,4344,4331,4333,4332,4089,4161,
  170. 4177,4178,4180,4184,4191,4206,4199,4273,4282,4268,
  171. 4289,4321,4316,4343,4339,4369,4377,4385,4383,4382,
  172. 4380,4381,4378,4379,4390,4389,4388,4391,4405,4400,
  173. 4401,4402,4404,4002,4003,4004,4005,4007,4017,4024,
  174. 4030,4035,4040,4043,4044,4049,4051,4053,4058,4060,
  175. 4062,4063,4064,4065,4068,4069,4070,4072,4073,4074,
  176. 4077,4080,4082,4083,4085,4086,4088,4091,4092,4097,
  177. 4098,4099,4100,4102,4103,4106,4107,4109,4111,4115,
  178. 4117,4118,4120,4124,4125,4126,4138,4139,4141,4151,
  179. 4158,4164,4165,4182,4185,4159,4160,4166,4172,4175,
  180. 4188,4201,4202,4204,4205,4208,4209;
  181. setarray .card3[0], 4120,4216,4217,4219,4221,4222,4230,4234,4233,4232,
  182. 4237,4238,4242,4243,4245,4246,4249,4252,4255,4258,
  183. 4262,4264,4276,4270,4271,4218,4239,4251,4253,4269,
  184. 4334,4105,4133,4136,4229,4272,4277,4279,4281,4284,
  185. 4285,4290,4296,4298,4301,4310,4314,4317,4325,4327,
  186. 4328,4329,4338,4340,4346,4347,4348,4349,4350,4351,
  187. 4353,4354,4355,4356,4358,4360,4362,4364,4366,4368,
  188. 4370,4371,4373,4375,4387,4406,4129,4155,4291,4392,
  189. 4393,4394,4409,4410,4411,4412,4413,4414,4415,4416,
  190. 4417,4418,4420,4421,4422,4423,4424,4427,4427,4428,
  191. 4429,4431,4432,4433,4434,4435,4436,4437,4438,4439,
  192. 4440,4442,4443,4444,4445,4447,4448,4449,4450,4452,
  193. 4453;
  194. setarray .card[1], getarraysize(.card1), getarraysize(.card2), getarraysize(.card3);
  195. end;
  196. }