Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Template for new versions:
## New Features

## Fixes
- `list-agreements`: fix logic for determining age of active petitions

## Misc Improvements
- `fix/loyaltycascade`: now also breaks up brawls and other intra-fort conflicts that *look* like loyalty cascades
Expand Down
16 changes: 7 additions & 9 deletions list-agreements.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,14 @@ function get_petition_age(agr)
local agr_year = agr.details[0].year
local cur_year_tick = df.global.cur_year_tick
local cur_year = df.global.cur_year
local del_year, del_year_tick
--delta, check to prevent off by 1 error, not validated
if cur_year_tick > agr_year_tick then
del_year = cur_year - agr_year
del_year_tick = cur_year_tick - agr_year_tick
else
del_year = cur_year - agr_year - 1
del_year_tick = agr_year_tick - cur_year_tick
local del_year = cur_year - agr_year
local del_year_tick = cur_year_tick - agr_year_tick
if del_year_tick < 0 then
del_year = del_year - 1
del_year_tick = del_year_tick + 403200
end
local julian_day = math.floor(del_year_tick / 1200) + 1
-- Round up to the nearest day, since we don't do fractions
local julian_day = math.ceil(del_year_tick / 1200)
local del_month = math.floor(julian_day / 28)
local del_day = julian_day % 28
return {del_year,del_month,del_day}
Expand Down
Loading