public override void Deserialize(MBObjectManager objectManager, XmlNode node) { base.Deserialize(objectManager, node); this.HeroCharacter = MultiplayerClassDivisions.GetMPCharacter(node.Attributes["hero"].Value); this.TroopCharacter = MultiplayerClassDivisions.GetMPCharacter(node.Attributes["troop"].Value); string stringId = node.Attributes["banner_bearer"]?.Value; if (stringId != null) { this.BannerBearerCharacter = MultiplayerClassDivisions.GetMPCharacter(stringId); } this.HeroIdleAnim = node.Attributes["hero_idle_anim"]?.Value; this.HeroMountIdleAnim = node.Attributes["hero_mount_idle_anim"]?.Value; this.TroopIdleAnim = node.Attributes["troop_idle_anim"]?.Value; this.TroopMountIdleAnim = node.Attributes["troop_mount_idle_anim"]?.Value; this.Culture = this.HeroCharacter.Culture; this.ClassGroup = new MultiplayerClassDivisions.MPHeroClassGroup(this.HeroCharacter.DefaultFormationClass.GetName()); this.TroopMultiplier = (float)Convert.ToDouble(node.Attributes["multiplier"].Value); this.TroopCost = Convert.ToInt32(node.Attributes["cost"].Value); this.ArmorValue = Convert.ToInt32(node.Attributes["armor"].Value); this.Health = 100; this.MeleeAI = 50; this.RangedAI = 50; XmlNode attribute = (XmlNode)node.Attributes["hitpoints"]; if (attribute != null) { this.Health = Convert.ToInt32(attribute.Value); } this.MovementSpeedMultiplier = (float)Convert.ToDouble(node.Attributes["movement_speed"].Value); this.CombatMovementSpeedMultiplier = (float)Convert.ToDouble(node.Attributes["combat_movement_speed"].Value); this.TopSpeedReachDuration = (float)Convert.ToDouble(node.Attributes["acceleration"].Value); this.MeleeAI = Convert.ToInt32(node.Attributes["melee_ai"].Value); this.RangedAI = Convert.ToInt32(node.Attributes["ranged_ai"].Value); TargetIconType result; if (Enum.TryParse <TargetIconType>(node.Attributes["icon"].Value, true, out result)) { this.IconType = result; } foreach (XmlNode childNode1 in node.ChildNodes) { if (childNode1.NodeType != XmlNodeType.Comment && childNode1.Name == "Perks") { this._perks = new List <IReadOnlyPerkObject>(); foreach (XmlNode childNode2 in childNode1.ChildNodes) { if (childNode2.NodeType != XmlNodeType.Comment) { this._perks.Add(MPPerkObject.Deserialize(childNode2)); } } } } }
public CompassItemUpdateParams( object item, TargetIconType targetType, Vec3 worldPosition, BannerCode bannerCode, bool isAttacker, bool isAlly) : this() { this.Item = item; this.TargetType = targetType; this.WorldPosition = worldPosition; this.BannerCode = bannerCode; this.IsAttacker = isAttacker; this.IsAlly = isAlly; }
public CompassItemUpdateParams( object item, TargetIconType targetType, Vec3 worldPosition, uint color, uint color2) : this() { this.Item = item; this.TargetType = targetType; this.WorldPosition = worldPosition; this.Color = color; this.Color2 = color2; this.IsAttacker = false; this.IsAlly = false; }
public override List <CompassItemUpdateParams> GetCompassTargets() { List <CompassItemUpdateParams> itemUpdateParamsList = new List <CompassItemUpdateParams>(); if (!GameNetwork.IsMyPeerReady || !this.IsRoundInProgress) { return(itemUpdateParamsList); } MissionPeer component1 = GameNetwork.MyPeer.GetComponent <MissionPeer>(); if (component1 == null || component1.Team == null || component1.Team.Side == BattleSideEnum.None) { return(itemUpdateParamsList); } foreach (FlagCapturePoint flagCapturePoint in this.AllCapturePoints.Where <FlagCapturePoint>((Func <FlagCapturePoint, bool>)(cp => !cp.IsDeactivated))) { int num = 17 + flagCapturePoint.FlagIndex; itemUpdateParamsList.Add(new CompassItemUpdateParams((object)flagCapturePoint, (TargetIconType)num, flagCapturePoint.Position, flagCapturePoint.GetFlagColor(), flagCapturePoint.GetFlagColor2())); } bool flag1 = true; foreach (NetworkCommunicator networkPeer in GameNetwork.NetworkPeers) { MissionPeer component2 = networkPeer.GetComponent <MissionPeer>(); if (component2?.Team != null && component2.Team.Side != BattleSideEnum.None) { bool flag2 = component2.ControlledFormation != null; if (!flag2) { flag1 = false; } if (flag1 || component2.Team == component1.Team) { MultiplayerClassDivisions.MPHeroClass heroClassForPeer = MultiplayerClassDivisions.GetMPHeroClassForPeer(component2); if (flag2) { Formation controlledFormation = component2.ControlledFormation; if (controlledFormation.CountOfUnits != 0) { WorldPosition medianPosition = controlledFormation.QuerySystem.MedianPosition; Vec2 vec2 = controlledFormation.SmoothedAverageUnitPosition; if (!vec2.IsValid) { vec2 = controlledFormation.QuerySystem.AveragePosition; } medianPosition.SetVec2(vec2); BannerCode bannerCode = (BannerCode)null; bool isAttacker = false; bool isAlly = false; if (controlledFormation.Team != null) { if (controlledFormation.Banner == null) { controlledFormation.Banner = new Banner(controlledFormation.BannerCode, controlledFormation.Team.Color, controlledFormation.Team.Color2); } isAttacker = controlledFormation.Team.IsAttacker; isAlly = controlledFormation.Team.IsPlayerAlly; bannerCode = BannerCode.CreateFrom(controlledFormation.Banner); } TargetIconType targetType = heroClassForPeer != null ? heroClassForPeer.IconType : TargetIconType.None; itemUpdateParamsList.Add(new CompassItemUpdateParams((object)controlledFormation, targetType, medianPosition.GetNavMeshVec3(), bannerCode, isAttacker, isAlly)); } } else { Agent controlledAgent = component2.ControlledAgent; if (controlledAgent != null && controlledAgent.IsActive() && controlledAgent.Controller != Agent.ControllerType.Player) { BannerCode from = BannerCode.CreateFrom(new Banner(component2.Peer.BannerCode, component2.Team.Color, component2.Team.Color2)); itemUpdateParamsList.Add(new CompassItemUpdateParams((object)controlledAgent, heroClassForPeer.IconType, controlledAgent.Position, from, component2.Team.IsAttacker, component2.Team.IsPlayerAlly)); } } } } } return(itemUpdateParamsList); }