Skip to content

Treasury (Implementation details)

Raycoms edited this page Oct 12, 2019 · 1 revision

Each citizen tracks how much money he has. final double workerBalance;

Each citizen also tracks if it was paid and else refused to work: final boolean isPaid;

The colony tracks the days that pass and trigger the pay worker and tax worker event every 7 days. final int day;

The colony also tracks the tax rate. final double taxRate;

The treasury calculates how much salary a worker gets. public static void getSalaryForWorkerLevel(final int workerlevel) { //Example code. return workerLevel *100; }

The treasury knows about how much money the colony has. final double colonyBalance;

The treasury has an event log of the last tax/salary events. final List

BalanceEvent has an Enum for the reason and a double for the amount. Withdraw Deposit TaxIncome SalaryPayment

The Worker buildings for consumption track the amount they made this month, at the end of the month the tax gets removed and the rest of the money goes to the worker. final double income;

At the end of the month the Treasury will: (if day == 7)

  • Gather taxes of all consumer buildings and transfer the remaining value to the owners.
  • Gather taxes of all citizens based on their citizen hut.

At the first day of the month (day == 1) the treasury will pay the salaries of the workers. The treasury only pays full salaries, if it doesn't have enough money it will notify the player.

The treasury GUI has the following details:

Overview Page 1: Day of the week. Total balance. Total salary cost. (Current estimate). Total tax income (homes). (Current estimate). Total tax income consumption. (Current estimate).

From there is has on the right a second GUI which allows to change gold to money and vice versa. It also allows on this page in a third GUI to retrieve coins.

Details Page 2: Two Lists.

On the left a list of all salaries which will have to be paid for each worker. On the right the tax income for each of the building (Home and consumption). (Citizens living at the townhall, independend of the level pay very low taxes).