public void SaveHighlight(HighlightsController.Highlight highlight, Vec3 position) { if (!this.CanSaveHighlight(highlight.HighlightType, position)) { return; } this._highlightSaveQueue.Add(highlight); }
public override void OnScoreHit( Agent affectedAgent, Agent affectorAgent, WeaponComponentData attackerWeapon, bool isBlocked, float damage, float movementSpeedDamageModifier, float hitDistance, AgentAttackType attackType, float shotDifficulty, BoneBodyPartType victimHitBodyPart) { bool flag1 = affectorAgent != null && affectorAgent.IsMainAgent; if (affectorAgent == null || affectedAgent == null || (!affectorAgent.IsHuman || !affectedAgent.IsHuman)) { return; } HighlightsController.Highlight highlight = new HighlightsController.Highlight(); highlight.Start = Mission.Current.Time; highlight.End = Mission.Current.Time; bool flag2 = false; if (flag1 && (double)shotDifficulty >= 7.5) { highlight.HighlightType = this.GetHighlightTypeWithId("hlid_high_ranged_shot_difficulty"); flag2 = true; } if (flag1 && affectedAgent.HasMount && (attackType == AgentAttackType.Standard && affectorAgent.HasMount) && affectorAgent.IsDoingPassiveAttack) { highlight.HighlightType = this.GetHighlightTypeWithId("hlid_couched_lance_against_mounted_opponent"); flag2 = true; } if (this._isFirstImpact && affectorAgent.Formation != null && (affectorAgent.Formation.IsCavalry() && affectorAgent.Formation.MovementOrder == (object)MovementOrder.MovementOrderCharge) && this.CanSaveHighlight(this.GetHighlightTypeWithId("hlid_cavalry_charge_first_impact"), affectedAgent.Position)) { this._cavalryChargeHitTimes.RemoveAll((Predicate <float>)(ht => (double)ht + 3.0 < (double)Mission.Current.Time)); this._cavalryChargeHitTimes.Add(Mission.Current.Time); if (this._cavalryChargeHitTimes.Count >= 5) { highlight.HighlightType = this.GetHighlightTypeWithId("hlid_cavalry_charge_first_impact"); highlight.Start = this._cavalryChargeHitTimes[0]; highlight.End = this._cavalryChargeHitTimes.Last <float>(); flag2 = true; this._isFirstImpact = false; this._cavalryChargeHitTimes.Clear(); } } if (!flag2) { return; } this.SaveHighlight(highlight, affectedAgent.Position); }
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow killingBlow) { if (affectorAgent == null || affectedAgent == null || (!affectorAgent.IsHuman || !affectedAgent.IsHuman) || agentState != AgentState.Killed && agentState != AgentState.Unconscious) { return; } bool flag1 = affectorAgent != null && affectorAgent.Team.IsPlayerTeam; bool flag2 = affectorAgent != null && affectorAgent.IsMainAgent; HighlightsController.Highlight highlight = new HighlightsController.Highlight(); highlight.Start = Mission.Current.Time; highlight.End = Mission.Current.Time; bool flag3 = false; if (flag2 | flag1 && (killingBlow.WeaponRecordWeaponFlags.HasAllFlags <WeaponFlags>(WeaponFlags.Burning) || killingBlow.WeaponRecordWeaponFlags.HasAllFlags <WeaponFlags>(WeaponFlags.AffectsArea))) { highlight.HighlightType = this._highlightsController.GetHighlightTypeWithId("hlid_wall_break_kill"); flag3 = true; } MBReadOnlyList <Agent> teamAgents1 = affectedAgent.Team?.TeamAgents; bool flag4 = teamAgents1 == null || teamAgents1.Any <Agent>((Func <Agent, bool>)(agent => agent.State != AgentState.Killed && agent.State != AgentState.Unconscious)); if (!flag4 && flag2 | flag1) { highlight.HighlightType = this._highlightsController.GetHighlightTypeWithId("hlid_kill_last_enemy_on_battlefield"); flag3 = true; } if (flag2) { MBReadOnlyList <Agent> teamAgents2 = affectorAgent.Team?.TeamAgents; if ((teamAgents2 == null ? 1 : (teamAgents2.Any <Agent>((Func <Agent, bool>)(agent => !agent.IsMainAgent && agent.State != AgentState.Killed && agent.State != AgentState.Unconscious)) ? 1 : 0)) == 0 && !flag4) { highlight.HighlightType = this._highlightsController.GetHighlightTypeWithId("hlid_win_battle_as_last_man_standing"); flag3 = true; } } if (!flag3) { return; } this._highlightsController.SaveHighlight(highlight, affectedAgent.Position); }
public void SaveHighlight(HighlightsController.Highlight highlight) => this._highlightSaveQueue.Add(highlight);
public override void OnAgentRemoved( Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow killingBlow) { bool flag1 = affectorAgent?.Team != null && affectorAgent.Team.IsPlayerTeam; bool flag2 = affectorAgent != null && affectorAgent.IsMainAgent; if (affectorAgent == null || affectedAgent == null || (!affectorAgent.IsHuman || !affectedAgent.IsHuman) || agentState != AgentState.Killed && agentState != AgentState.Unconscious) { return; } if ((flag2 | flag1 && !affectedAgent.Team.IsPlayerAlly && killingBlow.WeaponClass == 12 || killingBlow.WeaponClass == 13) && this.CanSaveHighlight(this.GetHighlightTypeWithId("hlid_archer_salvo_kills"), affectedAgent.Position)) { if (!this._isArcherSalvoHappening) { this._archerSalvoKillTimes.RemoveAll((Predicate <float>)(ht => (double)ht + 4.0 < (double)Mission.Current.Time)); } this._archerSalvoKillTimes.Add(Mission.Current.Time); if (this._archerSalvoKillTimes.Count >= 5) { this._isArcherSalvoHappening = true; } } if (flag2 && this.CanSaveHighlight(this.GetHighlightTypeWithId("hlid_killing_spree"), affectedAgent.Position)) { if (!this._isKillingSpreeHappening) { this._playerKillTimes.RemoveAll((Predicate <float>)(ht => (double)ht + 10.0 < (double)Mission.Current.Time)); } this._playerKillTimes.Add(Mission.Current.Time); if (this._playerKillTimes.Count >= 4) { this._isKillingSpreeHappening = true; } } HighlightsController.Highlight highlight = new HighlightsController.Highlight(); highlight.Start = Mission.Current.Time; highlight.End = Mission.Current.Time; bool flag3 = false; if (flag2 && killingBlow.WeaponRecordWeaponFlags.HasAllFlags <WeaponFlags>(WeaponFlags.Burning)) { highlight.HighlightType = this.GetHighlightTypeWithId("hlid_burning_ammunition_kill"); flag3 = true; } if (flag2 && killingBlow.IsMissile && killingBlow.BoneIndex == (sbyte)13) { highlight.HighlightType = this.GetHighlightTypeWithId("hlid_headshot_kill"); flag3 = true; } if (flag2 && killingBlow.IsMissile && (affectedAgent.HasMount && affectedAgent.IsDoingPassiveAttack) && (killingBlow.WeaponClass == 19 || killingBlow.WeaponClass == 20)) { highlight.HighlightType = this.GetHighlightTypeWithId("hlid_throwing_weapon_kill_against_charging_enemy"); flag3 = true; } if (this._isFirstImpact && affectorAgent.Formation != null && (affectorAgent.Formation.IsCavalry() && affectorAgent.Formation.MovementOrder == (object)MovementOrder.MovementOrderCharge) && this.CanSaveHighlight(this.GetHighlightTypeWithId("hlid_cavalry_charge_first_impact"), affectedAgent.Position)) { this._cavalryChargeHitTimes.RemoveAll((Predicate <float>)(ht => (double)ht + 3.0 < (double)Mission.Current.Time)); this._cavalryChargeHitTimes.Add(Mission.Current.Time); if (this._cavalryChargeHitTimes.Count >= 5) { highlight.HighlightType = this.GetHighlightTypeWithId("hlid_cavalry_charge_first_impact"); highlight.Start = this._cavalryChargeHitTimes[0]; highlight.End = this._cavalryChargeHitTimes.Last <float>(); flag3 = true; this._isFirstImpact = false; this._cavalryChargeHitTimes.Clear(); } } if (!flag3) { return; } this.SaveHighlight(highlight, affectedAgent.Position); }