//===== rAthena Script ======================================================================
//= Map Of The Week v4.4
//===== Original By =========================================================================
//= Kaushik
//===== Current Version: ====================================================================
//= 1.0 - Script Release.
//= 1.1 - Added GM selection of Map Of The Week.
//= 1.2 - Fixed Timer Selection of the Map is on Sunday @ 24:00 server time.
//= 2.0 - Added Contract System.
//= 2.1 - Fixed Contract Expiry (Set #MOTWC to 0 once contract is expired).
//= 2.2 - Cleaned Script to remove some unneeded repertition and script. [ToastOfDoom]
//= 2.3 - Added Bottle Grenade ingredients to the script as it was missed.
//= 2.4 - Decreased the drop rate.
//= 2.5 - Changed announce and dispbottom.
//= 3.0 - Added Whisper Functions. (map, kills, contract, gm).
//= 3.1 - Changed to dynamic Cost and Kills - @motwcost & @motwkill to your desired numbers.
//= 3.2 - Added Menu To The NPC.
//= 4.0 - Added GM commands to change random map, selected map & to Destroy all contracts.
//= 4.1 - Removed SQL unwanted variable.
//= 4.2 - Fixed script contract count variable.
//= 4.3 - Fixed tweet to not give out contract if no map of the week is assigned.
//= 4.4 - Fixed NPC Whisper
//= 5.0 - Changed rewards to dynamic rewards [WIP].
//===== Compatible With: ====================================================================
//= Tested in SQL Revision 14435
//===== Description: ========================================================================
//= A Random Map Will be selected and edp, acid demo bottle ingredients are rewarded.
//===========================================================================================
prontera,147,190,4 script Map Of The Week 914,{
function MO_NoContractk;
function MO_ContractEnd;
function MO_NoContract;
function MO_Nothing;
function MO_NoZeny;
function MOTW_Name;
set @motwcost, 1000000; //The cost for the contract per @motwkill kills.
set @motwkill, 350; //Kills available while the contract is purchased for @motwcost Zeny.
mes "[Map Of The Week]";
mes "Map Of The Week or simply ^FF0000MOTW^000000 lets you enjoy your time on tbRO more excitingly as it would let you ^FF0000win prizes for every monster you kill on the assigned map^000000! Sounds cool right?";
mes " ";
mes " Now, what do you want to do?";
switch(select("- Main Information / Mechanics","- Check Rewards","- Contract Status","- Sign a Contract","- Commands","- Cancel"))
{
case 1:
next;
if($MOTW$ == ""){
mes "The Map Of The Week has not been assigned.";
mes "--------------------------";
mes " Mechanics:";
mes " 1. Once Map Of The Week (MOTW) is set, you could win prizes depending on chance for every monster you kill on that map.";
mes " 2. To be eligible for receiving prizes, you have to buy a contract that's good for 350 kills in one whole week.";
mes " 3. The contract costs ^FF0000300x Poring Coins^000000 and would mean you can receive prizes for 350 kills you make on the MOTW.";
mes " 4. Prizes you can get from 1 kill could be anything from the ff: ^FF00005x SPECs, 15x SPECs, 30x SPECs.^000000";
mes " 5. For available commands, you can do the following: ^FF0000whisper npc:Map Of The Week (case-sensitive) and enter keywords 'kills' [or] 'map' [or] 'contract'.^000000 ";
mes " ";
close;
}
mes "[Map Of The Week]";
mes "The Map Of The Week Is ^FF0000"+$MOTW$+"^000000.";
mes "--------------------------";
mes " Mechanics:";
mes " 1. Once Map Of The Week (MOTW) is set, you could win prizes depending on chance for every monster you kill on that map.";
mes " 2. To be eligible for receiving prizes, you have to buy a contract that's good for 350 kills in one whole week.";
mes " 3. The contract costs ^FF0000300x Poring Coins^000000 and would mean you can receive prizes for 350 kills you make on the MOTW.";
mes " 4. Prizes you can get from 1 kill could be anything from the ff: ^FF00005x SPECs, 15x SPECs, 30x SPECs.^000000";
mes " 5. For available commands, you can do the following: ^FF0000whisper npc:Map Of The Week (case-sensitive) and enter keywords 'kills' [or] 'map' [or] 'contract'.^000000 ";
mes " ";
close;
case 2:
next;
mes "[Map Of The Week]";
mes "Prizes you can get from 1 kill could be anything from the ff: ^FF00005x SPECs, 15x SPECs, 30x SPECs^000000.";
close;
case 3:
next;
mes "[Map Of The Week]";
mes "Please wait while we check your deeds if any.";
progressbar "green",3;
if(!#MOTWC) {
next;
mes "[Map Of The Week]";
mes "You currently don't have a contract.";
close;
}
mes "Your contract will expire after ^FF0000"+(@motwkill-#MOTWKI)+"^000000 kills.";
close;
case 4:
next;
mes "[Map Of The Week]";
if($MOTW$ == ""){
mes "The Map Of The Week has not been assigned. You cannot purchase a contract at this time.";
close;
}
mes "Do you want to buy a contract?";
if(select("Yes:NO")-1) {
mes "[Map Of The Week]";
mes "Come back again!";
close;
}else{
mes "[Map Of The Week]";
mes "It would cost ^FF0000300x Poring Coins^000000 for ^FF0000"+@motwkill+" kills^000000.";
if(select("We have a deal!:Nevermind")-1) {
mes "[Map Of The Week]";
mes "Come back again!";
close;
}else{
if (countitem(7539) < 300) MO_NoZeny;
delitem 7539,300;
set #MOTWC, 1;
set #MOTWKI, 0;
next;
mes "[Map Of The Week]";
mes "^008800Congratulations! Your contract has been signed.^000000";
mes " ";
mes "You can renew your contract anywhere by calling the NPC.";
mes "Whisper ^FF0000npc:Map Of The Week^000000 (case-sensitive) and enter keywords such as kills, map or contract.";
close;
}
}
case 5:
next;
mes "[Map Of The Week]";
mes "Whisper ^FF0000NPC:Map Of The Week^000000 (case-sensitive)";
mes "Available Keywords :";
mes "- ^FF0000kills^000000: the no. of kills left.";
mes "- ^FF0000contract^000000: to renew or buy contract.";
mes "- ^FF0000map^000000: to know the Map Of The Week.";
close;
case 6:
next;
mes "[Map Of The Week]";
mes "Come back when you are free again.";
close;
}
OnWhisperGlobal:
if(compare(@whispervar0$,"map")) {
dispbottom "MOTW : The Map Of The Week is "+$MOTW$;
end;
}
if(@whispervar0$ == "kills") {
if(#MOTWC != 1) {
mes "[Map Of The Week]";
mes "You are not under a contract.";
close;
end;
}
mes "[Map Of The Week]";
mes "You can still kill "+(@motwkill- #MOTWKI)+" monsters!";
close;
}
if(compare(@whispervar0$,"contract")) {
if(#MOTWC != 1) {
mes "[Map Of The Week]";
mes "You currently don't have a contract. Do you want to buy one?";
if(select("Yes:NO")-1) {
mes "[Map Of The Week]";
mes "Come back again!";
close;
end;
}else{
mes "[Map Of The Week]";
mes "It would cost ^FF0000500x Poring Coins^000000 for ^FF0000"+@motwkill+" kills.^000000";
if(select("Sure I Will Pay:No")-1) {
mes "[Map Of The Week]";
mes "Come back again!";
close;
end;
}else{
if (countitem(7539) < 300) MO_NoZeny;
delitem 7539,300;
set #MOTWC, 1;
set #MOTWKI, 0;
mes "[Map Of The Week]";
mes "^008800Congratulations! Your contract has been signed.^000000";
close;
end;
}
}
}else{
mes "You are already under contract!";
close;
end;
}
}
if(compare(@whispervar0$,"gm")) {
if(getgmlevel() < 90) end;
mes "[Map Of The Week]";
mes "What do you want to do "+strcharinfo(0)+"?";
switch(select("^00FF00-^000000Random MOTW","^00FF00-^000000Enter MOTW","^FF0000-^000000Destroy All Contracts","^FF0000-^000000Nothing"))
{
case 1:
switch(rand(3)){
case 0:
set $@MOTWS, rand(1,11);
set $mapotw$, "pay_fild" + (($@MOTWS < 10)?"0":"") + $@MOTWS;
set $MOTW$, "Payon Forest "+$@MOTWS;
break;
case 1:
set $@MOTWS, rand(0,11);
set $mapotw$, "prt_fild" + (($@MOTWS < 10)?"0":"") + $@MOTWS;
set $MOTW$, "Prontera Field "+$@MOTWS;
break;
case 2:
set $@MOTWS, rand(1,22);
set $mapotw$, "moc_fild" + (($@MOTWS < 10)?"0":"") + $@MOTWS;
set $MOTW$, "Sograt Desert "+$@MOTWS;
break;
}
announce "[Map Of The Week] The MOTW is "+$MOTW$+"! Kill any mobs in this map with active contract and you could get anywhere within 1,500 up to 5,000 SPECs for the whole week!",0;
next;
mes "[Map Of The Week]";
mes "The Map Of The Week is ^FF0000"+$MOTW$+"^000000!";
close;
case 2:
MOTW_Name;
case 3:
next;
mes "[Map Of The Week]";
mes "Destroyed All Contracts.";
query_sql ("DELETE FROM `trincli0232`.`global_reg_value` WHERE `global_reg_value`.`str` = '#MOTWC' ");
query_sql ("DELETE FROM `trincli0232`.`global_reg_value` WHERE `global_reg_value`.`str` = '#MOTWKI' ");
close;
case 4:
next;
mes "[Map Of The Week]";
mes "Come back when you are free again.";
close;
}
}
close;
end;
MO_Nothing:
mes "[Map Of The Week]";
mes "Available Keywords:";
mes "- ^FF0000kills^000000: the no. of kills left";
mes "- ^FF0000contract^000000: to renew or buy contract";
mes "- ^FF0000map^000000: to know the Map Of The Week";
close;
end;
MO_NoZeny:
next;
mes "[Map Of The Week]";
mes "Come back when you have enough Poring Coins.";
close;
end;
MO_NoContract:
next;
mes "[Map Of The Week]";
mes "You are not under a contract.";
close;
end;
MO_ContractEnd:
dispbottom "MOTW : Your contract has expired.";
set #MOTWC,0;
end;
MO_NoContractk:
dispbottom "MOTW : You are not under a contract.";
end;
MOTW_Name:
mes "[Map Of The Week]";
mes "Enter the map name";
input $MOTWGM$;
mes "The map you entered is ^FF0000"+$MOTWGM$+"^000000";
mes "Is this the correct map";
if(select("Yes:No")-1) {
MOTW_Name;
}
else {
set $mapotw$, $MOTWGM$;
set $MOTW$, $MOTWGM$;
announce "MOTW : The Map Of The Week is "+$MOTW$+"!!!!",0;
close;
end;
}
OnClock2400:
if(gettime(4)!=0) end;
switch(rand(3)){
case 0:
set $@MOTWS, rand(1,11);
set $mapotw$, "pay_fild" + (($@MOTWS < 10)?"0":"") + $@MOTWS;
set $MOTW$, "Payon Forest "+$@MOTWS;
break;
case 1:
set $@MOTWS, rand(0,11);
set $mapotw$, "prt_fild" + (($@MOTWS < 10)?"0":"") + $@MOTWS;
set $MOTW$, "Prontera Field "+$@MOTWS;
break;
case 2:
set $@MOTWS, rand(1,22);
set $mapotw$, "moc_fild" + (($@MOTWS < 10)?"0":"") + $@MOTWS;
set $MOTW$, "Sograt Desert "+$@MOTWS;
break;
}
announce "MOTW : The Map Of The Week is "+$MOTW$+"!!!!",0;
end;
OnNPCKillEvent:
getmapxy(.@map$,.@x,.@y,0);
if (.@map$ != $mapotw$) end;
if (!#MOTWC) MO_NoContractk;
if (#MOTWKI >= @motwkill) MO_ContractEnd;
set #MOTWKI, #MOTWKI+1;
switch(rand(10)){
case 0:
getitem 6153,5;
break;
case 1:
getitem 6153,15;
break;
case 2:
getitem 6153,30;
break;
}
}