private void HandleDeathMessage(MobileParty mb, CSPartyData dynamicData)
 {
     if (dynamicData.spawnBaseData.deathMessage != null)
     {
         UX.ShowParseDeathMessage(dynamicData.spawnBaseData.deathMessage, dynamicData.latestClosestSettlement.ToString());
     }
 }
Example #2
0
        protected override void Initialize()
        {
            base.Initialize();
            this.spriteBatch  = new SpriteBatch(this.GraphicsDevice);
            this.Window.Title = "Paladin Rescue Team";

            Resolution resolution = Utilities.GetSupportedResolutions().Last();


            // Init call mandated by Auxiliary library.
            Root.Init(this, this.spriteBatch, this.graphics, resolution);
            Root.BeforeLastDraw = () =>
            {
                UX.Clear();
                Tooltip.Clear();
            };
            Writer.SpriteBatch = this.spriteBatch;


            if (this.ImmediatelyFullscreenize)
            {
                Root.SetResolution(Utilities.GetSupportedResolutions().FindLast(m => true));
                Root.IsFullscreen = true;
            }


            Assets.LoadAll(Content);
            SFX.Load(Content);



            Primitives.Fonts.Add(FontFamily.Small,
                                 new FontGroup(Assets.FontLittle, Assets.FontLittleItalic, Assets.FontLittleBold,
                                               Assets.FontLittleBoldItalic));
            Primitives.Fonts.Add(FontFamily.Normal,
                                 new FontGroup(Assets.FontNormal, Assets.FontNormal, Assets.FontNormalBold, Assets.FontNormalBold));
            Primitives.Fonts.Add(FontFamily.Big,
                                 new FontGroup(Assets.FontBig, Assets.FontBig, Assets.FontBigBold, Assets.FontBigBold));


            // Make the buttons orange.
            GuiSkin mainSkin = GuiSkin.DefaultSkin;

            mainSkin.Font = Assets.FontNormal;
            mainSkin.InnerBorderThickness         = 1;
            mainSkin.OuterBorderThickness         = 1;
            mainSkin.GreyBackgroundColor          = Color.DarkOrange;
            mainSkin.GreyBackgroundColorMouseOver = Color.Orange;
            mainSkin.InnerBorderColor             = Color.Red;
            mainSkin.InnerBorderColorMouseOver    = Color.Red;
            mainSkin.InnerBorderColorMousePressed = Color.DarkRed;

            Root.Display_DisplayFpsCounter      = false;
            Root.Display_DisplayFpsCounterWhere = new Vector2(5, 55);
            // Go to main menu.
            Root.PushPhase(new MainMenuPhase());
        }
Example #3
0
        private void RemoveEverything()
        {
            List <MobileParty> toBeRemoved = new List <MobileParty>();

            foreach (MobileParty mb in MobileParty.All)
            {
                if (mb.StringId.StartsWith("cs"))
                {
                    //one of our parties.
                    toBeRemoved.Add(mb);
                }
                else
                {
                    //party will still exist but could still contain our troops or prisoners
                    List <CharacterObject> charObjectsToBeRemoved = new List <CharacterObject>();

                    foreach (var t in mb.MemberRoster.GetTroopRoster())
                    {
                        if (t.Character.StringId.StartsWith("cs_"))
                        {
                            charObjectsToBeRemoved.Add(t.Character);
                        }
                    }
                    for (int i = 0; i < charObjectsToBeRemoved.Count; i++)
                    {
                        mb.MemberRoster.RemoveTroop(charObjectsToBeRemoved[i], mb.MemberRoster.GetTroopCount(charObjectsToBeRemoved[i]));
                    }
                    //now do it for prisoners
                    charObjectsToBeRemoved.Clear();
                    foreach (var t in mb.PrisonRoster.GetTroopRoster())
                    {
                        if (t.Character.StringId.StartsWith("cs_"))
                        {
                            charObjectsToBeRemoved.Add(t.Character);
                        }
                    }
                    for (int i = 0; i < charObjectsToBeRemoved.Count; i++)
                    {
                        mb.PrisonRoster.RemoveTroop(charObjectsToBeRemoved[i], mb.PrisonRoster.GetTroopCount(charObjectsToBeRemoved[i]));
                    }
                }
            }
            for (int i = 0; i < toBeRemoved.Count; i++)
            {
                if (toBeRemoved[i].Party.MapEvent != null)
                {
                    UX.ShowMessage("CustomSpawns: the party " + toBeRemoved[i].StringId + " is currently engaged at a map event and thus cannot be removed until this event is completed.", Color.ConvertStringToColor("#001FFFFF"));
                    removed = false;
                }
                UX.ShowMessage("CustomSpawns: removing " + toBeRemoved[i].StringId, Color.ConvertStringToColor("#001FFFFF"));
                toBeRemoved[i].RemoveParty();
            }
            if (removed)
            {
                UX.ShowMessage("CustomSpawns is now safe to remove from your game.", Color.ConvertStringToColor("#001FFFFF"));
            }
        }
Example #4
0
        public SettingsForm(UX.Data.Configuration.Application applicationConfiguration, MultiMiner.Engine.Data.Configuration.Xgminer minerConfiguration,
            Paths pathConfiguration, Perks perksConfiguration)
        {
            InitializeComponent();

            this.minerConfiguration = minerConfiguration;
            this.applicationConfiguration = applicationConfiguration;
            this.pathConfiguration = pathConfiguration;
            this.perksConfiguration = perksConfiguration;
        }
Example #5
0
 protected override void Draw(GameTime gameTime)
 {
     // Auxiliary handles all drawing.
     this.GraphicsDevice.Clear(Color.CornflowerBlue);
     Tooltip.Clear();
     UX.Clear();
     this.spriteBatch.Begin();
     Root.DrawPhase(gameTime);
     Tooltip.DrawTooltipReally();
     Root.DrawOverlay(gameTime);
     this.spriteBatch.End();
     base.Draw(gameTime);
 }
Example #6
0
        private void RegularBanditSpawn()
        {
            try
            {
                var    list = dataManager.Data;
                Random rand = new Random();
                foreach (Data.SpawnData data in list)
                {
                    int j = 0;
                    for (int i = 0; i < data.RepeatSpawnRolls; i++)
                    {
                        if (data.CanSpawn() && (data.MinimumNumberOfDaysUntilSpawn < (int)Math.Ceiling(Campaign.Current.CampaignStartTime.ElapsedDaysUntilNow)))
                        {
                            if (ConfigLoader.Instance.Config.IsAllSpawnMode || (float)rand.NextDouble() < data.ChanceOfSpawn)
                            {
                                var spawnSettlement = Spawner.GetSpawnSettlement(data, rand);
                                //spawn nao!
                                MobileParty spawnedParty = Spawner.SpawnParty(spawnSettlement, data.SpawnClan, data.PartyTemplate, data.PartyType, new TextObject(data.Name));
                                data.IncrementNumberSpawned(); //increment for can spawn and chance modifications
                                //dynamic data registration
                                DynamicSpawnData.AddDynamicSpawnData(spawnedParty, new CSPartyData(data, spawnSettlement));

                                j++;
                                //AI Checks!
                                Spawner.HandleAIChecks(spawnedParty, data, spawnSettlement);
                                //accompanying spawns
                                foreach (var accomp in data.SpawnAlongWith)
                                {
                                    MobileParty juniorParty = Spawner.SpawnParty(spawnSettlement, data.SpawnClan, accomp.templateObject, data.PartyType, new TextObject(accomp.name));
                                    Spawner.HandleAIChecks(juniorParty, data, spawnSettlement); //junior party has same AI behaviour as main party. TODO in future add some junior party AI and reconstruction.
                                }
                                //message if available
                                if (data.spawnMessage != null)
                                {
                                    UX.ShowParseSpawnMessage(data.spawnMessage, spawnSettlement.Name.ToString());
                                }
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                ErrorHandler.HandleException(e);
            }
        }
 public GPUMinerSettingsForm(Engine.Data.Configuration.Xgminer minerConfiguration,
     UX.Data.Configuration.Application applicationConfiguration)
 {
     InitializeComponent();
     this.minerConfiguration = minerConfiguration;
     this.workingMinerConfiguration = ObjectCopier.CloneObject<Engine.Data.Configuration.Xgminer, Engine.Data.Configuration.Xgminer>(minerConfiguration);
     this.applicationConfiguration = applicationConfiguration;
     this.workingApplicationConfiguration = ObjectCopier.CloneObject<UX.Data.Configuration.Application, UX.Data.Configuration.Application>(applicationConfiguration);
     
     //manual clone needed
     this.workingMinerConfiguration.AlgorithmMiners = new SerializableDictionary<string, string>();
     foreach (string key in this.minerConfiguration.AlgorithmMiners.Keys)
         this.workingMinerConfiguration.AlgorithmMiners[key] = this.minerConfiguration.AlgorithmMiners[key];
 }
Example #8
0
        public PoolsForm(List<Engine.Data.Configuration.Coin> coinConfigurations, List<PoolGroup> knownCoins,
            UX.Data.Configuration.Application applicationConfiguration, UX.Data.Configuration.Perks perksConfiguration)
        {
            this.configurations = coinConfigurations;
            this.knownCoins = knownCoins;

            InitializeComponent();

            saveToRemotingCheckBox.Visible = false;
            if (perksConfiguration.PerksEnabled && perksConfiguration.EnableRemoting)
            {
                saveToRemotingCheckBox.Visible = true;
                this.applicationBindingSource.DataSource = applicationConfiguration;
            }
        }
Example #9
0
 public LayoutManager(UX.UxBase ux)
 {
     initializeProperties(null, ux);
 }
Example #10
0
        private void ConstructListFromXML(string filePath)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(filePath);
            try
            {
                foreach (XmlNode node in doc.DocumentElement)
                {
                    if (node.NodeType == XmlNodeType.Comment)
                    {
                        continue;
                    }

                    SpawnData dat = new SpawnData();

                    dat.PartyTemplate = (PartyTemplateObject)MBObjectManager.Instance.ReadObjectReferenceFromXml("party_template", typeof(PartyTemplateObject), node);
                    if (node.Attributes["spawn_clan"] == null)
                    {
                        dat.SpawnClan = (Clan)MBObjectManager.Instance.ReadObjectReferenceFromXml("bandit_clan", typeof(Clan), node);
                    }
                    else
                    {
                        dat.SpawnClan = (Clan)MBObjectManager.Instance.ReadObjectReferenceFromXml("spawn_clan", typeof(Clan), node);
                    }

                    //have bannerlord read attributes

                    int    i = 0;
                    string s = "overriden_spawn_clan";
                    while (true)
                    {
                        string s1 = s + "_" + i.ToString();
                        if (node.Attributes[s1] == null || node.Attributes[s1].InnerText == "")
                        {
                            break;
                        }
                        else
                        {
                            dat.OverridenSpawnClan.Add((Clan)MBObjectManager.Instance.ReadObjectReferenceFromXml(s1, typeof(Clan), node));
                        }
                        i++;
                    }

                    int    j  = 0;
                    string st = "overriden_spawn_culture";
                    while (true)
                    {
                        string s1 = st + "_" + j.ToString();
                        if (node.Attributes[s1] == null || node.Attributes[s1].InnerText == "")
                        {
                            break;
                        }
                        else
                        {
                            dat.OverridenSpawnCultures.Add(((CultureObject)MBObjectManager.Instance.ReadObjectReferenceFromXml(s1, typeof(CultureObject), node)).GetCultureCode());
                        }
                        j++;
                    }

                    j  = 0;
                    st = "overriden_spawn_settlement";
                    while (true)
                    {
                        string s1 = st + "_" + j.ToString();
                        if (node.Attributes[s1] == null || node.Attributes[s1].InnerText == "")
                        {
                            break;
                        }
                        else
                        {
                            dat.OverridenSpawnSettlements.Add(((Settlement)MBObjectManager.Instance.ReadObjectReferenceFromXml(s1, typeof(Settlement), node)));
                        }
                        j++;
                    }

                    //get elements
                    dat.MaximumOnMap = node["MaximumOnMap"] == null? 0 : int.Parse(node["MaximumOnMap"].InnerText);
                    if (dat.MaximumOnMap < 1)
                    {
                        throw new Exception("the node 'MaximumOnMap' cannot be less than 1!");
                    }

                    dat.PartyType             = node["PartyType"] == null ? MobileParty.PartyTypeEnum.Bandit : StringToPartyTypeEnumIfInvalidBandit(node["PartyType"].InnerText);
                    dat.ChanceOfSpawn         = node["ChanceOfSpawn"] == null? 1 : float.Parse(node["ChanceOfSpawn"].InnerText);
                    dat.Name                  = node["Name"] == null ? "Unnamed" : node["Name"].InnerText;
                    dat.ChanceInverseConstant = node["ChanceInverseConstant"] == null? 0 : float.Parse(node["ChanceInverseConstant"].InnerText);
                    dat.RepeatSpawnRolls      = node["RepeatSpawnRolls"] == null? 1 : int.Parse(node["RepeatSpawnRolls"].InnerText);

                    dat.PatrolAroundSpawn             = node["PatrolAroundSpawn"] == null ? false : bool.Parse(node["PatrolAroundSpawn"].InnerText);
                    dat.MinimumNumberOfDaysUntilSpawn = node["MinimumNumberOfDaysUntilSpawn"] == null ? -1 : int.Parse(node["MinimumNumberOfDaysUntilSpawn"].InnerText);

                    dat.AttackClosestIfIdleForADay = node["AttackClosestIfIdleForADay"] == null ? true : bool.Parse(node["AttackClosestIfIdleForADay"].InnerText);

                    //try spawn at list creation
                    if (node["TrySpawnAt"] != null && node["TrySpawnAt"].InnerText != "")
                    {
                        dat.TrySpawnAtList = ConstructTrySettlementList(node["TrySpawnAt"].InnerText);
                    }

                    //message
                    string msg   = node["SpawnMessage"] == null? "" : node["SpawnMessage"].InnerText;
                    string color = node["SpawnMessageColor"] == null ? "" : node["SpawnMessageColor"].InnerText;

                    if (msg != "")
                    {
                        if (color == "")
                        {
                            dat.spawnMessage = new InformationMessage(msg, Color.Black);
                        }
                        else
                        {
                            Color c = UX.GetMessageColour(color) == "" ? (color[0] == '#'? Color.ConvertStringToColor(color) : Color.Black) : Color.ConvertStringToColor(UX.GetMessageColour(color));
                            dat.spawnMessage = new InformationMessage(msg, c);
                        }
                    }
                    //handle extra linear speed.
                    float extraSpeed = float.MinValue;
                    if (node["ExtraLinearSpeed"] != null)
                    {
                        if (!float.TryParse(node["ExtraLinearSpeed"].InnerText, out extraSpeed))
                        {
                            throw new Exception("ExtraLinearSpeed must be a float value! ");
                        }
                        Main.customSpeedModel.RegisterPartyExtraSpeed(dat.PartyTemplate.StringId, extraSpeed);
                    }

                    //handle base speed override
                    float baseSpeedOverride = float.MinValue;
                    if (node["BaseSpeedOverride"] != null)
                    {
                        if (!float.TryParse(node["BaseSpeedOverride"].InnerText, out baseSpeedOverride))
                        {
                            throw new Exception("BaseSpeedOverride must be a float value! ");
                        }
                        Main.customSpeedModel.RegisterPartyBaseSpeed(dat.PartyTemplate.StringId, baseSpeedOverride);
                    }
                    else
                    {
                        Main.customSpeedModel.RegisterPartyBaseSpeed(dat.PartyTemplate.StringId, float.MinValue);
                    }

                    //patrol around closest lest interrupted and switch
                    if (node["PatrolAroundClosestLestInterruptedAndSwitch"] != null)
                    {
                        bool val = false;
                        if (!bool.TryParse(node["PatrolAroundClosestLestInterruptedAndSwitch"].InnerText, out val))
                        {
                            break;
                        }
                        if (!val)
                        {
                            break;
                        }
                        XmlNode innerNode = node["PatrolAroundClosestLestInterruptedAndSwitch"];
                        float   minDays   = 0;
                        float   maxDays   = 10;
                        List <SpawnSettlementType> TryPatrolAround = new List <SpawnSettlementType>();
                        try
                        {
                            if (!float.TryParse(innerNode.Attributes["min_stable_days"].InnerText, out minDays))
                            {
                                throw new Exception("min_stable_days must be a float value!");
                            }
                            if (!float.TryParse(innerNode.Attributes["max_stable_days"].InnerText, out maxDays))
                            {
                                throw new Exception("max_stable_days must be a float value!");
                            }
                            if (innerNode.Attributes["try_patrol_around"] != null && innerNode.Attributes["try_patrol_around"].InnerText != "")
                            {
                                TryPatrolAround = ConstructTrySettlementList(innerNode.Attributes["try_patrol_around"].InnerText);
                            }
                        }catch
                        {
                            throw new Exception("not all attributes in PatrolAroundClosestLestInterruptedAndSwitch were filled properly!");
                        }
                        dat.PatrolAroundClosestLestInterruptedAndSwitch =
                            new AI.PatrolAroundClosestLestInterruptedAndSwitchBehaviour.PatrolAroundClosestLestInterruptedAndSwitchBehaviourData(null, minDays, maxDays, TryPatrolAround);
                    }

                    //min max party speed modifiers
                    float minSpeed = float.MinValue;
                    if (node["MinimumFinalSpeed"] != null)
                    {
                        if (!float.TryParse(node["MinimumFinalSpeed"].InnerText, out minSpeed))
                        {
                            throw new Exception("MinimumFinalSpeed must be a float value! ");
                        }
                        Main.customSpeedModel.RegisterPartyMinimumSpeed(dat.PartyTemplate.StringId, minSpeed);
                    }

                    float maxSpeed = float.MinValue;
                    if (node["MaximumFinalSpeed"] != null)
                    {
                        if (!float.TryParse(node["MaximumFinalSpeed"].InnerText, out maxSpeed))
                        {
                            throw new Exception("MaximumFinalSpeed must be a float value! ");
                        }
                        Main.customSpeedModel.RegisterPartyMaximumSpeed(dat.PartyTemplate.StringId, maxSpeed);
                    }

                    //Spawn along with
                    int    k   = 0;
                    string str = "spawn_along_with";
                    while (true)
                    {
                        string s1 = str + "_" + k.ToString();
                        if (node.Attributes[s1] == null || node.Attributes[s1].InnerText == "")
                        {
                            break;
                        }
                        else
                        {
                            PartyTemplateObject pt = (PartyTemplateObject)MBObjectManager.Instance.ReadObjectReferenceFromXml(s1, typeof(PartyTemplateObject), node);
                            dat.SpawnAlongWith.Add(new AccompanyingParty(pt, NameSignifierData.Instance.GetPartyNameFromID(pt.StringId),
                                                                         NameSignifierData.Instance.GetPartyFollowBehaviourFlagFromID(pt.StringId)));
                            Main.customSpeedModel.RegisterPartyExtraSpeed(pt.StringId, NameSignifierData.Instance.GetSpeedModifierFromID(pt.StringId));
                            Main.customSpeedModel.RegisterPartyBaseSpeed(pt.StringId, NameSignifierData.Instance.GetBaseSpeedModifierOverrideFromID(pt.StringId));
                            if (minSpeed != float.MinValue)
                            {
                                Main.customSpeedModel.RegisterPartyMinimumSpeed(pt.StringId, minSpeed);
                            }
                            if (maxSpeed != float.MinValue)
                            {
                                Main.customSpeedModel.RegisterPartyMaximumSpeed(pt.StringId, maxSpeed);
                            }
                        }
                        k++;
                    }

                    data.Add(dat);
                    if (!partyIDtoData.ContainsKey(dat.PartyTemplate.StringId)) //TODO add way to alert modder that he should use one party template for one AI
                    {
                        partyIDtoData.Add(dat.PartyTemplate.StringId, dat);
                    }
                }
            }
            catch (Exception e)
            {
                ErrorHandler.HandleException(e, "Spawn Data Parsing of " + filePath);
            }
        }
Example #11
0
        private void RegularSpawn()
        {
            try
            {
                var    list = SpawnDataManager.Instance.Data;
                Random rand = new Random();
                var    isSpawnSoundPlaying = false;
                foreach (Data.SpawnData data in list)
                {
                    for (int i = 0; i < data.RepeatSpawnRolls; i++)
                    {
                        if (data.CanSpawn() && (data.MinimumNumberOfDaysUntilSpawn < (int)Math.Ceiling(Campaign.Current.CampaignStartTime.ElapsedDaysUntilNow)))
                        {
                            float currentChanceOfSpawn = data.ChanceOfSpawn;
                            if (!ConfigLoader.Instance.Config.IsAllSpawnMode &&
                                (float)rand.NextDouble() >= currentChanceOfSpawn * ConfigLoader.Instance.Config.SpawnChanceFlatMultiplier)
                            {
                                continue;
                            }

                            var spawnSettlement = Spawner.GetSpawnSettlement(data, (s => data.MinimumDevestationToSpawn > DevestationMetricData.Singleton.GetDevestation(s)), rand);
                            //spawn nao!

                            if (spawnSettlement == null)
                            {
                                //no valid spawn settlement

                                break;
                            }

                            MobileParty spawnedParty = Spawner.SpawnParty(spawnSettlement, data.SpawnClan, data.PartyTemplate, data.PartyType, new TextObject(data.Name));
                            if (spawnedParty == null)
                            {
                                return;
                            }
                            data.IncrementNumberSpawned(); //increment for can spawn and chance modifications
                                                           //dynamic data registration
                            //dynamic spawn tracking
                            DynamicSpawnData.Instance.AddDynamicSpawnData(spawnedParty, new CSPartyData(data, spawnSettlement));
                            //AI Checks!
                            Spawner.HandleAIChecks(spawnedParty, data, spawnSettlement);
                            //accompanying spawns
                            foreach (var accomp in data.SpawnAlongWith)
                            {
                                MobileParty juniorParty = Spawner.SpawnParty(spawnSettlement, data.SpawnClan, accomp.templateObject, data.PartyType, new TextObject(accomp.name));
                                if (juniorParty == null)
                                {
                                    continue;
                                }
                                Spawner.HandleAIChecks(juniorParty, data, spawnSettlement); //junior party has same AI behaviour as main party. TODO in future add some junior party AI and reconstruction.
                            }
                            //message if available
                            if (data.spawnMessage != null)
                            {
                                UX.ShowParseSpawnMessage(data.spawnMessage, spawnSettlement.Name.ToString());
                                //if (data.SoundEvent != -1 && !isSpawnSoundPlaying && ConfigLoader.Instance.Config.SpawnSoundEnabled)
                                //{
                                //    var sceneEmpty = Scene.CreateNewScene(false);
                                //    SoundEvent sound = SoundEvent.CreateEvent(data.SoundEvent, sceneEmpty);
                                //    sound.Play();
                                //    isSpawnSoundPlaying = true;
                                //}
                            }
                            DailyLogger.ReportSpawn(spawnedParty, currentChanceOfSpawn);
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                ErrorHandler.HandleException(e);
            }
        }
Example #12
0
 public LayoutManager(string layoutFolder, UX.UxBase ux)
 {
     initializeProperties(layoutFolder, ux);
 }
Example #13
0
        private void initializeProperties(string layoutFolder, UX.UxBase ux)
        {
            if (String.IsNullOrEmpty(layoutFolder))
            {
                LayoutFolder = System.Environment.ExpandEnvironmentVariables("%WIX_ROOT%\\test\\sandbox");
            }
            else
            {
                LayoutFolder = System.Environment.ExpandEnvironmentVariables(layoutFolder);
            }

            if (ux != null)
            {
                this.Ux = ux;
            }

            CreateAndInitializeWixBundleManifestWithMinimumDefaults();
        }
Example #14
0
 public void CreateConfigurations(out Engine.Data.Configuration.Engine engineConfiguration,
     out UX.Data.Configuration.Application applicationConfiguraion,
     out Perks perksConfiguration)
 {
     engineConfiguration = CreateEngineConfiguration();
     applicationConfiguraion = CreateApplicationConfiguration();
     perksConfiguration = CreatePerksConfiguration();
 }
Example #15
0
        private void RegularSpawn()
        {
            try
            {
                var    list = dataManager.Data;
                Random rand = new Random();
                var    isSpawnSoundPlaying = false;
                foreach (Data.SpawnData data in list)
                {
                    int j = 0;
                    for (int i = 0; i < data.RepeatSpawnRolls; i++)
                    {
                        if (data.CanSpawn() && (data.MinimumNumberOfDaysUntilSpawn < (int)Math.Ceiling(Campaign.Current.CampaignStartTime.ElapsedDaysUntilNow)))
                        {
                            if (CsSettings.IsAllSpawnMode || (float)rand.NextDouble() < data.ChanceOfSpawn)
                            {
                                var spawnSettlement = Spawner.GetSpawnSettlement(data, rand);
                                //spawn nao!
                                MobileParty spawnedParty = Spawner.SpawnParty(spawnSettlement, data.SpawnClan, data.PartyTemplate, data.PartyType, new TextObject(data.Name), data.PartyTemplatePrisoner, data.InheritClanFromSettlement);
                                data.IncrementNumberSpawned(); //increment for can spawn and chance modifications
                                //dynamic data registration
                                DynamicSpawnData.AddDynamicSpawnData(spawnedParty, new CSPartyData(data, spawnSettlement));

                                j++;
                                //AI Checks!
                                Spawner.HandleAIChecks(spawnedParty, data, spawnSettlement);
                                //accompanying spawns
                                foreach (var accomp in data.SpawnAlongWith)
                                {
                                    MobileParty juniorParty = Spawner.SpawnParty(spawnSettlement, data.SpawnClan, accomp.templateObject, data.PartyType, new TextObject(accomp.name), data.PartyTemplatePrisoner, data.InheritClanFromSettlement);
                                    Spawner.HandleAIChecks(juniorParty, data, spawnSettlement); //junior party has same AI behaviour as main party. TODO in future add some junior party AI and reconstruction.
                                }
                                //message if available
                                if (data.spawnMessage != null && data.inquiryMessage == null)
                                {
                                    UX.ShowParseSpawnMessage(data.spawnMessage, spawnSettlement.Name.ToString());
                                    if (data.SoundEvent != -1 && !isSpawnSoundPlaying && CsSettings.SpawnSoundEnabled)
                                    {
                                        var        sceneEmpty = Scene.CreateNewScene(false);
                                        SoundEvent sound      = SoundEvent.CreateEvent(data.SoundEvent, sceneEmpty);
                                        sound.Play();
                                        isSpawnSoundPlaying = true;
                                    }
                                }
                                //default spawn message type always takes priority over the inquiry type if they're both present
                                else if (data.spawnMessage != null && data.inquiryMessage != null)
                                {
                                    UX.ShowParseSpawnMessage(data.spawnMessage, spawnSettlement.Name.ToString());
                                }
                                //only if the spawn message EXPLICITLY doesn't exist does it choose the inquiry message
                                else if (data.spawnMessage == null && data.inquiryMessage != null)
                                {
                                    UX.ShowParseSpawnInquiryMessage(data.inquiryMessage, spawnSettlement.Name.ToString(), data.inquiryPause);
                                }
                            }
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            catch (Exception e)
            {
                ErrorHandler.HandleException(e);
            }
        }
Example #16
0
 public override string ToString()
 {
     return(Node.Index + ": " + UX.ToString("0.0000") + ", " + UZ.ToString("0.0000") + ", " + RY.ToString("0.0000"));
 }
Example #17
0
        public override UserControl GetUI()
        {
            UserControl control = new UX();

            return(control);
        }