• NOW LIVE! Into the Woods--new character species, eerie monsters, and haunting villains to populate the woodlands of your D&D games.

[RPG] Jobs and collecting salary?

You have to give the HR employee a void check in order to do that. And since Morrus has implemented neither a HR department or Checks as objects, you'll have to collect your salary.

:p

Instead of your salary instantly going to your bank account, could the timer NOT reset when you actually collect your salary?
 

log in or register to remove this ad


I've checked the code more carefully; the problem is there but the fix is more complex than just changing a line. The algorithm he uses is wrong.
// [Calculate Time Untill Next Payment]
$diff = time()-$member['last_jpay'];
$diff = $diff+$job['jinterval'];
Can you see it? He takes the time since your last payment and adds the job interval to it. So if I have a week job and I got paid on the 1st, and today is the 3rd, he makes 3-1=2, 2+7=9. That's not the "diff" between today and my next wage. It's a meaningless number.

I think that changing that to
// [Calculate Time Untill Next Payment]
$diff = time()-$member['last_jpay'];
$diff = $job['jinterval']-$diff;
should fix it. At which point the part which says
$tdays=$daysDiff-1;
$thrs=23-$hrsDiff;
$tmins=59-$minsDiff;
$tsecs=59-$secsDiff;
becomes useless and wrong. So the entire block should become
// [Calculate Time Untill Next Payment]
$diff = time()-$member['last_jpay'];
$diff = $job['jinterval']-$diff;
$tdays = floor($diff/60/60/24);
$diff -= $daysDiff*60*60*24;
$thrs = floor($diff/60/60);
$diff -= $hrsDiff*60*60;
$tmins = floor($diff/60);
$diff -= $minsDiff*60;
$tsecs = $diff;

$timer ="{$tdays} days, ".$thrs." hours, ".$tmins." minutes and ".$tsecs." seconds until you are able to collect your salary";
$time=$timer;
There, now it works and it's even simpler. :)
I've evidenced the bits which need to be changed. I don't really know PHP, but I'm fairly sure that this would work, could Morrus try and change it...?
 
Last edited:

It apparently was fixed, but now my timer is off again. I'm an acolyte (48 hours) and today it tells me I have 2 days, 11 hours. I figure that means I have 11 hours, if the same code error is there, but I thought it was fixed. :\ It didn't say anything unusual yesterday (less than 12 hours ago).
 

Into the Woods

Remove ads

Top