示例#1
0
        public static void Apply(Kingdom kingdom, Kingdom otherKingdom)
        {
            Kingdom playerKingdom = Clan.PlayerClan?.Kingdom;

            if (otherKingdom == playerKingdom && playerKingdom.Leader == Hero.MainHero)
            {
                TextObject textObject = new TextObject("{=384jX28Q}{KINGDOM} is breaking the alliance with {PLAYER_KINGDOM}.");
                textObject.SetTextVariable("KINGDOM", kingdom.Name);
                textObject.SetTextVariable("PLAYER_KINGDOM", otherKingdom.Name);

                InformationManager.ShowInquiry(new InquiryData(
                                                   new TextObject("{=D1ZQKZr1}Alliance Broken").ToString(),
                                                   textObject.ToString(),
                                                   true,
                                                   false,
                                                   GameTexts.FindText("str_ok", null).ToString(),
                                                   null,
                                                   () => ApplyInternal(kingdom, otherKingdom),
                                                   null,
                                                   ""), true);
            }
            else
            {
                ApplyInternal(kingdom, otherKingdom);
            }
        }
示例#2
0
        private Kingdom GoRebelKingdom(Clan clan, IEnumerable <Settlement> settlements)
        {
            var capital = settlements.First();
            var owner   = capital.OwnerClan;
            // create a new kingdom for the clan
            TextObject kingdomIntroText = new TextObject("{=Separatism_Kingdom_Intro_Anarchy}{RebelKingdom} was found in {Year} as a result of anarchy in fiefs of the {ClanName} when people of {Settlement} have called {Ruler} on rulership.", null);

            kingdomIntroText.SetTextVariable("Year", CampaignTime.Now.GetYear);
            kingdomIntroText.SetTextVariable("ClanName", owner.Name);
            kingdomIntroText.SetTextVariable("Settlement", capital.Name);
            kingdomIntroText.SetTextVariable("Ruler", clan.Leader.Name);
            var kingdom = clan.CreateKingdom(kingdomIntroText);

            // keep policies from the old settlement kingdom
            foreach (var policy in owner.Kingdom.ActivePolicies)
            {
                kingdom.AddPolicy(policy);
            }
            // move the clan out of its current kingdom
            clan.ChangeKingdom(null, false);
            // change settlement ownership
            foreach (var s in settlements)
            {
                ChangeOwnerOfSettlementAction.ApplyByRevolt(clan.Leader, s);
            }
            // move the clan into the new kingdom
            clan.ChangeKingdom(kingdom, false);
            // declare wars
            kingdom.InheritsWarsFromKingdom(owner.Kingdom);
            DeclareWarAction.Apply(owner.Kingdom, kingdom);

            return(kingdom);
        }
        private static void ApplyInternal(Hero orphan, Clan adoptionClan)
        {
            if (adoptionClan == null)
            {
                return;
            }

            if (orphan.IsDead)
            {
                PrepareOrphanAction.Apply(orphan);
            }

            orphan.Clan = adoptionClan;
            var updatedEncyclopediaText =
                new TextObject(
                    "{HISTORY} {?CHARACTER.GENDER}She{?}He{\\?} was adopted at the age of {CHARACTER.AGE} by the {CLAN}.");

            if (orphan.EncyclopediaText == null)
            {
                orphan.EncyclopediaText = new TextObject(Hero.SetHeroEncyclopediaTextAndLinks(orphan));
            }
            var history = orphan.EncyclopediaText != null?orphan.EncyclopediaText.ToString() : "";

            updatedEncyclopediaText.SetTextVariable("HISTORY", history);
            StringHelpers.SetCharacterProperties("CHARACTER", orphan.CharacterObject, updatedEncyclopediaText, true);
            updatedEncyclopediaText.SetTextVariable("CLAN", adoptionClan.Name);
            orphan.EncyclopediaText = updatedEncyclopediaText;

            InformationManager.DisplayMessage(
                new InformationMessage(orphan.Name + " has been adopted by the " + adoptionClan.Name));
        }
