stock_market.txt 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793
  1. //===== eAthena Script =======================================
  2. //= Stock Market Game
  3. //===== By: ==================================================
  4. //= acky (acky@bigpond.net.au)
  5. //===== Current Version: =====================================
  6. //= 1.3.1
  7. //===== Compatible With: =====================================
  8. //= Any eAthena Version
  9. //===== Description: =========================================
  10. //= NPC for a stock market game.
  11. //===== Additional Comments: =================================
  12. //= GM Must activate the NPC before use.
  13. //= Fixed MAJOR exploit. - players could buy for free
  14. //= Low prices likely to rise, High prices likely to drop
  15. //= Small fix by Galeon
  16. //= Lupus: This script lets players make 40,000,000z a day
  17. //= so use it on your own risk
  18. //============================================================
  19. prontera,140,181,5 script sharenames -1,{
  20. end;
  21. OnInit:
  22. // Sets the names of the shares //
  23. set $S1N$,"JIN";
  24. set $S2N$,"VNG";
  25. set $S3N$,"SHA";
  26. set $S4N$,"RGC";
  27. set $S5N$,"PSC";
  28. set $S6N$,"GNG";
  29. set $S7N$,"XRO";
  30. set $S8N$,"GRM";
  31. set $S9N$,"DOP";
  32. set $S10N$,"POR";
  33. // Transaction fee //
  34. set $S_Trans,1500;
  35. // Min & Max buyable //
  36. set $S_BuyMin,1;
  37. set $S_BuyMax,1000000;
  38. end;
  39. // Average Price (Your start prices) //
  40. set $S_Avg,100;
  41. // Set times of fluctuation //
  42. OnClock1100:
  43. set $S_LastUpd$,"12:00";
  44. goto S_Fluc;
  45. end;
  46. OnClock0000:
  47. set $S_LastUpd$,"00:00";
  48. goto S_Fluc;
  49. end;
  50. OnClock0600:
  51. set $S_LastUpd$,"06:00";
  52. goto S_Fluc;
  53. end;
  54. OnClock1800:
  55. set $S_LastUpd$,"18:00";
  56. goto S_Fluc;
  57. end;
  58. OnClock2100:
  59. set $S_LastUpd$,"21:00";
  60. goto S_Fluc;
  61. end;
  62. OnClock0900:
  63. set $S_LastUpd$,"09:00";
  64. goto S_Fluc;
  65. end;
  66. OnClock1500:
  67. set $S_LastUpd$,"15:00";
  68. goto S_Fluc;
  69. end;
  70. S_Fluc:
  71. set $fluc,rand (-6,6);
  72. set $S1B,$S1;
  73. set $S1,$S1+$fluc;
  74. if ($S1 < 25) set $S1,$S1+3;
  75. if ($S1 < 50) set $S1,$S1+2;
  76. if ($S1 > 150) set $S1,$S1-2;
  77. if ($S1 > 175) set $S1,$S1-3;
  78. if ($S1 < 1) set $S1,1;
  79. set $fluc,rand (-6,6);
  80. set $S2B,$S2;
  81. set $S2,$S2+$fluc;
  82. if ($S2 < 25) set $S2,$S2+3;
  83. if ($S2 < 50) set $S2,$S2+2;
  84. if ($S2 > 150) set $S2,$S2-2;
  85. if ($S2 > 175) set $S2,$S2-3;
  86. if ($S2 < 1) set $S2,1;
  87. set $fluc,rand (-6,6);
  88. set $S3B,$S3;
  89. set $S3,$S3+$fluc;
  90. if ($S3 < 25) set $S3,$S3+3;
  91. if ($S3 < 50) set $S3,$S3+2;
  92. if ($S3 > 150) set $S3,$S3-2;
  93. if ($S3 > 175) set $S3,$S3-3;
  94. if ($S3 < 1) set $S3,1;
  95. set $fluc,rand (-6,6);
  96. set $S4B,$S4;
  97. set $S4,$S4+$fluc;
  98. if ($S4 < 25) set $S4,$S4+3;
  99. if ($S4 < 50) set $S4,$S4+2;
  100. if ($S4 > 150) set $S4,$S4-2;
  101. if ($S4 > 175) set $S4,$S4-3;
  102. if ($S4 < 1) set $S4,1;
  103. set $fluc,rand (-6,6);
  104. set $S5B,$S5;
  105. set $S5,$S5+$fluc;
  106. if ($S5 < 25) set $S5,$S5+3;
  107. if ($S5 < 50) set $S5,$S5+2;
  108. if ($S5 > 150) set $S5,$S5-2;
  109. if ($S5 > 175) set $S5,$S5-3;
  110. if ($S5 < 1) set $S5,1;
  111. set $fluc,rand (-6,6);
  112. set $S6B,$S6;
  113. set $S6,$S6+$fluc;
  114. if ($S6 < 25) set $S6,$S6+3;
  115. if ($S6 < 50) set $S6,$S6+2;
  116. if ($S6 > 150) set $S6,$S6-2;
  117. if ($S6 > 175) set $S6,$S6-3;
  118. if ($S6 < 1) set $S6,1;
  119. set $fluc,rand (-6,6);
  120. set $S7B,$S7;
  121. set $S7,$S7+$fluc;
  122. if ($S7 < 25) set $S7,$S7+3;
  123. if ($S7 < 50) set $S7,$S7+2;
  124. if ($S7 > 150) set $S7,$S7-2;
  125. if ($S7 > 175) set $S7,$S7-3;
  126. if ($S7 < 1) set $S7,1;
  127. set $fluc,rand (-6,6);
  128. set $S8B,$S8;
  129. set $S8,$S8+$fluc;
  130. if ($S8 < 25) set $S8,$S8+3;
  131. if ($S8 < 50) set $S8,$S8+2;
  132. if ($S8 > 150) set $S8,$S8-2;
  133. if ($S8 > 175) set $S8,$S8-3;
  134. if ($S8 < 1) set $S8,1;
  135. set $fluc,rand (-6,6);
  136. set $S9B,$S9;
  137. set $S9,$S9+$fluc;
  138. if ($S9 < 25) set $S9,$S9+3;
  139. if ($S9 < 50) set $S9,$S9+2;
  140. if ($S9 > 150) set $S9,$S9-2;
  141. if ($S9 > 175) set $S9,$S9-3;
  142. if ($S9 < 1) set $S9,1;
  143. set $fluc,rand (-6,6);
  144. set $S10B,$S10;
  145. set $S10,$S10+$fluc;
  146. if ($S10 < 25) set $S10,$S10+3;
  147. if ($S10 < 50) set $S10,$S10+2;
  148. if ($S10 > 150) set $S10,$S10-2;
  149. if ($S10 > 175) set $S10,$S10-3;
  150. if ($S10 < 1) set $S10,1;
  151. end;
  152. }
  153. - script Stock Market::stockmarket 109,{
  154. // Ensures no trading when default prices have not been set //
  155. set @stotal,$S1+$S2+$S3+$S4+$S5+$S6+$S7+$S8+$S9+$S10;
  156. if (@stotal > 0) goto S_Start;
  157. mes "[Stock Market]";
  158. mes "Trading is currently closed.";
  159. if (getgmlevel() > 90) goto GM_Open;
  160. close;
  161. // Begining of interface //
  162. S_Start:
  163. mes "[Stock Market]";
  164. mes "Last fluctuation: " + $S_LastUpd$;
  165. // Loss/Gain in price //
  166. set @S1Update,$S1-$S1B;
  167. set @S2Update,$S2-$S2B;
  168. set @S3Update,$S3-$S3B;
  169. set @S4Update,$S4-$S4B;
  170. set @S5Update,$S5-$S5B;
  171. set @S6Update,$S6-$S6B;
  172. set @S7Update,$S7-$S7B;
  173. set @S8Update,$S8-$S8B;
  174. set @S9Update,$S9-$S9B;
  175. set @S10Update,$S10-$S10B;
  176. // Makes Loss/Gain Red/Green //
  177. if (@S1Update < 0) set @S1Update$,"^FF0000"+@S1Update+"^000000";
  178. if (@S1Update > 0) set @S1Update$,"^00FF00+"+@S1Update+"^000000";
  179. if (@S1Update == 0) set @S1Update$,@S1Update;
  180. if (@S2Update < 0) set @S2Update$,"^FF0000"+@S2Update+"^000000";
  181. if (@S2Update > 0) set @S2Update$,"^00FF00+"+@S2Update+"^000000";
  182. if (@S2Update == 0) set @S2Update$,@S2Update;
  183. if (@S3Update < 0) set @S3Update$,"^FF0000"+@S3Update+"^000000";
  184. if (@S3Update > 0) set @S3Update$,"^00FF00+"+@S3Update+"^000000";
  185. if (@S3Update == 0) set @S3Update$,@S3Update;
  186. if (@S4Update < 0) set @S4Update$,"^FF0000"+@S4Update+"^000000";
  187. if (@S4Update > 0) set @S4Update$,"^00FF00+"+@S4Update+"^000000";
  188. if (@S4Update == 0) set @S4Update$,@S4Update;
  189. if (@S5Update < 0) set @S5Update$,"^FF0000"+@S5Update+"^000000";
  190. if (@S5Update > 0) set @S5Update$,"^00FF00+"+@S5Update+"^000000";
  191. if (@S5Update == 0) set @S5Update$,@S5Update;
  192. if (@S6Update < 0) set @S6Update$,"^FF0000"+@S6Update+"^000000";
  193. if (@S6Update > 0) set @S6Update$,"^00FF00+"+@S6Update+"^000000";
  194. if (@S6Update == 0) set @S6Update$,@S6Update;
  195. if (@S7Update < 0) set @S7Update$,"^FF0000"+@S7Update+"^000000";
  196. if (@S7Update > 0) set @S7Update$,"^00FF00+"+@S7Update+"^000000";
  197. if (@S7Update == 0) set @S7Update$,@S7Update;
  198. if (@S8Update < 0) set @S8Update$,"^FF0000"+@S8Update+"^000000";
  199. if (@S8Update > 0) set @S8Update$,"^00FF00+"+@S8Update+"^000000";
  200. if (@S8Update == 0) set @S8Update$,@S8Update;
  201. if (@S9Update < 0) set @S9Update$,"^FF0000"+@S9Update+"^000000";
  202. if (@S9Update > 0) set @S9Update$,"^00FF00+"+@S9Update+"^000000";
  203. if (@S9Update == 0) set @S9Update$,@S9Update;
  204. if (@S10Update < 0) set @S10Update$,"^FF0000"+@S10Update+"^000000";
  205. if (@S10Update > 0) set @S10Update$,"^00FF00+"+@S10Update+"^000000";
  206. if (@S10Update == 0) set @S10Update$,@S10Update;
  207. // Displays shares & prices //
  208. mes "^21698F"+$S1N$+"^000000" + " " + $S1 + "z (" + @S1Update$ + ")";
  209. mes "^21698F"+$S2N$+"^000000" + " " + $S2 + "z (" + @S2Update$ + ")";
  210. mes "^21698F"+$S3N$+"^000000" + " " + $S3 + "z (" + @S3Update$ + ")";
  211. mes "^21698F"+$S4N$+"^000000" + " " + $S4 + "z (" + @S4Update$ + ")";
  212. mes "^21698F"+$S5N$+"^000000" + " " + $S5 + "z (" + @S5Update$ + ")";
  213. mes "^21698F"+$S6N$+"^000000" + " " + $S6 + "z (" + @S6Update$ + ")";
  214. mes "^21698F"+$S7N$+"^000000" + " " + $S7 + "z (" + @S7Update$ + ")";
  215. mes "^21698F"+$S8N$+"^000000" + " " + $S8 + "z (" + @S8Update$ + ")";
  216. mes "^21698F"+$S9N$+"^000000" + " " + $S9 + "z (" + @S9Update$ + ")";
  217. mes "^21698F"+$S10N$+"^000000" + " " + $S10 + "z (" + @S10Update$ + ")";
  218. next;
  219. // GM Menu link //
  220. if (getgmlevel() > 90) goto GM_subMenu;
  221. menu "Portfolio",S_Port,"Buy Shares",S_Buy,"Sell Shares",S_Sell,"Cancel",S_Quit;
  222. GM_subMenu:
  223. menu "Portfolio",S_Port,"Buy Shares",S_Buy,"Sell Shares",S_Sell,"GM Menu",GM_Menu,"Cancel",S_Quit;
  224. // Selling Shares //
  225. S_Sell:
  226. mes "[Stock Market]";
  227. mes "Enter the name of the share you wish to sell.";
  228. mes "Transaction fee of ^FF0000" + $S_Trans + "z^000000 will apply.";
  229. if (#S1 > 0) mes "^0000FF"+$S1N$+"^FF0000" + " x " + #S1 + " [" + $S1 + "z]";
  230. if (#S2 > 0) mes "^0000FF"+$S2N$+"^FF0000" + " x " + #S2 + " [" + $S2 + "z]";
  231. if (#S3 > 0) mes "^0000FF"+$S3N$+"^FF0000" + " x " + #S3 + " [" + $S3 + "z]";
  232. if (#S4 > 0) mes "^0000FF"+$S4N$+"^FF0000" + " x " + #S4 + " [" + $S4 + "z]";
  233. if (#S5 > 0) mes "^0000FF"+$S5N$+"^FF0000" + " x " + #S5 + " [" + $S5 + "z]";
  234. if (#S6 > 0) mes "^0000FF"+$S6N$+"^FF0000" + " x " + #S6 + " [" + $S6 + "z]";
  235. if (#S7 > 0) mes "^0000FF"+$S7N$+"^FF0000" + " x " + #S7 + " [" + $S7 + "z]";
  236. if (#S8 > 0) mes "^0000FF"+$S8N$+"^FF0000" + " x " + #S8 + " [" + $S8 + "z]";
  237. if (#S9 > 0) mes "^0000FF"+$S9N$+"^FF0000" + " x " + #S9 + " [" + $S9 + "z]";
  238. if (#S10 > 0) mes "^0000FF"+$S10N$+"^FF0000" + " x " + #S10 + " [" + $S10 + "z]";
  239. set @sellname$,"0";
  240. input @sellname$;
  241. set @sellamount,0;
  242. input @sellamount;
  243. if (@sellamount < 1) goto S_SellInv;
  244. if (zeny < $S_Trans) goto S_NoZeny;
  245. set zeny,zeny-$S_Trans;
  246. SELLS1:
  247. if (@sellname$ != $S1N$) goto SELLS2;
  248. if (@sellamount > #S1) goto S_SellTooHigh;
  249. set @price,@sellamount*$S1;
  250. set #S1,#S1-@sellamount;
  251. set zeny,zeny+@price;
  252. next;
  253. mes "Sold " + @sellamount + " " + $S1N$ + " shares.";
  254. mes "Earned ^0000FF"+@price+"z^000000.";
  255. next;
  256. goto S_Start;
  257. SELLS2:
  258. if (@sellname$ != $S2N$) goto SELLS3;
  259. if (@sellamount > #S2) goto S_SellTooHigh;
  260. set @price,@sellamount*$S2;
  261. set #S2,#S2-@sellamount;
  262. set zeny,zeny+@price;
  263. next;
  264. mes "Sold " + @sellamount + " " + $S2N$ + " shares.";
  265. mes "Earned ^0000FF"+@price+"z^000000.";
  266. next;
  267. goto S_Start;
  268. SELLS3:
  269. if (@sellname$ != $S3N$) goto SELLS4;
  270. if (@sellamount > #S3) goto S_SellTooHigh;
  271. set @price,@sellamount*$S3;
  272. set #S3,#S3-@sellamount;
  273. set zeny,zeny+@price;
  274. next;
  275. mes "Sold " + @sellamount + " " + $S3N$ + " shares.";
  276. mes "Earned ^0000FF"+@price+"z^000000.";
  277. next;
  278. goto S_Start;
  279. SELLS4:
  280. if (@sellname$ != $S4N$) goto SELLS5;
  281. if (@sellamount > #S4) goto S_SellTooHigh;
  282. set @price,@sellamount*$S4;
  283. set #S4,#S4-@sellamount;
  284. set zeny,zeny+@price;
  285. next;
  286. mes "Sold " + @sellamount + " " + $S4N$ + " shares.";
  287. mes "Earned ^0000FF"+@price+"z^000000.";
  288. next;
  289. goto S_Start;
  290. SELLS5:
  291. if (@sellname$ != $S5N$) goto SELLS6;
  292. if (@sellamount > #S5) goto S_SellTooHigh;
  293. set @price,@sellamount*$S5;
  294. set #S5,#S5-@sellamount;
  295. set zeny,zeny+@price;
  296. next;
  297. mes "Sold " + @sellamount + " " + $S5N$ + " shares.";
  298. mes "Earned ^0000FF"+@price+"z^000000.";
  299. next;
  300. goto S_Start;
  301. SELLS6:
  302. if (@sellname$ != $S6N$) goto SELLS7;
  303. if (@sellamount > #S6) goto S_SellTooHigh;
  304. set @price,@sellamount*$S6;
  305. set #S6,#S6-@sellamount;
  306. set zeny,zeny+@price;
  307. next;
  308. mes "Sold " + @sellamount + " " + $S6N$ + " shares.";
  309. mes "Earned ^0000FF"+@price+"z^000000.";
  310. next;
  311. goto S_Start;
  312. SELLS7:
  313. if (@sellname$ != $S7N$) goto SELLS8;
  314. if (@sellamount > #S7) goto S_SellTooHigh;
  315. set @price,@sellamount*$S7;
  316. set #S7,#S7-@sellamount;
  317. set zeny,zeny+@price;
  318. next;
  319. mes "Sold " + @sellamount + " " + $S7N$ + " shares.";
  320. mes "Earned ^0000FF"+@price+"z^000000.";
  321. next;
  322. goto S_Start;
  323. SELLS8:
  324. if (@sellname$ != $S8N$) goto SELLS9;
  325. if (@sellamount > #S8) goto S_SellTooHigh;
  326. set @price,@sellamount*$S8;
  327. set #S8,#S8-@sellamount;
  328. set zeny,zeny+@price;
  329. next;
  330. mes "Sold " + @sellamount + " " + $S8N$ + " shares.";
  331. mes "Earned ^0000FF"+@price+"z^000000.";
  332. next;
  333. goto S_Start;
  334. SELLS9:
  335. if (@sellname$ != $S9N$) goto SELLS10;
  336. if (@sellamount > #S9) goto S_SellTooHigh;
  337. set @price,@sellamount*$S9;
  338. set #S9,#S9-@sellamount;
  339. set zeny,zeny+@price;
  340. next;
  341. mes "Sold " + @sellamount + " " + $S9N$ + " shares.";
  342. mes "Earned ^0000FF"+@price+"z^000000.";
  343. next;
  344. goto S_Start;
  345. SELLS10:
  346. if (@sellname$ != $S10N$) goto SELLS11;
  347. if (@sellamount > #S10) goto S_SellTooHigh;
  348. set @price,@sellamount*$S10;
  349. set #S10,#S10-@sellamount;
  350. set zeny,zeny+@price;
  351. next;
  352. mes "Sold " + @sellamount + " " + $S10N$ + " shares.";
  353. mes "Earned ^0000FF"+@price+"z^000000.";
  354. next;
  355. goto S_Start;
  356. SELLS11:
  357. mes "^FF0000Invalid Share Name.^000000";
  358. next;
  359. goto S_Start;
  360. S_SellTooHigh:
  361. mes "^FF0000You don't have that many shares.^000000";
  362. next;
  363. goto S_Start;
  364. S_SellInv:
  365. mes "^FF0000Invalid integer.^000000";
  366. next;
  367. goto S_Start;
  368. // Buying Shares //
  369. S_Buy:
  370. mes "[Stock Market]";
  371. mes "Available shares:";
  372. mes $S1N$;
  373. mes $S2N$;
  374. mes $S3N$;
  375. mes $S4N$;
  376. mes $S5N$;
  377. mes $S6N$;
  378. mes $S7N$;
  379. mes $S8N$;
  380. mes $S9N$;
  381. mes $S10N$;
  382. next;
  383. menu "Continue",-,"Cancel",S_Start;
  384. mes "Enter the name of the share company";
  385. mes "Transaction fee of ^FF0000" + $S_Trans + "z^000000 will apply.";
  386. set @buyname$,"0";
  387. input @buyname$;
  388. set @buyamount,0;
  389. input @buyamount;
  390. // Checks valid number //
  391. if (@buyamount < $S_BuyMin) goto S_TooLow;
  392. if (@buyamount > $S_BuyMax) goto S_TooHigh;
  393. if (zeny < $S_Trans) goto S_NoZeny;
  394. set zeny,zeny-$S_Trans;
  395. // Purchases the shares //
  396. PURS1:
  397. if (@buyname$ != $S1N$) goto PURS2;
  398. set @price,@buyamount*$S1;
  399. if (zeny < @price) goto S_NoZeny;
  400. set #S1,#S1+@buyamount;
  401. set @price,@buyamount*$S1;
  402. set zeny,zeny-@price;
  403. mes "Bought " + @buyamount + " " + $S1N$ + " shares.";
  404. mes "Lost ^0000FF"+@price+"z^000000.";
  405. next;
  406. goto S_Start;
  407. PURS2:
  408. if (@buyname$ != $S2N$) goto PURS3;
  409. set @price,@buyamount*$S2;
  410. if (zeny < @price) goto S_NoZeny;
  411. set #S2,#S2+@buyamount;
  412. set zeny,zeny-@price;
  413. mes "Bought " + @buyamount + " " + $S2N$ + " shares.";
  414. mes "Lost ^0000FF"+@price+"z^000000.";
  415. next;
  416. goto S_Start;
  417. PURS3:
  418. if (@buyname$ != $S3N$) goto PURS4;
  419. set @price,@buyamount*$S3;
  420. if (zeny < @price) goto S_NoZeny;
  421. set #S3,#S3+@buyamount;
  422. set zeny,zeny-@price;
  423. mes "Bought " + @buyamount + " " + $S3N$ + " shares.";
  424. mes "Lost ^0000FF"+@price+"z^000000.";
  425. next;
  426. goto S_Start;
  427. PURS4:
  428. if (@buyname$ != $S4N$) goto PURS5;
  429. set @price,@buyamount*$S4;
  430. if (zeny < @price) goto S_NoZeny;
  431. set #S4,#S4+@buyamount;
  432. set zeny,zeny-@price;
  433. mes "Bought " + @buyamount + " " + $S4N$ + " shares.";
  434. mes "Lost ^0000FF"+@price+"z^000000.";
  435. next;
  436. goto S_Start;
  437. PURS5:
  438. if (@buyname$ != $S5N$) goto PURS6;
  439. set @price,@buyamount*$S5;
  440. if (zeny < @price) goto S_NoZeny;
  441. set #S5,#S5+@buyamount;
  442. set zeny,zeny-@price;
  443. mes "Bought " + @buyamount + " " + $S5N$ + " shares.";
  444. mes "Lost ^0000FF"+@price+"z^000000.";
  445. next;
  446. goto S_Start;
  447. PURS6:
  448. if (@buyname$ != $S6N$) goto PURS7;
  449. set @price,@buyamount*$S6;
  450. if (zeny < @price) goto S_NoZeny;
  451. set #S6,#S6+@buyamount;
  452. set zeny,zeny-@price;
  453. mes "Bought " + @buyamount + " " + $S6N$ + " shares.";
  454. mes "Lost ^0000FF"+@price+"z^000000.";
  455. next;
  456. goto S_Start;
  457. PURS7:
  458. if (@buyname$ != $S7N$) goto PURS8;
  459. set @price,@buyamount*$S7;
  460. if (zeny < @price) goto S_NoZeny;
  461. set #S7,#S7+@buyamount;
  462. set zeny,zeny-@price;
  463. mes "Bought " + @buyamount + " " + $S7N$ + " shares.";
  464. mes "Lost ^0000FF"+@price+"z^000000.";
  465. next;
  466. goto S_Start;
  467. PURS8:
  468. if (@buyname$ != $S8N$) goto PURS9;
  469. set @price,@buyamount*$S8;
  470. if (zeny < @price) goto S_NoZeny;
  471. set #S8,#S8+@buyamount;
  472. set zeny,zeny-@price;
  473. mes "Bought " + @buyamount + " " + $S8N$ + " shares.";
  474. mes "Lost ^0000FF"+@price+"z^000000.";
  475. next;
  476. goto S_Start;
  477. PURS9:
  478. if (@buyname$ != $S9N$) goto PURS10;
  479. set @price,@buyamount*$S9;
  480. if (zeny < @price) goto S_NoZeny;
  481. set #S9,#S9+@buyamount;
  482. set zeny,zeny-@price;
  483. mes "Bought " + @buyamount + " " + $S9N$ + " shares.";
  484. mes "Lost ^0000FF"+@price+"z^000000.";
  485. next;
  486. goto S_Start;
  487. PURS10:
  488. if (@buyname$ != $S10N$) goto PURS11;
  489. set @price,@buyamount*$S10;
  490. if (zeny < @price) goto S_NoZeny;
  491. set #S10,#S10+@buyamount;
  492. set zeny,zeny-@price;
  493. mes "Bought " + @buyamount + " " + $S10N$ + " shares.";
  494. mes "Lost ^0000FF"+@price+"z^000000.";
  495. next;
  496. goto S_Start;
  497. PURS11:
  498. goto S_InvName;
  499. // Number too low //
  500. S_TooLow:
  501. mes "^FF0000Minimum of " + $S_BuyMin + " shares can be bought at a time.^000000";
  502. next;
  503. goto S_Start;
  504. // Number too high //
  505. S_TooHigh:
  506. mes "^FF0000Maximum number of " + $S_BuyMax + " shares can be bought at a time.^000000";
  507. next;
  508. goto S_Start;
  509. S_NoZeny:
  510. mes "^FF0000You do not have enough zeny.^000000";
  511. next;
  512. goto S_Start;
  513. // Sends user to start if name invalid //
  514. S_InvName:
  515. mes "^FF0000Invalid share name.^000000";
  516. next;
  517. goto S_Start;
  518. // Displays your total amount //
  519. S_Port:
  520. mes "[Stock Market]";
  521. ACCS1:
  522. if (#S1 < 1) goto ACCS2;
  523. set @S1,#S1*$S1;
  524. mes $S1N$ + ": " + #S1 + " x " + $S1 + "z = " + @S1 + "z";
  525. ACCS2:
  526. if (#S2 < 1) goto ACCS3;
  527. set @S2,#S2*$S2;
  528. mes $S2N$ + ": " + #S2 + " x " + $S2 + "z = " + @S2 + "z";
  529. ACCS3:
  530. if (#S3 < 1) goto ACCS4;
  531. set @S3,#S3*$S3;
  532. mes $S3N$ + ": " + #S3 + " x " + $S3 + "z = " + @S3 + "z";
  533. ACCS4:
  534. if (#S4 < 1) goto ACCS5;
  535. set @S4,#S4*$S4;
  536. mes $S4N$ + ": " + #S4 + " x " + $S4 + "z = " + @S4 + "z";
  537. ACCS5:
  538. if (#S5 < 1) goto ACCS6;
  539. set @S5,#S5*$S5;
  540. mes $S5N$ + ": " + #S5 + " x " + $S5 + "z = " + @S5 + "z";
  541. ACCS6:
  542. if (#S6 < 1) goto ACCS7;
  543. set @S6,#S6*$S6;
  544. mes $S6N$ + ": " + #S6 + " x " + $S6 + "z = " + @S6 + "z";
  545. ACCS7:
  546. if (#S7 < 1) goto ACCS8;
  547. set @S7,#S7*$S7;
  548. mes $S7N$ + ": " + #S7 + " x " + $S7 + "z = " + @S7 + "z";
  549. ACCS8:
  550. if (#S8 < 1) goto ACCS9;
  551. set @S8,#S8*$S8;
  552. mes $S8N$ + ": " + #S8 + " x " + $S8 + "z = " + @S8 + "z";
  553. ACCS9:
  554. if (#S9 < 1) goto ACCS10;
  555. set @S9,#S9*$S9;
  556. mes $S9N$ + ": " + #S9 + " x " + $S9 + "z = " + @S9 + "z";
  557. ACCS10:
  558. if (#S10 < 1) goto ACCS11;
  559. set @S10,#S10*$S10;
  560. mes $S10N$ + ": " + #S10 + " x " + $S10 + "z = " + @S10 + "z";
  561. // Total //
  562. ACCS11:
  563. set @total,@S1 + @S2 + @S3 + @S4 + @S5 + @S6 + @S7 + @S8 + @S9 + @S10;
  564. mes "Total value: "+@total+"z";
  565. next;
  566. goto S_Start;
  567. // GM MENU //
  568. GM_Menu:
  569. mes "[Stock Market]";
  570. mes "Master, do you require anything?";
  571. menu "Fluctuate Market",S_Fluc,"Reset Prices",GM_Open,"Nothing",S_Start;
  572. S_Fluc:
  573. set $fluc,rand (-6,6);
  574. set $S1B,$S1;
  575. set $S1,$S1+$fluc;
  576. if ($S1 < 25) set $S1,$S1+3;
  577. if ($S1 < 50) set $S1,$S1+2;
  578. if ($S1 > 150) set $S1,$S1-2;
  579. if ($S1 > 175) set $S1,$S1-3;
  580. if ($S1 < 1) set $S1,1;
  581. set $fluc,rand (-6,6);
  582. set $S2B,$S2;
  583. set $S2,$S2+$fluc;
  584. if ($S2 < 25) set $S2,$S2+3;
  585. if ($S2 < 50) set $S2,$S2+2;
  586. if ($S2 > 150) set $S2,$S2-2;
  587. if ($S2 > 175) set $S2,$S2-3;
  588. if ($S2 < 2) set $S2,1;
  589. set $fluc,rand (-6,6);
  590. set $S3B,$S3;
  591. set $S3,$S3+$fluc;
  592. if ($S3 < 25) set $S3,$S3+3;
  593. if ($S3 < 50) set $S3,$S3+2;
  594. if ($S3 > 150) set $S3,$S3-2;
  595. if ($S3 > 175) set $S3,$S3-3;
  596. if ($S3 < 1) set $S3,1;
  597. set $fluc,rand (-6,6);
  598. set $S4B,$S4;
  599. set $S4,$S4+$fluc;
  600. if ($S4 < 25) set $S4,$S4+3;
  601. if ($S4 < 50) set $S4,$S4+2;
  602. if ($S4 > 150) set $S4,$S4-2;
  603. if ($S4 > 175) set $S4,$S4-3;
  604. if ($S4 < 1) set $S4,1;
  605. set $fluc,rand (-6,6);
  606. set $S5B,$S5;
  607. set $S5,$S5+$fluc;
  608. if ($S5 < 25) set $S5,$S5+3;
  609. if ($S5 < 50) set $S5,$S5+2;
  610. if ($S5 > 150) set $S5,$S5-2;
  611. if ($S5 > 175) set $S5,$S5-3;
  612. if ($S5 < 1) set $S5,1;
  613. set $fluc,rand (-6,6);
  614. set $S6B,$S6;
  615. set $S6,$S6+$fluc;
  616. if ($S6 < 25) set $S6,$S6+3;
  617. if ($S6 < 50) set $S6,$S6+2;
  618. if ($S6 > 150) set $S6,$S6-2;
  619. if ($S6 > 175) set $S6,$S6-3;
  620. if ($S6 < 1) set $S6,1;
  621. set $fluc,rand (-6,6);
  622. set $S7B,$S7;
  623. set $S7,$S7+$fluc;
  624. if ($S7 < 25) set $S7,$S7+3;
  625. if ($S7 < 50) set $S7,$S7+2;
  626. if ($S7 > 150) set $S7,$S7-2;
  627. if ($S7 > 175) set $S7,$S7-3;
  628. if ($S7 < 1) set $S7,1;
  629. set $fluc,rand (-6,6);
  630. set $S8B,$S8;
  631. set $S8,$S8+$fluc;
  632. if ($S8 < 25) set $S8,$S8+3;
  633. if ($S8 < 50) set $S8,$S8+2;
  634. if ($S8 > 150) set $S8,$S8-2;
  635. if ($S8 > 175) set $S8,$S8-3;
  636. if ($S8 < 1) set $S8,1;
  637. set $fluc,rand (-6,6);
  638. set $S9B,$S9;
  639. set $S9,$S9+$fluc;
  640. if ($S9 < 25) set $S9,$S9+3;
  641. if ($S9 < 50) set $S9,$S9+2;
  642. if ($S9 > 150) set $S9,$S9-2;
  643. if ($S9 > 175) set $S9,$S9-3;
  644. if ($S9 < 1) set $S9,1;
  645. set $fluc,rand (-6,6);
  646. set $S10B,$S10;
  647. set $S10,$S10+$fluc;
  648. if ($S10 < 25) set $S10,$S10+3;
  649. if ($S10 < 50) set $S10,$S10+2;
  650. if ($S10 > 150) set $S10,$S10-2;
  651. if ($S10 > 175) set $S10,$S10-3;
  652. if ($S10 < 1) set $S10,1;
  653. set $S_LastUpd$,"GM Fluctuation";
  654. mes "Market fluctuated.";
  655. close;
  656. GM_Open:
  657. menu "Set prices to...",GM_Set,"Cancel",-;
  658. mes "Farewell.";
  659. close;
  660. GM_Set:
  661. mes "Are you sure you want to reset?";
  662. mes "^FF0000All share values will become the same.^000000";
  663. next;
  664. menu "Yes",-,"No",GM_Menu;
  665. set @gmset,0;
  666. input @gmset;
  667. set $S1,@gmset;
  668. set $S2,@gmset;
  669. set $S3,@gmset;
  670. set $S4,@gmset;
  671. set $S5,@gmset;
  672. set $S6,@gmset;
  673. set $S7,@gmset;
  674. set $S8,@gmset;
  675. set $S9,@gmset;
  676. set $S10,@gmset;
  677. set $S1B,@gmset;
  678. set $S2B,@gmset;
  679. set $S3B,@gmset;
  680. set $S4B,@gmset;
  681. set $S5B,@gmset;
  682. set $S6B,@gmset;
  683. set $S7B,@gmset;
  684. set $S8B,@gmset;
  685. set $S9B,@gmset;
  686. set $S10B,@gmset;
  687. mes "All prices changed to " + @gmset + "z.";
  688. close;
  689. S_Quit:
  690. mes "[Stock Market]";
  691. mes "Goodbye.";
  692. close;
  693. }
  694. prontera,140,181,5 duplicate(stockmarket) Stock Market 109