diff options
author | Jesusaves <cpntb1@ymail.com> | 2025-03-04 15:57:38 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2025-03-04 15:57:38 -0300 |
commit | 7071512b58d79765c970ad780e52885ce0294065 (patch) | |
tree | ba4af75f0aace6d5902c0627b44cc13f55804616 | |
parent | 864810fb600c89576ca3605f18c647b7158e6a02 (diff) | |
download | serverdata-7071512b58d79765c970ad780e52885ce0294065.tar.gz serverdata-7071512b58d79765c970ad780e52885ce0294065.tar.bz2 serverdata-7071512b58d79765c970ad780e52885ce0294065.tar.xz serverdata-7071512b58d79765c970ad780e52885ce0294065.zip |
Refactor a bit the code and fix an exploit before it goes live
-rw-r--r-- | npc/003-11/alfred.txt | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/npc/003-11/alfred.txt b/npc/003-11/alfred.txt index 96d8ca27d..24b2753d0 100644 --- a/npc/003-11/alfred.txt +++ b/npc/003-11/alfred.txt @@ -38,17 +38,16 @@ OnBleep: // Check if you changed the map if (getmap() != "003-11") { // Check how many hours you've worked - .@current = gettimeparam(GETTIME_MINUTE); + .@current = max(0, gettimeparam(GETTIME_MINUTE) - @alfred_st); // Pay you for every 60 minutes - .@pay = min(.maxHours, (.@current - @alfred_st) / 60) * _calc_wage(); + .@pay = min(.maxHours, .@current / 60) * _calc_wage(); // Pay fraction of hour if you spent over 4 hours here // But ONLY if you leave manually, logout won't pay you fractions. // There's a deflator of 50% over the fraction, however - if (((.@current - @alfred_st) / 60) >= 4) - .@pay += (((.@current - @alfred_st) % 60) * _calc_wage()) / 120; + if ((.@current / 60) >= 4 && (.@current / 60) < .maxHours) + .@pay += ((.@current % 60) * _calc_wage()) / 120; // Fraction of hour code pending .maxHours enforcement // i.e. preventing you from working more than .maxHours per day - //.@pay += ((.@current - @alfred_st) % 60) * _calc_wage() / 60; Zeny += .@pay; // Terminate the work @alfred_st = 0; |