示例#4
0
        public bool ApplyCondition(Kingdom kingdom, Kingdom otherKingdom, out TextObject?textObject, bool forcePlayerCharacterCosts = false, bool bypassCosts = false)
        {
            textObject = null;
            IEnumerable <LogEntry> gameActionLogs = Campaign.Current.LogEntryHistory.GameActionLogs;

            var lastPeaceTime = CampaignTime.Never;

            foreach (var logEntry in gameActionLogs)
            {
                if (logEntry is MakePeaceLogEntry &&
                    ((((MakePeaceLogEntry)logEntry).Faction1 == kingdom.MapFaction && ((MakePeaceLogEntry)logEntry).Faction2 == otherKingdom.MapFaction) || (((MakePeaceLogEntry)logEntry).Faction1 == otherKingdom.MapFaction && ((MakePeaceLogEntry)logEntry).Faction2 == kingdom.MapFaction)))
                {
                    lastPeaceTime = logEntry.GameTime;
                    break;
                }
            }

            var daysSinceLastWar     = CampaignTime.Now.ToDays - lastPeaceTime.ToDays;
            var hasEnoughTimeElapsed = lastPeaceTime == CampaignTime.Never || daysSinceLastWar > MinimumTimeFromLastWar;

            if (!hasEnoughTimeElapsed)
            {
                textObject = new TextObject(TOO_SOON);
                textObject.SetTextVariable("ELAPSED_DAYS", (int)daysSinceLastWar);
                textObject.SetTextVariable("REQUIRED_DAYS", (int)MinimumTimeFromLastWar);
            }
            return(hasEnoughTimeElapsed);
        }
        public static void wait_menu_settlement_wait_on_tick(MenuCallbackArgs args, CampaignTime dt)
        {
            int captiveTimeInDays = PlayerCaptivity.CaptiveTimeInDays;

            if (captiveTimeInDays == 0)
            {
                return;
            }

            TextObject variable = null;

            if (Hero.MainHero.IsPrisoner && Hero.MainHero.PartyBelongedToAsPrisoner.Settlement != null)
            {
                variable = Hero.MainHero.PartyBelongedToAsPrisoner.Settlement.Name;
            }

            if (variable == null)
            {
                variable = Settlement.CurrentSettlement.Name;
            }

            TextObject text       = args.MenuContext.GameMenu.GetText();
            TextObject textObject = GameTexts.FindText("str_prisoner_of_settlement_for_days_menu_text", null);

            textObject.SetTextVariable("NUMBER_OF_DAYS", captiveTimeInDays);
            textObject.SetTextVariable("PLURAL", (captiveTimeInDays > 1) ? 1 : 0);
            textObject.SetTextVariable("SETTLEMENT_NAME", variable);
            text.SetTextVariable("CAPTIVITY_TEXT", textObject);
        }
示例#6
0
        private void SetModifier(int amount, Hero hero, SkillObject skill, SkillObject flag, bool displayMessage = true, bool quickInformation = false)
        //Warning: SkillObject flag never used.
        {
            if (amount == 0)
            {
                if ((displayMessage || quickInformation) && hero.GetSkillValue(skill) > 0)
                {
                    TextObject textObject = GameTexts.FindText("str_CE_level_start");
                    textObject.SetTextVariable("SKILL", skill.Name);
                    textObject.SetTextVariable("HERO", hero.Name);

                    if (hero.GetSkillValue(skill) > 1)
                    {
                        if (displayMessage)
                        {
                            InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), Colors.Green));
                        }
                        if (quickInformation)
                        {
                            InformationManager.AddQuickInformation(textObject, 0, hero.CharacterObject, "event:/ui/notification/relation");
                        }
                    }
                }

                hero.SetSkillValue(skill, 0);
            }
            else
            {
                int currentValue = hero.GetSkillValue(skill);
                int valueToSet   = currentValue + amount;
                if (valueToSet < 1)
                {
                    valueToSet = 1;
                }
                hero.SetSkillValue(skill, valueToSet);

                if (!displayMessage && !quickInformation)
                {
                    return;
                }
                TextObject textObject = GameTexts.FindText("str_CE_level_skill");
                textObject.SetTextVariable("HERO", hero.Name);
                textObject.SetTextVariable("SKILL", skill.Name);

                textObject.SetTextVariable("NEGATIVE", amount >= 0 ? 0 : 1);
                textObject.SetTextVariable("PLURAL", amount >= 2 ? 1 : 0);

                textObject.SetTextVariable("SKILL_AMOUNT", Math.Abs(amount));
                textObject.SetTextVariable("TOTAL_AMOUNT", valueToSet);
                if (displayMessage)
                {
                    InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), Colors.Green));
                }

                if (quickInformation)
                {
                    InformationManager.AddQuickInformation(textObject, 0, hero.CharacterObject, "event:/ui/notification/relation");
                }
            }
        }
示例#7
0
        private void OnDailyTick()
        {
            if (!SeparatismConfig.Settings.NationalRebellionsEnabled)
            {
                return;
            }

            var readyClans = Clan.All
                             .Where(c => c.Culture != c.Kingdom?.Culture && c.Settlements.Any(s => s.Culture == c.Culture))
                             .GroupBy(c => new { Kingdom = c.Kingdom, Culture = c.Culture })
                             .OrderByDescending(x => x.Count());

            foreach (var group in readyClans)
            {
                var rebelRightNow = SeparatismConfig.Settings.DailyNationalRebellionChance >= 1 ||
                                    (MBRandom.RandomFloat <= SeparatismConfig.Settings.DailyNationalRebellionChance);

                if (group.Count() >= SeparatismConfig.Settings.MinimalRequiredNumberOfNativeLords && rebelRightNow)
                {
                    var rebelKingdom = GoRebelKingdom(group.OrderByDescending(c => c.Tier).ThenByDescending(c => c.Renown));
                    var textObject   = new TextObject("{=Separatism_National_Rebel}{Culture} people of {Kingdom} leading by their native lords have rised a rebellion to fight for their independence and found the {RebelKingdom}.", null);
                    textObject.SetTextVariable("Culture", group.Key.Culture.Name);
                    textObject.SetTextVariable("Kingdom", group.Key.Kingdom.Name);
                    textObject.SetTextVariable("RebelKingdom", rebelKingdom.Name);
                    GameLog.Warn(textObject.ToString());
                    return;
                }
            }
        }
示例#8
0
        public void PayPatrols()
        {
            int totalWages = 0;
            PatrolProperties patrolProperties;

            foreach (Settlement settlement in Settlement.All)
            {
                if ((settlement.IsVillage || settlement.IsCastle) && settlement.OwnerClan == Clan.PlayerClan)
                {
                    settlementPatrolProperties.TryGetValue(settlement.StringId, out patrolProperties);
                    foreach (MobileParty patrol in patrolProperties.patrols.ToList())
                    {
                        GiveGoldAction.ApplyForCharacterToParty(Hero.MainHero, patrol.Party, (int)(patrol.GetTotalWage() * DailyPatrolWageModifier), true);
                        totalWages += (int)(patrol.GetTotalWage() * DailyPatrolWageModifier);
                    }
                    settlementPatrolProperties[settlement.StringId] = patrolProperties;
                }
            }
            if (totalWages > 0)
            {
                TextObject text = new TextObject("Daily Patrol Wages: -{BASILPATROL_DAILY_WAGES}{GOLD_ICON}", null);
                text.SetTextVariable("GOLD_ICON", "<img src=\"Icons\\Coin@2x\">");
                text.SetTextVariable("BASILPATROL_DAILY_WAGES", totalWages);
                InformationManager.DisplayMessage(new InformationMessage(text.ToString()));
            }
        }
示例#9
0
        private static string CreateMakePeaceInquiryText(Kingdom kingdomMakingPeace, Kingdom otherKingdom, int payment)
        {
            TextObject peaceText;

            if (Settings.Instance.EnableWarExhaustion && WarExhaustionManager.Instance.HasMaxWarExhaustion(kingdomMakingPeace, otherKingdom))
            {
                peaceText = new TextObject("{=HWiDa4R1}Exhausted from the war, the {KINGDOM} is proposing peace with the {PLAYER_KINGDOM}.");
                peaceText.SetTextVariable("KINGDOM", kingdomMakingPeace.Name.ToString());
                peaceText.SetTextVariable("PLAYER_KINGDOM", otherKingdom.Name.ToString());
            }
            else
            {
                peaceText = new TextObject("{=t0ZS9maD}{KINGDOM_LEADER} of the {KINGDOM} is proposing peace with the {PLAYER_KINGDOM}.");
                peaceText.SetTextVariable("KINGDOM_LEADER", kingdomMakingPeace.Leader.Name.ToString());
                peaceText.SetTextVariable("KINGDOM", kingdomMakingPeace.Name.ToString());
                peaceText.SetTextVariable("PLAYER_KINGDOM", otherKingdom.Name.ToString());
            }
            List <string> inquiryText = new List <string>();

            inquiryText.Add(peaceText.ToString());

            if (payment > 0)
            {
                TextObject warReparationText = new TextObject("{=ZrwszZww} They are willing to pay war reparations of {DENARS} denars.");
                warReparationText.SetTextVariable("DENARS", payment);
                inquiryText.Add(warReparationText.ToString());
            }
            return(string.Concat(inquiryText));
        }
