}
@Override
public void notify(DateObject date) {
ITradingOffice office = player.findTradingOffice(city);
int weekIndex = date.getDayInWeek();
ISteward steward = office.getSteward();
int dailyCost=0;
if (steward!=null){
dailyCost = (int) Math.rint(steward.getSalary()/7.0);
}
for (int i = weekIndex; i<stewardCostsDays.length;i++){
this.stewardCostsDays[i] = dailyCost;
}
int sum = 0;
for (int cost : stewardCostsDays) {
sum += cost;
}
this.stewardCosts=sum;
List<IBuilding> buildings = player.findBuildings(city,ITownHouse.class);
dailyCost=0;
for (IBuilding building : buildings) {
dailyCost += ((ITownHouse)building).computeRentalIncome();
}
for (int i = weekIndex; i<rentalIncomeDays.length;i++){
this.rentalIncomeDays[i] = dailyCost;
}
sum = 0;
for (int cost : rentalIncomeDays) {
sum += cost;
}
this.rentalIncome=sum;
buildings = player.findBuildings(city);
dailyCost=0;
for (IBuilding building : buildings) {
dailyCost += building.getPropertyTax();
}
for (int i = weekIndex; i<propertyTaxesDays.length;i++){
this.propertyTaxesDays[i] = dailyCost;
}
sum = 0;
for (int cost : propertyTaxesDays) {
sum += cost;
}
this.propertyTaxes=sum;
buildings = player.findBuildings(city,IWorkShop.class);
IStorage storage = office.getStorage();
dailyCost=0;
for (IBuilding building : buildings) {
dailyCost += (int)Math.rint(((IWorkShop)building).getSalaryPerWorker()/7.0);
}
for (int i = weekIndex; i<wageCostsDays.length;i++){
this.wageCostsDays[i] = dailyCost+storage.getGuardCostsPerDay();
}
sum = 0;
for (int cost : wageCostsDays) {
sum += cost;
}
this.wageCosts=sum;
IAutomatedTrading automaticTrading = office.getOfficeTrading();
if (automaticTrading!=null){
// TODO implement this when implementing office traiding
} else {
for (int i = weekIndex; i<officeTradingDays.length;i++){
this.officeTradingDays[i] = 0;