示例#1
0
文件: Form1.cs 项目: HeIIoween/FLHook
        void  bgWkr_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            bgWkr = null;

            buttonRepAddItem.Enabled = true;
            buttonRepEditItem.Enabled = true;
            buttonRepDelItem.Enabled = true;
            button3.Enabled = true;
            buttonAddBase.Enabled = true;
            buttonDelBase.Enabled = true;
            buttonAddItem.Enabled = true;
            buttonDelItem.Enabled = true;
            buttonSave.Enabled = true;
            buttonPurchaseRestrictionAddItem.Enabled = true;
            buttonPurchaseRestrictionEdittem.Enabled = true;
            buttonPurchaseRestrictionDelItem.Enabled = true;
            buttonEquipPurchaseRestrictionAdd.Enabled = true;
            buttonEquipPurchaseRestrictionEdit.Enabled = true;
            buttonEquipPurchaseRestrictionDel.Enabled = true;
            buttonSysSensorEditItem.Enabled = true;
            buttonSysSensorAddItem.Enabled = true;
            buttonSysSensorDelItem.Enabled = true;

            // Load our ini file
            try
            {
                cfgFilePath = Path.GetFullPath(cfgFilePath);
                cfgFile = new FLDataFile(cfgFilePath, false);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error '" + ex.Message + "' occured when loading the configuration file. Using defaults.");
            }

            try
            {
                checkBoxEnableMoveChar.Checked = cfgFile.GetSettingBool("General", "EnableMoveChar", true);
                checkBoxEnableRenameMe.Checked = cfgFile.GetSettingBool("General", "EnableRenameMe", true);
                checkBoxEnablePimpShip.Checked = cfgFile.GetSettingBool("General", "EnablePimpShip", true);
                checkBoxEnableRestart.Checked = cfgFile.GetSettingBool("General", "EnableRestart", true);
                checkBoxEnableGiveCash.Checked = cfgFile.GetSettingBool("General", "EnableGiveCash", true);
                checkBoxEnableDropRepAndMisc.Checked = cfgFile.GetSettingBool("General", "EnableDropRep", true);

                textBoxDropRepCost.Text = cfgFile.GetSettingStr("General", "RepDropCost", "350000");
                textBoxStuckMsg.Text = cfgFile.GetSettingStr("General", "StuckMsg", "Attention! Stand clear. Towing %player");
                textBoxDiceMsg.Text = cfgFile.GetSettingStr("General", "DiceMsg", "%player rolled %number");
                textBoxCoinMsg.Text = cfgFile.GetSettingStr("General", "CoinMsg", "%player tossed %result");
                textBoxSmiteMusic.Text = cfgFile.GetSettingStr("General", "SmiteMusic", "music_danger");

                textBoxDisconnectingPlayersRange.Text = cfgFile.GetSettingStr("General", "DisconnectingPlayersRange", "5000");
                checkBoxReportDisconnectingPlayers.Checked = cfgFile.GetSettingBool("General", "ReportDisconnectingPlayers", true);
                checkBoxKillDisconnectingPlayers.Checked = cfgFile.GetSettingBool("General", "KillDisconnectingPlayers", true);
                checkBoxLootDisconnectingPlayers.Checked = cfgFile.GetSettingBool("General", "LootDisconnectingPlayers", true);

                textBoxHullDropFactor.Text = cfgFile.GetSettingStr("General", "HullDropFactor", "0.0");
                textBoxCargoDropContainer.Text = cfgFile.GetSettingStr("General", "CargoDropContainer", "lootcrate_ast_loot_metal");
                textBoxHullDrop1NickName.Text = cfgFile.GetSettingStr("General", "HullDrop1NickName", "commodity_super_alloys");
                textBoxHullDrop2NickName.Text = cfgFile.GetSettingStr("General", "HullDrop2NickName", "commodity_engine_components");
                textBoxDisconnectMsg.Text = cfgFile.GetSettingStr("General", "DisconnectMsg", "%player is attempting to engage cloaking device");

                textBoxSpinProtectMass.Text = cfgFile.GetSettingStr("General", "SpinProtectionMass", "-1.0");
                textBoxSpinImpulseMultiplier.Text = cfgFile.GetSettingStr("General", "SpinProtectionMultiplier", "-8.0");

                checkBoxEnableEscort.Checked = cfgFile.GetSettingBool("General", "EnableEscort", false);
                textBoxEscortedShipMinimumMass.Text = cfgFile.GetSettingStr("General", "EscortedShipMinimumMass", "100000");
                textBoxEscortedShipDamageFactor.Text = cfgFile.GetSettingStr("General", "EscortedShipDamageFactor", "0.3");

                textBoxRestartMaxRank.Text = cfgFile.GetSettingStr("Restart", "MaxRank", "5");
                textBoxRestartMaxCash.Text = cfgFile.GetSettingStr("Restart", "MaxCash", "1000000");

                textBoxRenameCost.Text = cfgFile.GetSettingStr("Rename", "RenameCost", "2000000");
                textBoxRenameTimeLimit.Text = cfgFile.GetSettingStr("Rename", "RenameTimeLimit", "86400");
                textBoxMoveCost.Text = cfgFile.GetSettingStr("Rename", "MoveCost", "2000000");
                checkBoxCharnameTag.Checked = cfgFile.GetSettingBool("Rename", "CharnameTag", false);
                textBoxCharnameTagCost.Text = cfgFile.GetSettingStr("Rename", "MakeTagCost", "50000000");
                checkBoxAsciiCharnameOnly.Checked = cfgFile.GetSettingBool("Rename", "AsciiCharnameOnly", false);
                

                textBoxMinTransfer.Text = cfgFile.GetSettingStr("GiveCash", "MinTransfer", "100000");
                textBoxMinTime.Text = cfgFile.GetSettingStr("GiveCash", "MinTime", "3600");
                textBoxBlockedSystem.Text = cfgFile.GetSettingStr("GiveCash", "BlockedSystem", "iw09");

                textBoxPimpShipCost.Text = cfgFile.GetSettingStr("ShipPimper", "cost", "2000000");
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("ShipPimper", "equip"))
                {
                    string[] args = set.Str(0).Split(',');
                    if (args.Length > 0)
                    {
                        GameDataSet.HashListRow item = gameData.GetItemByNickName(args[0]);
                        if (item != null)
                        {
                            uIDataSet.ShipPimperItemList.AddShipPimperItemListRow(item.IDSName, item.ItemNickName, item.ItemHash, item.IDSInfo, item.IDSInfo1);
                        }
                    }
                }

                foreach (FLDataFile.Setting set in cfgFile.GetSettings("ShipPimper", "room"))
                {
                    GameDataSet.HashListRow item = gameData.GetItemByNickName(set.Str(0));
                    if (item != null)
                    {
                        uIDataSet.ShipPimperBaseList.AddShipPimperBaseListRow(item.IDSName, item.ItemNickName, item.ItemHash, item.IDSInfo, item.IDSInfo1);
                    }
                }

                checkBoxEnableRepFixUpdates.Checked = cfgFile.GetSettingBool("RepFixer", "EnableRepFixUpdates", true);
                checkBoxLogRepFixUpdates.Checked = cfgFile.GetSettingBool("RepFixer", "LogRepFixUpdates", true);
                checkBoxItemMustBeMounted.Checked = cfgFile.GetSettingBool("RepFixer", "ItemMustBeMounted", true);

                foreach (FLDataFile.Setting set in cfgFile.GetSettings("RepFixerItems"))
                {
                    GameDataSet.HashListRow item = gameData.GetItemByNickName(set.settingName);
                    if (item != null)
                    {
                        uIDataSet.RepFixerItemList.AddRepFixerItemListRow(item.IDSName, item.ItemNickName, item.ItemHash, item.IDSInfo, item.IDSInfo1);
                    }
                }

                checkBoxCheckIDRestrictions.Checked = cfgFile.GetSettingBool("PurchaseRestrictions", "CheckIDRestrictions", false);
                checkBoxEnforceIDRestrictions.Checked = cfgFile.GetSettingBool("PurchaseRestrictions", "EnforceIDRestrictions", false);
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("ShipItemRestrictions"))
                {
                    GameDataSet.HashListRow shipItem = gameData.GetItemByNickName(set.settingName);
                    GameDataSet.HashListRow controlItem = gameData.GetItemByNickName(set.Str(0));
                    if (shipItem != null && controlItem != null)
                    {
                        uIDataSet.ShipPurchaseRestrictionItems.AddShipPurchaseRestrictionItemsRow(shipItem.IDSName, shipItem.ItemNickName, controlItem.IDSName, controlItem.ItemNickName);
                    }
                }

                foreach (FLDataFile.Setting set in cfgFile.GetSettings("GoodItemRestrictions"))
                {
                    GameDataSet.HashListRow equipItem = gameData.GetItemByNickName(set.settingName);
                    GameDataSet.HashListRow controlItem = gameData.GetItemByNickName(set.Str(0));
                    if (equipItem != null && controlItem != null)
                    {
                        uIDataSet.EquipPurchaseRestrictionItems.AddEquipPurchaseRestrictionItemsRow(equipItem.IDSName, equipItem.ItemNickName, controlItem.IDSName, controlItem.ItemNickName);
                    }
                }

                foreach (FLDataFile.Setting set in cfgFile.GetSettings("NoBuy"))
                {
                    GameDataSet.HashListRow baseItem = gameData.GetItemByNickName(set.settingName);
                    GameDataSet.HashListRow goodItem = gameData.GetItemByNickName(set.Str(0));
                    if (baseItem != null && goodItem != null)
                    {
                        uIDataSet.BaseGoodNoBuyList.AddBaseGoodNoBuyListRow(baseItem.IDSName, baseItem.ItemNickName, goodItem.IDSName, goodItem.ItemNickName);
                    }
                }

                foreach (FLDataFile.Setting set in cfgFile.GetSettings("SystemSensor"))
                {
                    GameDataSet.HashListRow sysItem = gameData.GetItemByNickName(set.settingName);
                    string[] args = set.Str(0).Split(',');
                    if (args.Length > 0)
                    {
                        GameDataSet.HashListRow equipItem = gameData.GetItemByNickName(args[0]);
                        uint networkID = 1;
                        if (args.Length > 1)
                            networkID = UInt32.Parse(args[1]);
                        if (sysItem != null && equipItem != null)
                        {
                            uIDataSet.SysSensorList.AddSysSensorListRow(sysItem.IDSName, sysItem.ItemNickName, equipItem.IDSName, equipItem.ItemNickName, networkID);
                        }
                    }
                }

                checkBoxCustomHelp.Checked = cfgFile.GetSettingBool("Message", "CustomHelp", true);
                checkBoxCmdEcho.Checked = cfgFile.GetSettingBool("Message", "CmdEcho", true);
                checkBoxCmdHide.Checked = cfgFile.GetSettingBool("Message", "CmdHide", true);
                textBoxCmdEchoStyle.Text = cfgFile.GetSettingStr("Message", "CmdEchoStyle", "0x00AA0090");

                richTextBoxHelpLines.Clear();
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("Help"))
                {
                    richTextBoxHelpLines.AppendText(set.settingName);
                    richTextBoxHelpLines.AppendText("\n");
                }

                richTextBoxSwearWords.Clear();
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("SwearWords"))
                {
                    richTextBoxSwearWords.AppendText(set.Str(0));
                    richTextBoxSwearWords.AppendText("\n");
                }

                richTextBoxGreetingBannerLines.Clear();
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("GreetingBanner"))
                {
                    richTextBoxGreetingBannerLines.AppendText(set.Str(0));
                    richTextBoxGreetingBannerLines.AppendText("\n");
                }

                textBoxSpecialBannerDelay.Text = cfgFile.GetSettingStr("Message", "SpecialBannerDelay", "3000");
                textBoxStandardBannerDelay.Text = cfgFile.GetSettingStr("Message", "StandardBannerDelay", "1200");

                richTextBoxSpecialBannerLines.Clear();
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("SpecialBanner"))
                {
                    richTextBoxSpecialBannerLines.AppendText(set.Str(0));
                    richTextBoxSpecialBannerLines.AppendText("\n");
                }

                uIDataSet.StandardBannerList.Clear();
                foreach (FLDataFile.Section sect in cfgFile.sections)
                {
                    if (sect.sectionName == "StandardBanner")
                    {
                        StringBuilder sb = new StringBuilder();
                        foreach (FLDataFile.Setting set in sect.settings)
                        {
                            sb.AppendLine(set.Str(0));
                        }
                        uIDataSet.StandardBannerList.AddStandardBannerListRow(sb.ToString());
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error '" + ex.Message + "' occured when parsing the configuration file.");
            }

            
        }
