Skip to content

Instantly share code, notes, and snippets.

@AnnieRuru
Last active September 28, 2020 13:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AnnieRuru/6f41d54b03417a768167820ee6f1f037 to your computer and use it in GitHub Desktop.
Save AnnieRuru/6f41d54b03417a768167820ee6f1f037 to your computer and use it in GitHub Desktop.
/*
create table gold_room_ranking (
char_id int primary key,
gold_point int,
key(`gold_point`)
) engine = innodb;
*/
prontera,165,155,3 script Gold Room#tst 1_F_MARIA,{
mes "[ ^C6A518Gold Room Assistant^000000 ]";
mes "Whats up,basic people! I know you";
mes "want to become rich! Well i have a";
mes "place where you can find a very";
mes "rare Birds";
next;
mes "[ ^C6A518Gold Room Assistant^000000 ]";
mes "And if you kill those birds you";
mes "will gain a random amounth of Gold";
mes "Points or GP and you can TRADE it";
mes "into real GOLD!";
next;
mes "[ ^C6A518Gold Room Assistant^000000 ]";
mes "But there is something you should";
mes "know... There are guardians that";
mes "lurking around the map and they are strong!!";
mes "^FF0000All of your points will lose when you die!^000000";
next;
switch(select("~ Enter to Gold Room:~ Convert My Gold Points:~ Gold Room Ranking:~ Cancel")) {
mes "[ ^C6A518Gold Room Assistant^000000 ]";
case 1:
mes "Sorry to disturb you,but I need to";
mes "check if you're a bot.";
mes "Please type the correct captcha:";
mes "FEE: ^FF0000"+ F_InsertComma(.zeny) +" Zeny^000000";
for (.@i = 0; .@i < .strLen; ++.@i)
.@str$ += charat(.charSet$, rand(0, getstrlen(.charSet$)));
mes "Captcha: ^C6A518"+ .@str$ +"^000000";
next;
input .@txt$;
if (.@txt$ != .@str$) {
mes "You have not inputted Correct.";
mes "Captcha";
next;
atcommand "@kick "+ strcharinfo(PC_NAME);
end;
}
if (Zeny < .zeny) {
mes "Sorry, but you can't enter the room.";
close;
}
Zeny -= .zeny;
warp "ordeal_1-2",151,154;
end;
case 2:
if (!goldPoint) {
mes "Sorry, you don't have any Gold Points!";
dispbottom "Gold Points: 0";
close;
}
next;
select "Exchange Points";
mes "[ ^C6A518Gold Room Assistant^000000 ]";
mes "You got "+ goldPoint +"Gold Point"+".";
mes "How many points do you want to";
mes "exchange in Gold?";
mes " ";
mes "Each points are equivalent to ^FF00001^000000 Gold. ";
next;
if (input(.@gpoint, 0, 30000))
close;
if (.@gpoint > goldPoint) {
mes "[ ^C6A518Gold Room Assistant^000000 ]";
mes "Sorry, you don't have any Gold Points!";
close;
}
mes "[ ^C6A518Gold Room Assistant^000000 ]";
mes "Gained ^FF0000"+ .@gpoint +"^000000 x Gold.";
if (!checkweight(Gold, goldPoint)) {
mes "[ ^C6A518Gold Room Assistant^000000 ]";
mes "Sorry, you can't carry these gold bars.";
close;
}
getitem Gold, .@gpoint;
goldPoint -= .@gpoint;
close;
case 3:
.@nb = query_sql("select char_id as aaa, (select name from `char` where char_id = aaa), gold_point from gold_room_ranking where gold_point > 0 order by 3 desc limit 10", .@cid, .@name$, .@gold);
if (!.@nb) {
mes "No ranking yet";
close;
}
for (.@i = 0; .@i < .@nb; ++.@i)
mes (.@i +1)+". "+ .@name$[.@i] +" exchanged "+ .@gold[.@i] +" Golds";
close;
default:
mes "[ ^C6A518Goldy^000000 ]";
mes "Goodbye~";
close;
}
end;
OnInit:
.charSet$ = "0123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ";
.strLen = 10; // Sets how many characters for the generated confirmation code.
.zeny = 200000; // Entrance FEE for the room
monster "ordeal_1-2", 0,0, "Golden Peco", GRAND_PECO, 500, strnpcinfo(0)+"::OnKilled";
end;
OnKilled:
.@ppk = rand(1,3); // Points per kill
goldPoint += .@ppk;
dispbottom "You've earned "+ .@ppk +"Gold Point(s).[ Total:"+ goldPoint +" ]";
monster "ordeal_1-2", 0,0, "Golden Peco", GRAND_PECO, 1, strnpcinfo(0)+"::OnKilled";
query_sql "insert into gold_room_ranking values ( "+ getcharid(CHAR_ID_CHAR) +", "+ .@ppk +") on duplicate key update gold_point = gold_point +"+ .@ppk;
end;
OnPCDieEvent:
if (strcharinfo(PC_MAP) == "ordeal_1-2") {
goldPoint = 0;
dispbottom "Sorry, but all of the Gold Points you have earned has vanished.";
}
end;
}
ordeal_1-2,153,154,4 script Exit 1_F_MARIA,{
mes "[ ^C6A518Goldy^000000 ]";
mes "Go back to Main Town?";
if (select("Yes:No") == 2) close;
warp "SavePoint",0,0;
end;
}
//============Spawns=================
ordeal_1-2,0,0,0,0 monster Sword Guardian 1829,10,0,0,0
ordeal_1-2,0,0,0,0 monster Sword Guardian 1829,10,0,0,0
ordeal_1-2 mapflag nobranch
ordeal_1-2 mapflag noloot
ordeal_1-2 mapflag noexp
ordeal_1-2 mapflag nodrop
ordeal_1-2 mapflag noskill
ordeal_1-2 mapflag novending
ordeal_1-2 mapflag noreturn
ordeal_1-2 mapflag nowarp
ordeal_1-2 mapflag nowarpto
ordeal_1-2 mapflag nomemo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment