Ejemplo n.º 1
0
        public static Settlement cultureSettlement(Hero hero)
        {
            //var result;
            string sCulture = hero.MapFaction.Culture.StringId;

            switch (sCulture)
            {
            case "sturgia":
                return(Settlement.Find("town_S2"));

            case "aserai":
                return(Settlement.Find("town_A8"));

            case "vlandia":
                return(Settlement.Find("town_V3"));

            case "battania":
                return(Settlement.Find("town_B2"));

            case "khuzait":
                return(Settlement.Find("town_K4"));

            default:
                return(Settlement.Find("town_ES3"));
            }
        }
Ejemplo n.º 2
0
        private void Cleanup()
        {
            foreach (var settlementId in _settlementRecruiterDataBySettlementId.Keys)
            {
                var settlement    = Settlement.Find(settlementId);
                var recruiterData = GetRecruiterDataAtSettlement(settlement);

                // check if settlement is still owned by player, set recruiter to level 0 if not
                if (settlement.OwnerClan != Clan.PlayerClan)
                {
                    if (recruiterData.HasRecruiter)
                    {
                        recruiterData.HasRecruiter                = false;
                        recruiterData.RecruiterLevel              = 0;
                        recruiterData.IsRecruiterEnabled          = false;
                        recruiterData.MaxPercentOfUnitsInGarrison = 50;
                        InformationManager.DisplayMessage(new InformationMessage($"{settlement.Name} is no longer in your hands. Your recruiter ran away."));
                    }
                }

                // this ensure that anyone with recruiter without level or limit (early version didn't have it) can use it properly
                if (recruiterData.HasRecruiter && recruiterData.RecruiterLevel == 0)
                {
                    recruiterData.RecruiterLevel              = 1;
                    recruiterData.IsRecruiterEnabled          = true;
                    recruiterData.MaxPercentOfUnitsInGarrison = 50;
                }
            }
        }
Ejemplo n.º 3
0
        private void OnRecruiterApplySameLimitToAllSettlements(Settlement limitSettlement)
        {
            var num   = 0;
            var limit = GetRecruiterDataAtSettlement(limitSettlement).MaxPercentOfUnitsInGarrison;

            foreach (var settlementId in _settlementRecruiterDataBySettlementId.Keys)
            {
                var settlement    = Settlement.Find(settlementId);
                var recruiterData = GetRecruiterDataAtSettlement(settlement);

                if (recruiterData.HasRecruiter)
                {
                    recruiterData.MaxPercentOfUnitsInGarrison = limit;
                    num++;
                }
            }

            if (num > 0)
            {
                InformationManager.DisplayMessage(new InformationMessage($"Recruiter limit successfully set to {limit}% in {num} settlements."));
            }
            else
            {
                InformationManager.DisplayMessage(new InformationMessage($"You have no settlements with recruiter."));
            }

            GameMenu.SwitchToMenu("recruiter");
        }
 private void UpdateBankData()
 {
     foreach (var settlementId in _settlementBankDataBySettlementId.Keys)
     {
         var settlement = Settlement.Find(settlementId);
         var bankData   = GetBankDataAtSettlement(settlement);
         var hasMonthPassedSinceLastBankDataUpdate = (CampaignTime.Now - bankData.LastBankUpdateDate).ToDays >= CampaignTime.DaysInSeason;
         if (hasMonthPassedSinceLastBankDataUpdate)
         {
             if (bankData.RemainingUnpaidLoan == 0)
             {
                 var oldInterestRate         = bankData.InterestRate;
                 var newInterestRate         = CalculateSettlementInterestRate(settlement);
                 var moneyGainedFromInterest = (int)(bankData.Balance * oldInterestRate);
                 bankData.Balance     += moneyGainedFromInterest;
                 bankData.InterestRate = newInterestRate;
                 InformationManager.DisplayMessage(new InformationMessage($"Your balance at the {settlement.Name} bank has gained {moneyGainedFromInterest}<img src=\"Icons\\Coin@2x\"> from interest.${(Mathf.Abs(newInterestRate - oldInterestRate) > 0.0001 ? $" Your interest rate has changed from {oldInterestRate:0.0000}% to {newInterestRate:0.0000}%." : string.Empty)}", "event:/ui/notification/coins_positive"));
             }
             bankData.LastBankUpdateDate = CampaignTime.Now;
         }
         if (IsLoanOverdueAtSettlement(settlement) && bankData.HasBankPerformedInitialRetaliationForUnpaidLoan && HasWeekElapsedSinceLastBankRetaliation(bankData))
         {
             ApplyRecurringBankRetaliationForUnpaidLoan(settlement);
         }
     }
 }
