card_trader.txt 7.2 KB

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