private List <CreationCost> GetCost(CreationCost creationCost, int creationCount = 0) { List <CreationCost> list = new List <CreationCost>(); try { if (creationCount == 0 && App.State != null && App.State.GameSettings.CreationToCreateCount > 0) { creationCount = App.State.GameSettings.CreationToCreateCount; } if (creationCount == 0) { creationCount = 1; } foreach (CreationCost current in CreationCost.RequiredCreations(creationCost.TypeEnum, (long)creationCount, false)) { current.CountNeeded = current.CountNeeded * creationCost.CountNeeded / creationCount; list.Add(current); list.AddRange(this.GetCost(current, 0)); } } catch (Exception ex) { } return(list); }
public void InitSubItemCost(int countAdded = 0) { List <CreationCost> list = new List <CreationCost>(); foreach (CreationCost current in CreationCost.RequiredCreations(this.TypeEnum, (long)countAdded, false)) { list.AddRange(this.GetCost(current, countAdded)); } this.SubItemCreationCost = new List <CreationCost>(); using (List <CreationCost> .Enumerator enumerator2 = list.GetEnumerator()) { while (enumerator2.MoveNext()) { CreationCost cost = enumerator2.Current; CreationCost creationCost = this.SubItemCreationCost.FirstOrDefault((CreationCost x) => x.TypeEnum == cost.TypeEnum); if (creationCost == null) { this.SubItemCreationCost.Add(cost); } else { creationCost.CountNeeded = cost.CountNeeded; } } } //this.SubItemCreationCost = (from o in this.SubItemCreationCost // orderby (int)(o.TypeEnum * (Creation.CreationType)(-1)) // select o).ToList<CreationCost>(); }
public CDouble TotalDuration(GameState state) { CDouble cDouble = this.DurationInMS; using (List <CreationCost> .Enumerator enumerator = CreationCost.RequiredCreations(this.TypeEnum, 1L, false).GetEnumerator()) { while (enumerator.MoveNext()) { CreationCost cost = enumerator.Current; Creation creation = state.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); if (creation != null) { cDouble += cost.CountNeeded * creation.TotalDuration(state); } } } return(cDouble); }
private bool CheckPrerequesiteCost(List <CreationCost> requiredCreations) { bool flag = false; Creation creation = null; for (int i = 0; i < requiredCreations.Count; i++) { CreationCost cost = requiredCreations[i]; Creation creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); if (cost.CountNeeded > creation2.Count) { if (App.State.IsBuyUnlocked && App.State.GameSettings.AutoBuyCreations && creation2.CanBuy && creation2.AutoBuy) { CDouble cDouble = cost.CountNeeded - creation2.Count; CDouble rightSide = cDouble * creation2.BuyCost * (120 - App.State.PremiumBoni.AutoBuyCostReduction) / 100; if (App.State.Money >= rightSide) { App.State.Money -= rightSide; creation2.count += cDouble; App.State.Statistic.TotalMoneySpent += rightSide; } else { flag = true; creation = creation2; } } else { flag = true; creation = creation2; } } } if (flag) { if (creation != null) { creation.IsActive = true; } this.IsActive = false; } return(flag); }
private int CheckCountNeeded() { if (App.State.GameSettings.CreationToCreateCount > App.State.PremiumBoni.CreationCountBoni(true) + 1) { App.State.GameSettings.CreationToCreateCount = App.State.PremiumBoni.CreationCountBoni(true).ToInt() + 1; } CDouble cDouble = App.State.GameSettings.CreationToCreateCount; if (App.State.GameSettings.CreationsNextAtMode == 2 && this.NextAtCount > 0 && this.TotalCreated + cDouble >= this.NextAtCount && App.State.GameSettings.LastCreation == this) { cDouble = this.NextAtCount - this.TotalCreated; } if (App.State.GameSettings.CreationsNextAtMode == 1 && this.NextAtCount > 0 && this.Count + cDouble >= this.NextAtCount && App.State.GameSettings.LastCreation == this) { cDouble = this.NextAtCount - this.Count; } if (App.State.GameSettings.LastCreation != null && App.State.GameSettings.LastCreation != this) { List <CreationCost> source = CreationCost.RequiredCreations(App.State.GameSettings.LastCreation.TypeEnum, (long)App.State.GameSettings.LastCreation.CountToAdd.ToInt(), false); CreationCost creationCost = source.FirstOrDefault((CreationCost x) => x.TypeEnum == this.TypeEnum); if (creationCost != null) { cDouble = creationCost.CountNeeded; } if (cDouble > App.State.GameSettings.CreationToCreateCount) { cDouble = App.State.GameSettings.CreationToCreateCount; } if (!this.AutoBuy && cDouble < App.State.GameSettings.CreationToCreateCount) { cDouble = App.State.GameSettings.CreationToCreateCount; } } if (cDouble <= 0) { cDouble = 1; } if (this.TypeEnum == Creation.CreationType.Shadow_clone || this.TypeEnum == Creation.CreationType.Light || this.TypeEnum == Creation.CreationType.Stone) { cDouble = App.State.PremiumBoni.CreationCountBoni(true) + 1; } this.CountToAdd = cDouble; return(cDouble.ToInt()); }
public static bool HasCreations(GameState state, CreationCost cost, bool autobuy) { Creation creation = state.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); if (!(cost.CountNeeded > creation.Count)) { return(true); } if (!autobuy || !creation.CanBuy) { return(false); } CDouble cDouble = cost.CountNeeded - creation.Count; CDouble rightSide = cDouble * creation.BuyCost * (120 - state.PremiumBoni.AutoBuyCostReduction) / 100; if (state.Money >= rightSide) { state.Money -= rightSide; creation.count += cDouble; state.Statistic.TotalMoneySpent += rightSide; return(true); } return(false); }
public new void UpdateDuration(long ms) { foreach (GeneratorUpgrade current in this.Upgrades) { current.UpdateDuration(ms); } CDouble leftSide = 0; int num = 0; if (this.IsBuilt && this.ShadowCloneCount > 0) { Creation creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == Creation.CreationType.Stone); if (creation != null) { CDouble rightSide = ms * (long)App.State.ClonesDifGenMod / 20L; CDouble cDouble = this.ShadowCloneCount * rightSide; if (creation.Count < cDouble) { cDouble = creation.Count; } CDouble cDouble2 = this.Capacity - this.FilledCapacity; CDouble cDouble3 = cDouble * creation.BuyCost; if (cDouble3 > cDouble2) { leftSide = cDouble3 - cDouble2; cDouble3 = cDouble2; } if (leftSide > 0) { cDouble -= leftSide / creation.BuyCost; num = (leftSide / 962500000).ToInt(); } this.FilledCapacity += cDouble3; creation.Count -= cDouble; } } if (this.FilledCapacity > 0) { CDouble cDouble4 = this.ConvertSec * ms / 1000; if (this.FilledCapacity > cDouble4) { this.FilledCapacity -= cDouble4; } else { cDouble4 = this.FilledCapacity; this.FilledCapacity = 0; } CDouble cDouble5 = cDouble4 * this.DivinityEachCapacity; this.DivinitySec = cDouble5 * 1000 / ms; if (num > 400) { num = 400; } cDouble5 = cDouble5 * (num + 100) / 100; this.DivinitySecWithWorker = cDouble5 * 1000 / ms; if (App.State.PremiumBoni.CrystalBonusDivinity > 0) { cDouble5 = cDouble5 * (100 + App.State.PremiumBoni.CrystalBonusDivinity) / 100; this.DivinitySecWithWorkerCrystal = cDouble5 * 1000 / ms; } App.State.Money += cDouble5; } else { this.DivinitySecWithWorker = 0; this.DivinitySec = 0; } if (this.ShadowCloneCount == 0 || this.IsBuilt) { return; } if (!this.IsPaid) { bool flag = false; StringBuilder stringBuilder = new StringBuilder("You still need:\n"); using (List <CreationCost> .Enumerator enumerator2 = this.RequiredCreations.GetEnumerator()) { while (enumerator2.MoveNext()) { CreationCost cost = enumerator2.Current; Creation creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); if (!CreationCost.HasCreations(App.State, cost, App.State.GameSettings.AutoBuyCreationsForDivGen)) { flag = true; stringBuilder.Append(creation2.Name).Append(" x ").Append((cost.CountNeeded - creation2.Count).ToGuiText(true)).Append("\n"); } } } if (flag) { stringBuilder.Append("to build ").Append(this.Name).ToString(); if (!App.State.GameSettings.StickyClones) { GuiBase.ShowToast(stringBuilder.ToString()); App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount); this.ShadowCloneCount = 0; } else { this.MissingItems = "\n\n" + stringBuilder.ToString(); } return; } using (List <CreationCost> .Enumerator enumerator3 = this.RequiredCreations.GetEnumerator()) { while (enumerator3.MoveNext()) { CreationCost cost = enumerator3.Current; Creation creation3 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); creation3.Count -= cost.CountNeeded; } } this.IsPaid = true; } this.MissingItems = string.Empty; this.CurrentDuration += (ms * (long)this.ShadowCloneCount.ToInt() * (long)App.State.PremiumBoni.MonumentBuildTimeDivider * (100 + App.State.PremiumBoni.BuildingSpeedUpPercent(true)) / 100).ToLong(); Log.Info(string.Concat(new object[] { this.Name, ", Duration: ", this.CurrentDuration, " / ", this.DurationInMS(1) })); if (this.CurrentDuration > this.DurationInMS(1)) { this.IsPaid = false; this.CurrentDuration = 0L; this.IsBuilt = true; App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount); this.ShadowCloneCount = 0; } }
public new bool UpdateDuration(long ms) { if (this.ShadowCloneCount == 0) { return(false); } if (this.Level >= this.StopAt && this.StopAt != 0) { CDouble shadowCloneCount = this.ShadowCloneCount; App.State.Clones.RemoveUsedShadowClones(shadowCloneCount); this.ShadowCloneCount = 0; Monument monument = App.State.AllMonuments.FirstOrDefault((Monument x) => x.TypeEnum == this.type + 1); if (monument != null && monument.StopAt > 0) { monument.AddCloneCount(shadowCloneCount); } return(false); } if (!this.IsPaid) { bool flag = false; StringBuilder stringBuilder = new StringBuilder("You still need:\n"); using (List <CreationCost> .Enumerator enumerator = this.RequiredCreations.GetEnumerator()) { while (enumerator.MoveNext()) { CreationCost cost = enumerator.Current; Creation creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); if (cost.CountNeeded > creation.Count) { if (App.State.GameSettings.AutoBuyCreationsForMonuments && creation.CanBuy) { CDouble cDouble = cost.CountNeeded - creation.Count; CDouble rightSide = cDouble * creation.BuyCost * (120 - App.State.PremiumBoni.AutoBuyCostReduction) / 100; if (App.State.Money >= rightSide) { App.State.Money -= rightSide; creation.count += cDouble; App.State.Statistic.TotalMoneySpent += rightSide; } else { flag = true; stringBuilder.Append(creation.Name).Append(" x ").Append((cost.CountNeeded - creation.Count).ToGuiText(true)).Append("\n"); } } else { flag = true; stringBuilder.Append(creation.Name).Append(" x ").Append((cost.CountNeeded - creation.Count).ToGuiText(true)).Append("\n"); } } } } if (flag) { stringBuilder.Append("to upgrade ").Append(EnumName.Name(this.type)).ToString(); if (!App.State.GameSettings.StickyClones) { GuiBase.ShowToast(stringBuilder.ToString()); App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount); this.ShadowCloneCount = 0; } else { this.MissingItems = "\n\n" + stringBuilder.ToString(); } return(false); } using (List <CreationCost> .Enumerator enumerator2 = this.RequiredCreations.GetEnumerator()) { while (enumerator2.MoveNext()) { CreationCost cost = enumerator2.Current; Creation creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); creation2.Count -= cost.CountNeeded; } } this.IsPaid = true; } this.MissingItems = string.Empty; this.CurrentDuration += (ms * (long)this.ShadowCloneCount.ToInt() * (long)App.State.PremiumBoni.MonumentBuildTimeDivider * (100 + App.State.PremiumBoni.BuildingSpeedUpPercent(true)) / 100).ToLong(); if (this.CurrentDuration > this.DurationInMS(1)) { if (App.State.GameSettings.StopMonumentBuilding) { App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount); this.ShadowCloneCount = 0; } this.IsPaid = false; this.CurrentDuration = 0L; return(true); } return(false); }
public new void UpdateDuration(long ms) { if (this.Upgrade.UpdateDuration(ms)) { this.AddUpgradeLevel(); } if (App.State == null || this.ShadowCloneCount == 0) { return; } if (this.Level >= this.StopAt && this.StopAt != 0) { CDouble shadowCloneCount = this.ShadowCloneCount; App.State.Clones.RemoveUsedShadowClones(shadowCloneCount); this.ShadowCloneCount = 0; if (this.Upgrade.StopAt > 0 && this.Upgrade.IsAvailable) { this.Upgrade.AddCloneCount(shadowCloneCount); } else { Monument monument = App.State.AllMonuments.FirstOrDefault((Monument x) => x.TypeEnum == this.TypeEnum + 1); if (monument != null && monument.StopAt > 0) { monument.AddCloneCount(shadowCloneCount); } } return; } if (!this.IsPaid) { bool flag = false; StringBuilder stringBuilder = new StringBuilder("You still need:\n"); using (List <CreationCost> .Enumerator enumerator = this.RequiredCreations(this.Level).GetEnumerator()) { while (enumerator.MoveNext()) { CreationCost cost = enumerator.Current; Creation creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); cost.CountNeeded.Round(); creation.count.Round(); if (cost.CountNeeded > creation.Count) { if (App.State.IsBuyUnlocked && App.State.GameSettings.AutoBuyCreationsForMonuments && creation.CanBuy) { CDouble cDouble = cost.CountNeeded - creation.Count; CDouble rightSide = cDouble * creation.BuyCost * (120 - App.State.PremiumBoni.AutoBuyCostReduction) / 100; if (App.State.Money >= rightSide) { App.State.Money -= rightSide; creation.count += cDouble; App.State.Statistic.TotalMoneySpent += rightSide; } else { flag = true; stringBuilder.Append(creation.Name).Append(" x ").Append((cost.CountNeeded - creation.Count).ToGuiText(true)).Append("\n"); } } else { flag = true; stringBuilder.Append(creation.Name).Append(" x ").Append((cost.CountNeeded - creation.Count).ToGuiText(true)).Append("\n"); } } } } if (flag) { stringBuilder.Append("to build ").Append(this.Name).ToString(); if (!App.State.GameSettings.StickyClones) { GuiBase.ShowToast(stringBuilder.ToString()); App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount); this.ShadowCloneCount = 0; } else { this.MissingItems = "\n\n" + stringBuilder.ToString(); } return; } using (List <CreationCost> .Enumerator enumerator2 = this.RequiredCreations(this.Level).GetEnumerator()) { while (enumerator2.MoveNext()) { CreationCost cost = enumerator2.Current; Creation creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); creation2.Count -= cost.CountNeeded; } } this.IsPaid = true; } this.MissingItems = string.Empty; this.CurrentDuration += (ms * (long)this.ShadowCloneCount.ToInt() * (long)App.State.PremiumBoni.MonumentBuildTimeDivider * (100 + App.State.PremiumBoni.BuildingSpeedUpPercent(true)) / 100).ToLong(); if (this.CurrentDuration > this.DurationInMS(1)) { this.CurrentDuration = 0L; this.Level = ++this.Level; this.IsPaid = false; Statistic expr_4D4 = App.State.Statistic; expr_4D4.MonumentsCreated = ++expr_4D4.MonumentsCreated; Leaderboards.SubmitStat(LeaderBoardType.Monuments, App.State.Statistic.MonumentsCreated.ToInt(), false); if (this.TypeEnum == Monument.MonumentType.temple_of_god && this.Level == 1) { GuiBase.ShowContentUnlocked("You can now build a divinity generator!"); } this.AddStatBoni(); if (App.State.GameSettings.StopMonumentBuilding) { App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount); this.ShadowCloneCount = 0; } if (this.TypeEnum == Monument.MonumentType.temple_of_god) { App.State.Generator.IsAvailable = true; } } }
public void UpdateDuration(long ms) { if (App.State == null) { return; } if (!this.GodToDefeat.IsDefeated) { this.GodToDefeat.RecoverHealth(ms); } if (!this.IsActive) { return; } if (!this.GodToDefeat.IsDefeated) { this.FightGod(ms); if (this.GodToDefeat.IsDefeated) { this.description = string.Empty; } return; } bool flag = this.NextAtCount != 0 && this.NextAtCount <= this.Count; if (App.State.GameSettings.CreationsNextAtMode == 2) { flag = (this.NextAtCount != 0 && this.NextAtCount <= this.TotalCreated); } if ((App.State.GameSettings.LastCreation != null && App.State.GameSettings.LastCreation.TypeEnum != this.TypeEnum) || App.State.GameSettings.CreationsNextAtMode == 0) { flag = false; } if (flag && this.TypeEnum != Creation.CreationType.Shadow_clone) { foreach (Creation current in App.State.AllCreations) { current.IsActive = false; } Creation lastCreation = this; Creation creation = App.State.AllCreations.First((Creation x) => x.TypeEnum == Creation.CreationType.Shadow_clone); if (this.TypeEnum == Creation.CreationType.Universe) { lastCreation = creation; creation.IsActive = true; } else { Creation creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == this.TypeEnum + 1); if (creation2 != null && creation2.GodToDefeat.IsDefeated) { lastCreation = creation2; creation2.IsActive = true; } else { bool flag2 = false; foreach (Creation current2 in App.State.AllCreations) { if (current2.GodToDefeat.IsDefeated && current2.NextAtCount == 0 && current2.TypeEnum != Creation.CreationType.Shadow_clone) { lastCreation = current2; current2.IsActive = true; flag2 = true; break; } } if (!flag2) { lastCreation = creation; creation.IsActive = true; } } } App.State.GameSettings.LastCreation = lastCreation; return; } if (App.State.GameSettings.CreateShadowClonesIfNotMax && App.State.Clones.Count < App.State.Clones.MaxShadowClones && this.TypeEnum != Creation.CreationType.Shadow_clone) { this.oldActiveCreation = this; Creation creation3 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == Creation.CreationType.Shadow_clone); creation3.IsActive = true; return; } if (this.oldActiveCreation != null) { this.IsActive = false; this.oldActiveCreation.IsActive = true; this.oldActiveCreation = null; } int num = this.CheckCountNeeded(); List <CreationCost> list = CreationCost.RequiredCreations(this.TypeEnum, (long)num, false); if (this.CheckPrerequesiteCost(list)) { return; } this.currentDuration += App.State.CreationSpeed(ms); long durationInMS = this.DurationInMS; if (this.currentDuration > durationInMS) { this.currentDuration -= durationInMS; if (this.currentDuration > durationInMS) { this.currentDuration = durationInMS; } using (List <CreationCost> .Enumerator enumerator3 = list.GetEnumerator()) { while (enumerator3.MoveNext()) { CreationCost cost = enumerator3.Current; Creation creation4 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); creation4.Count -= cost.CountNeeded; } } CDouble rightSide = this.CreatingPowerGain() * (100 + (num - 1) * 5) / 100; App.State.CreatingPowerBase += rightSide; this.CanBuy = true; this.Count += num; this.TotalCreated += num; App.State.CheckForAchievement(this); if (this.TypeEnum != Creation.CreationType.Shadow_clone) { App.State.Statistic.TotalCreations += num; } this.FinishUUC(App.State); if (App.State.GameSettings.LastCreation != null && App.State.GameSettings.LastCreation.TypeEnum != this.TypeEnum) { Creation creation5 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == App.State.GameSettings.LastCreation.TypeEnum); this.IsActive = false; creation5.IsActive = true; } } }
public new bool UpdateDuration(long ms) { if (this.ShadowCloneCount == 0) { return(false); } if (this.StopAt != 0 && this.StopAt <= this.Level) { App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount); this.ShadowCloneCount = 0; return(false); } if (!this.IsPaid) { bool flag = false; StringBuilder stringBuilder = new StringBuilder("You still need:\n"); using (List <CreationCost> .Enumerator enumerator = this.RequiredCreations.GetEnumerator()) { while (enumerator.MoveNext()) { CreationCost cost = enumerator.Current; Creation creation = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); if (!CreationCost.HasCreations(App.State, cost, App.State.GameSettings.AutoBuyCreationsForDivGen)) { flag = true; stringBuilder.Append(creation.Name).Append(" x ").Append((cost.CountNeeded - creation.Count).ToGuiText(true)).Append("\n"); } } } if (flag) { if (!App.State.GameSettings.StickyClones) { stringBuilder.Append("to upgrade ").Append(this.Name).ToString(); GuiBase.ShowToast(stringBuilder.ToString()); App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount); this.ShadowCloneCount = 0; } else { this.MissingItems = "\n\n" + stringBuilder.ToString(); } return(false); } using (List <CreationCost> .Enumerator enumerator2 = this.RequiredCreations.GetEnumerator()) { while (enumerator2.MoveNext()) { CreationCost cost = enumerator2.Current; Creation creation2 = App.State.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); creation2.Count -= cost.CountNeeded; } } this.IsPaid = true; } this.MissingItems = string.Empty; this.CurrentDuration += (ms * (long)this.ShadowCloneCount.ToInt() * (long)App.State.PremiumBoni.MonumentBuildTimeDivider * (100 + App.State.PremiumBoni.BuildingSpeedUpPercent(true)) / 100).ToLong(); if (this.CurrentDuration > this.DurationInMS(1)) { this.IsPaid = false; this.CurrentDuration = 0L; this.Level = ++this.Level; if (App.State.GameSettings.StopDivinityGenBuilding) { App.State.Clones.RemoveUsedShadowClones(this.ShadowCloneCount); this.ShadowCloneCount = 0; } return(true); } return(false); }
public string UpdateDuration(long ms, GameState state) { this.UpdateInfoText(); if (this.ShadowClones > 0) { bool flag = true; using (List <CreationCost> .Enumerator enumerator = this.RequiredCreations.GetEnumerator()) { while (enumerator.MoveNext()) { CreationCost cost = enumerator.Current; Creation creation = state.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); CDouble leftSide = ms * cost.CountNeeded * this.Level; if (leftSide > creation.Count) { if (state.IsBuyUnlocked && state.GameSettings.AutoBuyForCrystal && creation.CanBuy) { CDouble leftSide2 = cost.CountNeeded * this.Level * (this.BaseDuration - this.CurrentDuration); CDouble cDouble = leftSide2 - creation.Count; CDouble rightSide = cDouble * creation.BuyCost * (120 - state.PremiumBoni.AutoBuyCostReduction) / 100; if (state.Money >= rightSide) { state.Money -= rightSide; creation.count += cDouble; state.Statistic.TotalMoneySpent += rightSide; } else { CDouble cDouble2 = leftSide - creation.Count; CDouble rightSide2 = cDouble2 * creation.BuyCost * (120 - state.PremiumBoni.AutoBuyCostReduction) / 100; if (state.Money >= rightSide2) { state.Money -= rightSide2; creation.count += cDouble2; state.Statistic.TotalMoneySpent += rightSide2; } else { flag = false; } } } else { flag = false; } } } } this.hasEnoughCreations = flag; if (flag) { using (List <CreationCost> .Enumerator enumerator2 = this.RequiredCreations.GetEnumerator()) { while (enumerator2.MoveNext()) { CreationCost cost = enumerator2.Current; Creation creation2 = state.AllCreations.FirstOrDefault((Creation x) => x.TypeEnum == cost.TypeEnum); CDouble rightSide3 = ms * cost.CountNeeded * this.Level; creation2.count -= rightSide3; } } this.CurrentDuration += ms; double num = (double)this.CurrentDuration / (double)this.BaseDuration; int num2 = (int)num; if (num2 > 0) { this.CurrentDuration = (long)((num - (double)num2) * (double)this.BaseDuration); Crystal crystal = this.Crystals.FirstOrDefault((Crystal x) => x.Level == 1); if (crystal == null) { this.Crystals.Add(new Crystal { Type = this.Type, Level = 1, Count = this.Level * num2 }); } else { crystal.Count += this.Level * num2; } this.Crystals = (from x in this.Crystals orderby x.Level.ToInt() select x).ToList <Crystal>(); return(string.Concat(new object[] { "- ", this.Level * num2, " x ", this.Type.ToString(), " Crystal\n" })); } } return(string.Empty); } return(string.Empty); }