public override void OnGameLoaded(Game game, object initializerObject) { if (!(game.GameType is Campaign)) { return; } try { this.DeserializeObject(Path.Combine(BasePath.Name, "Modules", "DistinguishedService", "Settings.xml")); } catch (Exception ex) { InformationManager.DisplayMessage(new InformationMessage("Could not serialize Settings.xml: " + ex.Message.ToString() + " Using default values!", Color.FromUint(4282569842U))); this.CurrentSettings = new Settings(); } try { AddNewGuy ang = new AddNewGuy(); ang.addDialogs((CampaignGameStarter)initializerObject); ((CampaignGameStarter)initializerObject).AddBehavior((CampaignBehaviorBase) new DSBattleBehavior(ang)); if ((double)this.CurrentSettings.companion_extra_lethality > 0.0) { CampaignEvents.HeroWounded.AddNonSerializedListener((object)this, new Action <Hero>(ang.OnHeroWounded)); } if ((double)this.CurrentSettings.ai_promotion_chance > 0.0) { CampaignEvents.MapEventEnded.AddNonSerializedListener((object)this, new Action <MapEvent>(ang.MapEventEnded)); } if (this.CurrentSettings.upgrade_to_hero) { CampaignEvents.PlayerUpgradedTroopsEvent.AddNonSerializedListener((object)this, new Action <CharacterObject, CharacterObject, int>(ang.upgrade_to_hero)); CampaignEvents.OnUnitRecruitedEvent.AddNonSerializedListener((object)this, new Action <CharacterObject, int>(ang.recruit_to_hero)); } InformationManager.DisplayMessage(new InformationMessage(new TextObject("最佳服务加载成功 (cnedwin)", (Dictionary <string, object>)null).ToString(), Colors.Blue)); } catch (Exception ex) { InformationManager.DisplayMessage(new InformationMessage(new TextObject("There was a problem:\n" + ex.ToString(), (Dictionary <string, object>)null).ToString(), Colors.Blue)); } }
public DSBattleLogic(AddNewGuy ang) { this._ang_instance = ang; ang.nominations = new List <CharacterObject>(); ang.killcounts = new List <int>(); }
public override void ShowBattleResults() { if (TutorialPhase.Instance.TutorialQuestPhase != TutorialQuestPhase.Finalized || Mission.Current.Mode == MissionMode.Conversation || (Mission.Current.Mode == MissionMode.StartUp || Mission.Current.CombatType == Mission.MissionCombatType.ArenaCombat)) { return; } int num1 = this.totalKillCount(); if (num1 <= 0) { return; } float f = (float)DSBattleLogic.Percentile((IEnumerable <float>) this.kill_counts(), (double)this._ang_instance.outperform_percentile); foreach (Agent activeAgent in Mission.Current.PlayerTeam.ActiveAgents) { if (!activeAgent.IsHero) { CharacterObject characterObject = CharacterObject.Find(activeAgent.Character.StringId); if (MobileParty.MainParty.MemberRoster.Contains(characterObject)) { int num2 = !characterObject.IsArcher ? (!characterObject.IsMounted ? this._ang_instance.inf_kill_threshold : this._ang_instance.cav_kill_threshold) : this._ang_instance.ran_kill_threshold; if (((double)this._ang_instance.outperform_percentile <= 0.0 ? 1 : (activeAgent.KillCount > MathF.Ceiling(f) ? 1 : 0)) != 0 && activeAgent.KillCount >= num2 && AddNewGuy.is_soldier_qualified(characterObject)) { this._ang_instance.nominations.Add(characterObject); this._ang_instance.killcounts.Add(activeAgent.KillCount); } } } } this._ang_instance.begin_battle_size = num1; this._ang_instance.OnPCBattleEnded_results(); }
public DSBattleBehavior(AddNewGuy ang) => this._ang_instance = ang;