Exemplo n.º 1
0
 public WangVM(Action onClose, Action <MobileParty> openPartyAsManage, Action openBannerEditor)
 {
     _onClose           = onClose;
     _openPartyAsManage = openPartyAsManage;
     _clan = Hero.MainHero.Clan;
     _playerUpdateTracker = PlayerUpdateTracker.Current;
     ClanMembers          = new WangClanMembersVM(RefreshCategoryValues);
     CanvassVM            = new CanvassVM(RefreshCategoryValues);
     ModSettings          = new ModSettingVM(RefreshCategoryValues);
     ClanFiefs            = new ClanFiefsVM(RefreshCategoryValues);
     SetSelectedCategory(0);
     Leader        = new HeroVM(_clan.Leader);
     CurrentRenown = (int)Clan.PlayerClan.Renown;
     CurrentTier   = Clan.PlayerClan.Tier;
     if (Campaign.Current.Models.ClanTierModel.HasUpcomingTier(Clan.PlayerClan))
     {
         NextTierRenown          = Clan.PlayerClan.RenownRequirementForNextTier;
         MinRenownForCurrentTier = Campaign.Current.Models.ClanTierModel.GetRequiredRenownForTier(CurrentTier);
         NextTier = Clan.PlayerClan.Tier + 1;
         IsRenownProgressComplete = false;
     }
     else
     {
         NextTierRenown          = 1;
         MinRenownForCurrentTier = 1;
         NextTier = 0;
         IsRenownProgressComplete = true;
     }
     RenownHint = new BasicTooltipViewModel(() => CampaignUIHelper.GetClanRenownTooltip(Clan.PlayerClan));
     UpdateBannerVisuals();
 }
Exemplo 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);
 }
Exemplo n.º 3
0
        public override void RefreshValues()
        {
            base.RefreshValues();

            if (this._hero.IsPregnant)
            {
                this.PregnancyStatus = new TextObject("{=suems_doctor_satus_pregnancy_get}Pregnant", null).ToString();
            }
            else
            {
                this.PregnancyStatus = "";
            }

            if (Hero.MainHero.Spouse == this._hero)
            {
                this.SpousePrimaryStatus = new TextObject("{=suems_doctor_satus_primary_spouse}Primary", null).ToString();
            }
            else
            {
                this.SpousePrimaryStatus = "";
            }

            this.Name = this._hero.Name.ToString();
            this.CurrentActionText = ((this._hero != Hero.MainHero) ? CampaignUIHelper.GetHeroBehaviorText(this._hero) : "");
            if (this._hero.PartyBelongedToAsPrisoner != null)
            {
                TextObject textObject = new TextObject("{=a8nRxITn}Prisoner of {PARTY_NAME}", null);
                textObject.SetTextVariable("PARTY_NAME", this._hero.PartyBelongedToAsPrisoner.Name);
                this.LocationText = textObject.ToString();
            }
            else
            {
                this.LocationText = ((this._hero != Hero.MainHero) ? StringHelpers.GetLastKnownLocation(this._hero).ToString() : " ");
            }
        }
