//===== Athena Script ======================================== //= Poring Race System //===== By: ================================================== //= Masao //= Original Script from Zell_ff8 & xianz //===== Current Version: ===================================== //= 1.0 //===== Compatible With: ===================================== //= Any eAthena SVN //===== Description: ========================================= //= Poring Race //===== Additional Comments: ================================= //= Version 1.0 if there are any Bugs please let me know. //= Thanks to goddameit for helping me with the prize distribution. //============================================================ - script PraceAnnouncer -1,{ OnClock0000: OnClock0200: OnClock0400: OnClock0600: OnClock0800: OnClock1000: OnClock1200: OnClock1400: OnClock1600: OnClock1800: OnClock2000: OnClock2200: set $accessPrace,1; initnpctimer "Race Manager#prace"; announce "The Poringrace is now open again!",bc_all; announce "You have 1 minute time from now to make a bet in the race!",bc_all; end; } quiz_02,291,247,6 script Poringrace Warper 909,{ set .@n$,"[Poring Race]"; if ($accessPrace == 0) goto L_PO; mes .@n$; mes "Would you like me to warp you to the Poringrace Map?"; menu "Yes please!",-,"No thanks.",L_C; close2; warp "p_track01",74,42; end; L_C: mes .@n$; mes "Ok, bye."; close; L_PO: set .@Hour,gettime(3); set .@Minute,gettime(2); set .@PraceTime,gettime(3)+2; if (gettime(3) % 2){ set .@PraceTime,.@PraceTime-1; } mes .@n$; mes "The Poringrace is currently closed."; mes "The next race will start"; mes "at "+.@PraceTime+" o' clock."; mes "And the time is now "+.@Hour+":"+.@Minute+"."; close; } p_track01,58,41,2 script Race Manager#prace 765,{ set .@n$,"[Race Manager]"; set .@prace_zeny,10000; if ($prace_random < 1) callsub OnInit; if (@prace_bet == 1) goto L_AP; getmapxy(.@m$,.@x1,.@y,1,"Poring#prace1"); getmapxy(.@m$,.@x2,.@y,1,"Angeling#prace2"); getmapxy(.@m$,.@x3,.@y,1,"Metaling#prace3"); getmapxy(.@m$,.@x4,.@y,1,"Deviling#prace4"); getmapxy(.@m$,.@x5,.@y,1,"Santa Poring#prace5"); getmapxy(.@m$,.@x6,.@y,1,"Poporing#prace6"); if (.@x1 != 58 || .@x2 != 58 || .@x3 != 58 || .@x4 != 58 || .@x5 != 58 || .@x6 != 58) { mes .@n$; mes "The race already begun..."; close; } if(.PlayerCheck >= 125) { mes .@n$; mes "I'm sorry but we reached the maximum of allowed Players to take part on the current race!"; mes "Please try it again next time <3"; close2; warp "prontera",155,181; end; } mes .@n$; mes "Hi "+strcharinfo(0)+","; mes "on which Poring would you like to make a bet?"; mes "It costs you only "+.@prace_zeny+" zeny."; next; menu "Poring",L_P1,"Angeling",L_P2,"Metaling",L_P3,"Deviling",L_P4,"Santa Poring",L_P5,"Poporing",L_P6,"Cancel",-; mes .@n$; mes "Have a nice day."; close2; warp "prontera",155,181; end; L_P1: if (Zeny < .@prace_zeny) goto L_NZ; set Zeny,Zeny-.@prace_zeny; set @prace_winner$,"Poring"; goto L_R; L_P2: if (Zeny < .@prace_zeny) goto L_NZ; set Zeny,Zeny-.@prace_zeny; set @prace_winner$,"Angeling"; goto L_R; L_P3: if (Zeny < .@prace_zeny) goto L_NZ; set Zeny,Zeny-.@prace_zeny; set @prace_winner$,"Metaling"; goto L_R; L_P4: if (Zeny < .@prace_zeny) goto L_NZ; set Zeny,Zeny-.@prace_zeny; set @prace_winner$,"Deviling"; goto L_R; L_P5: if (Zeny < .@prace_zeny) goto L_NZ; set Zeny,Zeny-.@prace_zeny; set @prace_winner$,"Santa Poring"; goto L_R; L_P6: if (Zeny < .@prace_zeny) goto L_NZ; set Zeny,Zeny-.@prace_zeny; set @prace_winner$,"Poporing"; goto L_R; L_R: getmapxy(.@m$,.@x1,.@y,1,"Poring#prace1"); getmapxy(.@m$,.@x2,.@y,1,"Angeling#prace2"); getmapxy(.@m$,.@x3,.@y,1,"Metaling#prace3"); getmapxy(.@m$,.@x4,.@y,1,"Deviling#prace4"); getmapxy(.@m$,.@x5,.@y,1,"Santa Poring#prace5"); getmapxy(.@m$,.@x6,.@y,1,"Poporing#prace6"); if (.@x1 != 58 || .@x2 != 58 || .@x3 != 58 || .@x4 != 58 || .@x5 != 58 || .@x6 != 58) { mes .@n$; mes "The race already begun..."; close; } set .PlayerCheck,.PlayerCheck+1; set $@prace_bets,$@prace_bets+1; set $prace_bidders[$@prace_bets],getcharid(3); set @prace_bet,1; mes .@n$; mes "I've got "+$@prace_bets+" bets until now."; npctalk "I've received "+strcharinfo(0)+"'s bet for this race!"; close; L_AP: mes .@n$; mes "You've already made a bet on ^00bb00"+@prace_winner$+"^000000."; close; L_NZ: mes .@n$; mes "Sorry but you do not have enough zeny."; close; OnInit: set $prace_random,70; set $prace_random2,600; set $prace_winner$,""; set $@prace_bets,0; set $prace_bidders,0; set .PlayerCheck,0; end; OnTimer60000: mapannounce "p_track01","1 Minute until the Race begins!",1,0xFFAB54; end; OnTimer120000: mapannounce "p_track01","Porings, on your marks... Get ready...",1,0xFFAB54; end; OnTimer121000: mapannounce "p_track01","...1...",1,0xFFAB54; end; OnTimer122000: mapannounce "p_track01","...2...",1,0xFFAB54; end; OnTimer123000: donpcevent "Race Manager#prace::OnStartRace"; mapannounce "p_track01","...3...",1,0xFFAB54; end; OnTimer123500: mapannounce "p_track01","Go!!!",1,0xFFAB54; end; OnTimer183500: set $prace_winner$,""; set $@prace_bets,0; set .PlayerCheck,0; callsub ReturnRace; end; OnStartRace: donpcevent "Poring#prace1::OnRace"; donpcevent "Angeling#prace2::OnRace"; donpcevent "Metaling#prace3::OnRace"; donpcevent "Deviling#prace4::OnRace"; donpcevent "Santa Poring#prace5::OnRace"; donpcevent "Poporing#prace6::OnRace"; end; OnStopRace: donpcevent "Poring#prace1::OnStop"; donpcevent "Angeling#prace2::OnStop"; donpcevent "Metaling#prace3::OnStop"; donpcevent "Deviling#prace4::OnStop"; donpcevent "Santa Poring#prace5::OnStop"; donpcevent "Poporing#prace6::OnStop"; if ($prace_winner$ != "") callsub WinRace; end; ReturnRace: donpcevent "Poring#prace1::OnReturn"; donpcevent "Angeling#prace2::OnReturn"; donpcevent "Metaling#prace3::OnReturn"; donpcevent "Deviling#prace4::OnReturn"; donpcevent "Santa Poring#prace5::OnReturn"; donpcevent "Poporing#prace6::OnReturn"; end; WinRace: mapannounce "p_track01","And the winner is "+$prace_winner$,1,0xFFAB54; donpcevent "Checker#Cprace::OnCheck"; sleep2 10000; mapwarp "p_track01","maintown",165,200; set $accessPrace,0; end; } - script Checker#Cprace -1,{ OnCheck: for(set .@tmp1,0;.@tmp1<=$@prace_bets;set .@tmp1,.@tmp1+1) { if(attachrid($prace_bidders[.@tmp1])) { dispbottom "The winner is "+$prace_winner$+" and you bet on "+@prace_winner$+"."; if (@prace_winner$ == $prace_winner$) { dispbottom "You've won! Congratulations!"; getitem 12109,3; // Poring Box emotion 21,1; } else { dispbottom "I'm sorry you lost, better luck next time..."; emotion 28,1; } set @prace_winner$,""; set @prace_bet,0; detachrid; } } deletearray $prace_bidders[0],128; set $@prace_bets,0; set .PlayerCheck,0; end; } p_track01,58,38,2 script Poring#prace1 1002,{ end; OnRace: initnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 58,38; end; OnTimer1000: getmapxy(.@m$,.@x,.@y,1,"Poring#prace1"); if (rand(100) < $prace_random) npcwalkto .@x-1,.@y; setnpctimer rand($prace_random2); startnpctimer; if ((.@x-1) == 29) { set $prace_winner$,"Poring"; emotion 29; donpcevent "Race Manager#prace::OnStopRace"; } end; } p_track01,58,36,2 script Angeling#prace2 1096,{ end; OnRace: initnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 58,36; end; OnTimer1000: getmapxy(.@m$,.@x,.@y,1,"Angeling#prace2"); if (rand(100) < $prace_random) npcwalkto .@x-1,.@y; setnpctimer rand($prace_random2); startnpctimer; if ((.@x-1) == 29) { set $prace_winner$,"Angeling"; emotion 29; donpcevent "Race Manager#prace::OnStopRace"; } end; } p_track01,58,34,2 script Metaling#prace3 1613,{ end; OnRace: initnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 58,34; end; OnTimer1000: getmapxy(.@m$,.@x,.@y,1,"Metaling#prace3"); if (rand(100) < $prace_random) npcwalkto .@x-1,.@y; setnpctimer rand($prace_random2); startnpctimer; if ((.@x-1) == 29) { set $prace_winner$,"Metaling"; emotion 29; donpcevent "Race Manager#prace::OnStopRace"; } end; } p_track01,58,32,2 script Deviling#prace4 1582,{ end; OnRace: initnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 58,32; end; OnTimer1000: getmapxy(.@m$,.@x,.@y,1,"Deviling#prace4"); if (rand(100) < $prace_random) npcwalkto .@x-1,.@y; setnpctimer rand($prace_random2); startnpctimer; if ((.@x-1) == 29) { set $prace_winner$,"Deviling"; emotion 29; donpcevent "Race Manager#prace::OnStopRace"; } end; } p_track01,58,30,2 script Santa Poring#prace5 1062,{ end; OnRace: initnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 58,30; end; OnTimer1000: getmapxy(.@m$,.@x,.@y,1,"Santa Poring#prace5"); if (rand(100) < $prace_random) npcwalkto .@x-1,.@y; setnpctimer rand($prace_random2); startnpctimer; if ((.@x-1) == 29) { set $prace_winner$,"Santa Poring"; emotion 29; donpcevent "Race Manager#prace::OnStopRace"; } end; } p_track01,58,28,2 script Poporing#prace6 1031,{ end; OnRace: initnpctimer; end; OnStop: stopnpctimer; end; OnReturn: npcwalkto 58,28; end; OnTimer1000: getmapxy(.@m$,.@x,.@y,1,"Poporing#prace6"); if (rand(100) < $prace_random) npcwalkto .@x-1,.@y; setnpctimer rand($prace_random2); startnpctimer; if ((.@x-1) == 29) { set $prace_winner$,"Poporing"; emotion 29; donpcevent "Race Manager#prace::OnStopRace"; } end; } p_track01 mapflag nobranch p_track01 mapflag noicewall p_track01 mapflag nomemo p_track01 mapflag noreturn p_track01 mapflag noteleport p_track01 mapflag nowarpto p_track01 mapflag nowarp p_track01 mapflag pvp off p_track01 mapflag nosave