public DiplomacyFactionRelationshipVM(IFaction faction, HintViewModel hint)
 {
     this.Faction         = faction;
     this.ImageIdentifier = new ImageIdentifierVM(BannerCode.CreateFrom(faction.Banner), true);
     this.NameText        = this.Faction.Name.ToString();
     this.Hint            = hint;
 }
Ejemplo n.º 2
0
 public void UpdateProperties()
 {
     RelationToMainHeroText = "";
     GovernorOfText         = "";
     Skills.Clear();
     Traits.Clear();
     UpdateLearningSkillSelection();
     foreach (SkillObject item in SkillObject.All)
     {
         Skills.Add(new EncyclopediaSkillVM(item, _hero.GetSkillValue(item)));
     }
     foreach (TraitObject heroTrait in CampaignUIHelper.GetHeroTraits())
     {
         if (_hero.GetTraitLevel(heroTrait) != 0)
         {
             Traits.Add(new EncyclopediaTraitItemVM(heroTrait, _hero));
         }
     }
     IsChild = _hero.IsChild;
     if (_hero != Hero.MainHero)
     {
         RelationToMainHeroText = CampaignUIHelper.GetHeroRelationToHeroText(_hero, Hero.MainHero).ToString();
     }
     if (_hero.GovernorOf != null)
     {
         GameTexts.SetVariable("SETTLEMENT_NAME", _hero.GovernorOf.Owner.Settlement.EncyclopediaLinkWithName);
         GovernorOfText = GameTexts.FindText("str_governor_of_label").ToString();
     }
     HeroModel = new HeroViewModel();
     HeroModel.FillFrom(_hero);
     Banner_9 = new ImageIdentifierVM(BannerCode.CreateFrom(_hero.ClanBanner), nineGrid: true);
 }
Ejemplo n.º 3
0
 public void FillFrom(Hero hero, int seed = -1)
 {
     if (FaceGen.GetMaturityTypeWithAge(hero.Age) > BodyMeshMaturityType.Child)
     {
         this._hero          = hero;
         this.isNonEquipment = false;
         base.FillFrom(hero.CharacterObject, seed);
         base.MountCreationKey = TaleWorlds.Core.MountCreationKey.GetRandomMountKey(hero.CharacterObject.Equipment[10].Item, hero.CharacterObject.GetMountKeySeed());
         this.IsDead           = hero.IsDead;
         if (hero.Noncombatant)
         {
             Equipment expr_69 = hero.CivilianEquipment;
             this._equipment = ((expr_69 != null) ? expr_69.Clone(false) : null);
         }
         else
         {
             Equipment expr_84 = hero.BattleEquipment;
             this._equipment = ((expr_84 != null) ? expr_84.Clone(false) : null);
         }
         Equipment expr_9D = this._equipment;
         base.EquipmentCode = ((expr_9D != null) ? expr_9D.CalculateEquipmentCode() : null);
         if (((hero != null) ? hero.ClanBanner : null) != null)
         {
             base.BannerCodeText = BannerCode.CreateFrom(hero.ClanBanner).Code;
         }
         IFaction expr_D9 = hero.MapFaction;
         base.ArmorColor1 = ((expr_D9 != null) ? expr_D9.Color : 0u);
         IFaction expr_F1 = hero.MapFaction;
         base.ArmorColor2 = ((expr_F1 != null) ? expr_F1.Color2 : 0u);
     }
 }
Ejemplo n.º 4
0
        public static BannerCode CreateFrom(Banner banner)
        {
            BannerCode bannerCode = new BannerCode();

            if (banner != null)
            {
                bannerCode.Code = banner.Serialize();
            }
            return(bannerCode);
        }
Ejemplo n.º 5
0
        public MemberItemVM(Hero hero, Action <MemberItemVM> onCharacterSelect)
        {
            this._hero = hero;
            this._onCharacterSelect = onCharacterSelect;
            CharacterCode characterCode = CharacterCode.CreateFrom(hero.CharacterObject);

            this.Visual = new ImageIdentifierVM(characterCode);
            //this.IsFamilyMember = Hero.MainHero.Clan.Nobles.Contains(this._hero);
            this.Banner_9 = new ImageIdentifierVM(BannerCode.CreateFrom(hero.ClanBanner), true);
            this.RefreshValues();
        }
