Permalink
Cannot retrieve contributors at this time
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
166 lines (156 sloc)
6.05 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //===== rAthena Script ======================================= | |
| //= Daily Reward | |
| //===== By =================================================== | |
| //= llchrisll | |
| //===== Version ============================================== | |
| //= 1.0 - Initial Version | |
| // - Modified the way the timer works | |
| // - Added checkidle | |
| //===== Tested With ========================================== | |
| //= rAthena 04/29/2020 Revision | |
| //= GIT Hash: 4829f3775d5371e65d6648cf05b6f0c2810bb664 | |
| //===== Description ========================================== | |
| //= Simple Daily Reward Script | |
| //= Config: | |
| // You can add more than the given values, even more variables, see the config | |
| //===== Comments ============================================= | |
| //= I'm not adding an IP Check, too lazy for that | |
| //============================================================ | |
| - script DailyLogin -1,{ | |
| OnPCLoginEvent: | |
| if(#DailyReward > gettimetick(2)) { | |
| dispbottom .n$+": You can't currently recieve the Daily Reward, you still have to wait "+callfunc("Time2Str",#DailyReward); | |
| end; | |
| } | |
| set #DailyReward,0; | |
| announce .n$+": Stay active for "+( (.rew_login%60 == 0)?.rew_login/60+" hour(s)":.rew_login+" Minute(s)")+" to recieve the Daily Reward.",bc_self; | |
| addtimer .rew_timer,"DailyLogin::OnTimeCheck"; | |
| end; | |
| OnTimeCheck: | |
| deltimer "DailyLogin::OnTimeCheck"; | |
| if(checkidle() <= .idle) { | |
| if(@CheckIdle) | |
| set @CheckIdle,0; | |
| set @daily,@daily + .rew_count; | |
| //if(getgroupid()) // Testing purposes | |
| // dispbottom "Daily Timer: "+@daily; | |
| if(@daily == .rew_login) { | |
| set @daily,0; | |
| if(.rew_type == 2) | |
| set @DailyReward,DT_DAYOFMONTH; | |
| else | |
| set @DailyReward,Daily + 1; | |
| announce .n$+": You can now recieve your Daily Reward. Please visit me for that.",bc_self; | |
| end; | |
| } | |
| } else { | |
| if(!@CheckIdle) { | |
| announce .n$+": You need to stay active for your Daily Reward. I will check again in "+.rew_count+" minute(s).",bc_self; | |
| set @CheckIdle,1; | |
| } | |
| } | |
| addtimer .rew_timer,"DailyLogin::OnTimeCheck"; | |
| end; | |
| OnInit: | |
| set .n$,"[Daily Reward]"; | |
| set .rew_time,86400; // Timer until next Reward in seconds | |
| // Check in seconds how long the player can be "idle" | |
| set .idle,5; | |
| // How long does someone have to stay online to recieve the reward in minutes | |
| // Default: 60 = 1 Hour | |
| set .rew_login,60; | |
| // How many minutes should pass for the counter to increase > OnTimeCheck | |
| set .rew_count,1; | |
| // Dynamic Timer - Don't touch this please | |
| set .rew_timer,.rew_count*60*1000; | |
| // Reward Type: | |
| // 1 = Continues Reward | |
| // 2 = Depending on day | |
| set .rew_type,1; | |
| end; | |
| } | |
| prontera,150,175,4 script Daily Reward 100,{ | |
| mes .n$; | |
| mes "Welcome, "+strcharinfo(0)+"!"; | |
| set .@d_login,getvariableofnpc(.rew_login,"DailyLogin")-@daily; | |
| if(!@DailyReward) { | |
| mes "I'm sorry, but you can't recieve your Daily Reward yet."; | |
| mes "You still have to wait "+( (.@d_login%60 == 0)?.@d_login/60+" hour(s)":.@d_login+" minute(s)")+"."; | |
| close; | |
| } | |
| mes "The reward for today is:"; | |
| set .@Day,@DailyReward; | |
| for ( set .@r,0; .@r < getarraysize(getd(".rew_day"+.@Day)); set .@r,.@r + 2) { | |
| if(getd(".rew_day"+.@Day+"["+.@r+"]") == 1) { | |
| mes "Zeny: "+getd(".rew_day"+.@Day+"["+(.@r+1)+"]"); | |
| set Zeny,Zeny + getd(".rew_day"+.@Day+"["+(.@r+1)+"]"); | |
| } else if(getd(".rew_day"+.@Day+"["+.@r+"]") >= 501 ) { | |
| mes getd(".rew_day"+.@Day+"["+(.@r+1)+"]")+"x "+getitemname(getd(".rew_day"+.@Day+"["+.@r+"]")); | |
| getitem getd(".rew_day"+.@Day+"["+.@r+"]"),getd(".rew_day"+.@Day+"["+(.@r+1)+"]"); | |
| } else { | |
| mes getd(".rew_day"+.@Day+"["+(.@r+1)+"]")+"x "+.rew_vard$[getd(".rew_day"+.@Day+"["+.@r+"]")-1]; | |
| setd(""+.rew_varn$[getd(".rew_day"+.@Day+"["+.@r+"]")-1]),getd(""+.rew_varn$[getd(".rew_day"+.@Day+"["+.@r+"]")-1]) + getd(".rew_day"+.@Day+"["+(.@r+1)+"]"); | |
| } | |
| } | |
| set #DailyReward,gettimetick(2) + .rew_time; | |
| if(getvariableofnpc(.rew_type,"DailyLogin") == 1) | |
| set Daily,@DailyReward; | |
| set @DailyReward,0; | |
| mes " "; | |
| mes "You have collected your daily reward. See you next time."; | |
| close; | |
| OnInit: | |
| set .n$,"["+strnpcinfo(0)+"]"; | |
| // Display Name of Variables for Players | |
| setarray .rew_vard$[1],"Cash Points","Kafra Points"," PvP Points","WoE Points","Event Points"; | |
| // Variable Names | |
| setarray .rew_varn$[1],"#CASHPOINTS","#KAFRAPOINTS","PvPPoints","WoEPoints","EventPoints"; | |
| // ======= Reward Settings ======= | |
| // - Identifiers: | |
| // 1 = Zeny | |
| // 2 = Cash Points | |
| // 3 = Kafra Points | |
| // 4 = PvP Points | |
| // 5 = WoE Points | |
| // 6 = Event Points | |
| // For Items = Item ID | |
| // Note: You can add more Variables if you want and rename the current ones of course | |
| // But remember to note it like above for better overview which Identfier it has | |
| // The Idenfier is the "Index" of the Array + 1, see above | |
| // Example: Variable for Quest Points, add it after the last Value of each Array | |
| // .rew_vard$ = "Quest Points" > Display Name for Players | |
| // .rew_varn$ = "QuestPoints" > Variable Name for the Script | |
| // The Idenfier for it would be 7, so the Index would be 6 | |
| setarray .rew_day1[0],1,5000,12863,5,2,5; | |
| setarray .rew_day2[0],1,15000,12899,5,3,10; | |
| setarray .rew_day3[0],1,10000,12902,5,2,50; | |
| setarray .rew_day4[0],1,5000,512,100,2,5; | |
| setarray .rew_day5[0],1,5000,512,100,2,5; | |
| setarray .rew_day6[0],1,5000,512,100,2,5; | |
| setarray .rew_day7[0],1,5000,512,100,2,5; | |
| setarray .rew_day8[0],1,5000,512,100,2,5; | |
| setarray .rew_day9[0],1,5000,512,100,2,5; | |
| setarray .rew_day10[0],1,5000,512,100,2,5; | |
| setarray .rew_day11[0],1,5000,512,100,2,5; | |
| setarray .rew_day12[0],1,5000,512,100,2,5; | |
| setarray .rew_day13[0],1,5000,512,100,2,5; | |
| setarray .rew_day14[0],1,5000,512,100,2,5; | |
| setarray .rew_day15[0],1,5000,512,100,2,5; | |
| setarray .rew_day16[0],1,5000,512,100,2,5; | |
| setarray .rew_day17[0],1,5000,512,100,2,5; | |
| setarray .rew_day18[0],1,5000,512,100,2,5; | |
| setarray .rew_day19[0],1,5000,512,100,2,5; | |
| setarray .rew_day20[0],1,5000,512,100,2,5; | |
| setarray .rew_day21[0],1,5000,512,100,2,5; | |
| setarray .rew_day22[0],1,5000,512,100,2,5; | |
| setarray .rew_day23[0],1,5000,512,100,2,5; | |
| setarray .rew_day24[0],1,5000,512,100,2,5; | |
| setarray .rew_day25[0],1,5000,512,100,2,5; | |
| setarray .rew_day26[0],1,5000,512,100,2,5; | |
| setarray .rew_day27[0],1,5000,512,100,2,5; | |
| setarray .rew_day28[0],1,5000,512,100,2,5; | |
| setarray .rew_day29[0],1,5000,512,100,2,5; | |
| setarray .rew_day30[0],1,5000,512,100,2,5; | |
| setarray .rew_day31[0],1,5000,512,100,2,5; | |
| end; | |
| } |