I've recently got a brilliant idea.
Why not make my own version of a paid script, sold on rAthena
and release it to Hercules for free!?
(Not because I'm banned on rAthena )
I need a peer review before releasing the whole package.
@Myriad Did a nice Peer review of my terribel kode...
If anyone else would like to contribute, feel free.
Otherwise, it is soon to be released
UPD : I reDrew the cutins, they don't look like stolen from rAthena
1) configuration
there are 2 arrays
setarray .prize_id[1],-1,31024,31026,31008,31020,31017,31010,31016,0,31009;
setarray .prize_qty[1],2,1,1,1,3,3,1,3,0,3;
in prize_id
if id is > 0, the prize is an item
if id = 0 , the prize is NOTHING!
if id = -1, the prizer is free spin (number of free spins set in qty array)
in array .prize_qty you setup the quantity won
//===== Hercules Script ======================================
//= Wheel of Fortune
//===== By ===================================================
//= Habilis
//= Edited by Myriad
//===== Description ==========================================
//= Wheel of fortune something.
//============================================================
- script Wheel_of_Fortune FAKE_NPC ,{
OnInit:
disablenpc("Wheel of Fortune#Main");
disablenpc("Hussein#WOF");
.EventName$ = "[Wheel Of Fortune]";
end;
OnMinute39:
OnStart:
query_sql("DELETE FROM `acc_reg_num_db` WHERE `key`='#freewheelfortunespin';");
announce(sprintf("%s : The event will begin in 1 minute, near the center of Prontera.", .EventName$), bc_blue | bc_all);
initnpctimer();
end;
OnTimer60000: // 1 min
enablenpc("Wheel of Fortune#Main");
enablenpc("Hussein#WOF");
announce(sprintf("%s : Come to Prontera and test your luck, everyone got some free spins!", .EventName$), bc_blue | bc_all);
end;
OnTimer1800000: // 30 mins
announce(sprintf("%s : One more minute, do your last spin!", .EventName$), bc_blue | bc_all);
end;
OnTimer1860000: // 31 mins
OnStop:
disablenpc("Wheel of Fortune#Main");
disablenpc("Hussein#WOF");
end;
}
prontera,159,178,3 script Hussein#WOF 1_M_MERCHANT,{
doevent("Wheel of Fortune#Main::OnTalk");
end;
}
prontera,155,176,3 script Wheel of Fortune#Main 2_SLOT_MACHINE,{
OnTalk:
if (#freewheelfortunespin == 0)
#freewheelfortunespin = .Free_Spins;
if (getd(.Event_Points_Variable$) < .Points_Cost && #freewheelfortunespin < 0) {
mesf("[^0055FF ::: %s ::: ^000000]", .EventName$);
mes("You are out of points");
mes("and have no more free");
mes("spins! Come back next");
mes("time for more.");
close();
}
.@mes$ = (#freewheelfortunespin > 0) ? sprintf(", but you, my friend, have %d free spin%s!", #freewheelfortunespin, (#freewheelfortunespin == 1) ? "" : "s") : ".";
cutin("aca_salim02", 2);
addtimer(1, sprintf("%s::OnEnd", strnpcinfo(NPC_NAME)));
mesf("[^0055FF ::: %s ::: ^000000]", .EventName$);
mes("Do you want to spin the wheel?");
mesf("It costs ^FF0000%d Event points^000000 to play%s", .Points_Cost, .@mes$);
next();
callsub(S_Loop);
S_Loop:
.@val = getd(.Event_Points_Variable$);
if (.@val < .Points_Cost && #freewheelfortunespin < 0)
callsub(S_End);
switch (select(
(#freewheelfortunespin > 0) ? sprintf("Yes! Use free spin! (%d left)", #freewheelfortunespin) : "",
(.@val > 0) ? sprintf("Yes! Use Event Points. (%d remaining)", .@val) : "",
"No (Leave)"
)) {
case 1: callsub(S_Pay, 0);
case 2: callsub(S_Pay, 1);
default: callsub(S_End);
}
S_Pay:
switch (getarg(0)) {
// pay with free spin
case 0:
if (#freewheelfortunespin > 0) {
if ((#freewheelfortunespin -= 1) < 1)
#freewheelfortunespin = -1;
callsub(S_Gamble);
} else
callsub(S_End);
// Pay with points
case 1:
default:
if ((.@val = getd(.Event_Points_Variable$)) >= .Points_Cost) {
setd(.Event_Points_Variable$, (.@val -= .Points_Cost));
dispbottom(sprintf("%s : You now have %d event points.", .ServerName$, .@val));
callsub(S_Gamble);
} else {
cutin("aca_salim02", 2);
mesf("[^0055FF ::: %s ::: ^000000]", .EventName$);
mes("Awww, you don't have enough to gamble...");
mes(" ");
mes("Have you ever heard?");
mes("'Money isn't all that matters' Got it?");
mes("Byeeeeeeeeeeeeee ;)");
callsub(S_End);
}
}
S_Gamble:
// Actual Gambling
.@sector = rand(.Sector[0], .Sector[1]);
.@displayCutin = (.@sector * 2) - 1;
.@Speed = .Spin_Speed;
for (.@i = 0; .@i < .nbTurns; .@i++) {
.@b = .Cutin[0];
while (.@b <= .Cutin[1]) {
cutin(sprintf("%s%d", .cutin$, .@b), 4);
sleep2(.@Speed);
.@b++;
.@Speed++;
}
}
.@b = .Cutin[0];
while (.@b < .@displayCutin) {
cutin(sprintf("%s%d", .cutin$, .@b), 4);
sleep2(.@Speed);
.@b++;
}
cutin(sprintf("%s%d", .cutin$, .@b), 4);
if (.prize_id[.@sector] == -1) {
// Free spin
if (.Sound_Effects)
soundeffect("wheel_jackpot.wav", 0);
announce(sprintf("[%s] : Wow, %d more Free spins!!!", .EventName$, .prize_qty[.@sector]), bc_blue | bc_self);
#freewheelfortunespin = #freewheelfortunespin == -1 ? .prize_qty[.@sector] : #freewheelfortunespin + .prize_qty[.@sector];
} else if (.prize_id[.@sector] == 0) {
// nothing
if (.Sound_Effects)
soundeffect("wheel_lost.wav", 0);
announce(sprintf("[%s] : Awwww, No luck in gamble, more luck in love...", .EventName$), bc_blue | bc_self);
} else {
// item
if (.Sound_Effects)
soundeffect("wheel_won.wav", 0);
announce(sprintf("[%s] : Enjoy your prize!!!", .EventName$), bc_blue | bc_self);
getitem(.prize_id[.@sector], .prize_qty[.@sector]);
}
sleep2(1000);
callsub(S_Loop);
end;
S_End:
close2();
OnEnd:
cutin("", 255);
end;
OnInit:
.ServerName$ = "[Your boring server]";
.EventName$ = "Wheel Of Fortune";
.cutin$ = "WheelOfFortune_";
.Event_Points_Variable$ = "#LROEVENTPOINTS"; // The name of your event points variable
setarray(.Sector, 1, 10); // Sector range
setarray(.Cutin, 0, 19); // Cutin range
.Spin_Speed = 50; // What is the base spin speed? (ms)
.nbTurns = 2;
.Points_Cost = 100; // How many 'points' does it cost for a spin?
.Free_Spins = 1; // How many free spins does a player get?
.Sound_Effects = true; // Enable sound effects? (true/false)
setarray(.prize_id[1], -1, 31024, 31026, 31008, 31020, 31017, 31010, 31016, 0, 31009);
setarray(.prize_qty[1], 2, 1, 1, 1, 3, 3, 1, 3, 0, 3);
end;
}