示例#10
0
        internal void CECaptorReleasePrisoners(MenuCallbackArgs args, int amount = 10, bool releaseHeroes = false)
        {
            try
            {
                int prisonerCount = MobileParty.MainParty.PrisonRoster.Count;
                if (prisonerCount < amount)
                {
                    amount = prisonerCount;
                }
                MobileParty.MainParty.PrisonRoster.KillNumberOfMenRandomly(amount, false);
                if (releaseHeroes)
                {
                    foreach (TroopRosterElement element in MobileParty.MainParty.PrisonRoster.GetTroopRoster())
                    {
                        if (element.Character.IsHero)
                        {
                            element.Character.HeroObject.ChangeState(Hero.CharacterStates.Active);
                        }
                    }
                    MobileParty.MainParty.PrisonRoster.Clear();
                }

                TextObject textObject = GameTexts.FindText("str_CE_release_prisoners");
                textObject.SetTextVariable("HERO", Hero.MainHero.Name);
                textObject.SetTextVariable("AMOUNT", amount);
                InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), Colors.Green));
            }
            catch (Exception)
            {
                CECustomHandler.LogToFile("Couldn't release any prisoners.");
            }
        }
        // Returns display data from siege parameter, combines castle and town into one method determined by isCastle parameter.
        private string GetDisplayFromSiege(SiegeEvent e, bool isCastle)
        {
            if (isCastle)
            {
                TextObject text = GameTexts.FindText("str_sta_alarm_castle_attack_message", null);
                text.SetTextVariable("CASTLE", e.BesiegedSettlement.Name.ToString());
                TextObject attacker = new TextObject("", null);
                attacker.SetTextVariable("PARTY", e.BesiegedSettlement.LastAttackerParty.Name);
                attacker.SetTextVariable("NAME", e.BesiegedSettlement.LastAttackerParty.LeaderHero.Name);
                attacker.SetTextVariable("GENDER", e.BesiegedSettlement.LastAttackerParty.LeaderHero.IsFemale ? 1 : 0);
                attacker.SetTextVariable("FACTION", e.BesiegedSettlement.LastAttackerParty.LeaderHero.MapFaction.Name);
                text.SetTextVariable("ATTACKER", attacker);

                return(text.ToString());
            }
            else
            {
                TextObject text = GameTexts.FindText("str_sta_alarm_town_attack_message", null);
                text.SetTextVariable("TOWN", e.BesiegedSettlement.Name.ToString());
                TextObject attacker = new TextObject("", null);
                attacker.SetTextVariable("PARTY", e.BesiegedSettlement.LastAttackerParty.Name);
                attacker.SetTextVariable("NAME", e.BesiegedSettlement.LastAttackerParty.LeaderHero.Name);
                attacker.SetTextVariable("GENDER", e.BesiegedSettlement.LastAttackerParty.LeaderHero.IsFemale ? 1 : 0);
                attacker.SetTextVariable("FACTION", e.BesiegedSettlement.LastAttackerParty.LeaderHero.MapFaction.Name);
                text.SetTextVariable("ATTACKER", attacker);

                return(text.ToString());
            }
        }
示例#12
0
        public static void Apply(Kingdom kingdom, Kingdom otherKingdom, bool forcePlayerCharacterCosts = false)
        {
            Kingdom playerKingdom = Clan.PlayerClan?.Kingdom;

            if (otherKingdom == playerKingdom && playerKingdom.Leader == Hero.MainHero)
            {
                TextObject textObject = new TextObject("{=QbOqatd7}{KINGDOM} is proposing an alliance with {PLAYER_KINGDOM}.");
                textObject.SetTextVariable("KINGDOM", kingdom.Name);
                textObject.SetTextVariable("PLAYER_KINGDOM", otherKingdom.Name);

                InformationManager.ShowInquiry(new InquiryData(
                                                   new TextObject("{=3pbwc8sh}Alliance Proposal").ToString(),
                                                   textObject.ToString(),
                                                   true,
                                                   true,
                                                   new TextObject("{=3fTqLwkC}Accept").ToString(),
                                                   new TextObject("{=dRoMejb0}Decline").ToString(),
                                                   () => ApplyInternal(kingdom, otherKingdom, forcePlayerCharacterCosts),
                                                   null,
                                                   ""), true);
            }
            else
            {
                ApplyInternal(kingdom, otherKingdom, forcePlayerCharacterCosts);
            }
        }
        public override void NotifyExpired()
        {
            TextObject textObject = new TextObject("{=uWY09LJb}The non-aggression pact between {KINGDOM} and {OTHER_KINGDOM} has expired.");

            textObject.SetTextVariable("KINGDOM", Factions.Faction1.MapFaction.Name);
            textObject.SetTextVariable("OTHER_KINGDOM", Factions.Faction2.MapFaction.Name);
            if (Factions.Faction1.MapFaction == Clan.PlayerClan.Kingdom || Factions.Faction2.MapFaction == Clan.PlayerClan.Kingdom)
            {
                InformationManager.ShowInquiry(
                    new InquiryData(
                        new TextObject("{=pdI7Tjtj}Non-Aggression Pact Expired").ToString(),
                        textObject.ToString(),
                        true,
                        false,
                        GameTexts.FindText("str_ok", null).ToString(),
                        null,
                        null,
                        null,
                        ""), true);
            }
            else
            {
                InformationManager.DisplayMessage(new InformationMessage(textObject.ToString()));
            }
        }
