banker.txt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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. //| Revision:
  48. //| v.2.6: Added another Weight check to prevent coins from dropping
  49. //| to the ground because A) Too many coins (more than 30,000 ea)
  50. //| B) Your current weight + total coins weight were greater than
  51. //| your max weight, causing them to drop due to "over-weight".
  52. //| Thanks to Niktout for spotting it.
  53. //| Revision:
  54. //| v.2.7: Added a check to the Zeny -> Coin Mix label. It seems you
  55. //| can trade with negative zeny (meh...). This should prevent it.
  56. //| Thanks to Niktout.
  57. //| Upcomming possible updates:
  58. //| v.3.0: Adding a refining system, so you can gather ore and the likes
  59. //| to make your own coins. They will have a failure chance
  60. //| of course. You will need, for now: 10 ores of the type of
  61. //| coin you wish, a mini furnace, an anvil depending on what
  62. //| You're crafting, and a hammer according to it.
  63. //| Copyright © 2006 erKURITA. All Rights Reserved
  64. prontera.gat,155,188,3 script Zacariath Madhat 872,{
  65. //|~~~~~~~~~ Settings of the NPC: ~~~~~~~~~~~~~~~~~
  66. set @npcname$,"^999999[Zach]^000000"; //|
  67. set @bronzeprice,10000; //|
  68. set @silverprice,100000; //|
  69. set @goldprice,1000000; //|
  70. set @mithrilprice,10000000; //|
  71. set @bronzecoinid,673; //|
  72. set @silvercoinid,677; //|
  73. set @goldcoinid,671; //|
  74. set @mithrilcoinid,674; //|
  75. set @minvalue,@bronzeprice; //|
  76. set @name1$,getitemname(@bronzecoinid); //|
  77. set @name2$,getitemname(@silvercoinid); //|
  78. set @name3$,getitemname(@goldcoinid); //|
  79. set @name4$,getitemname(@mithrilcoinid); //|
  80. //|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  81. mes @npcname$;
  82. mes "Hi "+strcharinfo(0)+", I'm this town's banker";
  83. 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";
  84. next;
  85. mes @npcname$;
  86. 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";
  87. next;
  88. goto L_Menu;
  89. L_Menu:
  90. mes @npcname$;
  91. mes "What do you want to do then?";
  92. menu "Exchange my coins into zeny",L_CoinZeny,"Exchange my zeny into coins",L_ZenyCoin,"Nothing for now, sorry",L_End;
  93. //| Here starts the Coin to Zeny Exchange
  94. L_CoinZeny:
  95. next;
  96. mes @npcname$;
  97. mes "First than anything, what kind of coins are you going to exchange?";
  98. menu @name1$+"s",L_Bronze,@name2$+"s",L_Silver,@name3$+"s",L_Gold,@name4$+"s",L_Mithril,"None for now",L_Menu;
  99. L_Bronze:
  100. callsub L_Coincheckout,@bronzecoinid,@bronzeprice;
  101. goto L_CoinZeny;
  102. L_Silver:
  103. callsub L_Coincheckout,@silvercoinid,@silverprice;
  104. goto L_CoinZeny;
  105. L_Gold:
  106. callsub L_Coincheckout,@goldcoinid,@goldprice;
  107. goto L_CoinZeny;
  108. L_Mithril:
  109. callsub L_Coincheckout,@mithrilcoinid,@mithrilprice;
  110. goto L_CoinZeny;
  111. L_Coincheckout:
  112. switch(getarg(0)) {
  113. case @bronzecoinid:
  114. set @coinname$,"^996600"+getitemname(getarg(0))+"^000000";
  115. goto L_PreInputing;
  116. case @silvercoinid:
  117. set @coinname$,"^999999"+getitemname(getarg(0))+"^000000";
  118. goto L_PreInputing;
  119. case @goldcoinid:
  120. set @coinname$,"^FFCC00"+getitemname(getarg(0))+"^000000";
  121. goto L_PreInputing;
  122. case @mithrilcoinid:
  123. set @coinname$,"^CCCCCC"+getitemname(getarg(0))+"^000000";
  124. goto L_PreInputing;
  125. }
  126. L_PreInputing:
  127. next;
  128. mes @npcname$;
  129. mes "Let's see, how many coins do you want to exchange?";
  130. next;
  131. goto L_Inputing;
  132. L_Inputing:
  133. input @coinamount;
  134. if (@coinamount == 0) {
  135. mes @npcname$;
  136. mes "You didn't input any amount, please retry";
  137. next;
  138. goto L_Inputing;
  139. } else if (countitem(getarg(0)) < @coinamount) {
  140. mes @npcname$;
  141. mes "You don't have enough coins, please get some";
  142. next;
  143. goto L_Menu;
  144. } else
  145. next;
  146. mes @npcname$;
  147. mes "So, you want to exchange "+@coinamount+" "+@coinname$+" ?";
  148. 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;
  149. L_Proceed:
  150. next;
  151. set @price,getarg(1)*@coinamount;
  152. set Zeny,Zeny+@price;
  153. delitem getarg(0),@coinamount;
  154. mes @npcname$;
  155. mes "There we go, here's your money";
  156. next;
  157. return;
  158. //| Here starts the Zeny to Coin exchange.
  159. L_ZenyCoin:
  160. next;
  161. if (MaxWeight*50/100 < Weight) {
  162. if (MaxWeight*90/100 < Weight) {
  163. mes @npcname$;
  164. mes "Sorry but you have more than 90% weight. Your coins might drop. I can't give you anything.";
  165. next;
  166. goto L_Menu;
  167. } else
  168. mes @npcname$;
  169. mes "You have 50% or more weight, do you still want to continue?";
  170. menu "Yes",L_ContinueZenyCoin,"No, thanks",L_Menu;
  171. }
  172. L_ContinueZenyCoin:
  173. mes @npcname$;
  174. mes "First, how much zeny do you want to exchange";
  175. callsub L_Inputingzeny;
  176. callsub L_Zenycoins;
  177. next;
  178. mes @npcname$;
  179. mes "You can have, with "+@zenyamount+":";
  180. mes "^996600"+@bronzezeny+"^000000 "+@name1$+"s";
  181. mes "^999999"+@silverzeny+"^000000 "+@name2$+"s";
  182. mes "^FFCC00"+@goldzeny+"^000000 "+@name3$+"s";
  183. mes "or";
  184. mes "^CCCCCC"+@mithrilzeny+"^000000 "+@name4$+"s";
  185. next;
  186. if (@zenyamount < @minvalue) goto L_Moremoney;
  187. goto L_ZenyCoin2;
  188. L_ZenyCoin2:
  189. mes @npcname$;
  190. mes "Which coins do you want? Or do you want a mix of them?";
  191. 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;
  192. L_Bronzes:
  193. if (@bronzezeny == 0) goto L_Moremoney;
  194. callsub L_Zenycheckout,@bronzecoinid,@bronzeprice,@bronzezeny;
  195. goto L_Menu;
  196. L_Silvers:
  197. if (@silverzeny == 0) goto L_Moremoney;
  198. callsub L_Zenycheckout,@silvercoinid,@silverprice,@silverzeny;
  199. goto L_Menu;
  200. L_Golds:
  201. if (@goldzeny == 0) goto L_Moremoney;
  202. callsub L_Zenycheckout,@goldcoinid,@goldprice,@goldzeny;
  203. goto L_Menu;
  204. L_Mithrils:
  205. if (@mithrilzeny == 0) goto L_Moremoney;
  206. callsub L_Zenycheckout,@mithrilcoinid,@mithrilprice,@mithrilzeny;
  207. goto L_Menu;
  208. L_Zenycheckout:
  209. next;
  210. if (((getiteminfo(getarg(0),6))*getarg(2)) > (MaxWeight-Weight)) {
  211. mes @npcname$;
  212. mes "Sorry, your max weight does not allow me to give you this much of zeny coins";
  213. mes "Either choose another type of coins or a lower quantity, thanks";
  214. close;
  215. }
  216. if (getarg(2) > 30000) {
  217. mes @npcname$;
  218. mes "Sorry, I can't give you more than 30,000 ea";
  219. mes "Pick another coin type";
  220. close;
  221. }
  222. set @itemid,getarg(0);
  223. set @pricea,getarg(1)*getarg(2);
  224. getitem @itemid,getarg(2);
  225. set Zeny,Zeny-@pricea;
  226. mes @npcname$;
  227. mes "There you go, here's your coins";
  228. next;
  229. return;
  230. L_Zenycoins:
  231. set @bronzezeny,@zenyamount/@bronzeprice;
  232. set @silverzeny,@zenyamount/@silverprice;
  233. set @goldzeny,@zenyamount/@goldprice;
  234. set @mithrilzeny,@zenyamount/@mithrilprice;
  235. return;
  236. L_Inputingzeny:
  237. input @zenyamount;
  238. if (Zeny == 0) {
  239. mes @npcname$;
  240. mes "You don't have any Zeny left. I can't do anything. Get some Zeny first";
  241. next;
  242. goto L_Menu;
  243. } else if (@zenyamount == 0) {
  244. mes @npcname$;
  245. mes "You didn't input any amount, please retry";
  246. next;
  247. goto L_Inputingzeny;
  248. } else if (@zenyamount > Zeny) {
  249. mes @npcname$;
  250. mes "The inputted zeny amount is bigger than your actual zeny amount";
  251. mes "Please re-entry another amount";
  252. next;
  253. goto L_Inputingzeny;
  254. } else return;
  255. //| Other labels
  256. L_Moremoney:
  257. mes @npcname$;
  258. mes "You need to get more zeny, I can't give you anything with "+@zenyamount+"z, sorry";
  259. next;
  260. goto L_Menu;
  261. L_End:
  262. next;
  263. mes @npcname$;
  264. mes "Good to see you and hope to see you again. Bye";
  265. close;
  266. //| Mix function
  267. L_Mix:
  268. next;
  269. mes @npcname$;
  270. mes "Ok, let's start with ^996600"+@name1$+"s^000000";
  271. next;
  272. mes @npcname$;
  273. mes "How many coins do you want?";
  274. input @bronzecoins;
  275. next;
  276. set @totalzeny,@bronzecoins*@bronzeprice;
  277. set @totalcoins,@bronzecoins;
  278. mes "Zeny Amount Inputted: ^000066"+@zenyamount+"^000000";
  279. mes "Coins:";
  280. mes " ^996600"+@name1$+"s^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000";
  281. mes "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯";
  282. if (@totalzeny > @zenyamount || @totalzeny < 0) {
  283. mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000";
  284. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  285. goto L_Overzeny;
  286. } else
  287. mes "TOTAL Zeny: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000";
  288. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  289. next;
  290. if (@totalzeny > @zenyamount || @totalzeny < 0)
  291. mes @npcname$;
  292. mes "Is this enough or do you want more?";
  293. menu "It's enough, thanks",L_Payoff,"No, I want some more",-;
  294. next;
  295. mes @npcname$;
  296. mes "Now ^999999"+@name2$+"s^000000. How many coins do you want?";
  297. next;
  298. input @silvercoins;
  299. next;
  300. set @totalzeny,@bronzecoins*@bronzeprice+@silvercoins*@silverprice;
  301. set @totalcoins,@bronzecoins+@silvercoins;
  302. mes "Zeny Amount Inputted: ^000066"+@zenyamount+"^000000";
  303. mes "Coins:";
  304. mes " ^996600"+@name1$+"s^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000";
  305. mes " ^999999"+@name2$+"s^000000: "+@silvercoins+" ^CC0000"+@silvercoins*@silverprice+"^000000";
  306. mes "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯";
  307. if (@totalzeny > @zenyamount || @totalzeny < 0) {
  308. mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000";
  309. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  310. goto L_Overzeny;
  311. } else
  312. mes "TOTAL Zeny: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000";
  313. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  314. next;
  315. if (@totalzeny > @zenyamount || @totalzeny < 0) goto L_Overzeny;
  316. mes @npcname$;
  317. mes "Is this enough or do you want more?";
  318. menu "It's enough, thanks",L_Payoff,"No, I want some more",-;
  319. next;
  320. mes @npcname$;
  321. mes "Now ^FFCC00"+@name3$+"s^000000. How many coins do you want?";
  322. input @goldcoins;
  323. next;
  324. set @totalzeny,@bronzecoins*@bronzeprice+@silvercoins*@silverprice+@goldcoins*@goldprice;
  325. set @totalcoins,@bronzecoins+@silvercoins+@goldcoins;
  326. mes "Zeny Amount Inputted: ^000066"+@zenyamount+"^000000";
  327. mes "Coins:";
  328. mes " ^996600"+@name1$+"s^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000";
  329. mes " ^999999"+@name2$+"s^000000: "+@silvercoins+" ^CC0000"+@silvercoins*@silverprice+"^000000";
  330. mes " ^FFCC00"+@name3$+"s^000000: "+@goldcoins+" ^CC0000"+@goldcoins*@goldprice+"^000000";
  331. mes "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯";
  332. if (@totalzeny > @zenyamount || @totalzeny < 0) {
  333. mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000";
  334. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  335. goto L_Overzeny;
  336. } else
  337. mes "TOTAL Zeny: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000";
  338. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  339. next;
  340. if (@totalzeny > @zenyamount || @totalzeny < 0) goto L_Overzeny;
  341. mes @npcname$;
  342. mes "Is this enough or do you want more?";
  343. menu "It's enough, thanks",L_Payoff,"No, I want some more",-;
  344. next;
  345. mes @npcname$;
  346. mes "Now ^CCCCCC"+@name4$+"s^000000. How many coins do you want?";
  347. input @mithrilcoins;
  348. next;
  349. set @totalzeny,@bronzecoins*@bronzeprice+@silvercoins*@silverprice+@goldcoins*@goldprice+@mithrilcoins*@mithrilprice;
  350. set @totalcoins,@bronzecoins+@silvercoins+@goldcoins+@mithrilcoins;
  351. mes "Zeny Amount Inputted: ^000066"+@zenyamount+"^000000";
  352. mes "Coins:";
  353. mes " ^996600"+@name1$+"s^000000: "+@bronzecoins+" ^CC0000"+@bronzecoins*@bronzeprice+"^000000";
  354. mes " ^999999"+@name2$+"s^000000: "+@silvercoins+" ^CC0000"+@silvercoins*@silverprice+"^000000";
  355. mes " ^FFCC00"+@name3$+"s^000000: "+@goldcoins+" ^CC0000"+@goldcoins*@goldprice+"^000000";
  356. mes " ^CCCCCC"+@name4$+"s^000000: "+@mithrilcoins+" ^CC0000"+@mithrilcoins*@mithrilprice+"^000000";
  357. mes "¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯";
  358. if (@totalzeny > @zenyamount || @totalzeny < 0) {
  359. mes "TOTAL Zeny: "+@totalcoins+" - ^CC0000"+@totalzeny+"^000000";
  360. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  361. goto L_Overzeny;
  362. } else
  363. mes "TOTAL: "+@totalcoins+" ^00CC00"+@totalzeny+"^000000";
  364. mes "Zeny Left: "+(@zenyamount-@totalzeny);
  365. next;
  366. if (@totalzeny > @zenyamount || @totalzeny < 0) goto L_Overzeny;
  367. mes @npcname$;
  368. mes "Is this ok?: "+@bronzecoins+" "+@name1$+"s, "+@silvercoins+" "+@name2$+"s, "+@goldcoins+" "+@name3$+"s, "+@mithrilcoins+" "+@name4$+"s, for a total amount of "+@totalzeny;
  369. menu "Yes, it's ok",L_Payoff,"No, I want to re-intro them",L_Mix,"Sorry, I dont want anything",L_Menu;
  370. L_Payoff:
  371. next;
  372. if (@zenyamount > Zeny) goto L_Overzeny;
  373. set Zeny,Zeny-@totalzeny;
  374. getitem @bronzecoinid,@bronzecoins;
  375. getitem @silvercoinid,@silvercoins;
  376. getitem @goldcoinid,@goldcoins;
  377. getitem @mithrilcoinid,@mithrilcoins;
  378. mes @npcname$;
  379. mes "There you go, here's your coins";
  380. next;
  381. set @bronzecoins,0;
  382. set @silvercoins,0;
  383. set @goldcoins,0;
  384. set @mithrilcoins,0;
  385. goto L_End;
  386. L_Overzeny:
  387. next;
  388. mes @npcname$;
  389. 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.";
  390. next;
  391. goto L_Menu;
  392. OnInit:
  393. setitemscript 671,"{}";
  394. end;
  395. }