Exemplo n.º 4
0
        public static void  Postfix(ref EncyclopediaHeroPageVM __instance)
        {
            if (null != ReflectUtils.ReflectField("_hero", __instance))
            {
                Hero   hero = (Hero)ReflectUtils.ReflectField("_hero", __instance);
                string heroOccupationName = CampaignUIHelper.GetHeroOccupationName(hero);
                if (string.IsNullOrEmpty(heroOccupationName))
                {
                    heroOccupationName = System.Enum.GetName(typeof(Occupation), hero.CharacterObject.Occupation);
                    string definition3 = GameTexts.FindText("str_enc_sf_occupation", null).ToString();
                    __instance.Stats.Add(new StringPairItemVM(definition3, heroOccupationName, null));
                }

                //模板
                FieldInfo fieldInfo = hero.CharacterObject.GetType().GetField("_originCharacter", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
                if (null != fieldInfo)
                {
                    object obj = fieldInfo.GetValue(hero.CharacterObject);;
                    if (obj is CharacterObject)
                    {
                        CharacterObject originCharacter = (CharacterObject)obj;
                        __instance.Stats.Add(new StringPairItemVM("模板: ", originCharacter.StringId, null));
                    }
                }
            }
        }
Exemplo n.º 5
0
 private void OnNamingHeroOver(string suggestedName)
 {
     if (CampaignUIHelper.IsStringApplicableForHeroName(suggestedName))
     {
         this.GetHero().CharacterObject.Name = new TextObject(suggestedName, null);
         this.Name = suggestedName;
     }
 }
Exemplo n.º 6
0
        public SpouseStatisticsItemVM(SpousesHeroStatistic spousesStats)
        {
            this._spousesStats = spousesStats;
            CharacterCode characterCode = CampaignUIHelper.GetCharacterCode(spousesStats.StatsHero.CharacterObject, false);

            this.Visual = new ImageIdentifierVM(characterCode);
            this.Name   = spousesStats.StatsHero.Name.ToString();
        }
 public static void OnNamingHeroOverPostfix(ClanLordItemVM __instance, string suggestedName)
 {
     if (!CampaignUIHelper.IsStringApplicableForHeroName(suggestedName))
     {
         return;
     }
     __instance.GetHero().FirstName = __instance.GetHero().Name;
 }
Exemplo n.º 8
0
        private void OnSessionLaunched(CampaignGameStarter game)
        {
            game.BlockSentences(
                () => !TelepathyBehaviour.MeetingInProgress,
                "main_option_discussions_1"                 // joining army
                );
            game.BlockSentences(
                () => !TelepathyBehaviour.MeetingInProgress || !TelepathySettings.Instance.HideQuestDialogLines,
                "hero_give_issue",                 // taking a quest
                "hero_task_given",                 // discuss a quest
                "caravan_create_conversation_1"    // form a caravan
                );

            game.AddPlayerLine(
                "lord_talk_ask_something_2",
                "lord_talk_ask_something_2",
                "telepathy_tell_location",
                new TextObject("{=Telepathy_Where_Are_You}Where are you?", null).ToString(),
                new ConversationSentence.OnConditionDelegate(() => meetingEncounter != null),
                null, 101, null, null);
            game.AddDialogLine(
                "telepathy_tell_location",
                "telepathy_tell_location",
                "lord_talk_ask_something_again",
                "{LORD_LOCATION_ANSWER}",
                new ConversationSentence.OnConditionDelegate(() => {
                HeroHelper.SetLastSeenLocation(meetingHero, true);
                var answer = meetingHero.LastSeenInSettlement
                                                ? new TextObject("{=Telepathy_Im_In}I'm in {Settlement}.", null)
                                                : new TextObject("{=Telepathy_Im_Near}I'm near {Settlement}.", null);
                answer.SetTextVariable("Settlement", meetingHero.LastSeenPlace.EncyclopediaLinkWithName);
                MBTextManager.SetTextVariable("LORD_LOCATION_ANSWER", answer, false);
                return(true);
            }),
                null, 100, null);
            game.AddPlayerLine(
                "lord_talk_ask_something_2",
                "lord_talk_ask_something_2",
                "telepathy_tell_objective",
                new TextObject("{=Telepathy_What_Are_You_Doing}What are you doing?", null).ToString(),
                new ConversationSentence.OnConditionDelegate(() => meetingEncounter != null),
                null, 101, null, null);
            game.AddDialogLine(
                "telepathy_tell_objective",
                "telepathy_tell_objective",
                "lord_talk_ask_something_again",
                "{LORD_OBJECTIVE_ANSWER}",
                new ConversationSentence.OnConditionDelegate(() => {
                string answer = meetingHero.PartyBelongedTo == null
                                                ? new TextObject("{=Telepathy_Nothing}Nothing actually.", null).ToString()
                                                : CampaignUIHelper.GetMobilePartyBehaviorText(meetingHero.PartyBelongedTo);
                MBTextManager.SetTextVariable("LORD_OBJECTIVE_ANSWER", answer, false);
                return(true);
            }),
                null, 100, null);
        }
Exemplo n.º 9
0
        public bool CheckUnknownBehavior(MobileParty patrol)
        {
            TextObject textObject = new TextObject("{=QXBf26Rv}Unknown Behavior", null);

            if (CampaignUIHelper.GetMobilePartyBehaviorText(patrol) == textObject.ToString())
            {
                return(true);
            }
            return(false);
        }
 public SpousesSelectTroopsItemVM(TroopRosterElement troop, Action <SpousesSelectTroopsItemVM> onAdd, Action <SpousesSelectTroopsItemVM> onRemove)
 {
     this._onAdd       = onAdd;
     this._onRemove    = onRemove;
     this.Troop        = troop;
     this.MaxAmount    = this.Troop.Number - this.Troop.WoundedNumber;
     this.Visual       = new ImageIdentifierVM(CampaignUIHelper.GetCharacterCode(troop.Character, false));
     this.Name         = troop.Character.Name.ToString();
     this.TierIconData = CampaignUIHelper.GetCharacterTierData(this.Troop.Character, false);
     this.TypeIconData = CampaignUIHelper.GetCharacterTypeData(this.Troop.Character, false);
 }
Exemplo n.º 11
0
        private static int GetMostAccurateDailyCost()
        {
            try {
                int.TryParse(CampaignUIHelper.GetGoldTooltip(Hero.MainHero.Clan).First(property => property.DefinitionLabel == "Expected Change").ValueLabel, out int dailyChange);
                return(Math.Min(dailyChange, 0));
            } catch {
                //ignored
            }

            return(0);
        }
Exemplo n.º 12
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();
        }