示例#14
0
        private void TraitObjectModifier(TraitObject traitObject, Color color, Hero hero, string trait, int amount, int xp, bool display)
        {
            if (xp == 0)
            {
                int currentTraitLevel = hero.GetTraitLevel(traitObject);
                int newNumber         = currentTraitLevel + amount;
                if (newNumber < 0)
                {
                    newNumber = 0;
                }


                hero.SetTraitLevel(traitObject, newNumber);

                if (!display)
                {
                    return;
                }
                TextObject textObject = GameTexts.FindText("str_CE_trait_level");
                textObject.SetTextVariable("HERO", hero.Name);
                textObject.SetTextVariable("POSITIVE", newNumber >= 0 ? 1 : 0);
                textObject.SetTextVariable("TRAIT", CEStrings.FetchTraitString(trait));
                InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), color));
            }
            else if (hero == Hero.MainHero)
            {
                Campaign.Current.PlayerTraitDeveloper.AddTraitXp(traitObject, xp);
            }
        }
        public static void DefectKingdomDebug(Clan clan, Kingdom kingdom)
        {
            if (!SettingsHelper.SystemDebugEnabled(AOSystems.EnsuredLoyalty, DebugType.General, new List <IFaction>()
            {
                clan, kingdom
            }))
            {
                return;
            }

            InDebugBranch = true;
            JoinKingdomAsClanBarterable asClanBarterable = new JoinKingdomAsClanBarterable(clan.Leader, kingdom);
            int  ClanBarterableValueForClan    = asClanBarterable.GetValueForFaction(clan);
            int  ClanBarterableValueForKingdom = asClanBarterable.GetValueForFaction(kingdom);
            bool NativeDecision = ClanBarterableValueForClan + ClanBarterableValueForKingdom <= 0;

            TextObject ResultTextObject = new TextObject(Debug_Defect);

            StringHelper.SetEntitiyProperties(ResultTextObject, "LEAVING_CLAN", clan, true);
            StringHelper.SetEntitiyProperties(ResultTextObject, "TARGET_KINGDOM", kingdom);
            StringHelper.SetNumericVariable(ResultTextObject, "CURRENT_BARTERABLE", ClanBarterableValueForClan, "N0");
            StringHelper.SetNumericVariable(ResultTextObject, "TARGET_BARTERABLE", ClanBarterableValueForKingdom, "N0");
            ResultTextObject.SetTextVariable("CLAN_DECISION", NativeDecision ? StayDecision : LeaveDecision);

            bool IsLoyaltyEnsured = LoyaltyManager.CheckLoyalty(clan, out TextObject LoyaltyTextObject, kingdom);

            LoyaltyTextObject.SetTextVariable("TRANSITION_PART", NativeDecision == IsLoyaltyEnsured ? LoyaltyManager.TransitionFromSame : LoyaltyManager.TransitionFromDifferent);
            ResultTextObject.SetTextVariable("ENSURED_LOYALTY_RESULT", LoyaltyTextObject);

            MessageHelper.SimpleMessage(ResultTextObject);
            InDebugBranch = false;
        }
        public static void LeaveKingdomDebug(Clan clan)
        {
            if (!SettingsHelper.SystemDebugEnabled(AOSystems.EnsuredLoyalty, DebugType.General, clan))
            {
                return;
            }

            InDebugBranch = true;
            LeaveKingdomAsClanBarterable asClanBarterable = new LeaveKingdomAsClanBarterable(clan.Leader, null);
            int  ClanBarterableValueForFaction            = asClanBarterable.GetValueForFaction(clan);
            int  StayThreshold  = (Settings.Instance.FixMinorFactionVassals ? clan.IsUnderMercenaryService : clan.IsMinorFaction) ? 500 : 0;
            bool NativeDecision = ClanBarterableValueForFaction <= StayThreshold;

            TextObject ResultTextObject = new TextObject(Debug_Leave);

            StringHelper.SetEntitiyProperties(ResultTextObject, "LEAVING_CLAN", clan, true);
            StringHelper.SetNumericVariable(ResultTextObject, "LEAVE_BARTERABLE", ClanBarterableValueForFaction, "N0");
            StringHelper.SetNumericVariable(ResultTextObject, "LEAVE_THRESHOLD", StayThreshold, "N0");
            ResultTextObject.SetTextVariable("CLAN_DECISION", NativeDecision ? StayDecision : LeaveDecision);

            bool IsLoyaltyEnsured = LoyaltyManager.CheckLoyalty(clan, out TextObject LoyaltyTextObject);

            LoyaltyTextObject.SetTextVariable("TRANSITION_PART", NativeDecision == IsLoyaltyEnsured ? LoyaltyManager.TransitionFromSame : LoyaltyManager.TransitionFromDifferent);
            ResultTextObject.SetTextVariable("ENSURED_LOYALTY_RESULT", LoyaltyTextObject);

            MessageHelper.SimpleMessage(ResultTextObject);
            InDebugBranch = false;
        }
