summaryrefslogblamecommitdiff
path: root/npc/custom/etc/stock_market.txt
blob: 465840dfe74305815fcd5983fb800fb2f65bf77a (plain) (tree)
1
2
3
4
5
6
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
                                                              




                                                              










                                                              
                                          

























































































































































                                               
                                                                             

                                                                      

































































































































































































































































































































































































































































                                                                                                                        
 
              

                                                             
               
 
         

                                                         
               
 
                     


















































































































                                                                                


                                                                   

                                     























                                                     
 
//===== Hercules Script ======================================
//= Stock Market Game
//===== By: ==================================================
//= acky
//===== Current Version: =====================================
//= 1.3.1
//===== Description: =========================================
//= NPC for a stock market game.
//===== Additional Comments: =================================
//= GM Must activate the NPC before use.
//= Fixed MAJOR exploit. - players could buy for free
//= Low prices likely to rise, High prices likely to drop
//= Small fix by Galeon
//= Lupus: This script lets players make 40,000,000z a day
//=        so use it on your own risk
//============================================================

-	script	sharenames	FAKE_NPC,{
	end;
OnInit:
	// Sets the names of the shares //
	set $S1N$,"JIN";
	set $S2N$,"VNG";
	set $S3N$,"SHA";
	set $S4N$,"RGC";
	set $S5N$,"PSC";
	set $S6N$,"GNG";
	set $S7N$,"XRO";
	set $S8N$,"GRM";
	set $S9N$,"DOP";
	set $S10N$,"POR";

	// Transaction fee //
	set $S_Trans,1500;

	// Min & Max buyable //
	set $S_BuyMin,1;
	set $S_BuyMax,1000000;
	end;

	// Average Price (Your start prices) //
	set $S_Avg,100;

	// Set times of fluctuation //
OnClock1100:
	set $S_LastUpd$,"12:00";
	goto S_Fluc;
	end;

OnClock0000:
	set $S_LastUpd$,"00:00";
	goto S_Fluc;
	end;

OnClock0600:
	set $S_LastUpd$,"06:00";
	goto S_Fluc;
	end;

OnClock1800:
	set $S_LastUpd$,"18:00";
	goto S_Fluc;
	end;

OnClock2100:
	set $S_LastUpd$,"21:00";
	goto S_Fluc;
	end;

OnClock0900:
	set $S_LastUpd$,"09:00";
	goto S_Fluc;
	end;

OnClock1500:
	set $S_LastUpd$,"15:00";
	goto S_Fluc;
	end;

S_Fluc:
	set $fluc,rand (-6,6);
	set $S1B,$S1;
	set $S1,$S1+$fluc;
	if ($S1 < 25) set $S1,$S1+3;
	if ($S1 < 50) set $S1,$S1+2;
	if ($S1 > 150) set $S1,$S1-2;
	if ($S1 > 175) set $S1,$S1-3;
	if ($S1 < 1) set $S1,1;

	set $fluc,rand (-6,6);
	set $S2B,$S2;
	set $S2,$S2+$fluc;
	if ($S2 < 25) set $S2,$S2+3;
	if ($S2 < 50) set $S2,$S2+2;
	if ($S2 > 150) set $S2,$S2-2;
	if ($S2 > 175) set $S2,$S2-3;
	if ($S2 < 1) set $S2,1;

	set $fluc,rand (-6,6);
	set $S3B,$S3;
	set $S3,$S3+$fluc;
	if ($S3 < 25) set $S3,$S3+3;
	if ($S3 < 50) set $S3,$S3+2;
	if ($S3 > 150) set $S3,$S3-2;
	if ($S3 > 175) set $S3,$S3-3;
	if ($S3 < 1) set $S3,1;

	set $fluc,rand (-6,6);
	set $S4B,$S4;
	set $S4,$S4+$fluc;
	if ($S4 < 25) set $S4,$S4+3;
	if ($S4 < 50) set $S4,$S4+2;
	if ($S4 > 150) set $S4,$S4-2;
	if ($S4 > 175) set $S4,$S4-3;
	if ($S4 < 1) set $S4,1;

	set $fluc,rand (-6,6);
	set $S5B,$S5;
	set $S5,$S5+$fluc;
	if ($S5 < 25) set $S5,$S5+3;
	if ($S5 < 50) set $S5,$S5+2;
	if ($S5 > 150) set $S5,$S5-2;
	if ($S5 > 175) set $S5,$S5-3;
	if ($S5 < 1) set $S5,1;

	set $fluc,rand (-6,6);
	set $S6B,$S6;
	set $S6,$S6+$fluc;
	if ($S6 < 25) set $S6,$S6+3;
	if ($S6 < 50) set $S6,$S6+2;
	if ($S6 > 150) set $S6,$S6-2;
	if ($S6 > 175) set $S6,$S6-3;
	if ($S6 < 1) set $S6,1;

	set $fluc,rand (-6,6);
	set $S7B,$S7;
	set $S7,$S7+$fluc;
	if ($S7 < 25) set $S7,$S7+3;
	if ($S7 < 50) set $S7,$S7+2;
	if ($S7 > 150) set $S7,$S7-2;
	if ($S7 > 175) set $S7,$S7-3;
	if ($S7 < 1) set $S7,1;

	set $fluc,rand (-6,6);
	set $S8B,$S8;
	set $S8,$S8+$fluc;
	if ($S8 < 25) set $S8,$S8+3;
	if ($S8 < 50) set $S8,$S8+2;
	if ($S8 > 150) set $S8,$S8-2;
	if ($S8 > 175) set $S8,$S8-3;
	if ($S8 < 1) set $S8,1;

	set $fluc,rand (-6,6);
	set $S9B,$S9;
	set $S9,$S9+$fluc;
	if ($S9 < 25) set $S9,$S9+3;
	if ($S9 < 50) set $S9,$S9+2;
	if ($S9 > 150) set $S9,$S9-2;
	if ($S9 > 175) set $S9,$S9-3;
	if ($S9 < 1) set $S9,1;

	set $fluc,rand (-6,6);
	set $S10B,$S10;
	set $S10,$S10+$fluc;
	if ($S10 < 25) set $S10,$S10+3;
	if ($S10 < 50) set $S10,$S10+2;
	if ($S10 > 150) set $S10,$S10-2;
	if ($S10 > 175) set $S10,$S10-3;
	if ($S10 < 1) set $S10,1;
	end;
}