Exemplo n.º 13
0
        public void CreateLists()
        {
            this.SkillEffects.Clear();
            int skillValue = this._SkillScreenVM.GetCharacterDeveloper().Hero.GetSkillValue(this.Skill);

            foreach (SkillEffect effect in from x in DefaultSkillEffects.GetAllSkillEffects()
                     where x.EffectedSkills.Contains(this.Skill)
                     select x)
            {
                this.SkillEffects.Add(new BindingListStringItem(CampaignUIHelper.GetSkillEffectText(effect, skillValue)));
            }
        }
Exemplo n.º 14
0
 private void OnNamingHeroOver(string suggestedName)
 {
     if (CampaignUIHelper.IsStringApplicableForHeroName(suggestedName))
     {
         var currentHero = this.GetHero();
         currentHero.CharacterObject.Name = new TextObject(suggestedName, null);
         this.Name             = suggestedName;
         currentHero.FirstName = currentHero.Name;
         //if (currentHero.IsPartyLeader)
         //ReflectUtils.ReflectMethodAndInvoke("Name", currentHero.PartyBelongedTo, new object[] { MobilePartyHelper.GeneratePartyName(currentHero.CharacterObject) });
     }
 }
Exemplo n.º 15
0
        public static void OnNamingHeroOverPostfix(ClanLordItemVM __instance, string suggestedName)
        {
            if (!CampaignUIHelper.IsStringApplicableForHeroName(suggestedName))
            {
                return;
            }
            Hero selectedHero = __instance.GetHero();

            selectedHero.FirstName = selectedHero.Name;
            if (selectedHero.IsPartyLeader)
            {
                selectedHero.PartyBelongedTo.Name = MobilePartyHelper.GeneratePartyName(selectedHero.CharacterObject);
            }
        }
Exemplo n.º 16
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();
        }
Exemplo n.º 17
0
        public static void OnNamingHeroOverPostfix(ClanLordItemVM __instance, string suggestedName)
        {
            if (!CampaignUIHelper.IsStringApplicableForHeroName(suggestedName))
            {
                return;
            }
            Hero selectedHero = __instance.GetHero();

            selectedHero.FirstName = selectedHero.Name;
            if (selectedHero.IsPartyLeader)
            {
                ReflectUtils.ReflectMethodAndInvoke("Name", selectedHero.PartyBelongedTo, new object[] { selectedHero.CharacterObject.GetName() });
            }
        }
Exemplo n.º 18
0
        public AssassinationCharacterPanel(Hero hero, Action <Hero> onSneakIn)
        {
            Hero = hero;

            _onSneakIn = onSneakIn;

            var characterObject = hero.CharacterObject;

            var characterCode = CampaignUIHelper.GetCharacterCode(characterObject, false);

            ImageIdentifier = new ImageIdentifierVM(characterCode);

            _nameText = characterObject.Name.ToString();
        }
 private void OnNamingHeroOver(string suggestedName)
 {
     if (CampaignUIHelper.IsStringApplicableForHeroName(suggestedName))
     {
         var currentHero = this.GetHero();
         currentHero.CharacterObject.Name = new TextObject(suggestedName, null);
         this.Name             = suggestedName;
         currentHero.FirstName = currentHero.Name;
         if (currentHero.IsPartyLeader)
         {
             currentHero.PartyBelongedTo.Name = MobilePartyHelper.GeneratePartyName(currentHero.CharacterObject);
         }
     }
 }
Exemplo n.º 20
0
 public static void  Postfix(ref EncyclopediaHeroPageVM __instance)
 {
     if (null != ReflectUtils.ReflectField("_hero", __instance))
     {
         Hero   hero = (Hero)ReflectUtils.ReflectField("_hero", __instance);
         string heroOccupationName = CampaignUIHelper.GetHeroOccupationName(hero);
         if (string.IsNullOrEmpty(heroOccupationName))
         {
             heroOccupationName = System.Enum.GetName(typeof(Occupation), hero.CharacterObject.Occupation);
             string definition3 = GameTexts.FindText("str_enc_sf_occupation", null).ToString();
             __instance.Stats.Add(new StringPairItemVM(definition3, heroOccupationName, null));
         }
     }
 }
            static void Postfix(SkillVM __instance, ref int ____fullLearningRateLevel, CharacterVM ____developerVM)
            {
                int attr = ____developerVM.GetCurrentAttributePoint(__instance.Skill.CharacterAttributeEnum);

                ____fullLearningRateLevel = (int)(__instance.Level + __instance.CurrentFocusLevel * Reworked_SkillsSubModule.__FOCUS_VALUE + attr * Reworked_SkillsSubModule.__ATTR_VALUE);
                __instance.OnPropertyChanged(nameof(__instance.FullLearningRateLevel));

                __instance.SkillEffects.Clear();
                int skillValue = (int)(__instance.Level + __instance.CurrentFocusLevel * Reworked_SkillsSubModule.__FOCUS_VALUE + attr * Reworked_SkillsSubModule.__ATTR_VALUE);

                foreach (SkillEffect effect in DefaultSkillEffects.GetAllSkillEffects().Where <SkillEffect>((Func <SkillEffect, bool>)(x => ((IEnumerable <SkillObject>)x.EffectedSkills).Contains <SkillObject>(__instance.Skill))))
                {
                    __instance.SkillEffects.Add(new BindingListStringItem(CampaignUIHelper.GetSkillEffectText(effect, skillValue)));
                }
            }