示例#2
0
        public EditReps(FLGameData gameData, string itemNickName, FLDataFile cfgFile)
        {
            InitializeComponent();

            this.itemNickName = itemNickName;
            this.cfgFile      = cfgFile;
            this.Text         = "Edit Reputations: " + gameData.GetItemDescByNickNameX(itemNickName);

            GameDataSet.HashListRow[] factions = (GameDataSet.HashListRow[])gameData.DataStore.HashList.Select("ItemType = '" + FLGameData.GAMEDATA_FACTIONS + "'");
            foreach (GameDataSet.HashListRow faction in factions)
            {
                uIDataSet.RepFixerItemFactions.AddRepFixerItemFactionsRow(faction.IDSName, faction.ItemNickName, "");
            }

            foreach (FLDataFile.Setting set in cfgFile.GetSettings(itemNickName))
            {
                string factionNick = set.settingName;

                string repStr = "-";
                if (set.NumValues() > 0)
                {
                    string[] values = set.Str(0).Split(',');
                    if (values.Length == 2)
                    {
                        int mode;
                        if (!Int32.TryParse(values[1], out mode))
                        {
                            repStr = "ERR";
                        }
                        else if (mode == MODE_REP_GREATERTHAN)
                        {
                            repStr = ">";
                        }
                        else if (mode == MODE_REP_STATIC)
                        {
                            repStr = "=";
                        }
                        else
                        {
                            repStr = "<";
                        }

                        float rep;
                        if (!Single.TryParse(values[0], out rep))
                        {
                            repStr = "ERR";
                        }
                        else if (rep > 1.0 || rep < -1.0)
                        {
                            repStr = "ERR";
                        }
                        else
                        {
                            repStr += rep.ToString();
                        }
                    }
                    else if (values.Length == 1)
                    {
                        float rep;
                        if (!Single.TryParse(values[0], out rep))
                        {
                            repStr = "ERR";
                        }
                        else if (rep > 1.0 || rep < -1.0)
                        {
                            repStr = "ERR";
                        }
                        repStr = "<" + rep.ToString();
                    }
                }

                foreach (UIDataSet.RepFixerItemFactionsRow faction in uIDataSet.RepFixerItemFactions.Rows)
                {
                    if (faction.ItemNickName == factionNick)
                    {
                        faction.Reputation = repStr;
                        break;
                    }
                }
            }
        }
