Exemplo n.º 1
0
        protected override void OnSubModuleLoad()
        {
            base.OnSubModuleLoad();

            SettingsHelper.GetSettings();

            //Setup Item Filters if needed
            if (TournamentXPSettings.Instance.TournamentEquipmentFilter)
            {
                //Eventually plan to let people define their own
                restrictors.Add(new TournamentEquipmentRestrictor
                {
                    IgnoreMounted          = true,
                    ExcludedItemTypeString = "Polearm",
                    ReplacementStringId    = "sturgia_sword_1_t2",
                });

                foreach (var d in restrictors)
                {
                    d.ItemType = (ItemObject.ItemTypeEnum)Enum.Parse(typeof(ItemObject.ItemTypeEnum), d.ExcludedItemTypeString);
                }
            }

            //Add localizations
            LocalizedTextManager.LoadLocalizationXmls();

#if DEBUG
            TournamentXPSettings.Instance.DebugMode = true;
#endif
        }
Exemplo n.º 2
0
        protected override void OnSubModuleLoad()
        {
            base.OnSubModuleLoad();

            var  version  = ModuleInfo.GetModules().Where(x => x.Name == "Native").Select(x => new { x.Name, x.Version }).FirstOrDefault().Version;
            bool mismatch = false;

#if VERSION130
            if (version.Major == 1 && version.Minor < 3)
            {
                mismatch = true;
            }
#endif
#if VERSION120
            if (version.Major == 1 && version.Minor != 2)
            {
                mismatch = true;
            }
#endif
#if VERSION111
            if (version.Major == 1 && version.Minor != 1)
            {
                mismatch = true;
            }
            if (version.Major > 1)
            {
                mismatch = true;
            }
#endif
            if (mismatch)
            {
                MessageBox.Show("TournamentsXPanded Version Mismatch detected.\nInstall the correct one for your version of the game.\nGame Version: " + version.Major + "." + version.Minor + "." + version.Revision);
                disabled = true;
            }
            if (SettingsHelper.LoadSettings())
            {
                //Setup Item Filters if needed
                if (TournamentXPSettings.Instance.TournamentEquipmentFilter)
                {
                    CreateEquipmentRules();
                }

                //Add localizations
                LocalizedTextManager.LoadLocalizationXmls();

#if DEBUG
                TournamentXPSettings.Instance.DebugMode = true;
#endif
            }
            else
            {
                disabled = true;
                MessageBox.Show("TournamentXP had a critical failure during initialization.  Check your error logs.\nDisabling TournamentXP.");
            }
        }
Exemplo n.º 3
0
        protected override void OnSubModuleLoad()
        {
            base.OnSubModuleLoad();

            var  version  = ModuleInfo.GetModules().Where(x => x.Name == "Native").Select(x => new { x.Name, x.Version }).FirstOrDefault().Version;
            bool mismatch = false;

#if VERSION120
            if (version.Major == 1 && version.Minor < 2)
            {
                mismatch = true;
            }
#endif
#if VERSION111
            if (version.Major == 1 && version.Minor > 1)
            {
                mismatch = true;
            }
            if (version.Major > 1)
            {
                mismatch = true;
            }
#endif
            if (mismatch)
            {
                MessageBox.Show("TournamentsXPanded Version Mismatch detected.\nInstall the correct one for your version of the game.\nGame Version: " + version.Major + "." + version.Minor + "." + version.Revision);
            }
            SettingsHelper.LoadSettings();

            //Setup Item Filters if needed
            if (TournamentXPSettings.Instance.TournamentEquipmentFilter)
            {
                //Eventually plan to let people define their own
                restrictors.Add(new TournamentEquipmentRestrictor
                {
                    IgnoreMounted          = true,
                    ExcludedItemTypeString = "Polearm",
                    ReplacementStringId    = "sturgia_sword_1_t2",
                });

                foreach (var d in restrictors)
                {
                    d.ItemType = (ItemObject.ItemTypeEnum)Enum.Parse(typeof(ItemObject.ItemTypeEnum), d.ExcludedItemTypeString);
                }
            }

            //Add localizations
            LocalizedTextManager.LoadLocalizationXmls();

#if DEBUG
            TournamentXPSettings.Instance.DebugMode = true;
#endif
        }
Exemplo n.º 4
0
        public static void Reset_gameTextDictionary()
        {
            // clear the translation data from the game using reflection
            Type      type  = typeof(LocalizedTextManager);
            FieldInfo info  = type.GetField("_gameTextDictionary", BindingFlags.NonPublic | BindingFlags.Static);
            object    value = info.GetValue(null);

            value.GetType().GetMethod("Clear").Invoke(value, null);

            // reload all localization xmls
            LocalizedTextManager.LoadLocalizationXmls();
        }
Exemplo n.º 5
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Form1 frm = new Form1();
            frm.TopLevel = true;
            frm.BringToFront();
            frm.Focus();
            string path = "";
            if (args.Length > 0)
            {
                path = args[0];
            }
            else
            {
                path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "Mount and Blade II Bannerlord", "Configs", "TournamentsXPanded", "tournamentxpsettings.json");
            }

            DirectoryInfo di = new DirectoryInfo(Assembly.GetEntryAssembly().Location);
            LocalizedTextManager.LoadLocalizationXmls(di.Parent.Parent.Parent.Parent.Parent.FullName);
            frm.SetupLanguageDropdown();
            frm.LoadConfig(path);


#if DEBUG
            string pathxml = "E:\\Users\\Brandon\\OneDrive - Mathis Consulting, LLC\\Development\\BannerLord\\BrandonMods\\TournamentXPanded.Configurator\\Languages\\settings-en.xml";
            string pathcs = "E:\\Users\\Brandon\\OneDrive - Mathis Consulting, LLC\\Development\\BannerLord\\BrandonMods\\TournamentsXPanded.Settings\\TournamentXPSettings.cs";
            string pathoutput = "e:\\settings.cs";

            var xmlstrings = File.ReadAllLines(pathxml);
            var csfile = File.ReadAllLines(pathcs);

            using (var sw = new StreamWriter(pathoutput, false))
            {
                foreach (var line in csfile)
                {
                    if (line.Trim().StartsWith("[SettingProperty"))
                    {
                        var parts = line.Split('"');
                        var newparts = "";
                        foreach(var p in parts)
                        {
                            var pt = LocalizedTextManager.FindStringId("English", p);
                            if (pt.StartsWith("{"))
                            {
                                //pt = pt + LocalizedTextManager.GetTranslatedText("English", LocalizedTextManager.GetStringId(pt));
                                pt = LocalizedTextManager.GetTranslatedText("English", LocalizedTextManager.GetStringId(pt));
                            }
                            newparts += pt + "\"";
                        }
                        newparts = newparts.Substring(0,newparts.Length - 1);
                        sw.WriteLine(newparts);
                    }
                    else
                    {
                        sw.WriteLine(line);
                    }
                }
            }
#endif


            Application.Run(frm);
        }