viewing paste daily | Text

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
//===== EinherjarRO Scripts ================================== 
//= Daily Prize, OnPCLoginEvent
//===== By: ================================================== 
//= Stolao
//===== Current Version: ===================================== 
//= 1.68
//===== 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 )
//= 1.64 Fixed Incorrect Logic Error
//= 1.65 Remove all "set"
//= 1.66 Added CheckWeight
//= 1.67 Fixed Tabulation
//= 1.68 Fixed message error
//===== Contact Info: ========================================
//= [Stolao] 
//= Email: [email protected]
//============================================================
-   script  LOGIN   -1,{
OnWhisperGlobal:
OnLoginCmnd:
OnPCLoginEvent:
    if(.Rest){
        @login = (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + gettime(2);
        if(@login > #LastDailyReward + .MaxWait ){
            #logintimer = 0;
            @login = 0;
        }
        message strcharinfo(0),"[Daily Rewards]: to collec reward you must remain logged in for "+ ( .Rest - #logintimer ) +" Minuets";
    }
    .@i = (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + gettime(2);
    if(.@i - .Rest -  #logintimer >= (#LastDailyReward + .MinWait)){
        if(.@i < #LastDailyReward + .MaxWait)
            @DRewardCon = #DRewardCon + 1;
        else    @DRewardCon = 0;
        sleep2 .Rest * 60000 - #logintimer + 100;
        .@g = (@DRewardCon > getarraysize(.Rewards$)) ? (getarraysize(.Rewards$)-1) : @DRewardCon;
        explode(.@XT$,.Rewards$[.@g],"|");
        for(.@x = 0; .@x < 5; .@x++){
            set .@TT[.@x], atoi(.@XT$[.@x]);
        }
        if(.Mode & 1 && .@TT[4]){
            for(.@x = 4; .@x < getarraysize(.@XT$); .@x += 2){
                .@itms[.@x - 4] = atoi(.@XT$[.@x]);
                .@qnts[.@x - 4] = atoi(.@XT$[.@x + 1]);
            }
            if(checkweight2(.@itms,.@qnts)){
                for(.@x = 4; .@x < getarraysize(.@itms) && .@x < getarraysize(.@qnts); .@x += 2){
                    getitem  .@itms[.@x], .@qnts[.@x+1];
                    message strcharinfo(0),"[Daily Rewards]: Recived "+  .@qnts[.@x+1] +" "+ getitemname(.@itms[.@x]);
                }
            } else {
                message strcharinfo(0),"[Daily Rewards]: You cannot carry the prizes, please use storage and relog.";
                #DRewardCon -= 1;
                end;
            }
        }
        if(.Mode & 2){
            if(.@TT[0]){
                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(.@x = 0; .@x < getarraysize(.BuffInfo); .@x += 4){
                if(#DRewardCon % .BuffInfo[.@x + 1] == 0) sc_start .BuffInfo[.@x], .BuffInfo[.@x + 2] * 60000, .BuffInfo[.@x + 3];
            }
        }
        @DRewardCon += 1;
        message strcharinfo(0),"[Daily Rewards]: You have collected your daily reward, for "+@DRewardCon+" day"+((@DRewardCon > 1)?"s":"")+" in a row.";
        //===============Display of pic's with day highlighted.=======================
        cutin .Pic$[.@g],4;
        //============================================================================
        #DRewardCon += 1;
        #LastDailyReward = .@i;
        #logintimer = 0;
        @login = 0;
    } else {
        .@days = (#LastDailyReward + .MinWait - .@i)/60/24;
        .@hours = ((#LastDailyReward + .MinWait - .@i)/60)%24;
        .@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) #logintimer = (gettime(7) * 365 * 24 * 60) + (gettime(8) * 24 * 60) + (gettime(3) * 60) + gettime(2) - @login + #logintimer;
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("relog"   ,"LOGIN::OnLoginCmnd",0,99);
    bindatcmd("loginreward" ,"LOGIN::OnLoginCmnd",0,99);
 
    //Minimum Minuets Between Collecting Daily Reward
    //   Day: 22*60 - 24*60
    //   Week: 10080
    .MinWait = 24*60;
 
    //Minuets Before Lose Consecutive Daily Reward
    //   Day: 48*60 - 50*60
    //   Week: 20160
    .MaxWait = 3000;
 
    //Number of mins after logging before collecting prize
    .Rest = 60;
 
    //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|501|1",            // Day 1: 1 Red Potion
        "0|0|0|0|501|2",            // Day 2: 2 Red Potion
        "0|0|0|0|501|3";            // Day 3: 3 Red Potion
                "0|0|0|0|501|4",            // Day 4: 4 Red Potion
        "0|0|0|0|501|5",            // Day 5: 5 Red Potion
        "0|0|0|0|501|6";            // Day 6: 6 Red Potion
                "0|0|0|0|501|7",            // Day 7: 7 Red Potion
        "0|0|0|0|501|8",            // Day 8: 8 Red Potion
        "0|0|0|0|501|9";            // Day 9: 9 Red Potion
                "0|0|0|0|501|10";           // Day 10: 10 Red Potion
                "0|0|0|0|501|11",           // Day 11: 11 Red Potion
        "0|0|0|0|501|12",           // Day 12: 12 Red Potion
        "0|0|0|0|501|13";           // Day 13: 13 Red Potion
                "0|0|0|0|501|14",           // Day 14: 14 Red Potion
        "0|0|0|0|501|15",           // Day 15: 15 Red Potion
        "0|0|0|0|501|16";           // Day 16: 16 Red Potion
                "0|0|0|0|501|17",           // Day 17: 17 Red Potion
        "0|0|0|0|501|18",           // Day 18: 18 Red Potion
        "0|0|0|0|501|19";           // Day 19: 19 Red Potion
                "0|0|0|0|501|20";           // Day 20: 20 Red Potion
                "0|0|0|0|501|21",           // Day 21: 21 Red Potion
        "0|0|0|0|501|22",           // Day 22: 22 Red Potion
        "0|0|0|0|501|23";           // Day 23: 23 Red Potion
                "0|0|0|0|501|24",           // Day 24: 24 Red Potion
        "0|0|0|0|501|25",           // Day 25: 25 Red Potion
        "0|0|0|0|501|26";           // Day 26: 26 Red Potion
                "0|0|0|0|501|27",           // Day 27: 27 Red Potion
        "0|0|0|0|501|28",           // Day 28: 28 Red Potion
        "0|0|0|0|501|29";           // Day 29: 29 Red Potion
                "0|0|0|0|501|30";           // Day 30: 30 Red Potion
                "0|0|0|0|501|31";           // Day 31: 31 Red Potion
        
    setarray .Pic$,
    "tutorial01", //pic with day1 highlighted
    "tutorial02", //pic with day2 highlighted
    "tutorial03"; //pic with day3 highlighted
        "tutorial04", //pic with day4 highlighted
    "tutorial05", //pic with day5 highlighted
    "tutorial06"; //pic with day6 highlighted
        "tutorial07", //pic with day7 highlighted
    "tutorial08", //pic with day8 highlighted
    "tutorial09"; //pic with day9 highlighted
        "tutorial10"; //pic with day10 highlighted
        "tutorial11", //pic with day11 highlighted
    "tutorial12", //pic with day12 highlighted
    "tutorial13"; //pic with day13 highlighted
        "tutorial14", //pic with day14 highlighted
    "tutorial15", //pic with day15 highlighted
    "tutorial16"; //pic with day16 highlighted
        "tutorial17", //pic with day17 highlighted
    "tutorial18", //pic with day18 highlighted
    "tutorial19"; //pic with day19 highlighted
        "tutorial20"; //pic with day20 highlighted
        "tutorial21", //pic with day21 highlighted
    "tutorial22", //pic with day22 highlighted
    "tutorial23"; //pic with day23 highlighted
        "tutorial24", //pic with day24 highlighted
    "tutorial25", //pic with day25 highlighted
    "tutorial26"; //pic with day26 highlighted
        "tutorial27", //pic with day27 highlighted
    "tutorial28", //pic with day28 highlighted
    "tutorial29"; //pic with day29 highlighted
        "tutorial30"; //pic with day30 highlighted
        "tutorial31", //pic with day31 highlighted
end;
}
Viewed 849 times, submitted by Guest.