示例#3
0
        /// <summary>
        /// Load an ion cross game data file that has a nickname key
        /// </summary>
        /// <param name="items">The database to copy data into</param>
        /// <param name="ioncrossDir">The file </param>
        /// <param name="hashFile"></param>
        private void LoadIonCrossNickNameDesc(GameDataSet.HashListDataTable items, string filePath, LogRecorderInterface log, bool isFaction)
        {
            try
            {
                FLDataFile ini = new FLDataFile(filePath, false);
                foreach (FLDataFile.Section s in ini.sections)
                {
                    foreach (FLDataFile.Setting setting in s.settings)
                    {
                        try
                        {
                            GameDataSet.HashListRow itemRecord = GetItemByNickName(setting.settingName.ToLowerInvariant());
                            if (isFaction)
                                itemRecord = GetItemByFactionNickName(setting.settingName.ToLowerInvariant());

                            if (itemRecord != null)
                            {
                                if (setting.NumValues() > 0)
                                    itemRecord.IDSName = setting.Str(0);
                            }
                        }
                        catch (Exception ex)
                        {
                            log.AddLog(String.Format("Error '{0}' when reading {1}", ex.Message, setting.desc));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                log.AddLog(String.Format("Error '{0}' when reading {1}", ex.Message, filePath));
            }
        }
示例#4
0
 /// <summary>
 /// Load a ion cross game data file that has a hash key
 /// </summary>
 /// <param name="items">The database to copy data into</param>
 /// <param name="ioncrossDir">The file </param>
 /// <param name="hashFile"></param>
 private void LoadIonCrossHashDesc(GameDataSet.HashListDataTable items, string filePath, LogRecorderInterface log)
 {
     try
     {
         FLDataFile ini = new FLDataFile(filePath, true);
         foreach (FLDataFile.Section s in ini.sections)
         {
             foreach (FLDataFile.Setting setting in s.settings)
             {
                 try
                 {
                     GameDataSet.HashListRow itemRecord = GetItemByNickName(setting.settingName);
                     if (itemRecord == null)
                         itemRecord = GetItemByHash(Convert.ToUInt32(setting.settingName));
                     if (itemRecord != null)
                     {
                         if (setting.NumValues() > 1)
                             itemRecord.IDSName = setting.Str(1);
                         else if (setting.NumValues() > 0)
                             itemRecord.IDSName = setting.Str(0);
                     }
                 }
                 catch (Exception ex)
                 {
                     log.AddLog(String.Format("Error '{0}' when reading {1}", ex.Message, setting.desc));
                 }
             }
         }
     }
     catch (Exception ex)
     {
         log.AddLog(String.Format("Error '{0}' when reading {1}", ex.Message, filePath));
     }
 }
示例#5
0
        /// <summary>
        /// Scan the goods files for the specifed shiphull to add the effects entries
        /// from the goods package to the ship as synthetic hardpoints.
        /// </summary>
        /// <param name="info"></param>
        /// <param name="loadout"></param>
        void AddFXFromGoods(FLDataFile flGoodsIni, string flDataPath, FLDataFile.Section shipPackageSection, LogRecorderInterface log)
        {
            try
            {
                string hullNickName = shipPackageSection.GetSetting("hull").Str(0);

                foreach (FLDataFile.Section section in flGoodsIni.sections)
                {
                    if (section.sectionName.ToLowerInvariant() != "good")
                        continue;

                    if (section.GetSetting("category").Str(0)!="shiphull")
                        continue;

                    if (section.GetSetting("nickname").Str(0)!=hullNickName)
                        continue;

                    string shipNickName = section.GetSetting("ship").Str(0);
                    uint shiphash = FLUtility.CreateID(shipNickName);

                    long defaultSound = 0;
                    long defaultPowerPlant = 0;
                    long defaultEngine = 0;

                    // Get the loadout for the ship.
                    foreach (FLDataFile.Setting setting in shipPackageSection.settings)
                    {
                        try
                        {
                            if (setting.settingName.ToLowerInvariant() != "addon")
                                continue;

                            if (setting.NumValues() != 3)
                                throw new Exception(setting.desc + "setting '" + setting.desc + "' should have 3 values");

                            string equipNickName = setting.Str(0);
                            GameDataSet.HashListRow item = GetItemByNickName(equipNickName);
                            if (item == null)
                                throw new Exception(setting.desc + " cannot find " + equipNickName + " in game data table");

                            if (item.ItemType == GAMEDATA_LIGHTS)
                            {
                                if (setting.Str(1) == "internal")
                                    throw new Exception(setting.desc + " invalid hardpoint for " + equipNickName);
                                DataStore.HardPointList.AddHardPointListRow(shiphash, setting.Str(1), item.ItemType, "", item.ItemHash);
                            }
                            else if (item.ItemType == GAMEDATA_FX)
                            {
                                if (setting.Str(1) == "internal")
                                    throw new Exception(setting.desc + " invalid hardpoint for " + equipNickName);
                                DataStore.HardPointList.AddHardPointListRow(shiphash, setting.Str(1), item.ItemType, "", item.ItemHash);
                            }
                            else if (item.ItemType == GAMEDATA_SOUND)
                            {
                                defaultSound = item.ItemHash;
                            }
                            else if (item.ItemType == GAMEDATA_POWERGEN)
                            {
                                defaultPowerPlant = item.ItemHash;
                            }
                            else if (item.ItemType == GAMEDATA_ENGINES)
                            {
                                defaultEngine = item.ItemHash;
                            }
                        }
                        catch (Exception e)
                        {
                            log.AddLog("Error '" + e.Message + "'");
                        }
                    }

                    DataStore.ShipInfoList.AddShipInfoListRow(shiphash, defaultEngine, defaultSound, defaultPowerPlant);
                }
            }
            catch (Exception e)
            {
                log.AddLog("Error '" + e.Message + "'");
            }
        }
示例#6
0
        /// <summary>
        /// Scans the specified directory and recursively search for ini files that appear to contain
        /// hashcodes.
        /// </summary>
        /// <param name="flDataPath"></param>
        /// <param name="iniFilePath"></param>
        /// <remarks>Not used any more</remarks>
        private void ScanForHashCodes(GameDataSet dataStore, string flDataPath, BackgroundWorker bgw, LogRecorderInterface log)
        {
            // Scan the ini files.    
            string[] iniFiles = Directory.GetFiles(flDataPath, "*.ini");
            for (int i=0; i<iniFiles.Length; i++)
            {
                if (bgw.CancellationPending)
                    return;

                string filePath = iniFiles[i];
                bgw.ReportProgress(((i * 100) / iniFiles.Length), "Scanning " + filePath.Substring(flDataPath.Length + 1) + "...");
                try
                {
                    FLDataFile ini = new FLDataFile(filePath, true);
                    foreach (FLDataFile.Section section in ini.sections)
                    {
                        foreach (FLDataFile.Setting e in section.settings)
                        {
                            if (e.NumValues() == 0)
                                continue;

                            string st = e.settingName.ToLowerInvariant();
                            if (st == "nickname" || st == "archetype" || st == "loadout"
                                || st == "explosion_arch" || st == "fuse" || st == "zone"
                                || st == "name" || st == "room" || st == "prop"
                                || st == "msg_id_prefix" || st == "npc")
                            {
                                string nickName = e.Str(0);
                                uint hashU = FLUtility.CreateID(nickName.ToLowerInvariant());
                                GameDataSet.HashListRow conflictingEntry = dataStore.HashList.FindByItemHash(hashU);
                                if (conflictingEntry == null)
                                {
                                    string keys = hashU.ToString() + " 0x" + hashU.ToString("X");
                                    dataStore.HashList.AddHashListRow(hashU, nickName, GAMEDATA_GEN, "", "", "", "", "", keys);
                                }
                            }

                            /* for (int j = 0; j < e.NumValues(); j++)
                            {
                                string nickName = e.Str(j);
                                uint hashU = FLUtility.CreateID(nickName.ToLowerInvariant());
                                string keys = hashU.ToString() + " 0x" + hashU.ToString("X");
                                GameDataSet.HashListRow conflictingEntry = dataStore.HashList.FindByItemHash(hashU);
                                if (conflictingEntry == null)
                                {
                                    dataStore.HashList.AddHashListRow(hashU, nickName, GAMEDATA_GEN, "", "", "", "", "");
                                }
                            } */                       
                        }
                    }
                }
                catch (Exception ex)
                {
                    log.AddLog(String.Format("Error '{0}' when scanning {1}", ex.Message, filePath));
                }
            }
            
            // Recurse through subdirectories.
            string[] dataDirs = Directory.GetDirectories(flDataPath);
            for (int i = 0; i < dataDirs.Length; i++ )
            {
                ScanForHashCodes(dataStore, dataDirs[i], bgw, log);
            }
        }
示例#7
0
        /// <summary>
        /// Parse the system file to extract base information.
        /// </summary>
        /// <param name="fileName"></param>
        void ParseSystem(string fileName, LogRecorderInterface log)
        {
            FLDataFile ini = new FLDataFile(fileName, true);
            foreach (FLDataFile.Section section in ini.sections)
            {
                string idsName = "";
                string idsInfo = "";
                string idsInfo1 = "";
                string pos = "";

                if (section.sectionName.ToLowerInvariant() == "object")
                {
                    try
                    {

                        if (section.SettingExists("ids_name"))
                        {
                            idsName = GetIDString(section.GetSetting("ids_name").UInt(0));
                        }

                        if (section.SettingExists("ids_info"))
                        {
                            uint value = section.GetSetting("ids_info").UInt(0);
                            idsInfo = GetIDString(value);
                            if (infocardMap.ContainsKey(value))
                                idsInfo1 = GetIDString(infocardMap[value]);
                        }

                        if (section.SettingExists("pos"))
                        {
                            pos = section.GetSetting("pos").Str(0)
                                + "," + section.GetSetting("pos").Str(1)
                                + "," + section.GetSetting("pos").Str(2);
                        }

                        if (section.SettingExists("base"))
                        {
                            string baseNick = section.GetSetting("base").Str(0);
                            GameDataSet.HashListRow baseItem = GetItemByNickName(baseNick);
                            if (baseItem != null)
                            {
                                if (baseItem.IDSInfo.Length == 0)
                                    baseItem.IDSInfo = idsInfo;
                                if (baseItem.IDSInfo1.Length == 0)
                                    baseItem.IDSInfo1 = idsInfo1;
                                if (baseItem.IDSInfo2.Length == 0)
                                    baseItem.IDSInfo2 = "Postion: " + pos;
                            }
                        }

                        AddGameData(DataStore.HashList, section, GAMEDATA_OBJECT, false);
                    }
                    catch (Exception e)
                    {
                        log.AddLog("Error '" + e.Message + "' when parsing '" + fileName);
                    }
                }
                else if (section.sectionName.ToLowerInvariant() == "zone")
                {
                    try
                    {
                        AddGameData(DataStore.HashList, section, GAMEDATA_ZONE, false);
                    }
                    catch (Exception e)
                    {
                        log.AddLog("Error '" + e.Message + "' when parsing '" + fileName);
                    }
                }
            }
        }
示例#8
0
        /// <summary>
        /// Load room hash codes from base ini data.
        /// </summary>
        /// <param name="baseIniPath"></param>
        private void LoadRoomData(GameDataSet dataStore, string baseNick, string baseIniPath)
        {
            FLDataFile iniRoom = new FLDataFile(baseIniPath, true);
            foreach (FLDataFile.Section section in iniRoom.sections)
            {
                if (section.sectionName.ToLowerInvariant() != "room")
                    continue;

                string locationNick = FLUtility.CreateID(baseNick.ToLowerInvariant()).ToString("x")
                    + "_" + section.GetSetting("nickname").Str(0).ToLowerInvariant();

                uint hashU = FLUtility.CreateID(locationNick.ToLowerInvariant());
                string keys = hashU.ToString() + " 0x" + hashU.ToString("X");

                GameDataSet.HashListRow conflictingEntry = dataStore.HashList.FindByItemHash(hashU);
                if (conflictingEntry == null)
                {
                    dataStore.HashList.AddHashListRow(hashU, locationNick, GAMEDATA_ROOM, GetItemDescByNickNameX(baseNick), "", "", "", "", keys);
                }
            }   
        }
示例#9
0
        private bool AddGameData(GameDataSet.HashListDataTable items, FLDataFile.Section section, string gameDataType, bool ignoreEntriesWithNoIds)
        {
            string nickName = section.GetSetting("nickname").Str(0);
            
            string stIDSName = GetIDSParm(section, "ids_name");
            if (stIDSName == "")
                stIDSName = GetIDSParm(section, "strid_name");

            if (ignoreEntriesWithNoIds && stIDSName == "")
                return false;

            uint hash = FLUtility.CreateID(nickName.ToLowerInvariant());
            if (gameDataType == GAMEDATA_FACTIONS)
                hash = FLUtility.CreateFactionID(nickName);

            GameDataSet.HashListRow conflictingHashEntry = items.FindByItemHash(hash);
            if (conflictingHashEntry != null)
                return false;

            string stIDSInfo = GetIDSParm(section, "ids_info");
            
            string stIDSInfo1 = GetIDSParm(section, "ids_info1");
            if (stIDSInfo1 == "")
                stIDSInfo1 = GetIDSParm(section, "ids_short_name");

            string stIDSInfo2 = GetIDSParm(section, "ids_info2");
            string stIDSInfo3 = GetIDSParm(section, "ids_info3");

            string keys = hash.ToString() + " 0x" + hash.ToString("X");

            items.AddHashListRow(hash, nickName, gameDataType, stIDSName, stIDSInfo, stIDSInfo1, stIDSInfo2, stIDSInfo3, keys);
            return true;
        }
示例#10
0
 private string GetIDSParm(FLDataFile.Section section, string parmName)
 {
     string stInfo = "";
     if (section.SettingExists(parmName))
     {
         uint idsInfo = section.GetSetting(parmName).UInt(0);
         stInfo = GetIDString(idsInfo);
         if (stInfo == null)
             throw new Exception("ids_info not found " + idsInfo);
         stInfo = stInfo.Trim();
     }
     return stInfo;
 }
示例#11
0
        /// <summary>
        /// Load all game data.
        /// </summary>
        public void LoadAll(string flExePath, LogRecorderInterface log)
        {
            DataStore.Clear();

            FLDataFile flIni = null;
            try
            {
                flIni = new FLDataFile(flExePath + Path.DirectorySeparatorChar + "Freelancer.ini", true);
            }
            catch (Exception e)
            {
                log.AddLog("Error '" + e.Message + "' when parsing '" + flExePath);
                return;
            }
            string flDataPath = Path.GetFullPath(Path.Combine(flExePath, flIni.GetSetting("Freelancer", "data path").Str(0)));

            log.AddLog("Loading strings...");

            // Load the string dlls.
            LoadLibrary(flExePath + Path.DirectorySeparatorChar + "resources.dll");
            foreach (FLDataFile.Setting flIniEntry in flIni.GetSettings("Resources", "DLL"))
                LoadLibrary(flExePath + Path.DirectorySeparatorChar + flIniEntry.Str(0));

            log.AddLog("Loading universe...");

            // Scan ini files and parse base entries
            foreach (FLDataFile.Setting flIniEntry in flIni.GetSettings("Data", "universe"))
            {
                string iniPath = flDataPath + Path.DirectorySeparatorChar + flIniEntry.Str(0);
                try
                {
                    FLDataFile ini = new FLDataFile(iniPath, true);
                    foreach (FLDataFile.Section section in ini.sections)
                    {
                        try
                        {
                            string sectionName = section.sectionName.ToLowerInvariant();
                            if (sectionName == "base")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_BASES, true);
                                string baseNick = section.GetSetting("nickname").Str(0);
                                string baseFilePath = flDataPath + Path.DirectorySeparatorChar + section.GetSetting("file").Str(0);
                                LoadRoomData(DataStore, baseNick, baseFilePath);
                            }
                            else if (sectionName == "system")
                            {
                                string baseNick = section.GetSetting("nickname").Str(0).ToLowerInvariant();
                                AddGameData(DataStore.HashList, section, GAMEDATA_SYSTEMS, true);
                                string file = Directory.GetParent(ini.filePath).FullName + "\\" + section.GetSetting("file").Str(0);
                                ParseSystem(file, log);
                            }
                        }
                        catch (Exception e)
                        {
                            log.AddLog("Error '" + e.Message + "' when parsing '" + iniPath);
                        }
                    }
                }
                catch (Exception e)
                {
                    log.AddLog("Error '" + e.Message + "' when parsing '" + iniPath);
                }
            }

            log.AddLog("Loading ships...");

            // Scan ship files and parse ship entries
            foreach (FLDataFile.Setting flIniEntry in flIni.GetSettings("Data", "ships"))
            {
                string iniPath = flDataPath + Path.DirectorySeparatorChar + flIniEntry.Str(0);
                try
                {
                    FLDataFile ini = new FLDataFile(iniPath, true);
                    foreach (FLDataFile.Section section in ini.sections)
                    {
                        if (section.sectionName.ToLowerInvariant() == "ship")
                        {
                            AddGameData(DataStore.HashList, section, GAMEDATA_SHIPS, true);

                            string nickName = section.GetSetting("nickname").Str(0);
                            uint hash = FLUtility.CreateID(nickName.ToLowerInvariant());

                            foreach (FLDataFile.Setting setting in section.settings)
                            {
                                try
                                {
                                    if (setting.settingName.ToLowerInvariant() == "da_archetype")
                                    {
                                        // UTF hardpoints are only really useful to validate the shiparch and ship default loadout.
                                        // Don't bother loading them.
                                        // UtfFile utf = new UtfFile(flDataPath + Path.DirectorySeparatorChar + setting.Str(0));
                                        // foreach (string hp in utf.hardpoints)
                                        // {
                                        //    DataStore.HardPointList.AddHardPointListRow(hash, hp, "");
                                        // }
                                    }
                                    else if (setting.settingName.ToLowerInvariant() == "hp_type")
                                    {

                                        string type = setting.Str(0);
                                        for (int i = 1; i < setting.NumValues(); i++)
                                        {
                                            string hp = setting.Str(i);
                                            GameDataSet.HardPointListRow hpInfo = GetHardPointByShipAndHPName(hash, hp);
                                            if (hpInfo == null)
                                                hpInfo = DataStore.HardPointList.AddHardPointListRow(hash, hp, HardpointClassToGameDataClass(type), "", 0);
                                            hpInfo.MountableTypes += " " + type;
                                        }
                                    }
                                }
                                catch (Exception ex)
                                {
                                    log.AddLog(String.Format("Error '{0}' when reading {1}", ex.Message, setting.desc));
                                }
                            }
                        }
                    }
                }
                catch (Exception e)
                {
                    log.AddLog("Error '" + e.Message + "' when parsing '" + iniPath);
                }
            }

            log.AddLog("Loading equipment...");

            // Scan ini files and parse equipment entries.
            foreach (FLDataFile.Setting flIniEntry in flIni.GetSettings("Data", "equipment"))
            {
                string iniPath = flDataPath + Path.DirectorySeparatorChar + flIniEntry.Str(0);
                try
                {
                    FLDataFile ini = new FLDataFile(iniPath, true);
                    foreach (FLDataFile.Section section in ini.sections)
                    {
                        try
                        {
                            string sectionName = section.sectionName.ToLowerInvariant();
                            // Internal equipment; these are mounted internally.
                            if (sectionName == "engine")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_ENGINES, true);
                            }
                            else if (sectionName == "power")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_POWERGEN, true);
                            }
                            else if (sectionName == "scanner")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_SCANNERS, true);
                            }
                            else if (sectionName == "tractor")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_TRACTORS, true);
                            }
                            else if (sectionName == "cloakingdevice")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_CLOAK, true);
                            }
                            else if (sectionName == "armor")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_ARMOR, true);
                            }
                            else if (sectionName == "internalfx")
                            {
                                if (section.SettingExists("use_sound"))
                                {
                                    AddGameData(DataStore.HashList, section, GAMEDATA_SOUND, false);
                                }
                            }
                            // External hardpoints.
                            else if (sectionName == "attachedfx")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_FX, false);
                            }
                            else if (sectionName == "light")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_LIGHTS, false);
                            }
                            else if (sectionName == "gun")
                            {
                                if (section.SettingExists("hp_gun_type"))
                                {
                                    string hpType = section.GetSetting("hp_gun_type").Str(0);
                                    AddGameData(DataStore.HashList, section, HardpointClassToGameDataClass(hpType), true);
                                    DataStore.EquipInfoList.AddEquipInfoListRow(
                                        FLUtility.CreateID(section.GetSetting("nickname").Str(0)),
                                        HardpointClassToGameDataClass(hpType), hpType);
                                }
                                // Probably an npc gun
                                else
                                {
                                    AddGameData(DataStore.HashList, section, GAMEDATA_GEN, false);
                                }
                            }
                            else if (sectionName == "shieldgenerator")
                            {
                                if (section.SettingExists("hp_type"))
                                {
                                    string hpType = section.GetSetting("hp_type").Str(0);
                                    AddGameData(DataStore.HashList, section, HardpointClassToGameDataClass(hpType), true);
                                    DataStore.EquipInfoList.AddEquipInfoListRow(
                                        FLUtility.CreateID(section.GetSetting("nickname").Str(0)),
                                        HardpointClassToGameDataClass(hpType), hpType);
                                }
                                // Probably an npc shield
                                else
                                {
                                    AddGameData(DataStore.HashList, section, GAMEDATA_GEN, false);
                                }
                            }
                            else if (sectionName == "countermeasuredropper")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_CM, true);
                            }
                            else if (sectionName == "thruster")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_THRUSTERS, true);
                            }
                            else if (sectionName == "minedropper")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_MINES, true);
                            }

                            // Cargo and ammo.
                            else if (sectionName == "munition")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_AMMO, true);
                            }
                            else if (sectionName == "repairkit")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_CARGO, true);
                            }
                            else if (sectionName == "countermeasure")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_AMMO, true);
                            }
                            else if (sectionName == "shieldbattery")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_CARGO, true);
                            }
                            else if (sectionName == "mine")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_AMMO, true);
                            }
                            else if (sectionName == "commodity")
                            {
                                AddGameData(DataStore.HashList, section, GAMEDATA_CARGO, true);
                            }

                            // Random stuff I don't know what to do with.
                            else if (sectionName == "shield")
                            { } // ignore this section
                            else if (sectionName == "lootcrate")
                            { } // ignore this section
                            else if (sectionName == "lod")
                            { } // ignore this section - it has no nickname
                            else if (sectionName == "tradelane")
                            { } // ignore this section
                            else if (sectionName == "motor")
                            { } // ignore this section
                            else if (sectionName == "explosion")
                            { } // ignore this section
                            else if (sectionName == "cargopod")
                            { } // ignore this section
                            else if (sectionName == "tradelane")
                            { } // ignore this section

                            else
                            {
                            }
                        }
                        catch (Exception e)
                        {
                            log.AddLog("Error '" + e.Message + "' when parsing '" + iniPath);
                        }
                    }
                }
                catch (Exception e)
                {
                    log.AddLog("Error '" + e.Message + "' when parsing '" + iniPath);
                }
            }

            log.AddLog("Loading factions...");

            // Scan ini files and parse faction entries
            foreach (FLDataFile.Setting flIniEntry in flIni.GetSettings("Data", "groups"))
            {
                string iniPath = flDataPath + Path.DirectorySeparatorChar + flIniEntry.Str(0);
                try
                {
                    FLDataFile ini = new FLDataFile(iniPath, true);
                    foreach (FLDataFile.Section section in ini.sections)
                    {
                        if (section.sectionName.ToLowerInvariant() == "group")
                        {
                            AddGameData(DataStore.HashList, section, GAMEDATA_FACTIONS, true);
                        }
                    }
                }
                catch (Exception e)
                {
                    log.AddLog("Error '" + e.Message + "' when parsing '" + iniPath);
                }
            }
            foreach (IntPtr hInstance in vDLLs)
                FreeLibrary(hInstance);
            vDLLs.Clear();
        }
