card_trader.txt 7.0 KB

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