public TitheEntryGlobal() { this.requestedTitheAmount = (int)TitheUtilities.TaxCalculation(50000); this.titheDef = DefDatabase <TitheDef> .GetRandom(); // this.ID = CorruptionStoryTrackerUtilities.currentStoryTracker.GetTitheID(); }
public static void CalculateColonyTithes(CorruptionStoryTracker tracker) { Log.Message("Calculating Tithes"); float wealthInt = 0f; List <Map> maps = Find.Maps; for (int i = 0; i < maps.Count; i++) { if (maps[i].IsPlayerHome) { wealthInt += maps[i].wealthWatcher.WealthTotal; } } float calc = 0f; float totalAmount = TitheUtilities.TaxCalculation(wealthInt); float baseAmount = totalAmount / DefDatabase <TitheDef> .AllDefsListForReading.Count; foreach (TitheDef current in DefDatabase <TitheDef> .AllDefsListForReading) { if (!tracker.currentTithes.Any(x => x.titheDef == current)) { if (calc <= totalAmount) { calc += baseAmount; float num = baseAmount * current.wealthFactor; TitheEntryGlobal entry = new TitheEntryGlobal(current, num); tracker.currentTithes.Add(entry); } } } tracker.DaysToTitheCollection = 60; tracker.TitheCollectionActive = false; }