Ejemplo n.º 5
0
        public static void SetupKingdomParties(MBReadOnlyList <MobileParty> mobileParties)
        {
            if (mobileParties == null)
            {
                return;
            }

            Dictionary <string, MobileParty> existingParties = new Dictionary <string, MobileParty>();
            List <MobileParty> tempList = mobileParties.ToList();

            tempList.ForEach(p =>
            {
                // Campaign.Current.MobileParties can have some invalid entries, make sure only valid MobileParties get added for processing
                if (p.Leader?.Name != null && !existingParties.ContainsKey(p.Leader.Name.ToString()))
                {
                    existingParties.Add(p.Leader.Name.ToString(), p);
                }
            });

            if (existingParties.Count > 0 && KingdomConfigs.Any())
            {
                KingdomConfigs.ForEach(kC =>
                {
                    Dictionary <string, KingdomLocation> lordLocations = LoadLocationsForKingdomConfiguration(kC);
                    if (!lordLocations.IsEmpty() && lordLocations.Count > 0)
                    {
                        string[] names = new string[lordLocations.Count];
                        lordLocations.Keys.CopyTo(names, 0);
                        List <string> lordsToAdd = names.ToList();

                        lordsToAdd.ForEach(lord =>
                        {
                            if (existingParties.ContainsKey(lord))
                            {
                                MobileParty p = existingParties[lord];
                                if (p?.Leader?.Name != null)
                                {
                                    KingdomLocation location    = lordLocations[lord];
                                    Settlement targetSettlement = Settlement.Find(location.SettlementName);

                                    // Here we assign ownership of the targetSettlement to the KingdomLeaderId defined in config.xml
                                    if (p.Leader.StringId.Equals(kC.kingdomLeaderId))
                                    {
                                        TaleWorlds.CampaignSystem.Actions.ChangeOwnerOfSettlementAction.ApplyByDefault(p.LeaderHero, targetSettlement);
                                    }
                                    // Move the party's position, use the XOffset and YOffset from the relevant locations.xml
                                    p.Position2D = new Vec2(targetSettlement.Position2D.X + location.XOffset, targetSettlement.Position2D.Y + location.YOffset);
                                    // Make them patrol around their location
                                    p.SetMovePatrolAroundSettlement(targetSettlement);
                                }
                            }
                        });
                    }
                });
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        /// If the top culture is different than the current culture, it will be changed here
        /// </summary>
        void applyCulture()
        {
            Settlement    settlement = Settlement.Find(settlementId);
            CultureObject topCulture = getTopCulture();

            if (settlement.Culture.StringId != topCulture.StringId)
            {
                DynaCultureUtils.ChangeSettlementCulture(settlement, topCulture);
            }
        }
Ejemplo n.º 7
0
        private void AddScaHeroesToWorld(MBReadOnlyList <MobileParty> mobileParties)
        {
            if (mobileParties == null)
            {
                InformationManager.DisplayMessage(new InformationMessage("SCA3: mobileParties was null! Abandoning SCA3 party setup...", Color.FromUint(4278255360U)));
                return;
            }

            var parties = mobileParties.ToList();

            InformationManager.DisplayMessage(
                new InformationMessage($"SCA3: Mobile parties has {parties.Count } parties in it. Filtering for SCA heroes...", Color.FromUint(4278255360U)));

            foreach (var scaHero in _heroLocations)
            {
                InformationManager.DisplayMessage(
                    new InformationMessage($"SCA3: Looping through SCA hero list. We see { scaHero.HeroName}.", Color.FromUint(4278255360U)));

                try
                {
                    var party = parties
                                .Where(p => p.Leader?.Name != null && p.Leader.Name.ToString() == scaHero.HeroName)
                                .SingleOrDefault();

                    if (party == null)
                    {
                        InformationManager.DisplayMessage(
                            new InformationMessage($"SCA3: party lead by SCA hero '{scaHero.HeroName} ({scaHero.HeroId})' not found in mobileParties! Skipping hero.", Color.FromUint(4278255360U)));
                        continue;
                    }

                    InformationManager.DisplayMessage(
                        new InformationMessage($"SCA3: Found party lead by SCA hero {scaHero.HeroName}! (It is {party.Id})", Color.FromUint(4278255360U)));

                    var settlement = Settlement.Find(scaHero.SettlementId);
                    ChangeOwnerOfSettlementAction.ApplyByDefault(party.LeaderHero, settlement);
                    party.Position2D = new Vec2(
                        settlement.Position2D.X + scaHero.XOffset,
                        settlement.Position2D.Y + scaHero.YOffset);
                    party.SetMovePatrolAroundSettlement(settlement);
                }
                catch (Exception ex)
                {
                    InformationManager.DisplayMessage(
                        new InformationMessage($"SCA3: Error looping through hero locations on hero: {scaHero.HeroName}! Message: {ex.Message}"));
                }
            }
        }
Ejemplo n.º 8
0
        private void SetPlayerStartingConditions()
        {
            string PlayerCulture = Hero.MainHero.Culture.Name.ToString();

            DebugConsole.Log(this, "Player culture is: " + PlayerCulture);
            switch (PlayerCulture)
            {
            case "Vlandia":
                ChangeOwnerOfSettlementAction.ApplyByDefault(Hero.MainHero, Settlement.Find("town_V7"));
                DebugConsole.Log(this, "Giving player city Charas town_V7");
                break;

            case "Sturgia":
                ChangeOwnerOfSettlementAction.ApplyByDefault(Hero.MainHero, Settlement.Find("town_S5"));
                DebugConsole.Log(this, "Giving player city Tyal town_S5");
                break;

            case "Empire":
                ChangeOwnerOfSettlementAction.ApplyByDefault(Hero.MainHero, Settlement.Find("town_ES4"));
                DebugConsole.Log(this, "Giving player city Lycaron town_ES4");
                break;

            case "Aserai":
                ChangeOwnerOfSettlementAction.ApplyByDefault(Hero.MainHero, Settlement.Find("town_A3"));
                DebugConsole.Log(this, "Giving player city Iyakis town_A3");
                break;

            case "Khuzait":
                ChangeOwnerOfSettlementAction.ApplyByDefault(Hero.MainHero, Settlement.Find("town_K2"));
                DebugConsole.Log(this, "Giving player city Akkalat town_K2");
                break;

            case "Battania":
                ChangeOwnerOfSettlementAction.ApplyByDefault(Hero.MainHero, Settlement.Find("town_B4"));
                DebugConsole.Log(this, "Giving player city Seonon town_B4");
                break;

            default:
                DebugConsole.Log(this, "Default");
                break;
            }
            InformationManager.DisplayMessage(new InformationMessage("Your Clan's benefactors supplied you with some money to aid in completing your mission", TaleWorlds.Library.Color.White, ""));
            Hero.MainHero.ChangeHeroGold(30000);
        }
Ejemplo n.º 9
0
        private static void SetCameraToSettlement(string stringID)
        {
            try
            {
                Log($"SetCameraToSettlement({stringID})");
                CloseAnyOpenWindows();

#if !OneFourThree
                MapScreen.Instance.FastMoveCameraToPosition(Settlement.Find(stringID).Position2D);
#else
                MapScreen.Instance.SetMapCameraPosition(Settlement.Find(stringID).Position2D);
#endif
                Traverse.Create(MapScreen.Instance).Method("UpdateMapCamera").GetValue();
            }
            catch (Exception ex)
            {
                Log(ex);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        /// On campaign start, if there was no CultureConfig.dat, lookups need to be initialized
        /// </summary>
        public void OnCampaignLoad()
        {
            _cachedCultures = new Dictionary <string, CultureObject>();

            // There was no current influence stored in the save file
            if (CurrentInfluences == null)
            {
                Settlement settlement = Settlement.Find(settlementId);

                CurrentInfluences = new Dictionary <string, decimal>();
                CurrentInfluences.Add(settlement.Culture.StringId, 1m);
            }

            // there was no target influence stored in the save file
            if (TargetInfluences == null)
            {
                TargetInfluences = new Dictionary <string, decimal>();
                RecalculateInfluencers(true);
            }
        }
Ejemplo n.º 11
0
        public static Vec2 GetSettlementLoc() //This is to get the vector of a HC settlement...Possible Todo Home town
        {
            Vec2       sresult;
            Settlement settlement;
            string     sCulture = Hero.MainHero.MapFaction.Culture.StringId;

            switch (sCulture)
            {
            case "sturgia":
                settlement = Settlement.Find("town_S2");
                sresult    = settlement.GatePosition;
                break;

            case "aserai":
                settlement = Settlement.Find("town_A8");
                sresult    = settlement.GatePosition;
                break;

            case "vlandia":
                settlement = Settlement.Find("town_V3");
                sresult    = settlement.GatePosition;
                break;

            case "battania":
                settlement = Settlement.Find("town_B2");
                sresult    = settlement.GatePosition;
                break;

            case "khuzait":
                settlement = Settlement.Find("town_K4");
                sresult    = settlement.GatePosition;
                break;

            default:
                settlement = Settlement.Find("tutorial_training_field");
                sresult    = settlement.GatePosition;
                break;
            }
            return(sresult);
        }
        /// <summary>
        /// On campaign start, if there was no CultureConfig.dat, lookups need to be initialized
        /// </summary>
        public void OnCampaignLoad()
        {
            // There was no current influence stored in the save file
            if (CurrentInfluences == null)
            {
                Settlement settlement = Settlement.Find(settlementId);
                if (settlement.Name.ToString() == "Thractorae Castle")
                {
                    int u = 0;
                }

                CurrentInfluences = new Dictionary <string, decimal>();
                CurrentInfluences.Add(settlement.Culture.StringId, 1m);
            }

            // there was no target influence stored in the save file
            if (TargetInfluences == null)
            {
                TargetInfluences = new Dictionary <string, decimal>();
                RecalculateInfluencers(true);
            }
        }
Ejemplo n.º 13
0
        public static Settlement CSOptionSettlement()
        {
            int opt = CSCharCreationOption.CSLocationOption;

            switch (opt)
            {
            case 0:
                return(CSCharCreationOption.cultureSettlement(Hero.MainHero));

            case 1:
                return(CSCharCreationOption.RandcultureSettlement());

            case 2:
                return(Settlement.Find("town_A8"));

            case 3:
                return(Settlement.Find("town_B2"));

            case 4:
                return(Settlement.Find("town_EW2"));

            case 5:
                return(Settlement.Find("town_S2"));

            case 6:
                return(Settlement.Find("town_K4"));

            case 7:
                return(Settlement.Find("town_V3"));

            case 8:
                return(CSCharCreationOption.cultureSettlement(Hero.MainHero));

            default:
                return(Settlement.Find("tutorial_training_field"));
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Recalculate influence based on campaign circumstances and save it as "TargetInfluence"
        /// </summary>
        /// <param name="firstTimeSetup"></param>
        /// <returns></returns>
        int recalculateInfluencers(bool firstTimeSetup)
        {
            Settlement settlement = Settlement.Find(settlementId);

            // foreach nearby settlement, sum up the influence of each culture type
            List <Settlement> influencingSettlements = new List <Settlement>();

            // Geographically close settlements
            influencingSettlements.AddRange(Settlement.FindSettlementsAroundPosition(settlement.Position2D, DynaCultureSettings.Instance.SettlementInfluenceRange).Where(x => x.IsVillage || x.IsCastle || x.IsTown));

            if (DynaCultureSettings.Instance.TradeLinkedInfluence)
            {
                // Trade-linked settlements
                if (settlement.IsCastle || settlement.IsTown)
                {
                    influencingSettlements.AddRange(settlement.BoundVillages.Select(v => v.Settlement));
                }

                // Parent's Trade-linked settlements
                if (settlement.IsVillage)
                {
                    influencingSettlements.AddRange(Settlement.FindFirst(s => s.BoundVillages.Contains(settlement.Village)).BoundVillages.Select(v => v.Settlement));
                }
            }

            // calculate the influence caused by our neighbors
            int sum = 0;
            Dictionary <CultureObject, int> influencers = new Dictionary <CultureObject, int>();

            foreach (var otherSettlement in influencingSettlements)
            {
                int influence = getInfluenceFromSettlement(otherSettlement, settlement, firstTimeSetup);
                sum += influence;

                if (!influencers.ContainsKey(otherSettlement.Culture))
                {
                    influencers.Add(otherSettlement.Culture, influence);
                }
                else
                {
                    influencers[otherSettlement.Culture] += influence;
                }
            }

            // calculate the influence caused by our owners
            int ownerInfluence = BASE_INFLUENCE * DynaCultureSettings.Instance.OwnerInfluenceStrength;

            sum += ownerInfluence;

            if (ownerInfluence > 0)
            {
                var ownerCulture = DynaCultureUtils.GetOwnerCulture(settlement);

                if (!influencers.ContainsKey(ownerCulture))
                {
                    influencers.Add(ownerCulture, ownerInfluence);
                }
                else
                {
                    influencers[ownerCulture] += ownerInfluence;
                }
            }

            // foreach influencing culture, calculate the percent of total influence
            bool didTargetsChange = false;

            foreach (var pair in influencers)
            {
                CultureObject culture = pair.Key;
                decimal       percent = (decimal)pair.Value / sum;

                if (!TargetInfluences.ContainsKey(culture.StringId))
                {
                    TargetInfluences.Add(culture.StringId, percent);
                    didTargetsChange = true;
                }
                else if (percent != TargetInfluences[culture.StringId])
                {
                    TargetInfluences[culture.StringId] = percent;
                    didTargetsChange = true;
                }
            }

            // clear out no longer influencing cultures
            for (int x = 0; x < TargetInfluences.Count; x++)
            {
                if (!influencers.Select(c => c.Key.StringId).Contains(TargetInfluences.ElementAt(x).Key))
                {
                    TargetInfluences[TargetInfluences.ElementAt(x).Key] = 0m;
                }
            }

            if (didTargetsChange)
            {
                TargetInfluencesIDKey++;
            }

            return(sum);
        }
        /// <summary>
        /// Every day this settlement will progress its CurrentInfluence towards its TargetInfluence
        /// </summary>
        public void OnDailyTick()
        {
            int influenceSum = RecalculateInfluencers(false);

            Settlement settlementtst = Settlement.Find(settlementId);

            if (settlementtst.Name.ToString() == "Lochana Castle")
            {
                int u = 0;
            }

            if (Settings.Instance.AssimilationDelay != 0)
            {
                // detect if there were ownership changes around us
                if (expectedIDKey != TargetInfluencesIDKey)
                {
                    daysSinceTargetsChanged = 0;
                    expectedIDKey           = TargetInfluencesIDKey;
                }
                else
                {
                    daysSinceTargetsChanged++;
                }

                // each day we will move 1/[setting] of the way towards the target
                decimal assimilationRate = Math.Min((decimal)influenceSum / Settings.Instance.AssimilationDelay, 1);

                // Iterate each pressuring influence
                foreach (var targetInfluence in TargetInfluences)
                {
                    // If we already have some of that culture
                    if (CurrentInfluences.ContainsKey(targetInfluence.Key))
                    {
                        // today we will shift this culture by (difference) * (rate)
                        decimal assimilationDelta = (targetInfluence.Value - CurrentInfluences[targetInfluence.Key]) * assimilationRate;

                        CurrentInfluences[targetInfluence.Key] += assimilationDelta;
                    }
                    else
                    {
                        // Today we will shift this culture by (target) * (rate)
                        decimal assimilationDelta = targetInfluence.Value * assimilationRate;

                        // Always add a previously nonexistant culture
                        CurrentInfluences.Add(targetInfluence.Key, assimilationDelta);
                    }
                }

                // Clear out no-influence cultures
                for (int x = 0; x < CurrentInfluences.Count; x++)
                {
                    var currentInfluence = CurrentInfluences.ElementAt(x);
                    if (currentInfluence.Value < 0)
                    {
                        CurrentInfluences.Remove(CurrentInfluences.ElementAt(x).Key);
                        x--;
                    }
                }
            }
            else
            {
                CurrentInfluences = TargetInfluences;
            }

            applyCulture();
        }
Ejemplo n.º 16
0
        private void UpdateRecruiter()
        {
            Cleanup();

            var message = "- ";

            InformationManager.DisplayMessage(new InformationMessage("Recruiter Garrison Report:"));

            var shouldAddSeparator = false;
            var totalNewRecruits   = 0;

            foreach (var settlementId in _settlementRecruiterDataBySettlementId.Keys)
            {
                var settlement    = Settlement.Find(settlementId);
                var recruiterData = GetRecruiterDataAtSettlement(settlement);

                if (recruiterData.HasRecruiter && recruiterData.IsRecruiterEnabled)
                {
                    // if there is no party, make one
                    if (settlement.Town.GarrisonParty == null)
                    {
                        settlement.AddGarrisonParty();
                    }

                    // get number of troops to be recruited
                    var count = GetRecruitsPerDayAtSettlement(settlement);
                    var currentGarrisonCount = settlement.Town.GarrisonParty?.Party.NumberOfAllMembers ?? 0;
                    var maxGarrisonCount     = settlement.Town.GarrisonParty?.Party.PartySizeLimit ?? 0;

                    // make sure we don't recruit over the limit
                    if (currentGarrisonCount + count >= maxGarrisonCount)
                    {
                        count = maxGarrisonCount - currentGarrisonCount;
                    }

                    // make sure we don't recruit over the limit based on garrison max count and user's limit in %
                    var maxGarrisonCountByPlayerLimit =
                        Math.Round((double)recruiterData.MaxPercentOfUnitsInGarrison / 100 * (double)maxGarrisonCount);
                    if (currentGarrisonCount + count >= maxGarrisonCountByPlayerLimit)
                    {
                        count = 0; // do not add any units
                    }

                    // add information to log message (only if there is a change)
                    if (count > 0)
                    {
                        totalNewRecruits += count;
                        if (shouldAddSeparator)
                        {
                            message += ", ";
                        }
                        shouldAddSeparator = true;

                        message += $"{settlement.Name} (+{count})";
                    }

                    // add roster to garrison
                    if (settlement.Town.GarrisonParty != null)
                    {
                        settlement.Town.GarrisonParty.AddElementToMemberRoster(settlement.Culture.BasicTroop, count,
                                                                               false);
                    }
                }
            }

            // if there are no new recruits, tell player
            if (totalNewRecruits == 0)
            {
                InformationManager.DisplayMessage(new InformationMessage("- No new recruits today"));
                return;
            }
            else
            {
                InformationManager.DisplayMessage(new InformationMessage($"- Total: {totalNewRecruits} new recruits"));
            }

            // log message (only if there are any settlements)
            if (_settlementRecruiterDataBySettlementId.Count > 0)
            {
                InformationManager.DisplayMessage(new InformationMessage($"{message}"));
            }
        }
Ejemplo n.º 17
0
        public void DebugCulture(MobileParty party, Settlement settlement, Hero hero)
        {
            try
            {
                if (party == null || settlement == null || hero == null || !party.IsMainParty)
                {
                    return;
                }

                var pair = ChangeCultureManager.Instance.InfluenceMap[settlement.StringId];

                string msg  = $"Settlement: {settlement.Name} \nCulture: {settlement.Culture.Name}";
                string msg2 = "";

                foreach (var pair2 in ChangeCultureManager.Instance.InfluenceMap)
                {
                    var smnt = Settlement.Find(pair2.Key);
                    msg2 += pair2.Key.ToString() + " (" + smnt.Name + "), " + pair2.Value.TargetInfluences.Count
                            + "(Currently: " + smnt.Culture.Name + ", Originally: " + pair2.Value.homelandCultureId + ", Owned by: " + (smnt.OwnerClan.Kingdom == null ? smnt.OwnerClan.Culture.Name.ToString() : smnt.OwnerClan.Kingdom.Culture.Name.ToString()) + ")" + "\n";
                    msg2 += "Target Influences:\n";
                    foreach (var inf in pair2.Value.TargetInfluences)
                    {
                        decimal currentinf;
                        if (!pair2.Value.CurrentInfluences.TryGetValue(inf.Key, out currentinf))
                        {
                            currentinf = 0m;
                        }
                        msg2 += inf.Key + ", " + currentinf + " => " + inf.Value.ToString() + " | Days Since change: " + pair2.Value.daysSinceTargetsChanged + " | CurrentID: " + pair2.Value.expectedIDKey + " | TargetID: " + pair2.Value.TargetInfluencesIDKey + "\n";
                    }
                    msg2 += "Current Influences:\n";
                    foreach (var inf in pair2.Value.CurrentInfluences)
                    {
                        decimal targetinf;
                        if (!pair2.Value.TargetInfluences.TryGetValue(inf.Key, out targetinf))
                        {
                            targetinf = 0m;
                        }
                        msg2 += inf.Key + ", " + inf.Value.ToString() + " => " + targetinf + " | Days Since change: " + pair2.Value.daysSinceTargetsChanged + " | CurrentID: " + pair2.Value.expectedIDKey + " | TargetID: " + pair2.Value.TargetInfluencesIDKey + "\n";
                    }
                    msg2 += "\n";
                }
                string file  = $@"C:\Users\{Environment.UserName}\Desktop\debug.txt";
                string file2 = $@"C:\Users\{Environment.UserName}\Desktop\debugPrevious.txt";
                if (System.IO.File.Exists(file))
                {
                    if (System.IO.File.Exists(file2))
                    {
                        System.IO.File.Delete(file2);
                    }

                    System.IO.File.Copy(file, file2);
                    System.IO.File.Delete(file);
                }

                System.IO.File.WriteAllText(file, msg2);

                //System.Windows.Forms.MessageBox.Show(msg);
            }
            catch (Exception ex)
            {
            }
        }
Ejemplo n.º 18
0
 private Settlement getSelf()
 {
     return(Settlement.Find(this.settlementID));
 }
Ejemplo n.º 19
0
 public Settlement getSelf()
 {
     return(Settlement.Find(this.settlementID));
 }
 private Settlement GetSelf()
 {
     return(Settlement.Find(SettlementId));
 }