private void Recalculate() { if (this._hero.Clan?.Kingdom != null && Clan.PlayerClan?.Kingdom != null && this._hero.Clan.Kingdom == Clan.PlayerClan.Kingdom) { this.CanGrantFief = GrantFiefAction.CanGrantFief(this._hero.Clan, out _); } this.RefreshValues(); }
public EncyclopediaHeroPageVMExtensionVM(EncyclopediaPageArgs args) : base(args) { this._grantFiefInterface = new GrantFiefInterface(); _hero = (base.Obj as Hero); this.SendMessengerInfluenceCost = (int)DiplomacyCostCalculator.DetermineInfluenceCostForSendingMessenger(); this.SendMessengerActionName = new TextObject("{=cXfcwzPp}Send Messenger").ToString(); this.GrantFiefActionName = new TextObject("{=LpoyhORp}Grant Fief").ToString(); this.CanGrantFief = GrantFiefAction.CanGrantFief(this._hero.Clan, out _); base.RefreshValues(); }
public void OnGrantFief() { GrantFiefAction.Apply(this.SelectedSettlementItem.Settlement, this._targetHero.Clan); TextObject text = new TextObject("{=cXbgaPSm}{SETTLEMENT_NAME} was granted to {CLAN_NAME}."); text.SetTextVariable("SETTLEMENT_NAME", this.SelectedSettlementItem.Settlement.Name); text.SetTextVariable("CLAN_NAME", this._targetHero.Clan.Name); InformationManager.ShowInquiry(new InquiryData(new TextObject("{=jznJfkfU}Fief Granted").ToString(), text.ToString(), true, false, GameTexts.FindText("str_ok", null).ToString(), null, null, null), false); _onComplete.Invoke(); }
public override void RefreshValues() { base.RefreshValues(); // this is called before the constructor the first time if (_hero is null) { return; } if (_hero.Clan?.Kingdom is not null && Clan.PlayerClan?.Kingdom is not null && _hero.Clan.Kingdom == Clan.PlayerClan.Kingdom) { CanGrantFief = GrantFiefAction.CanGrantFief(_hero.Clan, out _); } UpdateIsMessengerAvailable(); }
public GrantFiefItemVM(Settlement settlement, Hero targetHero, Action <GrantFiefItemVM> onSelect) { Settlement = settlement; Name = settlement.Name.ToString(); var component = settlement.GetComponent <SettlementComponent>(); SettlementImagePath = ((component is null) ? "placeholder" : (component.BackgroundMeshName + "_t")); var component2 = settlement.GetComponent <Town>(); if (component2 is not null) { Prosperity = MBMath.Round(component2.Prosperity); IconPath = component2.BackgroundMeshName; } else if (settlement.IsCastle) { Prosperity = MBMath.Round(settlement.Prosperity); IconPath = ""; } Garrison = Settlement.Town.GarrisonParty?.Party.NumberOfAllMembers ?? 0; _onSelect = onSelect; RelationBonus = string.Concat(new string[] { GrantFiefAction.PreviewPositiveRelationChange(Settlement, targetHero).ToString(), "+" }); }
private void RefreshCanGrantFief() { this.CanGrantFiefToClan = GrantFiefAction.CanGrantFief(this.CurrentSelectedClan.Clan, out string hint); this.GrantFiefHint = this.CanGrantFiefToClan ? new HintViewModel() : new HintViewModel(hint, null); }
private void RefreshCanGrantFief() { CanGrantFiefToClan = GrantFiefAction.CanGrantFief(CurrentSelectedClan.Clan, out var hint); GrantFiefHint = CanGrantFiefToClan ? new HintViewModel() : Compat.HintViewModel.Create(new TextObject(hint)); }