示例#17
0
 public MissionScoreboardComponent.ScoreboardHeader[] GetScoreboardHeaders()
 {
     GameNetwork.MyPeer.GetComponent <MissionRepresentativeBase>();
     return(new MissionScoreboardComponent.ScoreboardHeader[9]
     {
         new MissionScoreboardComponent.ScoreboardHeader("avatar", (Func <MissionPeer, string>)(missionPeer => ""), (Func <BotData, string>)(bot => "")),
         new MissionScoreboardComponent.ScoreboardHeader("badge", (Func <MissionPeer, string>)(missionPeer => BadgeManager.GetByIndex(missionPeer.GetPeer().ChosenBadgeIndex)?.StringId), (Func <BotData, string>)(bot => "")),
         new MissionScoreboardComponent.ScoreboardHeader("name", (Func <MissionPeer, string>)(missionPeer => missionPeer.Name.ToString()), (Func <BotData, string>)(bot => new TextObject("{=hvQSOi79}Bot").ToString())),
         new MissionScoreboardComponent.ScoreboardHeader("kill", (Func <MissionPeer, string>)(missionPeer => missionPeer.KillCount.ToString()), (Func <BotData, string>)(bot => bot.KillCount.ToString())),
         new MissionScoreboardComponent.ScoreboardHeader("death", (Func <MissionPeer, string>)(missionPeer => missionPeer.DeathCount.ToString()), (Func <BotData, string>)(bot => bot.DeathCount.ToString())),
         new MissionScoreboardComponent.ScoreboardHeader("assist", (Func <MissionPeer, string>)(missionPeer => missionPeer.AssistCount.ToString()), (Func <BotData, string>)(bot => bot.AssistCount.ToString())),
         new MissionScoreboardComponent.ScoreboardHeader("score", (Func <MissionPeer, string>)(missionPeer => missionPeer.Score.ToString()), (Func <BotData, string>)(bot => bot.Score.ToString())),
         new MissionScoreboardComponent.ScoreboardHeader("soldiers", (Func <MissionPeer, string>)(missionPeer =>
         {
             TextObject textObject = new TextObject("{=4FVIuqsl}{ALIVE}/{TOTAL}");
             textObject.SetTextVariable("ALIVE", missionPeer.BotsUnderControlAlive + (missionPeer.IsControlledAgentActive ? 1 : 0));
             textObject.SetTextVariable("TOTAL", missionPeer.BotsUnderControlTotal + 1);
             return textObject.ToString();
         }), (Func <BotData, string>)(bot =>
         {
             TextObject textObject = new TextObject("{=4FVIuqsl}{ALIVE}/{TOTAL}");
             textObject.SetTextVariable("ALIVE", bot.AliveCount);
             textObject.SetTextVariable("TOTAL", 0);
             return textObject.ToString();
         })),
         new MissionScoreboardComponent.ScoreboardHeader("ping", (Func <MissionPeer, string>)(missionPeer => missionPeer.GetNetworkPeer().AveragePingInMilliseconds.Round().ToString()), (Func <BotData, string>)(bot => ""))
     });
 }
