banker.txt 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419
  1. //| ~~~~~~~~~~~ Information ~~~~~~~~~~~
  2. //| | This is a simple banking npc, |
  3. //| | which uses coins to store zeny |
  4. //| | instead of using those global |
  5. //| | variables :P |
  6. //| | |
  7. //| | It's fully customizable, you |
  8. //| | can exchange the coin ID used |
  9. //| | at will, it won't affect the |
  10. //| | script whatsoever =3 |
  11. //| | |
  12. //| | The prices can also be set, the |
  13. //| | way you like the most, as they |
  14. //| | won't affect the script either |
  15. //| | |
  16. //| | No db/client files modification |
  17. //| | needed, just "Plug&Play" ;P |
  18. //| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  19. //| Revision:
  20. //| v.1.0: Released script. No problems or bugs found, at least :P
  21. //| It's your duty to find them now if there are.
  22. //| @minvalue must contain the coin price of the lowest coin value
  23. //| in order for the script to work correctly. By default it's set
  24. //| to the bronze coin
  25. //| Revision:
  26. //| v.2.0: Added a Mix option in the Zeny to Coin function,
  27. //| where it allows you to split your desired Zeny into
  28. //| the coins you wish to obtain, without having to go
  29. //| through the other functions to obtain them all. That way
  30. //| you can get them all at once ;3
  31. //|
  32. //| It also displays the total zeny being exchanged,
  33. //| the total coins obtained and the difference between
  34. //| the amount of zeny you've inputted and the sum of
  35. //| the coin's values.
  36. //| Revision:
  37. //| v.2.5: Replaced all the coin names with a variable that has
  38. //| getitemname(<coin_id), for more customization of the script.
  39. //|
  40. //| Fixed aswell a 0 at the mixing function, it had an unexistant
  41. //| variable plus it was rendering a message to 0. Pretty bad =/
  42. //|
  43. //| The implementation of the getitemname was because some people
  44. //| complaining that those items seemed to be wrong, that the name
  45. //| in the db was Platinum while the script had Silver, so well,
  46. //| there you have it. No more silver coins, thanks to you :)
  47. //| Upcomming possible updates:
  48. //| v.3.0: Adding a refining system, so you can gather ore and the likes
  49. //| to make your own coins. They will have a failure chance
  50. //| of course. You will need, for now: 10 ores of the type of
  51. //| coin you wish, a mini furnace, an anvil depending on what
  52. //| You're crafting, and a hammer according to it.
  53. //| Copyright © 2006 erKURITA. All Rights Reserved
  54. prontera.gat,155,188,3 script Zacariath Madhat 872,{
  55. //|~~~~~~~~~ Settings of the NPC: ~~~~~~~~~~~~~~~~~
  56. set @npcname$,"^999999[Zach]^000000"; //|
  57. set @bronzeprice,10000; //|
  58. set @silverprice,100000; //|
  59. set @goldprice,1000000; //|
  60. set @mithrilprice,10000000; //|
  61. set @bronzecoinid,673; //|
  62. set @silvercoinid,677; //|
  63. set @goldcoinid,671; //|
  64. set @mithrilcoinid,674; //|
  65. set @minvalue,@bronzeprice; //|
  66. set @name1$,getitemname(@bronzecoinid); //|
  67. set @name2$,getitemname(@silvercoinid); //|
  68. set @name3$,getitemname(@goldcoinid); //|
  69. set @name4$,getitemname(@mithrilcoinid); //|
  70. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  71. mes @npcname$;
  72. mes "Hi "+strcharinfo(0)+", I'm this town's banker";
  73. mes "I can allow you to exchange your zeny into useful and handy coins, which you can use to make trades between players, or just save them";
  74. next;
  75. mes @npcname$;
  76. mes "^996600"+@name1$+"s^000000 are worth "+@bronzeprice+"z, ^999999"+@name2$+"s^000000 are worth "+@silverprice+"z, ^FFCC00"+@name3$+"s^000000 "+@goldprice+"z, ^CCCCCC"+@name4$+"s^000000 are worth "+@mithrilprice+"z";
  77. next;
  78. goto L_Menu;
  79. L_Menu:
  80. mes @npcname$;
  81. mes "What do you want to do then?";
  82. menu "Exchange my coins into zeny",L_CoinZeny,"Exchange my zeny into coins",L_ZenyCoin,"Nothing for now, sorry",L_End;
  83. //| Here starts the Coin to Zeny Exchange
  84. L_CoinZeny:
  85. next;
  86. mes @npcname$;
  87. mes "First than anything, what kind of coins are you going to exchange?";
  88. menu @name1$+"s",L_Bronze,@name2$+"s",L_Silver,@name3$+"s",L_Gold,@name4$+"s",L_Mithril,"None for now",L_Menu;
  89. L_Bronze:
  90. callsub L_Coincheckout,@bronzecoinid,@bronzeprice;
  91. goto L_CoinZeny;
  92. L_Silver:
  93. callsub L_Coincheckout,@silvercoinid,@silverprice;
  94. goto L_CoinZeny;
  95. L_Gold:
  96. callsub L_Coincheckout,@goldcoinid,@goldprice;
  97. goto L_CoinZeny;
  98. L_Mithril:
  99. callsub L_Coincheckout,@mithrilcoinid,@mithrilprice;
  100. goto L_CoinZeny;
  101. L_Coincheckout:
  102. switch(getarg(0)) {
  103. case @bronzecoinid:
  104. set @coinname$,"^996600"+getitemname(getarg(0))+"^000000";
  105. goto L_PreInputing;
  106. case @silvercoinid:
  107. set @coinname$,"^999999"+getitemname(getarg(0))+"^000000";
  108. goto L_PreInputing;
  109. case @goldcoinid:
  110. set @coinname$,"^FFCC00"+getitemname(getarg(0))+"^000000";
  111. goto L_PreInputing;
  112. case @mithrilcoinid:
  113. set @coinname$,"^CCCCCC"+getitemname(getarg(0))+"^000000";
  114. goto L_PreInputing;
  115. }
  116. L_PreInputing:
  117. next;
  118. mes @npcname$;
  119. mes "Let's see, how many coins do you want to exchange?";
  120. next;
  121. goto L_Inputing;
  122. L_Inputing:
  123. input @coinamount;
  124. if (@coinamount == 0) {
  125. mes @npcname$;
  126. mes "You didn't input any amount, please retry";
  127. next;
  128. goto L_Inputing;
  129. } else if (countitem(getarg(0)) < @coinamount) {
  130. mes @npcname$;
  131. mes "You don't have enough coins, please get some";
  132. next;
  133. goto L_Menu;
  134. } else
  135. next;
  136. mes @npcname$;
  137. mes "So, you want to exchange "+@coinamount+" "+@coinname$+" ?";
  138. menu "Yes, I want to exchange this much",L_Proceed,"No, I want to exchange something else",L_CoinZeny,"No, I want to input another number",L_Inputing,"No, I dont want to exchange anything",L_Menu;
  139. L_Proceed:
  140. next;
  141. set @price,getarg(1)*@coinamount;
  142. set Zeny,Zeny+@price;
  143. delitem getarg(0),@coinamount;
  144. mes @npcname$;
  145. mes "There we go, here's your money";
  146. next;
  147. return;
  148. //| Here starts the Zeny to Coin exchange.
  149. L_ZenyCoin:
  150. next;
  151. if (MaxWeight*50/100 < Weight) {
  152. if (MaxWeight*90/100 < Weight) {
  153. mes @npcname;
  154. mes "Sorry but you have more than 90% weight. Your coins might drop. I can't give you anything.";
  155. next;
  156. goto L_Menu;
  157. } else
  158. mes @npcname$;
  159. mes "You have 50% or more weight, do you still want to continue?";
  160. menu "Yes",L_ContinueZenyCoin,"No, thanks",L_Menu;
  161. }
  162. L_ContinueZenyCoin:
  163. mes @npcname$;
  164. mes "First, how much zeny do you want to exchange";
  165. callsub L_Inputingzeny;
  166. callsub L_Zenycoins;
  167. next;
  168. mes @npcname$;
  169. mes "You can have, with "+@zenyamount+":";
  170. mes "^996600"+@bronzezeny+"^000000 "+@name1$+"s";
  171. mes "^999999"+@silverzeny+"^000000 "+@name2$+"s";
  172. mes "^FFCC00"+@goldzeny+"^000000 "+@name3$+"s";
  173. mes "or";
  174. mes "^CCCCCC"+@mithrilzeny+"^000000 "+@name4$+"s";
  175. next;
  176. if (@zenyamount < @minvalue) goto L_Moremoney;
  177. goto L_ZenyCoin2;
  178. L_ZenyCoin2:
  179. mes @npcname$;
  180. mes "Which coins do you want? Or do you want a mix of them?";
  181. menu "I want the "+@name1$+"s",L_Bronzes,"I want the "+@name2$+"s",L_Silvers,"I want the "+@name3$+"s",L_Golds,"I want the "+@name4$+"s",L_Mithrils,"I want a mix of them",L_Mix,"Nothing for now, sorry",L_Menu;
  182. L_Bronzes:
  183. if (@bronzezeny == 0) goto L_Moremoney;
  184. callsub L_Zenycheckout,@bronzecoinid,@bronzeprice,@bronzezeny;
  185. goto L_Menu;
  186. L_Silvers:
  187. if (@silverzeny == 0) goto L_Moremoney;
  188. callsub L_Zenycheckout,@silvercoinid,@silverprice,@silverzeny;
  189. goto L_Menu;
  190. L_Golds:
  191. if (@goldzeny == 0) goto L_Moremoney;
  192. callsub L_Zenycheckout,@goldcoinid,@goldprice,@goldzeny;
  193. goto L_Menu;
  194. L_Mithrils:
  195. if (@mithrilzeny == 0) goto L_Moremoney;
  196. callsub L_Zenycheckout,@mithrilcoinid,@mithrilprice,@mithrilzeny;
  197. goto L_Menu;
  198. L_Zenycheckout:
  199. next;
  200. set @itemid,getarg(0);
  201. set @pricea,getarg(1)*getarg(2);
  202. getitem @itemid,getarg(2);
  203. set Zeny,Zeny-@pricea;
  204. mes @npcname$;
  205. mes "There you go, here's your coins";
  206. next;
  207. return;
  208. L_Zenycoins:
  209. set @bronzezeny,@zenyamount/@bronzeprice;
  210. set @silverzeny,@zenyamount/@silverprice;
  211. set @goldzeny,@zenyamount/@goldprice;
  212. set @mithrilzeny,@zenyamount/@mithrilprice;
  213. return;
  214. L_Inputingzeny:
  215. input @zenyamount;
  216. if (Zeny == 0) {
  217. mes @npcname$;
  218. mes "You don't have any Zeny left. I can't do anything. Get some Zeny first";
  219. next;
  220. goto L_Menu;
  221. } else if (@zenyamount == 0) {
  222. mes @npcname$;
  223. mes "You didn't input any amount, please retry";
  224. next;
  225. goto L_Inputingzeny;
  226. } else if (@zenyamount > Zeny) {
  227. mes @npcname$;
  228. mes "The inputted zeny amount is bigger than your actual zeny amount";
  229. mes "Please re-entry another amount";
  230. next;
  231. goto L_Inputingzeny;
  232. } else return;
  233. //| Other labels
  234. L_Moremoney:
  235. mes @npcname$;
  236. mes "You need to get more zeny, I can't give you anything with "+@zenyamount+"z, sorry";
  237. next;
  238. goto L_Menu;
  239. L_End:
  240. next;
  241. mes @npcname$;
  242. mes "Good to see you and hope to see you again. Bye";
  243. close;
  244. //| Mix function
  245. L_Mix:
  246. next;
  247. mes @npcname$;
  248. mes "Ok, let's start with ^996600"+@name1$+"s^000000";
  249. next;
  250. mes @npcname$;
  251. mes "How many coins do you want?";
  252. input @bronzecoins;
  253. next;
  254. set @totalzeny,@bronzecoins*@bronzeprice;
  255. set @totalcoins,@bronzecoins;
  256. mes "Zeny Amount Inputted: ^000066"+@zenyamount+"^000000";
  257. mes "Coins:";
  258. mes " ^996600"+@name1$+"s^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000";
  259. mes "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯";
  260. if (@totalzeny > @zenyamount) {
  261. mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000";
  262. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  263. goto L_Overzeny;
  264. } else
  265. mes "TOTAL Zeny: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000";
  266. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  267. next;
  268. if (@totalzeny > @zenyamount)
  269. mes @npcname$;
  270. mes "Is this enough or do you want more?";
  271. menu "It's enough, thanks",L_Payoff,"No, I want some more",-;
  272. next;
  273. mes @npcname$;
  274. mes "Now ^999999"+@name2$+"s^000000. How many coins do you want?";
  275. next;
  276. input @silvercoins;
  277. next;
  278. set @totalzeny,@bronzecoins*@bronzeprice+@silvercoins*@silverprice;
  279. set @totalcoins,@bronzecoins+@silvercoins;
  280. mes "Zeny Amount Inputted: ^000066"+@zenyamount+"^000000";
  281. mes "Coins:";
  282. mes " ^996600"+@name1$+"s^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000";
  283. mes " ^999999"+@name2$+"s^000000: "+@silvercoins+" ^CC0000"+@silvercoins*@silverprice+"^000000";
  284. mes "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯";
  285. if (@totalzeny > @zenyamount) {
  286. mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000";
  287. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  288. goto L_Overzeny;
  289. } else
  290. mes "TOTAL Zeny: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000";
  291. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  292. next;
  293. if (@totalzeny > @zenyamount) goto L_Overzeny;
  294. mes @npcname$;
  295. mes "Is this enough or do you want more?";
  296. menu "It's enough, thanks",L_Payoff,"No, I want some more",-;
  297. next;
  298. mes @npcname$;
  299. mes "Now ^FFCC00"+@name3$+"s^000000. How many coins do you want?";
  300. input @goldcoins;
  301. next;
  302. set @totalzeny,@bronzecoins*@bronzeprice+@silvercoins*@silverprice+@goldcoins*@goldprice;
  303. set @totalcoins,@bronzecoins+@silvercoins+@goldcoins;
  304. mes "Zeny Amount Inputted: ^000066"+@zenyamount+"^000000";
  305. mes "Coins:";
  306. mes " ^996600"+@name1$+"s^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000";
  307. mes " ^999999"+@name2$+"s^000000: "+@silvercoins+" ^CC0000"+@silvercoins*@silverprice+"^000000";
  308. mes " ^FFCC00"+@name3$+"s^000000: "+@goldcoins+" ^CC0000"+@goldcoins*@goldprice+"^000000";
  309. mes "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯";
  310. if (@totalzeny > @zenyamount) {
  311. mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000";
  312. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  313. goto L_Overzeny;
  314. } else
  315. mes "TOTAL Zeny: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000";
  316. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  317. next;
  318. if (@totalzeny > @zenyamount) goto L_Overzeny;
  319. mes @npcname$;
  320. mes "Is this enough or do you want more?";
  321. menu "It's enough, thanks",L_Payoff,"No, I want some more",-;
  322. next;
  323. mes @npcname$;
  324. mes "Now ^CCCCCC"+@name4$+"s^000000. How many coins do you want?";
  325. input @mithrilcoins;
  326. next;
  327. set @totalzeny,@bronzecoins*@bronzeprice+@silvercoins*@silverprice+@goldcoins*@goldprice+@mithrilcoins*@mithrilprice;
  328. set @totalcoins,@bronzecoins+@silvercoins+@goldcoins+@mithrilcoins;
  329. mes "Zeny Amount Inputted: ^000066"+@zenyamount+"^000000";
  330. mes "Coins:";
  331. mes " ^996600"+@name1$+"s^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000";
  332. mes " ^999999"+@name2$+"s^000000: "+@silvercoins+" ^CC0000"+@silvercoins*@silverprice+"^000000";
  333. mes " ^FFCC00"+@name3$+"s^000000: "+@goldcoins+" ^CC0000"+@goldcoins*@goldprice+"^000000";
  334. mes " ^CCCCCC"+@name4$+"s^000000: "+@mithrilcoins+" ^CC0000"+@mithrilcoins*@mithrilprice+"^000000";
  335. mes "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯";
  336. if (@totalzeny > @zenyamount) {
  337. mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000";
  338. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  339. goto L_Overzeny;
  340. } else
  341. mes "TOTAL: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000";
  342. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  343. next;
  344. if (@totalzeny > @zenyamount) goto L_Overzeny;
  345. mes @npcname$;
  346. mes "Is this ok?: "+@bronzecoins+" "+@name1$+"s, "+@silvercoins+" "+@name2$+"s, "+@goldcoins+" "+@name3$+"s, "+@mithrilcoins+" "+@name4$+"s, for a total amount of "+@totalzeny;
  347. menu "Yes, it's ok",L_Payoff,"No, I want to re-intro them",L_Mix,"Sorry, I dont want anything",L_Menu;
  348. L_Payoff:
  349. next;
  350. if (@zenyamount > Zeny) goto L_Overzeny;
  351. set Zeny,Zeny-@totalzeny;
  352. getitem @bronzecoinid,@bronzecoins;
  353. getitem @silvercoinid,@silvercoins;
  354. getitem @goldcoinid,@goldcoins;
  355. getitem @mithrilcoinid,@mithrilcoins;
  356. mes @npcname$;
  357. mes "There you go, here's your coins";
  358. next;
  359. set @bronzecoins,0;
  360. set @silvercoins,0;
  361. set @goldcoins,0;
  362. set @mithrilcoins,0;
  363. goto L_End;
  364. L_Overzeny:
  365. next;
  366. mes @npcname$;
  367. mes "Sorry, I can't do anything else. Either the sum of all the coins you inputted is bigger than the zeny amount inputted, or the inputted amout of zeny is bigger that your total Zeny. Please retry.";
  368. next;
  369. goto L_Menu;
  370. OnInit:
  371. setitemscript 671,"{}";
  372. end;
  373. }