public CharacterCode CreateFrom(FacGenRecordData item) { CharacterCode characterCode = CharacterCode.CreateEmpty(); BodyProperties bodyProperties = BodyProperties.Default; BodyProperties.FromString(item.BodyPropertiesString, out bodyProperties); characterCode.BodyProperties = bodyProperties; string text = new Equipment().CalculateEquipmentCode(); ReflectUtils.ReflectPropertyAndSetValue("EquipmentCode", text, characterCode); ReflectUtils.ReflectPropertyAndSetValue("IsHero", true, characterCode); MBStringBuilder mBStringBuilder = default(MBStringBuilder); mBStringBuilder.Initialize(16, "CreateFrom"); mBStringBuilder.Append <string>("@---@"); mBStringBuilder.Append <string>(text); mBStringBuilder.Append <string>("@---@"); mBStringBuilder.Append <string>(characterCode.BodyProperties.ToString()); mBStringBuilder.Append <string>("@---@"); mBStringBuilder.Append <string>(item.IsFemale ? "1" : "0"); mBStringBuilder.Append <string>("@---@"); mBStringBuilder.Append <string>(characterCode.IsHero ? "1" : "0"); mBStringBuilder.Append <string>("@---@"); mBStringBuilder.Append <string>(((int)characterCode.FormationClass).ToString()); mBStringBuilder.Append <string>("@---@"); ReflectUtils.ReflectPropertyAndSetValue("Code", mBStringBuilder.ToStringAndRelease(), characterCode); return(characterCode); }
public SentimentCondition(CharacterCode character, int hasSentiment, CharacterCode towardsCharacter, bool moreThan = true) { _character = character; _status = hasSentiment; _towardsCharacter = towardsCharacter; _moreThan = moreThan; }
private void selectTroops() { List <InquiryElement> troopElements = new List <InquiryElement>(); foreach (CharacterObject troop in allTroops) { CharacterCode charCode = CharacterCode.CreateFrom(troop); troopElements.Add(new InquiryElement(troop, troop.Name.ToString(), new ImageIdentifier(charCode))); } InformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData( new TextObject("Select Troop").ToString(), new TextObject("Select The Troop Type").ToString(), troopElements, true, 1, new TextObject("Next").ToString(), new TextObject("Cancle").ToString(), (troop) => { getCount((CharacterObject)troop.First().Identifier); }, null ), true); }
public Character(CharacterCode code, Dictionary <CharacterCode, ISentiment> sentiments, Personality initial = Personality.Arianne) { _code = code; _personality = (int)initial; _senDict = sentiments; _changeCount = 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 HeroAdminHeroSelectorItemVM(Hero hero, Action <HeroAdminHeroSelectorItemVM> action) { this._hero = hero; this._onSelectedHeroAction = action; CharacterCode characterCode = CharacterCode.CreateFrom(hero.CharacterObject); this.Visual = new ImageIdentifierVM(characterCode); }
public static void Postfix(ImageIdentifierTextureProvider __instance, CharacterCode ____characterCode) { if (__instance.ImageTypeCode == 5 && ____characterCode != null && TaleWorlds.Core.FaceGen.GetMaturityTypeWithAge(____characterCode.BodyProperties.Age) <= BodyMeshMaturityType.Child && ____characterCode.BodyProperties.Age >= 3) { TableauCacheManager.Current.ReleaseTextureWithId(____characterCode, __instance.IsBig); } }
public HeroAdminRecordItemVM(HeroAdminCharacter heroAdminCharacter, Action <HeroAdminRecordItemVM> selectAction) { _heroAdminCharacter = heroAdminCharacter; this._onRecordSelected = selectAction; CharacterCode characterCode = CreateFrom(heroAdminCharacter); this.Visual = new ImageIdentifierVM(characterCode); this._skills = new MBBindingList <EncyclopediaSkillVM>(); RefreshHeroSkill(); }
public FacGenRecordItemVM(FacGenRecordData item, Action <FacGenRecordItemVM> onRecordSelected) { this._item = item; //characterCode.Code = characterCode.CreateNewCodeString(); CharacterCode characterCode = CreateFrom(item); this.Visual = new ImageIdentifierVM(characterCode); this._onRecordSelected = onRecordSelected; }
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(); }
public static string GetName(CharacterCode code) { if (_nameDict.ContainsKey(code)) { return(_nameDict[code]); } else { return("A stranger"); } }
// TO FIX: get character by name (string) public ICharacter GetCharacter(CharacterCode charCode) { foreach (ICharacter character in _characters) { if (character.IsCalled(charCode)) { return(character); } } return(null); }
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(); }
// The original method is async, but the problem spot is not, so... public static void Postfix(ImageIdentifierTextureProvider __instance, string id, int typeAsInt, string additionalArgs, ref CharacterCode ____characterCode, ref bool ____creatingTexture) { if (!string.IsNullOrEmpty(id) && typeAsInt == 5) { CharacterCode from = CharacterCode.CreateFrom(id); ____characterCode = from; if (TaleWorlds.Core.FaceGen.GetMaturityTypeWithAge(from.BodyProperties.Age) <= BodyMeshMaturityType.Child && from.BodyProperties.Age >= 3) { ____creatingTexture = true; TableauCacheManager.Current.BeginCreateCharacterTexture(from, new Action <Texture>(__instance.OnTextureCreated), __instance.IsBig); } } }
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 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(); }
private void ExecuteRangedCavalryTypeSelection() { if (!Game.Current.IsDevelopmentMode) { return; } List <InquiryElement> inquiryElements = new List <InquiryElement>(); foreach (BasicCharacterObject rangedCavalryType in this._rangedCavalryTypes) { ImageIdentifier imageIdentifier = new ImageIdentifier(CharacterCode.CreateFrom(rangedCavalryType)); inquiryElements.Add(new InquiryElement((object)rangedCavalryType, rangedCavalryType.Name.ToString(), imageIdentifier)); } InformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData("Ranged Cavalry Troop Types", string.Empty, inquiryElements, true, -1, "Done", "", new Action <List <InquiryElement> >(this.OnRangedCavalryTypeSelectionOver), new Action <List <InquiryElement> >(this.OnRangedCavalryTypeSelectionOver))); }
private void ExecuteRangedCavalryTypeSelection() { if (!Game.Current.IsDevelopmentMode) { return; } List <InquiryElement> inquiryElementList = new List <InquiryElement>(); using (List <BasicCharacterObject> .Enumerator enumerator = this._rangedCavalryTypes.GetEnumerator()) { while (enumerator.MoveNext()) { BasicCharacterObject current = enumerator.Current; ImageIdentifier imageIdentifier = new ImageIdentifier(CharacterCode.CreateFrom(current)); inquiryElementList.Add(new InquiryElement((object)current, ((object)current.Name).ToString(), imageIdentifier)); } } InformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData("Ranged Cavalry Troop Types", string.Empty, inquiryElementList, true, false, "Done", "", new Action <List <InquiryElement> >(this.OnRangedCavalryTypeSelectionOver), new Action <List <InquiryElement> >(this.OnRangedCavalryTypeSelectionOver), ""), false); }
private static void ShowChildrenToAdopt() { var currentSettlement = Hero.MainHero.CurrentSettlement; var lostChildren = OrphanAdoptionHelper.ChildrenForAdoptionAtSettlement(currentSettlement); var inquiryElements = new List <InquiryElement>(); foreach (var hero in lostChildren) { var identifier = new ImageIdentifier(CharacterCode.CreateFrom(hero.CharacterObject)); inquiryElements.Add(new InquiryElement(hero, hero.Name + " - " + Math.Floor(hero.BirthDay.ElapsedYearsUntilNow), identifier)); } if (inquiryElements.Count < 1) { InformationManager.ShowInquiry( new InquiryData("No child", "Empty orphanage", true, false, "OK", "", null, null), true); GameMenu.SwitchToMenu("town"); } else { InformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData( "Children you may adopt", "", inquiryElements, true, 1, "Continue", null, args => { if (args == null) { return; } if (!args.Any()) { return; } InformationManager.HideInquiry(); ConfirmAdoption(args.Select(element => element.Identifier as Hero).First()); }, null)); } }
public ChoiceEffect(CharacterCode character, SentimentEffect sentimentEffect, CharacterCode towardsCharacter) { _character = character; _towardsCharacter = towardsCharacter; _effect = sentimentEffect; }
public override int GetHashCode() { return(BoundingBox.GetHashCode() ^ CharacterCode.GetHashCode() ^ Ligatures.GetHashCode() ^ Name.GetHashCode() ^ VV.GetHashCode() ^ W.GetHashCode() ^ W0.GetHashCode() ^ W0X.GetHashCode() ^ W0Y.GetHashCode() ^ W1.GetHashCode() ^ W1X.GetHashCode() ^ W1Y.GetHashCode() ^ WX.GetHashCode() ^ WY.GetHashCode()); }
public int CompareTo(KoreanSyllable KoreanSyllable1) { return(CharacterCode.CompareTo(KoreanSyllable1.CharacterCode)); }
public static void game_menu_cps_town_courier_missive_on_consequence(MenuCallbackArgs args) { // TODO: select recipient and type of missive //ImageIdentifierType.Character var contacts = PostalServiceModel.GetValidMissiveRecipients(Hero.MainHero); var elements = (from c in contacts select new InquiryElement(c.StringId, c.Name.ToString(), new ImageIdentifier(CharacterCode.CreateFrom(c.CharacterObject)))).DefaultIfEmpty().ToList(); InformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData("Send Missive", "To whom should we deliver this missive?", elements, true, true, "Send", "Cancel", OnSendMissive, (List <InquiryElement> r) => { })); }
public int CompareTo(char c) { return(CharacterCode.CompareTo(c)); }
public bool IsCalled(CharacterCode charCode) { return(_code == charCode); }
public PersonalityCondition(CharacterCode character, int personality) { _character = character; _personality = personality; }
public int CompareTo(int i) { return(CharacterCode.CompareTo(i)); }
/// <summary> /// Initializes a new instance of the <see cref="EncodedString" /> struct. /// </summary> /// <param name="code">The character code.</param> /// <param name="text">The text value.</param> public EncodedString(CharacterCode code, string text) { this.Text = text; this.Code = code; }
// all of this is really really bad but idc public static List <InquiryElement> AssemblePatrolSizes(PatrolData dat) { MBObjectManager objManager = Game.Current.ObjectManager; List <InquiryElement> list = new List <InquiryElement>(); CharacterObject ch1 = objManager.GetObject <CharacterObject>("looter"); CharacterObject ch2 = objManager.GetObject <CharacterObject>("imperial_recruit"); CharacterObject ch3 = objManager.GetObject <CharacterObject>("imperial_infantryman"); CharacterObject ch4 = objManager.GetObject <CharacterObject>("imperial_veteran_infantryman"); if (dat.sizes.Contains("small")) { list.Add(new InquiryElement(dat, "Small " + "(" + dat.basePrice.ToString() + " gold)", new ImageIdentifier(CharacterCode.CreateFrom(ch1)))); } if (dat.sizes.Contains("medium")) { if (Hero.MainHero.Gold >= dat.basePrice + dat.priceStep) { list.Add(new InquiryElement(dat, "Medium " + "(" + (dat.basePrice + dat.priceStep).ToString() + " gold)", new ImageIdentifier(CharacterCode.CreateFrom(ch2)))); } else { list.Add(new InquiryElement(dat, "Medium " + "(" + (dat.basePrice + dat.priceStep).ToString() + " gold)", new ImageIdentifier(CharacterCode.CreateFrom(ch2)), false, "You do not have enough gold to purchase this size")); } } if (dat.sizes.Contains("large")) { if (Hero.MainHero.Gold >= dat.basePrice + (dat.priceStep * 2)) { list.Add(new InquiryElement(dat, "Large " + "(" + (dat.basePrice + (dat.priceStep * 2)).ToString() + " gold)", new ImageIdentifier(CharacterCode.CreateFrom(ch3)))); } else { list.Add(new InquiryElement(dat, "Large " + "(" + (dat.basePrice + (dat.priceStep * 2)).ToString() + " gold)", new ImageIdentifier(CharacterCode.CreateFrom(ch3)), false, "You do not have enough gold to purchase this size")); } } if (dat.sizes.Contains("huge")) { if (Hero.MainHero.Gold >= dat.basePrice + (dat.priceStep * 3)) { list.Add(new InquiryElement(dat, "Large " + "(" + (dat.basePrice + (dat.priceStep * 3)).ToString() + " gold)", new ImageIdentifier(CharacterCode.CreateFrom(ch4)))); } else { list.Add(new InquiryElement(dat, "Large " + "(" + (dat.basePrice + (dat.priceStep * 3)).ToString() + " gold)", new ImageIdentifier(CharacterCode.CreateFrom(ch4)), false, "You do not have enough gold to purchase this size")); } } if (list.Count == 0) { throw new Exception("Assembling sizes of patrol {" + dat.templateName + "} failed"); } else { return(list); } }
private void ExecuteAssignGovernor() { if (this.CurrentSelectedFief == null) { return; } List <InquiryElement> inquiryElements = new List <InquiryElement>(); foreach (Hero hero in this._faction.Heroes.Where <Hero>((Func <Hero, bool>)(h => !h.IsDisabled)).Union <Hero>((IEnumerable <Hero>) this._faction.Companions)) { if (hero.IsActive && !hero.IsChild) { if (hero.PartyBelongedToAsPrisoner != null) { string hint = new TextObject("{=knwId8DG}You cannot assign a prisoner as a governor of a settlement", (Dictionary <string, TextObject>)null).ToString(); inquiryElements.Add(new InquiryElement((object)hero, hero.Name.ToString(), new ImageIdentifier(CharacterCode.CreateFrom((BasicCharacterObject)hero.CharacterObject)), false, hint)); } else if (hero == Hero.MainHero) { string hint = new TextObject("{=uoDuiBZR}You cannot assign yourself as a governor", (Dictionary <string, TextObject>)null).ToString(); inquiryElements.Add(new InquiryElement((object)hero, hero.Name.ToString(), new ImageIdentifier(CharacterCode.CreateFrom((BasicCharacterObject)hero.CharacterObject)), false, hint)); } else if (hero.PartyBelongedTo != null && hero.PartyBelongedTo.LeaderHero == hero) { string hint = new TextObject("{=pWObBhj5}You cannot assign a party leader as a new governor of a settlement", (Dictionary <string, TextObject>)null).ToString(); inquiryElements.Add(new InquiryElement((object)hero, hero.Name.ToString(), new ImageIdentifier(CharacterCode.CreateFrom((BasicCharacterObject)hero.CharacterObject)), false, hint)); } else if (hero.GovernorOf != null) { TextObject textObject = new TextObject("{=YbGu9rSH}This character is already the governor of {SETTLEMENT_NAME}", (Dictionary <string, TextObject>)null); textObject.SetTextVariable("SETTLEMENT_NAME", hero.GovernorOf.Name); inquiryElements.Add(new InquiryElement((object)hero, hero.Name.ToString(), new ImageIdentifier(CharacterCode.CreateFrom((BasicCharacterObject)hero.CharacterObject)), false, textObject.ToString())); } else { inquiryElements.Add(new InquiryElement((object)hero, hero.Name.ToString(), new ImageIdentifier(CharacterCode.CreateFrom((BasicCharacterObject)hero.CharacterObject)))); } } } if (inquiryElements.Count > 0) { string title = new TextObject("{=koX9okuG}None", (Dictionary <string, TextObject>)null).ToString(); inquiryElements.Add(new InquiryElement((object)null, title, new ImageIdentifier(ImageIdentifierType.Null))); InformationManager.ShowMultiSelectionInquiry(new MultiSelectionInquiryData(new TextObject("{=PAUsUq4Z}Select the Leader of the Settlement", (Dictionary <string, TextObject>)null).ToString(), string.Empty, inquiryElements, true, true, GameTexts.FindText("str_done", (string)null).ToString(), "", new Action <List <InquiryElement> >(this.OnGovernorSelectionOver), new Action <List <InquiryElement> >(this.OnGovernorSelectionOver), ""), false); } else { InformationManager.AddQuickInformation(new TextObject("{=JzrodcIR}There is no one available in your clan who can govern this settlement right now.", (Dictionary <string, TextObject>)null), 0, (BasicCharacterObject)null, ""); } }