Ejemplo n.º 6
0
        public SpouseServiceItemVM(Hero hero, Action <SpouseServiceItemVM> onCharacterSelect)
        {
            this._hero = hero;
            this._onCharacterSelect = onCharacterSelect;
            // CharacterCode characterCode = CharacterCode.CreateFrom(hero.CharacterObject);
            CharacterCode characterCode = CampaignUIHelper.GetCharacterCode(hero.CharacterObject, false);

            this.Visual = new ImageIdentifierVM(characterCode);
            //this.IsFamilyMember = Hero.MainHero.Clan.Nobles.Contains(this._hero);
            this.Banner_9 = new ImageIdentifierVM(BannerCode.CreateFrom(hero.ClanBanner), true);
            this.RefreshValues();
        }
Ejemplo n.º 7
0
 public void SetBannerCode(string value)
 {
     if (string.IsNullOrEmpty(value))
     {
         this._banner = null;
     }
     else
     {
         this._banner = BannerCode.CreateFrom(value).CalculateBanner();
     }
     this.RefreshCharacterTableau(null);
 }
Ejemplo n.º 8
0
        public WangLordItemVM(Hero hero, Action <WangLordItemVM> onCharacterSelect)
        {
            _hero = hero;
            _onCharacterSelect = onCharacterSelect;
            CharacterCode characterCode = CharacterCode.CreateFrom(hero.CharacterObject);

            Visual    = new ImageIdentifierVM(characterCode);
            Skills    = new MBBindingList <EncyclopediaSkillVM>();
            Traits    = new MBBindingList <EncyclopediaTraitItemVM>();
            Banner_9  = new ImageIdentifierVM(BannerCode.CreateFrom(hero.ClanBanner), nineGrid: true);
            HeroModel = new HeroViewModel();
            HeroModel.FillFrom(_hero);
            RefreshValues();
        }
Ejemplo n.º 9
0
        public override void RefreshValues()
        {
            base.RefreshValues();
            // CharacterCode characterCode = CharacterCode.CreateFrom(this.Clan.Leader.CharacterObject);
            CharacterCode characterCode = CampaignUIHelper.GetCharacterCode(this.Clan.Leader.CharacterObject, false);

            this.Visual   = new ImageIdentifierVM(characterCode);
            this.Banner   = new ImageIdentifierVM(this.Clan.Banner);
            this.Banner_9 = new ImageIdentifierVM(BannerCode.CreateFrom(this.Clan.Banner), true);

            this.Name = this.Clan.Name.ToString();
            GameTexts.SetVariable("TIER", this.Clan.Tier);
            this.TierText = GameTexts.FindText("str_clan_tier", null).ToString();
        }
 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 void FillHistorySide(SpousesBattleRecordSide side)
        {
            this._side = side;
            this.Score.UpdateScores(side.Name, side.Remain, side.KillCount, side.Wounded, side.RunAway, side.Killed, 0);
            this.Parties.Clear();
            if (side.Parties.Count > 0)
            {
                side.Parties.ForEach(obj => {
                    if (null != obj)
                    {
                        Parties.Add(new BattleHistorySPPartyVM(obj));
                    }
                });
            }

            if (null != side.Banner)
            {
                BannerCode bannerCode = BannerCode.CreateFrom(side.Banner);
                this.BannerVisual      = new ImageIdentifierVM(bannerCode, true);
                this.BannerVisualSmall = new ImageIdentifierVM(bannerCode, false);
            }
        }
Ejemplo n.º 12
0
        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);
        }
Ejemplo n.º 13
0
 public void UpdateBannerVisuals()
 {
     ClanBanner     = new ImageIdentifierVM(BannerCode.CreateFrom(_clan.Banner), nineGrid: true);
     ClanBannerHint = new HintViewModel(new TextObject("{=t1lSXN9O}Your clan's standard carried into battle").ToString());
     RefreshValues();
 }
Ejemplo n.º 14
0
 public TownRevolutionViewModel(SettlementInfo settInfo, FactionInfo factInfo)
 {
     _settlementInfo = settInfo;
     _factionInfo    = factInfo;
     _factionVisual  = new ImageIdentifierVM(BannerCode.CreateFrom(_settlementInfo.OriginalFaction.Banner), true);
 }