private static void Postfix(ArrangementOrder __instance, Formation formation) { if (__instance.OrderEnum != ArrangementOrder.ArrangementOrderEnum.ShieldWall) { return; } int num1 = (int)MessageBox.Show("Shieldbearers: " + formation.GetCountOfUnitsWithCondition((Func <Agent, bool>)(agent => agent.Equipment.HasShield())).ToString()); IFormationArrangement formationArrangement = Traverse.Create((object)formation).Property <IFormationArrangement>("arrangement").Value; int num2 = Traverse.Create((object)formationArrangement).Property <int>("FileCount").Value; int rankCount = formationArrangement.RankCount; MBList2D <IFormationUnit> mbList2D = Traverse.Create((object)formationArrangement).Field("_units2D").GetValue <MBList2D <IFormationUnit> >(); for (int index1 = 0; index1 < num2; ++index1) { ((Agent)mbList2D[index1, 0]).Equipment.HasShield(); } }
private void OnPeerComponentPreRemoved(VirtualPlayer peer, PeerComponent component) { if (!(component is MissionPeer missionPeer)) { return; } MissionPeer lobbyComponent = missionPeer.GetComponent <MissionPeer>(); int num = this._spectators.Contains(lobbyComponent) ? 1 : 0; bool flag = ((IEnumerable <MissionScoreboardComponent.MissionScoreboardSide>) this._sides).Any <MissionScoreboardComponent.MissionScoreboardSide>((Func <MissionScoreboardComponent.MissionScoreboardSide, bool>)(x => x != null && x.Players.Contains <MissionPeer>(lobbyComponent))); if (num != 0) { this._spectators.Remove(lobbyComponent); } else { if (!flag) { return; } this._sides[(int)lobbyComponent.Team.Side].RemovePlayer(lobbyComponent); Formation controlledFormation = missionPeer.ControlledFormation; if (controlledFormation != null) { Team team = missionPeer.Team; this.Sides[(int)team.Side].BotScores.AliveCount += controlledFormation.GetCountOfUnitsWithCondition((Func <Agent, bool>)(agent => agent.IsActive())); this.BotPropertiesChanged(team.Side); } Action <Team, Team, MissionPeer> playerSideChanged = this.OnPlayerSideChanged; if (playerSideChanged == null) { return; } playerSideChanged(lobbyComponent.Team, (Team)null, lobbyComponent); } }