示例#18
0
        private static void SetConsideredAction(out TextObject textObject, TextObject actionTargetName, KingdomDecision?clanDecision, ConsiderationType considerationType, bool revertPolicy = false, Settlement?annexedSettlement = null)
        {
            textObject = new TextObject(ConsiderationDescription);
            switch (considerationType)
            {
            case ConsiderationType.MakingPeace:
                textObject.SetTextVariable("CONSIDERED_ACTION", ActionMakingPeace);
                textObject.SetTextVariable("ACTION_DETAILS", TextObject.Empty);
                break;

            case ConsiderationType.DeclaringWar:
                textObject.SetTextVariable("CONSIDERED_ACTION", ActionDeclaringWar);
                textObject.SetTextVariable("ACTION_DETAILS", TextObject.Empty);
                break;

            case ConsiderationType.ChangingKingdomPolicy:
                textObject.SetTextVariable("CONSIDERED_ACTION", revertPolicy ? ActionDisavowingKingdomPolicy : ActionIntroducingKingdomPolicy);
                textObject.SetTextVariable("ACTION_DETAILS", TextObject.Empty);
                break;

            case ConsiderationType.AnnexingFief:
                SetEntityProperties(null, "ANNEXED_SETTLEMENT", annexedSettlement);
                textObject.SetTextVariable("CONSIDERED_ACTION", new TextObject(ActionAnnexingFief));
                textObject.SetTextVariable("ACTION_DETAILS", new TextObject(AnnexingFiefActionDetails));
                break;

            default:
                throw new ArgumentException(string.Format("{0} is not supported Consideration type", considerationType.ToString()), nameof(considerationType));
            }
            textObject.SetTextVariable("ACTION_TARGET", actionTargetName);
            textObject.SetTextVariable("CONSIDER_OUTCOME", clanDecision is null ? OutcomeIsAbstain : OutcomeIsElectionStart);
        }
示例#19
0
        private void AllianceFormed(AllianceEvent allianceFormedEvent)
        {
            var txt = new TextObject("{=PdN5g5ub}{KINGDOM} has formed an alliance with {OTHER_KINGDOM}!");

            txt.SetTextVariable("KINGDOM", allianceFormedEvent.Kingdom.Name);
            txt.SetTextVariable("OTHER_KINGDOM", allianceFormedEvent.OtherKingdom.Name);
            var txtRendered = txt.ToString();

            if (allianceFormedEvent.Kingdom == Clan.PlayerClan.Kingdom ||
                allianceFormedEvent.OtherKingdom == Clan.PlayerClan.Kingdom)
            {
                InformationManager.ShowInquiry(
                    new InquiryData(new TextObject("{=qIa19an4}Alliance Formed").ToString(),
                                    txtRendered,
                                    true,
                                    false,
                                    GameTexts.FindText("str_ok", null).ToString(),
                                    null,
                                    null,
                                    null));
            }
            else
            {
                InformationManager.DisplayMessage(new InformationMessage(txtRendered, SubModule.StdTextColor));
            }
        }
示例#20
0
        private static void SetPossibleAction(out TextObject textObject, ConsiderationType considerationType)
        {
            textObject = new TextObject(NoFactionFound);
            switch (considerationType)
            {
            case ConsiderationType.MakingPeace:
                textObject.SetTextVariable("POSSIBLE_ACTION", PossibleActionMakingPeace);
                break;

            case ConsiderationType.DeclaringWar:
                textObject.SetTextVariable("POSSIBLE_ACTION", PossibleActionDeclaringWar);
                break;

            case ConsiderationType.ChangingKingdomPolicy:
                textObject.SetTextVariable("POSSIBLE_ACTION", PossibleActionChangingKingdomPolicy);
                break;

            case ConsiderationType.AnnexingFief:
                textObject.SetTextVariable("POSSIBLE_ACTION", PossibleActionAnnexingFief);
                break;

            default:
                throw new ArgumentException(string.Format("{0} is not supported Consideration type", considerationType.ToString()), nameof(considerationType));
            }
        }
示例#21
0
        private void ShowGameChangePoll(string gameType, string scene)
        {
            TextObject pollQuestion = new TextObject("{=hOSafKZ9}A new {GAME_TYPE} game will be started on {SCENE_NAME}");

            pollQuestion.SetTextVariable("GAME_TYPE", gameType);
            pollQuestion.SetTextVariable("SCENE_NAME", scene);
            this.ShowPoll(pollQuestion);
        }
