Skip to content

Commit

Permalink
- Add the ability to charge additional upkeep per outpost controlled
Browse files Browse the repository at this point in the history
by a town.
    - Closes #7664.
  - New Config Option: economy.daily_taxes.per_outpost_cost
    - Default: 0.0
    - An optional price that a town must pay for each outpost they own.
This number is added to the town upkeep before any other upkeep
modifiers are applied to the Town's upkeep costs.
  • Loading branch information
LlmDl committed Nov 5, 2024
1 parent 4ddf461 commit 531848c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2851,6 +2851,12 @@ public enum ConfigNodes {
"",
"# Uses total number of plots that the town is overclaimed by, to determine the price_town_overclaimed_upkeep_penalty cost.",
"# If set to true the penalty is calculated (# of plots overclaimed X price_town_overclaimed_upkeep_penalty)."),
ECO_PRICE_TOWN_OUTPOST_UPKEEP_COST(
"economy.daily_taxes.per_outpost_cost",
"0.0",
"",
"# An optional price that a town must pay for each outpost they own. This number is added to the town upkeep",
"# before any other upkeep modifiers are applied to the Town's upkeep costs."),
ECO_TAXES_ALLOW_PLOT_PAYMENTS(
"economy.daily_taxes.use_plot_payments",
"false",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2218,8 +2218,12 @@ private static double getTownUpkeepCostRaw(Town town) {

// There's the chance that even with per-plot-upkeep, the townLevel upkeep modifier is still used, or 1.0 if not.
double townLevelPlotModifier = isUpkeepByPlot() && isTownLevelModifiersAffectingPlotBasedUpkeep() ? town.getTownLevel().upkeepModifier() : 1.0;

// outposts can have an added cost to the town's upkeep.
double outpostCost = getPerOutpostUpkeepCost() * town.getMaxOutpostSpawn();
double baseUpkeep = getTownUpkeep() + outpostCost;
// Amount is calculated using the above multipliers.
double amount = ((getTownUpkeep() * townMultiplier) * townLevelPlotModifier) * nationMultiplier;
double amount = ((baseUpkeep * townMultiplier) * townLevelPlotModifier) * nationMultiplier;

// When per-plot-upkeep is in use, there can be min/max amounts.
if (isUpkeepByPlot()) {
Expand Down Expand Up @@ -2306,6 +2310,10 @@ public static boolean isUpkeepPenaltyByPlot() {
return getBoolean(ConfigNodes.ECO_PRICE_TOWN_OVERCLAIMED_UPKEEP_PENALTY_PLOTBASED);
}

public static double getPerOutpostUpkeepCost() {
return getDouble(ConfigNodes.ECO_PRICE_TOWN_OUTPOST_UPKEEP_COST);
}

public static double getNationUpkeep() {

return getDouble(ConfigNodes.ECO_PRICE_NATION_UPKEEP);
Expand Down
7 changes: 6 additions & 1 deletion Towny/src/main/resources/ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10118,4 +10118,9 @@ v0.92.0.11:
- Adapt to Attributes change.
- Update bridger for java 21 support, courtesy of Warrior with PR #7658.
- Add messages to residents when they pay town and plot taxes.
- Closes #7657.
- Closes #7657.
- Add the ability to charge additional upkeep per outpost controlled by a town.
- Closes #7664.
- New Config Option: economy.daily_taxes.per_outpost_cost
- Default: 0.0
- An optional price that a town must pay for each outpost they own. This number is added to the town upkeep before any other upkeep modifiers are applied to the Town's upkeep costs.

0 comments on commit 531848c

Please sign in to comment.