prontera,140,181,5	script	Stock Market::stockmarket	4_M_MANAGER,{
	// Ensures no trading when default prices have not been set //
	set @stotal,$S1+$S2+$S3+$S4+$S5+$S6+$S7+$S8+$S9+$S10;
	if (@stotal <= 0) {
		mes "[Stock Market]";
		mes "Trading is currently closed.";
		if (getgmlevel() > 90)
			callsub(OnGMOpen);
		close;
	}

	freeloop(true);
	while (true) {
		mes "[Stock Market]";
		mes "Last fluctuation: " + $S_LastUpd$;

		// Loss/Gain in price //
		set @S1Update,$S1-$S1B;
		set @S2Update,$S2-$S2B;
		set @S3Update,$S3-$S3B;
		set @S4Update,$S4-$S4B;
		set @S5Update,$S5-$S5B;
		set @S6Update,$S6-$S6B;
		set @S7Update,$S7-$S7B;
		set @S8Update,$S8-$S8B;
		set @S9Update,$S9-$S9B;
		set @S10Update,$S10-$S10B;

		// Makes Loss/Gain Red/Green //
		if (@S1Update < 0) set @S1Update$,"^FF0000"+@S1Update+"^000000";
		if (@S1Update > 0) set @S1Update$,"^00FF00+"+@S1Update+"^000000";
		if (@S1Update == 0) set @S1Update$,@S1Update;

		if (@S2Update < 0) set @S2Update$,"^FF0000"+@S2Update+"^000000";
		if (@S2Update > 0) set @S2Update$,"^00FF00+"+@S2Update+"^000000";
		if (@S2Update == 0) set @S2Update$,@S2Update;

		if (@S3Update < 0) set @S3Update$,"^FF0000"+@S3Update+"^000000";
		if (@S3Update > 0) set @S3Update$,"^00FF00+"+@S3Update+"^000000";
		if (@S3Update == 0) set @S3Update$,@S3Update;

		if (@S4Update < 0) set @S4Update$,"^FF0000"+@S4Update+"^000000";
		if (@S4Update > 0) set @S4Update$,"^00FF00+"+@S4Update+"^000000";
		if (@S4Update == 0) set @S4Update$,@S4Update;

		if (@S5Update < 0) set @S5Update$,"^FF0000"+@S5Update+"^000000";
		if (@S5Update > 0) set @S5Update$,"^00FF00+"+@S5Update+"^000000";
		if (@S5Update == 0) set @S5Update$,@S5Update;

		if (@S6Update < 0) set @S6Update$,"^FF0000"+@S6Update+"^000000";
		if (@S6Update > 0) set @S6Update$,"^00FF00+"+@S6Update+"^000000";
		if (@S6Update == 0) set @S6Update$,@S6Update;

		if (@S7Update < 0) set @S7Update$,"^FF0000"+@S7Update+"^000000";
		if (@S7Update > 0) set @S7Update$,"^00FF00+"+@S7Update+"^000000";
		if (@S7Update == 0) set @S7Update$,@S7Update;

		if (@S8Update < 0) set @S8Update$,"^FF0000"+@S8Update+"^000000";
		if (@S8Update > 0) set @S8Update$,"^00FF00+"+@S8Update+"^000000";
		if (@S8Update == 0) set @S8Update$,@S8Update;

		if (@S9Update < 0) set @S9Update$,"^FF0000"+@S9Update+"^000000";
		if (@S9Update > 0) set @S9Update$,"^00FF00+"+@S9Update+"^000000";
		if (@S9Update == 0) set @S9Update$,@S9Update;

		if (@S10Update < 0) set @S10Update$,"^FF0000"+@S10Update+"^000000";
		if (@S10Update > 0) set @S10Update$,"^00FF00+"+@S10Update+"^000000";
		if (@S10Update == 0) set @S10Update$,@S10Update;

		// Displays shares & prices //
		mes "^21698F"+$S1N$+"^000000" + " " + $S1 + "z (" + @S1Update$ + ")";
		mes "^21698F"+$S2N$+"^000000" + " " + $S2 + "z (" + @S2Update$ + ")";
		mes "^21698F"+$S3N$+"^000000" + " " + $S3 + "z (" + @S3Update$ + ")";
		mes "^21698F"+$S4N$+"^000000" + " " + $S4 + "z (" + @S4Update$ + ")";
		mes "^21698F"+$S5N$+"^000000" + " " + $S5 + "z (" + @S5Update$ + ")";
		mes "^21698F"+$S6N$+"^000000" + " " + $S6 + "z (" + @S6Update$ + ")";
		mes "^21698F"+$S7N$+"^000000" + " " + $S7 + "z (" + @S7Update$ + ")";
		mes "^21698F"+$S8N$+"^000000" + " " + $S8 + "z (" + @S8Update$ + ")";
		mes "^21698F"+$S9N$+"^000000" + " " + $S9 + "z (" + @S9Update$ + ")";
		mes "^21698F"+$S10N$+"^000000" + " " + $S10 + "z (" + @S10Update$ + ")";
		next;

		// GM Menu link //
		if (getgmlevel() > 90) {
			if (select("GM Menu", "Normal Menu") == 1)
				callsub(OnGMMenu);
		}
		switch (select("Portfolio", "Buy Shares", "Sell Shares", "Cancel")) {
		case 1:
			mes "[Stock Market]";
			if (#S1 >= 1) {
				set @S1,#S1*$S1;
				mes $S1N$ + ": " + #S1 + " x " + $S1 + "z = " + @S1 + "z";
			}
			if (#S2 >= 1) {
				set @S2,#S2*$S2;
				mes $S2N$ + ": " + #S2 + " x " + $S2 + "z = " + @S2 + "z";
			}
			if (#S3 >= 1) {
				set @S3,#S3*$S3;
				mes $S3N$ + ": " + #S3 + " x " + $S3 + "z = " + @S3 + "z";
			}
			if (#S4 >= 1) {
				set @S4,#S4*$S4;
				mes $S4N$ + ": " + #S4 + " x " + $S4 + "z = " + @S4 + "z";
			}
			if (#S5 >= 1) {
				set @S5,#S5*$S5;
				mes $S5N$ + ": " + #S5 + " x " + $S5 + "z = " + @S5 + "z";
			}
			if (#S6 >= 1) {
				set @S6,#S6*$S6;
				mes $S6N$ + ": " + #S6 + " x " + $S6 + "z = " + @S6 + "z";
			}
			if (#S7 >= 1) {
				set @S7,#S7*$S7;
				mes $S7N$ + ": " + #S7 + " x " + $S7 + "z = " + @S7 + "z";
			}
			if (#S8 >= 1) {
				set @S8,#S8*$S8;
				mes $S8N$ + ": " + #S8 + " x " + $S8 + "z = " + @S8 + "z";
			}
			if (#S9 >= 1) {
				set @S9,#S9*$S9;
				mes $S9N$ + ": " + #S9 + " x " + $S9 + "z = " + @S9 + "z";
			}
			if (#S10 >= 1) {
				set @S10,#S10*$S10;
				mes $S10N$ + ": " + #S10 + " x " + $S10 + "z = " + @S10 + "z";
			}
			set @total,@S1 + @S2 + @S3 + @S4 + @S5 + @S6 + @S7 + @S8 + @S9 + @S10;
			mes "Total value: "+@total+"z";
			next;
			continue;
		case 2:
			mes "[Stock Market]";
			mes "Available shares:";
			mes $S1N$;
			mes $S2N$;
			mes $S3N$;
			mes $S4N$;
			mes $S5N$;
			mes $S6N$;
			mes $S7N$;
			mes $S8N$;
			mes $S9N$;
			mes $S10N$;
			next;
			if (select("Continue", "Cancel") != 1)
				continue;

			mes "Enter the name of the share company";
			mes "Transaction fee of ^FF0000" + $S_Trans + "z^000000 will apply.";
			set @buyname$,"0";
			input @buyname$;

			set @buyamount,0;
			input @buyamount;
			// Checks valid number //
			if (@buyamount < $S_BuyMin) {
				mes "^FF0000Minimum of " + $S_BuyMin + " shares can be bought at a time.^000000";
				next;
				continue;
			}
			if (@buyamount > $S_BuyMax) {
				mes "^FF0000Maximum number of " + $S_BuyMax + " shares can be bought at a time.^000000";
				next;
				continue;
			}
			if (Zeny < $S_Trans) {
				callsub(OnNoZeny);
				continue;
			}
			Zeny -= $S_Trans;

			if (@buyname$ == $S1N$) {
				set @price,@buyamount*$S1;
				if (Zeny < @price) {
					callsub(OnNoZeny);
					continue;
				}
				set #S1,#S1+@buyamount;
				set @price,@buyamount*$S1;
				Zeny -= @price;
				mes "Bought " + @buyamount + " " + $S1N$ + " shares.";
				mes "Lost ^0000FF"+@price+"z^000000.";
				next;
			} else if (@buyname$ == $S2N$) {
				set @price,@buyamount*$S2;
				if (Zeny < @price) {
					callsub(OnNoZeny);
					continue;
				}
				set #S2,#S2+@buyamount;
				Zeny -= @price;
				mes "Bought " + @buyamount + " " + $S2N$ + " shares.";
				mes "Lost ^0000FF"+@price+"z^000000.";
				next;
			} else if (@buyname$ == $S3N$) {
				set @price,@buyamount*$S3;
				if (Zeny < @price) {
					callsub(OnNoZeny);
					continue;
				}
				set #S3,#S3+@buyamount;
				Zeny -= @price;
				mes "Bought " + @buyamount + " " + $S3N$ + " shares.";
				mes "Lost ^0000FF"+@price+"z^000000.";
				next;
			} else if (@buyname$ == $S4N$) {
				set @price,@buyamount*$S4;
				if (Zeny < @price) {
					callsub(OnNoZeny);
					continue;
				}
				set #S4,#S4+@buyamount;
				Zeny -= @price;
				mes "Bought " + @buyamount + " " + $S4N$ + " shares.";
				mes "Lost ^0000FF"+@price+"z^000000.";
				next;
			} else if (@buyname$ == $S5N$) {
				set @price,@buyamount*$S5;
				if (Zeny < @price) {
					callsub(OnNoZeny);
					continue;
				}
				set #S5,#S5+@buyamount;
				Zeny -= @price;
				mes "Bought " + @buyamount + " " + $S5N$ + " shares.";
				mes "Lost ^0000FF"+@price+"z^000000.";
				next;
			} else if (@buyname$ == $S6N$) {
				set @price,@buyamount*$S6;
				if (Zeny < @price) {
					callsub(OnNoZeny);
					continue;
				}
				set #S6,#S6+@buyamount;
				Zeny -= @price;
				mes "Bought " + @buyamount + " " + $S6N$ + " shares.";
				mes "Lost ^0000FF"+@price+"z^000000.";
				next;
			} else if (@buyname$ == $S7N$) {
				set @price,@buyamount*$S7;
				if (Zeny < @price) {
					callsub(OnNoZeny);
					continue;
				}
				set #S7,#S7+@buyamount;
				Zeny -= @price;
				mes "Bought " + @buyamount + " " + $S7N$ + " shares.";
				mes "Lost ^0000FF"+@price+"z^000000.";
				next;
			} else if (@buyname$ == $S8N$) {
				set @price,@buyamount*$S8;
				if (Zeny < @price) {
					callsub(OnNoZeny);
					continue;
				}
				set #S8,#S8+@buyamount;
				Zeny -= @price;
				mes "Bought " + @buyamount + " " + $S8N$ + " shares.";
				mes "Lost ^0000FF"+@price+"z^000000.";
				next;
			} else if (@buyname$ == $S9N$) {
				set @price,@buyamount*$S9;
				if (Zeny < @price) {
					callsub(OnNoZeny);
					continue;
				}
				set #S9,#S9+@buyamount;
				Zeny -= @price;
				mes "Bought " + @buyamount + " " + $S9N$ + " shares.";
				mes "Lost ^0000FF"+@price+"z^000000.";
				next;
			} else if (@buyname$ == $S10N$) {
				set @price,@buyamount*$S10;
				if (Zeny < @price) {
					callsub(OnNoZeny);
					continue;
				}
				set #S10,#S10+@buyamount;
				Zeny -= @price;
				mes "Bought " + @buyamount + " " + $S10N$ + " shares.";
				mes "Lost ^0000FF"+@price+"z^000000.";
				next;
			} else {
				mes "^FF0000Invalid share name.^000000";
				next;
				continue;
			}
			continue;
		case 3:
			mes "[Stock Market]";
			mes "Enter the name of the share you wish to sell.";
			mes "Transaction fee of ^FF0000" + $S_Trans + "z^000000 will apply.";
			if (#S1 > 0) mes "^0000FF"+$S1N$+"^FF0000" + " x " + #S1 + " [" + $S1 + "z]";
			if (#S2 > 0) mes "^0000FF"+$S2N$+"^FF0000" + " x " + #S2 + " [" + $S2 + "z]";
			if (#S3 > 0) mes "^0000FF"+$S3N$+"^FF0000" + " x " + #S3 + " [" + $S3 + "z]";
			if (#S4 > 0) mes "^0000FF"+$S4N$+"^FF0000" + " x " + #S4 + " [" + $S4 + "z]";
			if (#S5 > 0) mes "^0000FF"+$S5N$+"^FF0000" + " x " + #S5 + " [" + $S5 + "z]";
			if (#S6 > 0) mes "^0000FF"+$S6N$+"^FF0000" + " x " + #S6 + " [" + $S6 + "z]";
			if (#S7 > 0) mes "^0000FF"+$S7N$+"^FF0000" + " x " + #S7 + " [" + $S7 + "z]";
			if (#S8 > 0) mes "^0000FF"+$S8N$+"^FF0000" + " x " + #S8 + " [" + $S8 + "z]";
			if (#S9 > 0) mes "^0000FF"+$S9N$+"^FF0000" + " x " + #S9 + " [" + $S9 + "z]";
			if (#S10 > 0) mes "^0000FF"+$S10N$+"^FF0000" + " x " + #S10 + " [" + $S10 + "z]";
			set @sellname$,"0";
			input @sellname$;
			set @sellamount,0;
			input @sellamount;
			if (@sellamount < 1) {
				mes "^FF0000Invalid integer.^000000";
				next;
				continue;
			}

			if (Zeny < $S_Trans) {
				callsub(OnNoZeny);
				continue;
			}
			Zeny -= $S_Trans;
			if (@sellname$ == $S1N$) {
				if (@sellamount > #S1) {
					callsub(OnSellTooHigh);
					continue;
				}
				set @price,@sellamount*$S1;
				set #S1,#S1-@sellamount;
				Zeny += @price;
				next;
				mes "Sold " + @sellamount + " " + $S1N$ + " shares.";
				mes "Earned ^0000FF"+@price+"z^000000.";
				next;
			} else if (@sellname$ == $S2N$) {
				if (@sellamount > #S2) {
					callsub(OnSellTooHigh);
					continue;
				}
				set @price,@sellamount*$S2;
				set #S2,#S2-@sellamount;
				Zeny += @price;
				next;
				mes "Sold " + @sellamount + " " + $S2N$ + " shares.";
				mes "Earned ^0000FF"+@price+"z^000000.";
				next;
			} else if (@sellname$ == $S3N$) {
				if (@sellamount > #S3) {
					callsub(OnSellTooHigh);
					continue;
				}
				set @price,@sellamount*$S3;
				set #S3,#S3-@sellamount;
				Zeny += @price;
				next;
				mes "Sold " + @sellamount + " " + $S3N$ + " shares.";
				mes "Earned ^0000FF"+@price+"z^000000.";
				next;
			} else if (@sellname$ == $S4N$) {
				if (@sellamount > #S4) {
					callsub(OnSellTooHigh);
					continue;
				}
				set @price,@sellamount*$S4;
				set #S4,#S4-@sellamount;
				Zeny += @price;
				next;
				mes "Sold " + @sellamount + " " + $S4N$ + " shares.";
				mes "Earned ^0000FF"+@price+"z^000000.";
				next;
			} else if (@sellname$ == $S5N$) {
				if (@sellamount > #S5) {
					callsub(OnSellTooHigh);
					continue;
				}
				set @price,@sellamount*$S5;
				set #S5,#S5-@sellamount;
				Zeny += @price;
				next;
				mes "Sold " + @sellamount + " " + $S5N$ + " shares.";
				mes "Earned ^0000FF"+@price+"z^000000.";
				next;
			} else if (@sellname$ == $S6N$) {
				if (@sellamount > #S6) {
					callsub(OnSellTooHigh);
					continue;
				}
				set @price,@sellamount*$S6;
				set #S6,#S6-@sellamount;
				Zeny += @price;
				next;
				mes "Sold " + @sellamount + " " + $S6N$ + " shares.";
				mes "Earned ^0000FF"+@price+"z^000000.";
				next;
			} else if (@sellname$ == $S7N$) {
				if (@sellamount > #S7) {
					callsub(OnSellTooHigh);
					continue;
				}
				set @price,@sellamount*$S7;
				set #S7,#S7-@sellamount;
				Zeny += @price;
				next;
				mes "Sold " + @sellamount + " " + $S7N$ + " shares.";
				mes "Earned ^0000FF"+@price+"z^000000.";
				next;
			} else if (@sellname$ == $S8N$) {
				if (@sellamount > #S8) {
					callsub(OnSellTooHigh);
					continue;
				}
				set @price,@sellamount*$S8;
				set #S8,#S8-@sellamount;
				Zeny += @price;
				next;
				mes "Sold " + @sellamount + " " + $S8N$ + " shares.";
				mes "Earned ^0000FF"+@price+"z^000000.";
				next;
			} else if (@sellname$ == $S9N$) {
				if (@sellamount > #S9) {
					callsub(OnSellTooHigh);
					continue;
				}
				set @price,@sellamount*$S9;
				set #S9,#S9-@sellamount;
				Zeny += @price;
				next;
				mes "Sold " + @sellamount + " " + $S9N$ + " shares.";
				mes "Earned ^0000FF"+@price+"z^000000.";
				next;
			} else if (@sellname$ == $S10N$) {
				if (@sellamount > #S10) {
					callsub(OnSellTooHigh);
					continue;
				}
				set @price,@sellamount*$S10;
				set #S10,#S10-@sellamount;
				Zeny += @price;
				next;
				mes "Sold " + @sellamount + " " + $S10N$ + " shares.";
				mes "Earned ^0000FF"+@price+"z^000000.";
				next;
			} else {
				mes "^FF0000Invalid Share Name.^000000";
				next;
			}
			continue;
		case 4:
			mes "[Stock Market]";
			mes "Goodbye.";
			close;
		}
	}
	end;

OnSellTooHigh:
	mes "^FF0000You don't have that many shares.^000000";
	next;
	return;

OnNoZeny:
	mes "^FF0000You do not have enough zeny.^000000";
	next;
	return;

	// GM MENU //
OnGMMenu:
	freeloop(true);
	while (true) {
		mes "[Stock Market]";
		mes "Master, do you require anything?";
		switch (select("Fluctuate Market", "Reset Prices", "Nothing")) {
		case 1:
			set $fluc,rand (-6,6);
			set $S1B,$S1;
			set $S1,$S1+$fluc;
			if ($S1 < 25) set $S1,$S1+3;
			if ($S1 < 50) set $S1,$S1+2;
			if ($S1 > 150) set $S1,$S1-2;
			if ($S1 > 175) set $S1,$S1-3;
			if ($S1 < 1) set $S1,1;

			set $fluc,rand (-6,6);
			set $S2B,$S2;
			set $S2,$S2+$fluc;
			if ($S2 < 25) set $S2,$S2+3;
			if ($S2 < 50) set $S2,$S2+2;
			if ($S2 > 150) set $S2,$S2-2;
			if ($S2 > 175) set $S2,$S2-3;
			if ($S2 < 2) set $S2,1;

			set $fluc,rand (-6,6);
			set $S3B,$S3;
			set $S3,$S3+$fluc;
			if ($S3 < 25) set $S3,$S3+3;
			if ($S3 < 50) set $S3,$S3+2;
			if ($S3 > 150) set $S3,$S3-2;
			if ($S3 > 175) set $S3,$S3-3;
			if ($S3 < 1) set $S3,1;

			set $fluc,rand (-6,6);
			set $S4B,$S4;
			set $S4,$S4+$fluc;
			if ($S4 < 25) set $S4,$S4+3;
			if ($S4 < 50) set $S4,$S4+2;
			if ($S4 > 150) set $S4,$S4-2;
			if ($S4 > 175) set $S4,$S4-3;
			if ($S4 < 1) set $S4,1;

			set $fluc,rand (-6,6);
			set $S5B,$S5;
			set $S5,$S5+$fluc;
			if ($S5 < 25) set $S5,$S5+3;
			if ($S5 < 50) set $S5,$S5+2;
			if ($S5 > 150) set $S5,$S5-2;
			if ($S5 > 175) set $S5,$S5-3;
			if ($S5 < 1) set $S5,1;

			set $fluc,rand (-6,6);
			set $S6B,$S6;
			set $S6,$S6+$fluc;
			if ($S6 < 25) set $S6,$S6+3;
			if ($S6 < 50) set $S6,$S6+2;
			if ($S6 > 150) set $S6,$S6-2;
			if ($S6 > 175) set $S6,$S6-3;
			if ($S6 < 1) set $S6,1;

			set $fluc,rand (-6,6);
			set $S7B,$S7;
			set $S7,$S7+$fluc;
			if ($S7 < 25) set $S7,$S7+3;
			if ($S7 < 50) set $S7,$S7+2;
			if ($S7 > 150) set $S7,$S7-2;
			if ($S7 > 175) set $S7,$S7-3;
			if ($S7 < 1) set $S7,1;

			set $fluc,rand (-6,6);
			set $S8B,$S8;
			set $S8,$S8+$fluc;
			if ($S8 < 25) set $S8,$S8+3;
			if ($S8 < 50) set $S8,$S8+2;
			if ($S8 > 150) set $S8,$S8-2;
			if ($S8 > 175) set $S8,$S8-3;
			if ($S8 < 1) set $S8,1;

			set $fluc,rand (-6,6);
			set $S9B,$S9;
			set $S9,$S9+$fluc;
			if ($S9 < 25) set $S9,$S9+3;
			if ($S9 < 50) set $S9,$S9+2;
			if ($S9 > 150) set $S9,$S9-2;
			if ($S9 > 175) set $S9,$S9-3;
			if ($S9 < 1) set $S9,1;

			set $fluc,rand (-6,6);
			set $S10B,$S10;
			set $S10,$S10+$fluc;
			if ($S10 < 25) set $S10,$S10+3;
			if ($S10 < 50) set $S10,$S10+2;
			if ($S10 > 150) set $S10,$S10-2;
			if ($S10 > 175) set $S10,$S10-3;
			if ($S10 < 1) set $S10,1;

			set $S_LastUpd$,"GM Fluctuation";
			mes "Market fluctuated.";
			close;
		case 2:
			callsub(OnGMOpen);
			continue;
		case 3:
			break;
		}
		break;
	}
	return;

OnGMOpen:
	if (select("Set prices to...", "Cancel") != 1) {
		mes "Farewell.";
		close;
	}
	mes "Are you sure you want to reset?";
	mes "^FF0000All share values will become the same.^000000";
	next;
	if (select("Yes", "No") != 1)
		return;
	set @gmset,0;
	input @gmset;
	set $S1,@gmset;
	set $S2,@gmset;
	set $S3,@gmset;
	set $S4,@gmset;
	set $S5,@gmset;
	set $S6,@gmset;
	set $S7,@gmset;
	set $S8,@gmset;
	set $S9,@gmset;
	set $S10,@gmset;
	set $S1B,@gmset;
	set $S2B,@gmset;
	set $S3B,@gmset;
	set $S4B,@gmset;
	set $S5B,@gmset;
	set $S6B,@gmset;
	set $S7B,@gmset;
	set $S8B,@gmset;
	set $S9B,@gmset;
	set $S10B,@gmset;
	mes "All prices changed to " + @gmset + "z.";
	close;
}