Jump to content
  • 0

Daily Reward vending exception


windston

Question


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   1
  • Joined:  03/06/12
  • Last Seen:  

I'm trying to add a vendcheck feature to prevent players vending from getting prizes but it only seems to affect normal vendors and not those that are @autotrade, they still seem to get the prize once 2 hours has past.

I'm using Stolao's Daily Login Reward 1.48.

This is what the script looks like, the changes I made are in red.

 

-    script    LOGIN    -1,{
OnWhisperGlobal:
OnLoginCmnd:
OnPCLoginEvent:
    sleep2 1000+.Rest*60000;
    set .@i,(gettime(7)*365*24)+(gettime(8)*24)+gettime(3);
    set .@g,getarraysize(.Rewards);
    if(checkvending() > 0) {dispbottom "You seem to be vending, you cannot claim a daily prize until you stop and relogin.";
    end; }

    if(.@i >= (#LastDailyReward + .MinWait)){
        if(.@i < #LastDailyReward + .MaxWait){ set #DRewardCon,#DRewardCon+1;
         } else { set #DRewardCon,1; }
        if(#DRewardCon*2 > .@g-1){ set .@p,.Rewards[.@g-2]; set .@q,.Rewards[.@g-1];
        } else { set .@p,.Rewards[#DRewardCon*2-2]; set .@q,.Rewards[#DRewardCon*2-1]; }
        if(.Mode&1&&.@p && checkvending() == 0) {
            if(!checkweight(.@p,.@q)){ dispbottom "You seem to be oveweight, put some stuff away and relog to claim prize"; end;
            } else { getitem .@p,.@q; dispbottom ""+.@q+" "+getitemname(.@p)+""; }
        }
        if(.Mode&2) set .@A,#DRewardCon*.ZMulti;
        if(.Mode&8) set .@A,.@A+.@q;
        if(.Mode&2||.Mode&8){ setd .PointType$,getd(.PointType$)+.@A; dispbottom ""+.@A+" "+.PointType$+""; }
        if(.Mode&4){ set .@B,#DRewardCon*.XPMulti[0]; set .@C,#DRewardCon*.XPMulti[1]; }
        if(.Mode&16){ set .@B,.@B+.@q; set .@C,.@C+.@q; }
        if(.Mode&4||.Mode&16){ getexp .@B,.@C; }
        if(.Mode&32){
            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];
            }
        }
        dispbottom "You have collected your daily reward, for "+#DRewardCon+" day"+((DRewardCon>1)?"s":"")+" in a row.";
        set #LastDailyReward,.@i;
    } else { dispbottom "You have "+(#LastDailyReward + .MinWait-.@i)+" hours till your next reward"; }    
end;

OnInit:


I added two checks to prevent autotraders from getting the prize but they seem to still get it, anyone have any ideas on what im doing wrong.

Link to comment
Share on other sites

3 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

It may be that @autoloot doesn't put the player in a vending state seen by the server. So for your case this is what you can do.

if( checkvending() || checkidle == ( 120 * 60 ) ){dispbottom "You seem to be vending. You cannot claim a daily prize until you stop and relogin."; end;}

That will check to see if they've been idle for 2hours. Though, this isn't full proof, because I can essentially log in walk around for 2seconds and then @autotrade, thus making the 2hour check invalid. This will only work with those who login and don't move from that spot at all.

 

Unless we get more information regarding how @autoloot players are seen by the server, this may be your best solution.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  22
  • Topics Per Day:  0.00
  • Content Count:  53
  • Reputation:   1
  • Joined:  03/06/12
  • Last Seen:  

I have vending only available on one map, would they be a way to add a condition to 

    if(.@i >= (#LastDailyReward + .MinWait))

 

So the player has to meet those condition but also cannot be on map A or whatever for the script to give out the prize.

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  31
  • Topics Per Day:  0.01
  • Content Count:  666
  • Reputation:   93
  • Joined:  04/27/12
  • Last Seen:  

Hmm, then perhaps a work around is in need. We'll do something to replace the sleep timer, while still keeping the original script's purpose in tact...  give me a few mins and I'll write something up.

 

Edit:

Okay, here is my revisions to your script...

-	script	LOGIN	-1,{
OnPCLoginEvent:
addtimer( 1000+.Rest*60000,strnpcinfo(3)+"::OnRewardTime";
setd ".Temp"+ getcharid(0) +"",(#LastDailyReward + .MinWait); //Saves your wait time for use in the loop.
freeloop 1; //Needed to do this...
while(1)
	{if( getd(".Temp"+ getcharid(0) +"") < (#LastDailyReward + .MinWait) ){break;}//Checks to see if you got the reward, then ends the loop. Thus ending the script.
	 if( checkidle >= (5*60) ){addtimercount( (checkidle*1000) - @lastidle,strnpcinfo(3)+"::OnRewardTime" ); set @lastidle,@lastidle+(checkidle*1000);}} //Checks to see if you've been idle for atleast 5mins, if so, then adds 5mins to the countdown timer. Meaning the player will essentially have to play for X amount of time to get reward, all idled time will not count and instead delay the timer.
freeloop 0;
end;
OnWhisperGlobal:
OnLoginCmnd:
OnRewardTime:
    set .@i,(gettime(7)*365*24)+(gettime(8)*24)+gettime(3);
    set .@g,getarraysize(.Rewards);
    if(checkvending() > 0) {dispbottom "You seem to be vending, you cannot claim a daily prize until you stop and relogin.";
    end; }
    if(.@i >= (#LastDailyReward + .MinWait)){
        if(.@i < #LastDailyReward + .MaxWait){ set #DRewardCon,#DRewardCon+1;
         } else { set #DRewardCon,1; }
        if(#DRewardCon*2 > .@g-1){ set .@p,.Rewards[.@g-2]; set .@q,.Rewards[.@g-1];
        } else { set .@p,.Rewards[#DRewardCon*2-2]; set .@q,.Rewards[#DRewardCon*2-1]; }
        if(.Mode&1&&.@p && checkvending() == 0) {
            if(!checkweight(.@p,.@q)){ dispbottom "You seem to be oveweight, put some stuff away and relog to claim prize"; end;
            } else { getitem .@p,.@q; dispbottom ""+.@q+" "+getitemname(.@p)+""; }
        }
        if(.Mode&2) set .@A,#DRewardCon*.ZMulti;
        if(.Mode&8) set .@A,.@A+.@q;
        if(.Mode&2||.Mode&8){ setd .PointType$,getd(.PointType$)+.@A; dispbottom ""+.@A+" "+.PointType$+""; }
        if(.Mode&4){ set .@B,#DRewardCon*.XPMulti[0]; set .@C,#DRewardCon*.XPMulti[1]; }
        if(.Mode&16){ set .@B,.@B+.@q; set .@C,.@C+.@q; }
        if(.Mode&4||.Mode&16){ getexp .@B,.@C; }
        if(.Mode&32){
            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];
            }
        }
        dispbottom "You have collected your daily reward, for "+#DRewardCon+" day"+((DRewardCon>1)?"s":"")+" in a row.";
        set #LastDailyReward,.@i;
    } else { dispbottom "You have "+(#LastDailyReward + .MinWait-.@i)+" hours till your next reward"; }    
end;

In side the script I left comments for you to follow, but I'll explain what this script does here.

 

While I did not touch the core of the script, I did change the timing calc for it. Instead of having the script sleep for X time, I added a timer, that will trigger after that time has ended. This is becaue a player must be online for X amount of time to get the reward, and only after the reward cooldown is finished, atleast that is what I can gather from the original script.

 

What I did was add in a check for Idle players, meaning those sitting in chat boxes, or just straight afking won't get the reward until they move around for the duration of the timer. This also applies to @autotraders.

 

In short this is what the script does....

1. Adds a 2hour timer (example time).

2. After 2 hours my timer will trigger an event giving me the reward, if my reward cool down is up.

3. If I idle (stand still) for more than 5mins. It will Add my idle time to the timer, thus extending it. And will continue to add this time, until I move around.

4. Once I move around again, the timer will countdown again.

5. After which if I don't idle, it will proceed to #2. Else it will proceed to #3 if I idle for more than 5mins.

 

How does this stop @autotraders?

Simple, when a player uses @autotrade, their character is still logged into the server, there for they can still go idle. And since player's can't move @autotraders until they relog, their timer will continously go up and up and up until the relog, which will reset the timer again.

Since this same rule can apply to venders it's effective on them as well. It is also effective on ChatBox users and afkers who just up and leave.

Edited by GmOcean
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...