banker.txt 15 KB

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