示例#12
0
        public EditReps(FLGameData gameData, string itemNickName, FLDataFile cfgFile)
        {
            InitializeComponent();

            this.itemNickName = itemNickName;
            this.cfgFile = cfgFile;
            this.Text = "Edit Reputations: " + gameData.GetItemDescByNickNameX(itemNickName);

            GameDataSet.HashListRow[] factions = (GameDataSet.HashListRow[])gameData.DataStore.HashList.Select("ItemType = '" + FLGameData.GAMEDATA_FACTIONS + "'");
            foreach (GameDataSet.HashListRow faction in factions)
            {
                uIDataSet.RepFixerItemFactions.AddRepFixerItemFactionsRow(faction.IDSName, faction.ItemNickName, "");
            }

            foreach (FLDataFile.Setting set in cfgFile.GetSettings(itemNickName))
            {
                string factionNick = set.settingName;

                string repStr = "-";
                if (set.NumValues() > 0)
                {
                    string[] values = set.Str(0).Split(',');
                    if (values.Length == 2)
                    {
                        int mode;
                        if (!Int32.TryParse(values[1], out mode))
                            repStr = "ERR";
                        else if (mode == MODE_REP_GREATERTHAN)
                            repStr = ">";
                        else if (mode == MODE_REP_STATIC)
                            repStr = "=";
                        else
                            repStr = "<";

                        float rep;
                        if (!Single.TryParse(values[0], out rep))
                            repStr = "ERR";
                        else if (rep > 1.0 || rep < -1.0)
                            repStr = "ERR";
                        else
                            repStr += rep.ToString();
                    }
                    else if (values.Length == 1)
                    {
                        float rep;
                        if (!Single.TryParse(values[0], out rep))
                            repStr = "ERR";
                        else if (rep > 1.0 || rep < -1.0)
                            repStr = "ERR";
                        repStr = "<" + rep.ToString();
                    }
                }

                foreach (UIDataSet.RepFixerItemFactionsRow faction in uIDataSet.RepFixerItemFactions.Rows)
                {
                    if (faction.ItemNickName == factionNick)
                    {
                        faction.Reputation = repStr;
                        break;
                    }
                }
            }
        }
