• A Player must logged in for 1 hour before he gets the prize.
• Then after the player receives the reward, the 24-hour countdown will start.
Example:
I received the reward at 21:03 (monday)
the daily 1hour will begin at 21:03 (tuesday)
the next reward will be on 22:03 (tuesday)
//===== EinherjarRO Scripts ==================================
//= Daily Prize, OnPCLoginEvent
//===== By: ==================================================
//= Stolao
//===== Current Version: =====================================
//= 1.63
//===== Compatible With: =====================================
//= rAthena SVN
//===== Description: =========================================
//= A reward system for players who play more frequently
//===== Comments: ============================================
//= Maybe Make .MinWait an array mins,days,weeks,months,years;
//===== Additional Comments: =================================
//= For Older See Old Versions
//= 1.51 Changed set .@g formula and move lower into script
//= 1.52 Replace all disbottom -> message
//= 1.53 Changed Format to Include minuets instead of just hours
//= 1.54 Made Time till next rewards display dynamic
//= 1.55 Changed a forgotten .PointType$ -> getd(.@TT[1])
//= 1.56 changed .@XT -> .@XT$
//= 1.57 Added Atoi where nessisary
//= 1.58 Fixed a swapped .@x and .@x+1
//= 1.59 Serveral Edit Undocumented to fix
//= 1.5A Fixed a logic bug, day 1 skipped
//= 1.5B Fixed a [-1] bug
//= 1.5C Actualy Fixed a logic bug, day 1 skipped
//= 1.5D Added A .Rest Notification
//= 1.5E Moved Sleep2 after the day check
//= 1.5F Added additive logging so a dc wont reset the .Rest Delay
//= 1.60 Added timer break into @at and @afk
//= 1.61 Added '[Daily Rewards]:' to all messages
//= 1.62 Fixed missing "
//= 1.63 Fixed missing )
//===== Contact Info: ========================================
//= [Stolao]
//= Email: [email protected]
//============================================================
- script LOGIN -1,{
OnWhisperGlobal:
OnLoginCmnd:
OnPCLoginEvent:
if(.Rest){
set @login, (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + gettime(2);
if(@login > #LastDailyReward + .MaxWait ){
set #logintimer, 0;
set @login, 0;
}
set .@rest, (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + .Rest;
message strcharinfo(0),"[Daily Rewards]: to collec reward you must remain logged in for "+ ( @login - .@rest ) +" Minuets";
}
set .@i, (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + gettime(2);
if(.@i - .Rest >= (#LastDailyReward + .MinWait)){
sleep2 100 + ( .Rest * 60000 ) - ( .@i - #logintimer );
if(.@i < #LastDailyReward + .MaxWait){ set #DRewardCon, #DRewardCon + 1;
} else { set #DRewardCon, 0; }
set .@g, (#DRewardCon > getarraysize(.Rewards$)) ? (getarraysize(.Rewards$)+1) : #DRewardCon;
explode(.@XT$,.Rewards$[.@g],"|");
for(set .@x,0; .@x < getarraysize(.@XT$); set .@x,.@x + 1){
set .@TT[.@x], atoi(.@XT$[.@x]);
}
if(.Mode & 1 && .@TT[4]){ //[Note]: I need to figure out a checkweight for all items tired atm lol, for now ill leave it missing
for(set .@x,4; .@x < getarraysize(.@TT); set .@x,.@x + 2){ getitem .@TT[.@x], .@TT[.@x+1]; message strcharinfo(0),"[Daily Rewards]: Recived "+ .@TT[.@x+1] +" "+ getitemname(.@TT[.@x]); }
}
if(.Mode & 2){
if(.@TT[0]){ set zeny,zeny + .@TT[0]; message strcharinfo(0),"[Daily Rewards]: Recived "+ .@TT[0] +"z"; }
if(.@TT[1]){ setd getd(.Points$[0]),getd(.Points$[0]) + .@TT[1]; message strcharinfo(0),"[Daily Rewards]: Recived "+ .@TT[1] +" "+.Points$[1]; }
}
if(.Mode & 4 && (.@TT[3] || .@TT[4])) getexp .@TT[3], .@TT[4];
if(.Mode & 8){
for(set .@x,0; .@x < getarraysize(.BuffInfo); set .@x,.@x + 4){
if(#DRewardCon % .BuffInfo[.@x + 1] == 0)
sc_start .BuffInfo[.@x], .BuffInfo[.@x + 2] * 60000, .BuffInfo[.@x + 3];
}
}
message strcharinfo(0),"[Daily Rewards]: You have collected your daily reward, for "+#DRewardCon+" day"+((#DRewardCon > 1)?"s":"")+" in a row.";
cutin .Pic$[.@g],4;
set #LastDailyReward, .@i;
set #logintimer, 0;
set @login, 0;
} else {
set .@days,(#LastDailyReward + .MinWait - .@i)/60/24;
set .@hours,((#LastDailyReward + .MinWait - .@i)/60)%24;
set .@mins,(#LastDailyReward + .MinWait - .@i)%60;
message strcharinfo(0),"[Daily Rewards]: You have "+ ((.@days) ? .@days +":Days " : "") +""+ ((.@hours) ? .@hours +":Hours " : "") +""+ ((.@mins) ? .@mins +":Minutes " : "") +"till your next reward";
}
end;
OnPCLogoutEvent:
if(@login){
set .@i, (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + gettime(2);
set #logintimer, .@i - @login + #logintimer;
set @login, 0;
}
return;
end;
OnInit:
//Basic Settings
// 1: Item | 2: Points | 4: Exp
// 8: Gain Buffs Every X Consecutive Days logged in
// (a bit value, e.g. 3 = Items & Points from Multi)
set .Mode,1;
//To Enable @ Command '@loginreward' unslash next lines
// * Needs extra commands for typos
bindatcmd("daily" ,"LOGIN::OnLoginCmnd",0,99);
//Enable Delay if @afk or @autotrade are available to players
// remove // to enable certain command checks
//bindatcmd("at" ,"LOGIN::OnPCLogoutEvent",0,99);
//bindatcmd("autotrade" ,"LOGIN::OnPCLogoutEvent",0,99);
//bindatcmd("AT" ,"LOGIN::OnPCLogoutEvent",0,99);
//bindatcmd("Autotrade" ,"LOGIN::OnPCLogoutEvent",0,99);
//bindatcmd("afk" ,"LOGIN::OnPCLogoutEvent",0,99);
//bindatcmd("AFK" ,"LOGIN::OnPCLogoutEvent",0,99);
//Minimum Minuets Between Collecting Daily Reward
// Day: 22*60 - 24*60
// Week: 10080
set .MinWait,24*60;
//Minuets Before Lose Consecutive Daily Reward
// Day: 48*60 - 50*60
// Week: 20160
set .MaxWait,3000;
//Number of mins after logging before collecting prize
set .Rest,0;
//Point Type
// [0] Points earned
// [1] Point name in mes
setarray .Points$,"#KAFRAPOINTS","K-Points";
// Consecutive Days Buff
// Each buff contains 4 variables (32 Total Max)
// <Type>,<Days>,<Duration>,<Rate>, // Buff 1
// <Type>,<Days>,<Duration>,<Rate>, // Buff 2
// ...;
//
// Example: 188,7,45,3
// -Every 7th consecutive day logged in Player gains +3 Str for 45 mins
//
// Type is 188, which references which SC_ to use, SC_INCSTR in this example
// -For a full list of SC_ visit the db/const.txt
// Days is days buff is applied, in this example 7, so every 7th day, 14,21,28....
// Duration is buff duration is Minuits, in this example 45 mins
// Rate is buff strength, in this example player gains 3 Str
setarray .BuffInfo ,260,2,360,1 // Life Insurance for 360 Mins Every 2nd Day
,198,3,120,10 // +10% Hp for 120 Mins Every 3th Day
,196,5,120,25 // +25 Flee for 120 Mins Every 5th Day
,257,7,240,50; // +50% Exp for 240 Mins Every 7th Day
// Daily Prize items (max 128 days):
// "<Zeny>|<Points>|<BaseExp>|<JobExp>|<itemID-1>|<amount-1>|<itemID-2>|<amount-2>...etc", // Day 1
// "<Zeny>|<Points>|<BaseExp>|<JobExp>|<itemID-1>|<amount-1>|<itemID-2>|<amount-2>...etc" // Day 2
// ...;
// Total length of any days string must be 255 or shorter
// * If players login longer than the last set
// day, they will keep getting the last prize.
setarray .Rewards$,
"0|0|0|0|0|0", // Day 0: First appearance of Daily Reward.
"0|0|0|0|501|1", // Day 1:
"0|0|0|0|501|2", // Day 2:
"0|0|0|0|501|3", // Day 3:
"0|0|0|0|501|4", // Day 4:
"0|0|0|0|501|5", // Day 5:
"0|0|0|0|501|6", // Day 6:
"0|0|0|0|501|7", // Day 7:
"0|0|0|0|501|8", // Day 8:
"0|0|0|0|501|9", // Day 9:
"0|0|0|0|501|10", // Day 10:
"0|0|0|0|501|11", // Day 11:
"0|0|0|0|501|12", // Day 12:
"0|0|0|0|501|13", // Day 13:
"0|0|0|0|501|14", // Day 14:
"0|0|0|0|501|15", // Day 15:
"0|0|0|0|501|16", // Day 16:
"0|0|0|0|501|17", // Day 17:
"0|0|0|0|501|18", // Day 18:
"0|0|0|0|501|10", // Day 19:
"0|0|0|0|501|20", // Day 20:
"0|0|0|0|501|21", // Day 21:
"0|0|0|0|501|22", // Day 22:
"0|0|0|0|501|23", // Day 23:
"0|0|0|0|501|24", // Day 24:
"0|0|0|0|501|25", // Day 25:
"0|0|0|0|501|26", // Day 26:
"0|0|0|0|501|27", // Day 27:
"0|0|0|0|501|28", // Day 28:
"0|0|0|0|501|29", // Day 29:
"0|0|0|0|501|30", // Day 30:
"0|0|0|0|501|31"; // Day 31:
setarray .Pic$,
"day1", // Day 0: First appearance of Daily Reward.
"day1", // Day 1:
"day2", // Day 2:
"day3", // Day 3:
"day4", // Day 4:
"day5", // Day 5:
"day6", // Day 6:
"day7", // Day 7:
"day8", // Day 8:
"day9", // Day 9:
"day10", // Day 10:
"day11", // Day 11:
"day12", // Day 12:
"day13", // Day 13:
"day14", // Day 14:
"day15", // Day 15:
"day16", // Day 16:
"day17", // Day 17:
"day18", // Day 18:
"day19", // Day 19:
"day20", // Day 20:
"day21", // Day 21:
"day22", // Day 22:
"day23", // Day 23:
"day24", // Day 24:
"day25", // Day 25:
"day26", // Day 26:
"day27", // Day 27:
"day28", // Day 28:
"day29", // Day 29:
"day30", // Day 30:
"day31"; // Day 31:
end;
}
Hi, can someone edit this script?
I want it to be:
• A Player must logged in for 1 hour before he gets the prize.
• Then after the player receives the reward, the 24-hour countdown will start.
Example:
I received the reward at 21:03 (monday)
the daily 1hour will begin at 21:03 (tuesday)
the next reward will be on 22:03 (tuesday)
Thanks
Share this post
Link to post
Share on other sites