示例#22
0
        private void ShowPlayerKickPoll(NetworkCommunicator peer, bool banUser)
        {
            TextObject pollQuestion = new TextObject("{=PNg2Rb4p}{PEER_NAME} will be kicked{IS_BANNED}");

            pollQuestion.SetTextVariable("PEER_NAME", banUser ? " and banned" : "");
            pollQuestion.SetTextVariable("IS_BANNED", peer.UserName);
            this.ShowPoll(pollQuestion);
        }
        public static TextObject GetConceptHyperlinkText(string link, TextObject conceptName)
        {
            TextObject textObject = new TextObject("{=!}<a style=\"Link.Concept\" href=\"event:{LINK}\"><b>{CONCEPT_NAME}</b></a>");

            textObject.SetTextVariable("LINK", link);
            textObject.SetTextVariable("CONCEPT_NAME", conceptName);
            return(textObject);
        }
        public static TextObject GetUnitHyperlinkText(string link, TextObject unitName)
        {
            TextObject textObject = new TextObject("{=!}<a style=\"Link.Unit\" href=\"event:{LINK}\"><b>{UNIT_NAME}</b></a>");

            textObject.SetTextVariable("LINK", link);
            textObject.SetTextVariable("UNIT_NAME", unitName);
            return(textObject);
        }
        public static TextObject GetKingdomHyperlinkText(string link, TextObject kingdomName)
        {
            TextObject textObject = new TextObject("{=!}<a style=\"Link.Kingdom\" href=\"event:{LINK}\"><b>{KINGDOM_NAME}</b></a>");

            textObject.SetTextVariable("LINK", link);
            textObject.SetTextVariable("KINGDOM_NAME", kingdomName);
            return(textObject);
        }
        public static TextObject GetClanHyperlinkText(string link, TextObject clanName)
        {
            TextObject textObject = new TextObject("{=!}<a style=\"Link.Clan\" href=\"event:{LINK}\"><b>{CLAN_NAME}</b></a>");

            textObject.SetTextVariable("LINK", link);
            textObject.SetTextVariable("CLAN_NAME", clanName);
            return(textObject);
        }
        public static TextObject GetHeroHyperlinkText(string link, TextObject heroName)
        {
            TextObject textObject = new TextObject("{=!}<a style=\"Link.Hero\" href=\"event:{LINK}\"><b>{HERO_NAME}</b></a>");

            textObject.SetTextVariable("LINK", link);
            textObject.SetTextVariable("HERO_NAME", heroName);
            return(textObject);
        }
示例#28
0
        private static string CreateMakePeaceDueToWarExhaustionInquiryText(Kingdom kingdom, IFaction faction)
        {
            TextObject peaceText = new TextObject("{=HWiDa4R1}Exhausted from the war, the {KINGDOM} is proposing peace with the {PLAYER_KINGDOM}.");

            peaceText.SetTextVariable("KINGDOM", kingdom.Name.ToString());
            peaceText.SetTextVariable("PLAYER_KINGDOM", faction.Name.ToString());

            return(peaceText.ToString());
        }
示例#29
0
        internal void VictimProstitutionModifier(int amount, Hero hero, bool updateFlag = false, bool displayMessage = true, bool quickInformation = false)
        {
            if (hero == null)
            {
                return;
            }
            SkillObject prostitutionSkill = CESkills.Prostitution;
            SkillObject prostitutionFlag  = CESkills.IsProstitute;

            if (updateFlag)
            {
                int currentLevel = hero.GetSkillValue(prostitutionFlag);

                if (amount == 0)
                {
                    if ((displayMessage || quickInformation) && currentLevel != 0)
                    {
                        TextObject textObject = GameTexts.FindText("str_CE_level_leave");
                        textObject.SetTextVariable("HERO", hero.Name);
                        textObject.SetTextVariable("OCCUPATION", prostitutionFlag.Name);
                        if (displayMessage)
                        {
                            InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), Colors.Green));
                        }

                        if (quickInformation)
                        {
                            InformationManager.AddQuickInformation(textObject, 0, hero.CharacterObject, "event:/ui/notification/relation");
                        }
                    }
                }
                else
                {
                    if ((displayMessage || quickInformation) && currentLevel != 1)
                    {
                        TextObject textObject = GameTexts.FindText("str_CE_level_enter");
                        textObject.SetTextVariable("HERO", hero.Name);
                        textObject.SetTextVariable("OCCUPATION", prostitutionFlag.Name);
                        if (displayMessage)
                        {
                            InformationManager.DisplayMessage(new InformationMessage(textObject.ToString(), Colors.Green));
                        }

                        if (quickInformation)
                        {
                            InformationManager.AddQuickInformation(textObject, 0, hero.CharacterObject, "event:/ui/notification/relation");
                        }
                    }
                }

                hero.SetSkillValue(prostitutionFlag, amount);
            }
            else
            {
                SetModifier(amount, hero, prostitutionSkill, prostitutionFlag, displayMessage, quickInformation);
            }
        }
        private TextObject GetMessengerArrivedText(IFaction faction1, IFaction faction2, Hero targetHero)
        {
            TextObject textObject = new TextObject("{=YnRmSele}The messenger from {FACTION1_NAME} has arrived at {HERO_NAME} of {FACTION2_NAME}.");

            textObject.SetTextVariable("FACTION1_NAME", faction1.Name.ToString());
            textObject.SetTextVariable("FACTION2_NAME", faction2.Name.ToString());
            textObject.SetTextVariable("HERO_NAME", targetHero.Name.ToString());
            return(textObject);
        }