示例#13
0
        void  BgWkr_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            bgWkr = null;

            buttonRepAddItem.Enabled  = true;
            buttonRepEditItem.Enabled = true;
            buttonRepDelItem.Enabled  = true;
            button3.Enabled           = true;
            buttonAddBase.Enabled     = true;
            buttonDelBase.Enabled     = true;
            buttonAddItem.Enabled     = true;
            buttonDelItem.Enabled     = true;
            buttonSave.Enabled        = true;
            buttonPurchaseRestrictionAddItem.Enabled   = true;
            buttonPurchaseRestrictionEdittem.Enabled   = true;
            buttonPurchaseRestrictionDelItem.Enabled   = true;
            buttonEquipPurchaseRestrictionAdd.Enabled  = true;
            buttonEquipPurchaseRestrictionEdit.Enabled = true;
            buttonEquipPurchaseRestrictionDel.Enabled  = true;
            buttonSysSensorEditItem.Enabled            = true;
            buttonSysSensorAddItem.Enabled             = true;
            buttonSysSensorDelItem.Enabled             = true;

            // Load our ini file
            try
            {
                cfgFilePath = Path.GetFullPath(cfgFilePath);
                cfgFile     = new FLDataFile(cfgFilePath, false);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error '" + ex.Message + "' occured when loading the configuration file. Using defaults.");
            }

            try
            {
                checkBoxEnableMoveChar.Checked       = cfgFile.GetSettingBool("General", "EnableMoveChar", true);
                checkBoxEnableRenameMe.Checked       = cfgFile.GetSettingBool("General", "EnableRenameMe", true);
                checkBoxEnablePimpShip.Checked       = cfgFile.GetSettingBool("General", "EnablePimpShip", true);
                checkBoxEnableRestart.Checked        = cfgFile.GetSettingBool("General", "EnableRestart", true);
                checkBoxEnableGiveCash.Checked       = cfgFile.GetSettingBool("General", "EnableGiveCash", true);
                checkBoxEnableDropRepAndMisc.Checked = cfgFile.GetSettingBool("General", "EnableDropRep", true);

                textBoxDropRepCost.Text = cfgFile.GetSettingStr("General", "RepDropCost", "350000");
                textBoxStuckMsg.Text    = cfgFile.GetSettingStr("General", "StuckMsg", "Attention! Stand clear. Towing %player");
                textBoxDiceMsg.Text     = cfgFile.GetSettingStr("General", "DiceMsg", "%player rolled %number");
                textBoxCoinMsg.Text     = cfgFile.GetSettingStr("General", "CoinMsg", "%player tossed %result");
                textBoxSmiteMusic.Text  = cfgFile.GetSettingStr("General", "SmiteMusic", "music_danger");

                textBoxDisconnectingPlayersRange.Text      = cfgFile.GetSettingStr("General", "DisconnectingPlayersRange", "5000");
                checkBoxReportDisconnectingPlayers.Checked = cfgFile.GetSettingBool("General", "ReportDisconnectingPlayers", true);
                checkBoxKillDisconnectingPlayers.Checked   = cfgFile.GetSettingBool("General", "KillDisconnectingPlayers", true);
                checkBoxLootDisconnectingPlayers.Checked   = cfgFile.GetSettingBool("General", "LootDisconnectingPlayers", true);

                textBoxHullDropFactor.Text     = cfgFile.GetSettingStr("General", "HullDropFactor", "0.0");
                textBoxCargoDropContainer.Text = cfgFile.GetSettingStr("General", "CargoDropContainer", "lootcrate_ast_loot_metal");
                textBoxHullDrop1NickName.Text  = cfgFile.GetSettingStr("General", "HullDrop1NickName", "commodity_super_alloys");
                textBoxHullDrop2NickName.Text  = cfgFile.GetSettingStr("General", "HullDrop2NickName", "commodity_engine_components");
                textBoxDisconnectMsg.Text      = cfgFile.GetSettingStr("General", "DisconnectMsg", "%player is attempting to engage cloaking device");

                textBoxSpinProtectMass.Text       = cfgFile.GetSettingStr("General", "SpinProtectionMass", "-1.0");
                textBoxSpinImpulseMultiplier.Text = cfgFile.GetSettingStr("General", "SpinProtectionMultiplier", "-8.0");

                checkBoxEnableEscort.Checked         = cfgFile.GetSettingBool("General", "EnableEscort", false);
                textBoxEscortedShipMinimumMass.Text  = cfgFile.GetSettingStr("General", "EscortedShipMinimumMass", "100000");
                textBoxEscortedShipDamageFactor.Text = cfgFile.GetSettingStr("General", "EscortedShipDamageFactor", "0.3");

                textBoxRestartMaxRank.Text = cfgFile.GetSettingStr("Restart", "MaxRank", "5");
                textBoxRestartMaxCash.Text = cfgFile.GetSettingStr("Restart", "MaxCash", "1000000");

                textBoxRenameCost.Text            = cfgFile.GetSettingStr("Rename", "RenameCost", "2000000");
                textBoxRenameTimeLimit.Text       = cfgFile.GetSettingStr("Rename", "RenameTimeLimit", "86400");
                textBoxMoveCost.Text              = cfgFile.GetSettingStr("Rename", "MoveCost", "2000000");
                checkBoxCharnameTag.Checked       = cfgFile.GetSettingBool("Rename", "CharnameTag", false);
                textBoxCharnameTagCost.Text       = cfgFile.GetSettingStr("Rename", "MakeTagCost", "50000000");
                checkBoxAsciiCharnameOnly.Checked = cfgFile.GetSettingBool("Rename", "AsciiCharnameOnly", false);


                textBoxMinTransfer.Text   = cfgFile.GetSettingStr("GiveCash", "MinTransfer", "100000");
                textBoxMinTime.Text       = cfgFile.GetSettingStr("GiveCash", "MinTime", "3600");
                textBoxBlockedSystem.Text = cfgFile.GetSettingStr("GiveCash", "BlockedSystem", "iw09");

                textBoxPimpShipCost.Text = cfgFile.GetSettingStr("ShipPimper", "cost", "2000000");
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("ShipPimper", "equip"))
                {
                    string[] args = set.Str(0).Split(',');
                    if (args.Length > 0)
                    {
                        GameDataSet.HashListRow item = gameData.GetItemByNickName(args[0]);
                        if (item != null)
                        {
                            uIDataSet.ShipPimperItemList.AddShipPimperItemListRow(item.IDSName, item.ItemNickName, item.ItemHash, item.IDSInfo, item.IDSInfo1);
                        }
                    }
                }

                foreach (FLDataFile.Setting set in cfgFile.GetSettings("ShipPimper", "room"))
                {
                    GameDataSet.HashListRow item = gameData.GetItemByNickName(set.Str(0));
                    if (item != null)
                    {
                        uIDataSet.ShipPimperBaseList.AddShipPimperBaseListRow(item.IDSName, item.ItemNickName, item.ItemHash, item.IDSInfo, item.IDSInfo1);
                    }
                }

                checkBoxEnableRepFixUpdates.Checked = cfgFile.GetSettingBool("RepFixer", "EnableRepFixUpdates", true);
                checkBoxLogRepFixUpdates.Checked    = cfgFile.GetSettingBool("RepFixer", "LogRepFixUpdates", true);
                checkBoxItemMustBeMounted.Checked   = cfgFile.GetSettingBool("RepFixer", "ItemMustBeMounted", true);

                foreach (FLDataFile.Setting set in cfgFile.GetSettings("RepFixerItems"))
                {
                    GameDataSet.HashListRow item = gameData.GetItemByNickName(set.settingName);
                    if (item != null)
                    {
                        uIDataSet.RepFixerItemList.AddRepFixerItemListRow(item.IDSName, item.ItemNickName, item.ItemHash, item.IDSInfo, item.IDSInfo1);
                    }
                }

                checkBoxCheckIDRestrictions.Checked   = cfgFile.GetSettingBool("PurchaseRestrictions", "CheckIDRestrictions", false);
                checkBoxEnforceIDRestrictions.Checked = cfgFile.GetSettingBool("PurchaseRestrictions", "EnforceIDRestrictions", false);
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("ShipItemRestrictions"))
                {
                    GameDataSet.HashListRow shipItem    = gameData.GetItemByNickName(set.settingName);
                    GameDataSet.HashListRow controlItem = gameData.GetItemByNickName(set.Str(0));
                    if (shipItem != null && controlItem != null)
                    {
                        uIDataSet.ShipPurchaseRestrictionItems.AddShipPurchaseRestrictionItemsRow(shipItem.IDSName, shipItem.ItemNickName, controlItem.IDSName, controlItem.ItemNickName);
                    }
                }

                foreach (FLDataFile.Setting set in cfgFile.GetSettings("GoodItemRestrictions"))
                {
                    GameDataSet.HashListRow equipItem   = gameData.GetItemByNickName(set.settingName);
                    GameDataSet.HashListRow controlItem = gameData.GetItemByNickName(set.Str(0));
                    if (equipItem != null && controlItem != null)
                    {
                        uIDataSet.EquipPurchaseRestrictionItems.AddEquipPurchaseRestrictionItemsRow(equipItem.IDSName, equipItem.ItemNickName, controlItem.IDSName, controlItem.ItemNickName);
                    }
                }

                foreach (FLDataFile.Setting set in cfgFile.GetSettings("NoBuy"))
                {
                    GameDataSet.HashListRow baseItem = gameData.GetItemByNickName(set.settingName);
                    GameDataSet.HashListRow goodItem = gameData.GetItemByNickName(set.Str(0));
                    if (baseItem != null && goodItem != null)
                    {
                        uIDataSet.BaseGoodNoBuyList.AddBaseGoodNoBuyListRow(baseItem.IDSName, baseItem.ItemNickName, goodItem.IDSName, goodItem.ItemNickName);
                    }
                }

                foreach (FLDataFile.Setting set in cfgFile.GetSettings("SystemSensor"))
                {
                    GameDataSet.HashListRow sysItem = gameData.GetItemByNickName(set.settingName);
                    string[] args = set.Str(0).Split(',');
                    if (args.Length > 0)
                    {
                        GameDataSet.HashListRow equipItem = gameData.GetItemByNickName(args[0]);
                        uint networkID = 1;
                        if (args.Length > 1)
                        {
                            networkID = UInt32.Parse(args[1]);
                        }
                        if (sysItem != null && equipItem != null)
                        {
                            uIDataSet.SysSensorList.AddSysSensorListRow(sysItem.IDSName, sysItem.ItemNickName, equipItem.IDSName, equipItem.ItemNickName, networkID);
                        }
                    }
                }

                checkBoxCustomHelp.Checked = cfgFile.GetSettingBool("Message", "CustomHelp", true);
                checkBoxCmdEcho.Checked    = cfgFile.GetSettingBool("Message", "CmdEcho", true);
                checkBoxCmdHide.Checked    = cfgFile.GetSettingBool("Message", "CmdHide", true);
                textBoxCmdEchoStyle.Text   = cfgFile.GetSettingStr("Message", "CmdEchoStyle", "0x00AA0090");

                richTextBoxHelpLines.Clear();
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("Help"))
                {
                    richTextBoxHelpLines.AppendText(set.settingName);
                    richTextBoxHelpLines.AppendText("\n");
                }

                richTextBoxSwearWords.Clear();
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("SwearWords"))
                {
                    richTextBoxSwearWords.AppendText(set.Str(0));
                    richTextBoxSwearWords.AppendText("\n");
                }

                richTextBoxGreetingBannerLines.Clear();
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("GreetingBanner"))
                {
                    richTextBoxGreetingBannerLines.AppendText(set.Str(0));
                    richTextBoxGreetingBannerLines.AppendText("\n");
                }

                textBoxSpecialBannerDelay.Text  = cfgFile.GetSettingStr("Message", "SpecialBannerDelay", "3000");
                textBoxStandardBannerDelay.Text = cfgFile.GetSettingStr("Message", "StandardBannerDelay", "1200");

                richTextBoxSpecialBannerLines.Clear();
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("SpecialBanner"))
                {
                    richTextBoxSpecialBannerLines.AppendText(set.Str(0));
                    richTextBoxSpecialBannerLines.AppendText("\n");
                }

                uIDataSet.StandardBannerList.Clear();
                foreach (FLDataFile.Section sect in cfgFile.sections)
                {
                    if (sect.sectionName == "StandardBanner")
                    {
                        StringBuilder sb = new StringBuilder();
                        foreach (FLDataFile.Setting set in sect.settings)
                        {
                            sb.AppendLine(set.Str(0));
                        }
                        uIDataSet.StandardBannerList.AddStandardBannerListRow(sb.ToString());
                    }
                }

                checkBoxEnableLoginSound.Checked = cfgFile.GetSettingBool("General", "EnableLoginSound", false);
                richTextBoxSounds.Clear();
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("Sounds"))
                {
                    richTextBoxSounds.AppendText(set.Str(0));
                    richTextBoxSounds.AppendText("\n");
                }
                if (richTextBoxSounds.TextLength == 0)
                {
                    richTextBoxSounds.AppendText(
                        "dx_s075x_03a03_or_pilot_03\n" +
                        "dx_s032a_01a01_hvis_xtr_1\n" +
                        "dx_s075x_03a01_or_pilot_01\n" +
                        "dx_s075x_03a02_or_pilot_02\n" +
                        "dx_s003x_0801_trent\n" +
                        "dx_s003x_0802_trent\n" +
                        "dx_s004x_1302_juni\n" +
                        "dx_s009d_0101_trent\n" +
                        "dx_s071c_0101_trent"
                        );
                }

                checkBoxEnableWardrobe.Checked = cfgFile.GetSettingBool("General", "EnableWardrobe", false);
                richTextBoxHeads.Clear();
                richTextBoxBodies.Clear();
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("Wardrobe"))
                {
                    if (set.settingName == "head")
                    {
                        richTextBoxHeads.AppendText(set.Str(0));
                        richTextBoxHeads.AppendText("\n");
                    }
                    else if (set.settingName == "body")
                    {
                        richTextBoxBodies.AppendText(set.Str(0));
                        richTextBoxBodies.AppendText("\n");
                    }
                }
                if (richTextBoxHeads.TextLength == 0)
                {
                    richTextBoxHeads.AppendText("monkey, sh_male5_head");
                }
                if (richTextBoxBodies.TextLength == 0)
                {
                    richTextBoxBodies.AppendText("orillion, pi_orillion_body");
                }

                checkBoxEnableMe.Checked = cfgFile.GetSettingBool("General", "EnableMe", false);
                checkBoxEnableDo.Checked = cfgFile.GetSettingBool("General", "EnableDo", false);

                checkBoxEnableRestartCost.Checked = cfgFile.GetSettingBool("General", "EnableRestartCost", false);
                richTextBoxRestarts.Clear();
                foreach (FLDataFile.Setting set in cfgFile.GetSettings("Restart"))
                {
                    if (set.settingName == "restart")
                    {
                        richTextBoxRestarts.AppendText(set.Str(0));
                        richTextBoxRestarts.AppendText("\n");
                    }
                }
                if (richTextBoxRestarts.TextLength == 0)
                {
                    richTextBoxRestarts.AppendText("zoner, 10000");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error '" + ex.Message + "' occured when parsing the configuration file.");
            }
        }