public static void Prefix(EconomyManager.Resource resource, ref int amount, ItemClass.Service service, ItemClass.SubService subService, ItemClass.Level level) { // NON-STOCK CODE START if (resource == EconomyManager.Resource.PublicIncome) { if (service == ItemClass.Service.Vehicles) { RealCityEconomyManager.roadIncomeForUI[MainDataStore.updateMoneyCount] += amount; if (subService == ItemClass.SubService.None) { if (level == ItemClass.Level.Level2) { MainDataStore.outsideGovermentMoney -= amount; } else { MainDataStore.outsideTouristMoney -= amount; } } } } else if (resource == EconomyManager.Resource.ResourcePrice) { RealCityEconomyManager.playerIndustryIncomeForUI[MainDataStore.updateMoneyCount] += amount; } /// NON-STOCK CODE END /// }
public static void Prefix(EconomyManager.Resource resource, ref int amount, ItemClass itemClass) { // NON-STOCK CODE START if (resource == EconomyManager.Resource.TourismIncome) { amount = 0; } else if (resource == EconomyManager.Resource.ResourcePrice) { RealCityEconomyManager.playerIndustryIncomeForUI[MainDataStore.updateMoneyCount] += amount; } else if (resource == EconomyManager.Resource.PublicIncome && itemClass.m_service == ItemClass.Service.Beautification) { if (amount > 0) { RealCityEconomyManager.citizenIncomeForUI[MainDataStore.updateMoneyCount] += amount; } else { //We use negetive amount to identify tourist income amount = -amount; RealCityEconomyManager.touristIncomeForUI[MainDataStore.updateMoneyCount] += amount; } } else if (resource == EconomyManager.Resource.PublicIncome && itemClass.m_service == ItemClass.Service.PlayerEducation) { RealCityEconomyManager.schoolIncomeForUI[MainDataStore.updateMoneyCount] += amount; } }
public static void Prefix(ref EconomyManager.Resource resource, ref int amount, ItemClass.Service service, ItemClass.SubService subService, ItemClass.Level level, ref uint __state) { if (amount < 0) { DebugLog.LogToFileOnly($"Error: EconomyManagerFetchResourcePatch: amount < 0 {service} {subService} {level}"); amount = 0; } __state = 0xdeadbeaf; if (resource == EconomyManager.Resource.PolicyCost) { OnFetchResourcePolicy(resource, ref amount, service, subService, level); } if (resource == EconomyManager.Resource.Maintenance) { //we must return right amount for playerbuilding to work normally. if (amount > 0) { __state = (uint)amount; } OnFetchResourceMaintenance(resource, ref amount, service, subService, level); } else if (resource == (EconomyManager.Resource) 16) { resource = EconomyManager.Resource.Maintenance; } else if (resource == (EconomyManager.Resource) 17) { resource = EconomyManager.Resource.PolicyCost; } }
/// <summary> /// Harmony Postfix patch to EcomonyWrapper.OnAddResource to fix any negative income /// </summary> /// <param name="resource"></param> /// <param name="amount"></param> public static void Postfix(EconomyManager.Resource resource, ref int amount, ItemClass.SubService subService) { if (resource == EconomyManager.Resource.PrivateIncome && amount < 0) { Logging.Message("fixed private building negative income of ", amount, " for building with subService ", subService); amount = -amount; } }
public static void Postfix(ushort buildingID, ref Building data, EconomyManager.Resource resource, ref int __result) { if (resource == EconomyManager.Resource.Maintenance) { float salary = RealCityPlayerBuildingAI.CaculateEmployeeOutcome(buildingID, data); __result = (int)((float)__result / MainDataStore.gameExpenseDivide - salary * 100f); } }
public static void OnFetchResourceMaintenance(EconomyManager.Resource resource, ref int amount, ItemClass.Service service, ItemClass.SubService subService, ItemClass.Level level) { switch (service) { case ItemClass.Service.Road: ProcessUnit(ref amount, ref Road); break; case ItemClass.Service.Garbage: ProcessUnit(ref amount, ref Garbage); break; case ItemClass.Service.PoliceDepartment: ProcessUnit(ref amount, ref PoliceDepartment); break; case ItemClass.Service.Beautification: ProcessUnit(ref amount, ref Beautification); break; case ItemClass.Service.Water: ProcessUnit(ref amount, ref Water); break; case ItemClass.Service.Education: ProcessUnit(ref amount, ref Education); break; case ItemClass.Service.Electricity: ProcessUnit(ref amount, ref Electricity); break; case ItemClass.Service.FireDepartment: ProcessUnit(ref amount, ref FireDepartment); break; case ItemClass.Service.Monument: ProcessUnit(ref amount, ref Monument); break; case ItemClass.Service.HealthCare: ProcessUnit(ref amount, ref HealthCare); break; case ItemClass.Service.PublicTransport: ProcessUnit(ref amount, ref PublicTransport); break; case ItemClass.Service.Disaster: ProcessUnit(ref amount, ref Disaster); break; case ItemClass.Service.PlayerIndustry: ProcessUnit(ref amount, ref PlayerIndustry); break; case ItemClass.Service.PlayerEducation: ProcessUnit(ref amount, ref PlayerEducation); break; case ItemClass.Service.Museums: ProcessUnit(ref amount, ref Museums); break; case ItemClass.Service.VarsitySports: ProcessUnit(ref amount, ref VarsitySports); break; case ItemClass.Service.Fishing: ProcessUnit(ref amount, ref Fishing); break; default: break; } }
public static void OnFetchResourcePolicy(EconomyManager.Resource resource, ref int amount, ItemClass.Service service, ItemClass.SubService subService, ItemClass.Level level) { ProcessUnit(ref amount, ref Policy_cost); }
private static int FetchResourceStub(EconomyManager economyManager, EconomyManager.Resource resource, int amount, ItemClass itemClass) { return(0); }