public int GetSeconds() { return(int)(gameTimer % 60); }
public int GetMinutes() { return(int) (gameTimer / 60) % 60; }
public int GetHours() { return(int) (gameTimer / 3600) % 24; }
public int GetDaysOfWeek() { return(int) (gameTimer / 86400) % 7 + 1; }
public int GetDaysOfMonth(){ return(int) (gameTimer / 86400) % 28 + 1; }
public int GetMonth() { return(int) (gameTimer / 2419200) % 12 + 1;}
the reason i ask is because let’s say i have a regeneration buff, which lasts for 2 hours,…
suppose it should tick every 5 minutes, but in the mean time if i call
public void Add_8_Hour()
{
gameTimer += 28800;
}
it’s not gonna regen in the time between each those 300 periods
Divide 28800 by your regen period and use the result to make a loop that runs the regen routine that many times. Or instead, if the regen amount is always the same, multiply that by the result of the division to get the total regen amount.
the trouble with that is , if im buff for next hour, wait 8 that would be 7 bonus hours when the buff should no longer count.
I think that’ll have to be done somehow else,
Don’t you have an idea how to run something every 300 once?
If your buff time only lasts an hour that’s 3600 seconds, so just divide by 300 either that or the amount of time added, (whichever is the lower value), as your multiplier/loop counter.
it lasts dependant on skill so the duration is dynamic.
public void Add_8_Hours()
{
if (SMA.I.spellBuffs[(int)PLAYER_BUFFS . BUFF_REGENERATION].Active())
{
// Here i should do the divisions or calculations?
SMA.I.spellBuffs[(int)PLAYER_BUFFS.BUFF_REGENERATION].timer //<- timer is just gametime + duration
}
gameTimer += 28800;
}