|
80 | 80 | if res < 0 then res += 1; |
81 | 81 |
|
82 | 82 | Result := GetTimeRunning() + UInt64(Trunc(res * ONE_DAY)); |
83 | | - Result += Trunc(Abs(GaussRand(0, randomness * 10 * ONE_DAY))); |
84 | | - Result := Max(0, Result); |
| 83 | + Result += Trunc(Abs(GaussRand(0, randomness * ONE_DAY / 2))); |
85 | 84 | end; |
86 | 85 |
|
87 | 86 |
|
@@ -119,7 +118,7 @@ begin |
119 | 118 | Self.Sleeps[idx].Length := length; |
120 | 119 | Self.Sleeps[idx].StdVar := randomness; |
121 | 120 | Self.Sleeps[idx].LogoutChance := logoutChance; |
122 | | - Self.Sleeps[idx].Next := Self.TimeRunningAtClock(Self.Sleeps[idx].Time, Self.Sleeps[idx].StdVar); |
| 121 | + Self.Sleeps[idx].Next := Self.TimeRunningAtClock(time, randomness); |
123 | 122 | end; |
124 | 123 |
|
125 | 124 |
|
@@ -198,6 +197,8 @@ in a "bare" time format (00:00:00). |
198 | 197 |
|
199 | 198 | `randomness` is self explanatory, gives variance to the time our script will |
200 | 199 | sleep at and it's length too. |
| 200 | +One thing to keep in mind is that randomness only affects time past `time`. |
| 201 | +In other words, you will never sleep before `time`. |
201 | 202 |
|
202 | 203 | `logoutChance` is the probability of logging out for the sleep break or to |
203 | 204 | simply afk and logout from inactivity. |
@@ -514,25 +515,25 @@ end; |
514 | 515 | (* |
515 | 516 | ## Antiban.TimeUntilBreak |
516 | 517 | ```pascal |
517 | | -function TAntiban.TimeUntilBreak(task: TBreakTask): String; |
| 518 | +function TAntiban.TimeUntilBreak(constref task: TBreakTask; fmt: String = TIME_FORMAL): String; |
518 | 519 | ``` |
519 | 520 | Check how much time is left until the specified break `task` should be taken. |
520 | 521 | *) |
521 | | -function TAntiban.TimeUntilBreak(task: TBreakTask): String; |
| 522 | +function TAntiban.TimeUntilBreak(constref task: TBreakTask; fmt: String = TIME_FORMAL): String; |
522 | 523 | begin |
523 | | - Result := FormatMilliseconds(Max(0, Round(task.Next - GetTimeRunning())), True); |
| 524 | + Result := FormatMilliseconds(Max(0, Round(task.Next - GetTimeRunning())), fmt); |
524 | 525 | end; |
525 | 526 |
|
526 | 527 | (* |
527 | 528 | ## Antiban.TimeUntilSleep |
528 | 529 | ```pascal |
529 | | -function TAntiban.TimeUntilSleep(task: TSleepTask): String; |
| 530 | +function TAntiban.TimeUntilSleep(constref task: TSleepTask; fmt: String = TIME_FORMAL): String; |
530 | 531 | ``` |
531 | 532 | Check how much time is left until the specified sleep break `task` should be taken. |
532 | 533 | *) |
533 | | -function TAntiban.TimeUntilSleep(task: TSleepTask): String; |
| 534 | +function TAntiban.TimeUntilSleep(constref task: TSleepTask; fmt: String = TIME_FORMAL): String; |
534 | 535 | begin |
535 | | - Result := FormatMilliseconds(Max(0, Round(task.Next - GetTimeRunning())), True); |
| 536 | + Result := FormatMilliseconds(Max(0, Round(task.Next - GetTimeRunning())), fmt); |
536 | 537 | end; |
537 | 538 |
|
538 | 539 | (* |
|
0 commit comments