card_trader.txt 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. //===== rAthena Script =======================================
  2. //= Card Trader
  3. //===== By: ==================================================
  4. //= Elias (og2)
  5. //===== Current Version: =====================================
  6. //= 1.4
  7. //===== Compatible With: =====================================
  8. //= rAthena Project; SVN r15340+
  9. //===== Description: =========================================
  10. //= Card and Points Trader
  11. //===== Additional Comments: =================================
  12. //= 1.0 Translated from the Official [Elias]
  13. //= 1.1 Fixed variables and optimized script [Elias]
  14. //= 1.2 Fixed char being stuck with breaks [Elias] (bugreport:5374)
  15. //= 1.3 Optimized: reduced from 123kb to 7kb! [Euphy]
  16. //= 1.4 Variables don't need to load OnInit. [Euphy]
  17. //= 1.4a Misc. [Capuche]
  18. //============================================================
  19. prontera,115,90,0 script Putty 4_F_01,{
  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 .@size_card[1], getarraysize(.@card1), getarraysize(.@card2), getarraysize(.@card3);
  60. .@points = oversea_event9;
  61. if (!.@points) {
  62. mes "[Putty]";
  63. mes "Hi there.";
  64. mes "I don't know if I can be";
  65. mes "of any assistance, but I";
  66. mes "am trying to help older veterans";
  67. mes "by exchaning the cards that";
  68. mes "they are no longer using.";
  69. next;
  70. switch(select("Ask for more information!","I don't have any cards right now.")) {
  71. case 1:
  72. mes "[Putty]";
  73. mes "I am giving 1 point for each card that you bring me.";
  74. mes "The points can be used to exchange for items that I have.";
  75. next;
  76. mes "[Putty]";
  77. mes "For ^CC0000100 points^000000: ^0000CC1 Old Card Album^000000.";
  78. mes "For ^CC000050 points^000000: ^0000CC20 Yggdrasil Berry^000000.";
  79. mes "For ^CC000020 points^000000: ^0000CC10 Blue Potion^000000.";
  80. mes "For ^CC00001 point^000000: ^0000CC4 Honey^000000.";
  81. next;
  82. break;
  83. case 2:
  84. mes "[Putty]";
  85. mes "Well, remember this offer!";
  86. close;
  87. }
  88. } else {
  89. mes "[Putty]";
  90. mes "Welcome back!";
  91. mes "I see you already have some";
  92. mes "trading points. Actually, you currently have ^00cc00" + .@points + "^000000.";
  93. next;
  94. mes "[Putty]";
  95. mes "Would you like to exchange these";
  96. mes "points now, or you would like to exchange more cards?";
  97. next;
  98. }
  99. switch(select("I would like to exchange cards.","Can I exchange the points?")) {
  100. case 1:
  101. mes "[Putty]";
  102. mes "Please tell me what card you want to exchange.";
  103. next;
  104. input .@i$;
  105. .@input$ = "_"+.@i$;
  106. freeloop(1);
  107. for(.@j = 1; .@j<4; .@j++) {
  108. for(.@i = 0; .@i<.@size_card[.@j]; .@i++)
  109. if (compare(.@input$,"_"+getitemname(getd(".@card"+.@j+"["+.@i+"]")))) {
  110. .@card = getd(".@card"+.@j+"["+.@i+"]");
  111. break;
  112. }
  113. sleep2 10; // For good measure
  114. if (.@card) break;
  115. }
  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. .@count = countitem(.@card);
  121. if (!.@count) {
  122. mes "You don't have any ^0055FF"+callfunc("F_GetPlural",getitemname(.@card))+"^000000 with you!";
  123. close;
  124. }
  125. mes "You've got ^0055FF"+callfunc("F_InsertPlural",.@count,getitemname(.@card))+"^000000.";
  126. mes " ";
  127. mes "Would you like to exchange 1 point for each of them?";
  128. next;
  129. switch(select("Yes, please!","No, thank you.")) {
  130. case 1:
  131. delitem .@card,.@count;
  132. oversea_event9 = (.@points+.@count);
  133. mes "[Putty]";
  134. mes "Alright, you have received ^CC0000"+.@count+"^000000 points.";
  135. break;
  136. case 2:
  137. mes "[Putty]";
  138. mes "Okay, let me know if I can help you with something else.";
  139. break;
  140. }
  141. }
  142. close;
  143. case 2:
  144. if (.@points) {
  145. mes "[Putty]";
  146. mes "These are the items that I have.";
  147. next;
  148. 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")) {
  149. case 1:
  150. if (.@points < 100) break;
  151. mes "[Putty]";
  152. mes "Great, I wish you the best";
  153. mes "of luck with this album. I have a";
  154. mes "very good feeling about this one!";
  155. oversea_event9 = .@points - 100;
  156. getitem 616,1;
  157. close;
  158. case 2:
  159. if (.@points < 50) break;
  160. mes "[Putty]";
  161. mes "Oh, you must like adventures.";
  162. mes "Here you go, just what you need!";
  163. oversea_event9 = .@points - 50;
  164. getitem 607,20;
  165. close;
  166. case 3:
  167. if (.@points < 20) break;
  168. mes "[Putty]";
  169. mes "Blue Potions? Are you sure?";
  170. mes "If that's what you want, here they are!";
  171. oversea_event9 = .@points - 20;
  172. getitem 505,10;
  173. close;
  174. case 4:
  175. if (.@points < 1) break;
  176. mes "[Putty]";
  177. mes "It took many bees";
  178. mes "to make all of this.";
  179. mes "Make good use of it.";
  180. oversea_event9 = .@points - 1;
  181. getitem 518,4;
  182. close;
  183. case 5:
  184. mes "[Putty]";
  185. mes "Alright, come back when you have more points.";
  186. close;
  187. }
  188. mes "[Putty]";
  189. mes "Sorry, but you don't have enough points.";
  190. close;
  191. } else {
  192. mes "[Putty]";
  193. mes "You have 0 points. You need at least 1 point to exchange.";
  194. close;
  195. }
  196. }
  197. }