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; } } }