Exemplo n.º 22
0
 public override void RefreshValues()
 {
     base.RefreshValues();
     this.Name = this._hero.Name.ToString();
     this.CurrentActionText = ((this._hero != Hero.MainHero) ? CampaignUIHelper.GetHeroBehaviorText(this._hero) : "");
     if (this._hero.PartyBelongedToAsPrisoner != null)
     {
         TextObject textObject = new TextObject("{=a8nRxITn}Prisoner of {PARTY_NAME}", null);
         textObject.SetTextVariable("PARTY_NAME", this._hero.PartyBelongedToAsPrisoner.Name);
         this.LocationText = textObject.ToString();
     }
     else
     {
         this.LocationText = ((this._hero != Hero.MainHero) ? StringHelpers.GetLastKnownLocation(this._hero).ToString() : " ");
     }
 }
        public override void RefreshValues()
        {
            base.RefreshValues();

            var traits = "";

            foreach (TraitObject heroTrait in CampaignUIHelper.GetHeroTraits())
            {
                if (Clan.Leader.GetTraitLevel(heroTrait) != 0)
                {
                    traits += CampaignUIHelper.GetTraitTooltipText(heroTrait, Clan.Leader) + " ";
                }
            }

            this.TierText += traits;
        }
Exemplo n.º 24
0
        public CSSkillVM(SkillObject skill, CSSkillScreenVM SkillScreenVM, CSScreenData screendata) //Action<PerkVM> onStartPerkSelection,
        {
            this.Skill          = skill;
            this._skill         = skill;
            this._SkillScreenVM = SkillScreenVM;
            this._screendata    = screendata;
            this.SkillId        = skill.StringId;
            this.Type           = (skill.IsPartySkill ? CSSkillVM.SkillType.Party : (skill.IsLeaderSkill ? CSSkillVM.SkillType.Leader : CSSkillVM.SkillType.Default)).ToString();

            this._boundAttributeName  = CharacterAttributes.GetCharacterAttribute(this.Skill.CharacterAttributeEnum).Name;
            this.LearningRateTooltip  = new BasicTooltipViewModel(() => CampaignUIHelper.GetLearningRateTooltip(this._boundAttributeCurrentValue, this.CurrentFocusLevel, this.Level, this._heroLevel, this._boundAttributeName));
            this.LearningLimitTooltip = new BasicTooltipViewModel(() => CampaignUIHelper.GetLearningLimitTooltip(this._boundAttributeCurrentValue, this.CurrentFocusLevel, this._boundAttributeName));
            this.InitializeValues();
            this._focusConceptObj = Concept.All.SingleOrDefault((Concept c) => c.StringId == "str_game_objects_skill_focus");
            this._skillConceptObj = Concept.All.SingleOrDefault((Concept c) => c.StringId == "str_game_objects_skills");
            this.RefreshValues();
        }
Exemplo n.º 25
0
 public HeroAdminPerkVM(PerkObject perk, bool isSelected, HeroAdminPerkVM.PerkAlternativeType alternativeType, Action <PerkObject, bool> onPerkSelectedChange)
 {
     this.AlternativeType       = (int)alternativeType;
     this.Perk                  = perk;
     this._onPerkSelectedChange = onPerkSelectedChange;
     this.PerkId                = "SPPerks\\" + perk.StringId;
     this.Level                 = (int)perk.RequiredSkillValue;
     this.LevelText             = ((int)perk.RequiredSkillValue).ToString();
     this.Hint                  = new BasicTooltipViewModel(() => CampaignUIHelper.GetPerkEffectText(perk, true));
     this._perkConceptObj       = Concept.All.SingleOrDefault(c => c.StringId == "str_game_objects_perks");
     if (isSelected)
     {
         this.CurrentState = HeroAdminPerkVM.PerkStates.EarnedAndActive;
     }
     else
     {
         this.CurrentState = HeroAdminPerkVM.PerkStates.EarnedButNotSelected;
     }
 }