viewing paste Unknown #15795 | Athena

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
// Daily Dynamic Rental Headgear Quest
// v1.1 (cleaned
// by Winz
 
prontera,150,164,3      script  Test    909,{
        if (taken)
                if (gettimetick(1) <= taken+86400000) {
                        mes "[Free headgear]";
                        mes "Sorry, you have received your headgear today.";
                        set .@timeleft, taken + 86400000 - gettimetick(0);
                        set .@remainingTime, taken - gettimetick(1);
                        set .@hr, .@timeleft / 3600000;
                        set .@min, .@remainingTime % 3600 / 60;
                        mes "Talk to me again in ^0000FF"+.@hr+" ^000000hour"+((.@hr > 1)? "s":"")+" ^000000and ^0000FF"+.@min+" ^000000minute"+((.@min > 1)? "s":"")+"^000000";
                        close;
                }
 
        mes "[Free headgear]";
        mes "Wanna free headgear?";
        mes "Today's prize is: ^0000FF"+getitemname($ar[.hg])+"^000000";
        next;
        mes "You just need:";
        for (set .@i,0; .@i < getarraysize(.todayreq)/2; set .@i, .@i+1)
                mes "^0000FF"+getitemname(.todayreq[.@i*2])+" ^000000:^00FF00 "+.todayreq[.@i*2+1]+" ^000000pcs.";
        if(select("Yes:No") == 2) close;
        next;
        mes "[Free headgear]";
        mes "Got the things already?!";
        mes "Let me check your bag.";
        next;
        for (set .@i,0; .@i < getarraysize(.todayreq)/2; set .@i, .@i+1)
                if (countitem(.todayreq[.@i*2]) >= .todayreq[.@i*2+1])
                        set .@yes, .@yes + 1;
        if (.@yes != (getarraysize(.todayreq)/2)) {
                mes "[Free headgear]";
                mes "You don't have the required items.";
                mes "Come back to me after you got those items.";
                close;
        }
        for (set .@i,0; .@i < getarraysize(.todayreq)/2; set .@i, .@i+1)
                delitem .todayreq[.@i*2],.todayreq[.@i*2+1];
        mes "[Free headgear]";
        mes "Here's your headgear!";
        mes "Congrats, 3Q, bye!";
        rentitem .todayhg, 60*60*24;
        set taken, gettimetick(1);
        close;
 
        OnInit:
        deletearray $ar;
        deletearray $exchange;
        setarray $ar[1],2251,2252,2253,2254,2255,2256,2257,2258,2259,2260,2261,2262,2263,2264,2265,2266,2267,2268,2269,2270,2271,2272,2273,2274,2275,2276,2277,2278,2279,2280,2281;//headgear
        setarray $exchange[1],501,502,503,504,505,506,507,508,509,510,511,512,513,514,515,516,517,518,519,520,521,522,523,525,526,528,529,530,531;//materials
        if (.hg == (getarraysize($ar)-1)) //last headgear index
                set .hg, 1; //set to first
        else
                set .hg, .hg+1; //next one e.g: 2251 -> 2252
               
        set .todayhg, $ar[.hg];
        set .@items, rand(5,6);
        set .@exsize, getarraysize($exchange)-1;
        for (set .@i,0; .@i < .@items; set .@i, .@i+1){
                set .@j, rand(1, .@exsize);
                for (set .@k,0; .@k < .@i; set .@k, .@k+1)
                        while(.@selected[.@k] == .@j || .@j==0) {
                                set .@j, rand(1, .@exsize);
                        }
                setarray .@selected[.@i],.@j;
                setarray .todayreq[.@i*2], $exchange[.@j];
                setarray .todayreq[.@i*2+1],rand(100,500);
        }
        end;
}
Viewed 514 times, submitted by unknown.