Ejemplo n.º 1
0
 /// <summary>
 /// Add the selected item to the parent's cargo table.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void okButton_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in dataGridView1.SelectedRows)
     {
         GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
         dataTable.AddBaseGoodNoBuyListRow(gameData.GetItemDescByHash(dataRow.ItemHash), dataRow.ItemNickName, "", "");
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Add the selected item to the parent's cargo table.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void okButton_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in dataGridView1.SelectedRows)
     {
         GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
         textBox.Text = dataRow.ItemNickName;
         break;
     }
     this.Close();
 }
 /// <summary>
 /// Add the selected item to the parent's cargo table.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void okButton_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in dataGridView1.SelectedRows)
     {
         GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
         dataItem.ControlDescription  = dataRow.IDSName;
         dataItem.ControlItemNickName = dataRow.ItemNickName;
         this.Close();
     }
 }
 /// <summary>
 /// Add the selected item to the parent's cargo table.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void okButton_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in dataGridView1.SelectedRows)
     {
         GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
         dataItem.EquipDescription = dataRow.IDSName;
         dataItem.EquipNickName    = dataRow.ItemNickName;
         dataItem.NetworkID        = (uint)numericUpDown1.Value;
         this.Close();
     }
 }
Ejemplo n.º 5
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            if (csItemGrid.SelectedRows.Count != 1)
            {
                return;
            }

            GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)csItemGrid.SelectedRows[0].DataBoundItem).Row;
            charFile.AddSetting("Player", "ship_archetype", new object[] { dataRow.ItemHash });
            appServices.SaveCharFile(charFile);
            this.Close();
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Add the selected item to the parent's cargo table.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void okButton_Click(object sender, EventArgs e)
 {
     foreach (DataGridViewRow row in dataGridView1.SelectedRows)
     {
         GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
         if (dataTable.FindByItemHash(dataRow.ItemHash) == null)
         {
             dataTable.AddRepFixerItemListRow(gameData.GetItemDescByHash(dataRow.ItemHash),
                                              dataRow.ItemNickName, dataRow.ItemHash, dataRow.IDSInfo, dataRow.IDSInfo1);
         }
     }
 }
Ejemplo n.º 7
0
        private void ChangeLocationWindow_Load(object sender, EventArgs e)
        {
            // Select the row that the player is currently at
            if (charFiles.Count == 1 && charFiles[0].SettingExists("Player", "base") &&
                charFiles[0].SettingExists("Player", "last_base"))
            {
                checkBox2.Checked = false;

                string currentBaseNick = charFiles[0].GetSetting("Player", "last_base").Str(0);
                foreach (DataGridViewRow row in dataGridViewBase.Rows)
                {
                    GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
                    if (dataRow.ItemNickName == currentBaseNick)
                    {
                        row.Selected = true;
                        dataGridViewBase.FirstDisplayedScrollingRowIndex = row.Index;
                        break;
                    }
                }
            }


            if (charFiles[0] != null && charFiles[0].SettingExists("Player", "system") &&
                charFiles[0].SettingExists("Player", "pos"))
            {
                checkBox2.Checked = true;

                string currentSystemNick = charFiles[0].GetSetting("Player", "system").Str(0);
                foreach (DataGridViewRow row in dataGridViewSystem.Rows)
                {
                    GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
                    if (dataRow.ItemNickName == currentSystemNick)
                    {
                        row.Selected = true;
                        dataGridViewSystem.FirstDisplayedScrollingRowIndex = row.Index;
                        break;
                    }
                }

                textBoxPosX.Text = charFiles[0].GetSetting("Player", "pos").Str(0);
                textBoxPosY.Text = charFiles[0].GetSetting("Player", "pos").Str(1);
                textBoxPosZ.Text = charFiles[0].GetSetting("Player", "pos").Str(2);
            }
            else
            {
                textBoxPosX.Text = "0";
                textBoxPosY.Text = "100000";
                textBoxPosZ.Text = "100000";
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Return the ship string for the specified player
        /// </summary>
        /// <param name="gameData">The current game data.</param>
        /// <param name="charFile">The player's data file.</param>
        /// <returns>A string containing the ship name.</returns>
        public static string GetShip(FLGameData gameData, FLDataFile charFile, out Int64 shipArchType)
        {
            string nickNameOrHash = charFile.GetSetting("Player", "ship_archetype").Str(0);

            GameDataSet.HashListRow shipItem = gameData.GetItemByNickName(nickNameOrHash);
            if (shipItem != null)
            {
                shipArchType = shipItem.ItemHash;
            }
            else
            {
                shipArchType = charFile.GetSetting("Player", "ship_archetype").UInt(0);
            }
            return(gameData.GetItemDescByHash(shipArchType));
        }
 private void AddEquipmentWindow_Load(object sender, EventArgs e)
 {
     if (rowToEdit != null)
     {
         foreach (DataGridViewRow row in ceItemGrid.Rows)
         {
             GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
             if (dataRow.ItemHash == rowToEdit.itemHash)
             {
                 row.Selected = true;
                 ceItemGrid.FirstDisplayedScrollingRowIndex = row.Index;
                 break;
             }
         }
     }
 }
 private void AddCargoWindow_Load(object sender, EventArgs e)
 {
     if (rowToEdit != null)
     {
         foreach (DataGridViewRow row in itemGrid.Rows)
         {
             GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
             if (dataRow.ItemHash == rowToEdit.itemHash)
             {
                 numericUpDown1.Value = rowToEdit.itemCount;
                 row.Selected         = true;
                 itemGrid.FirstDisplayedScrollingRowIndex = row.Index;
                 break;
             }
         }
     }
 }
Ejemplo n.º 11
0
 /// <summary>
 /// Setup list of ships.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ChangeShipWindow_Load(object sender, EventArgs e)
 {
     // Select the row that the player is currently
     if (charFile.SettingExists("Player", "ship_archetype"))
     {
         uint currentShipHash = charFile.GetSetting("Player", "ship_archetype").UInt(0);
         foreach (DataGridViewRow row in csItemGrid.Rows)
         {
             GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
             if (dataRow.ItemHash == currentShipHash)
             {
                 row.Selected = true;
                 csItemGrid.FirstDisplayedScrollingRowIndex = row.Index;
                 break;
             }
         }
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Save the new location
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void saveButton_Click(object sender, EventArgs e)
        {
            if (dataGridViewBase.SelectedRows.Count != 1)
            {
                return;
            }
            foreach (FLDataFile charFile in charFiles)
            {
                foreach (DataGridViewRow row in dataGridViewBase.SelectedRows)
                {
                    GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
                    string baseNick   = dataRow.ItemNickName;
                    string systemNick = baseNick.Substring(0, 4);

                    charFile.AddSetting("Player", "base", new object[] { baseNick });
                    charFile.AddSetting("Player", "last_base", new object[] { baseNick });
                    charFile.AddSetting("Player", "system", new object[] { systemNick });
                    break;
                }

                if (checkBox2.Checked)
                {
                    foreach (DataGridViewRow row in dataGridViewSystem.SelectedRows)
                    {
                        GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
                        string systemNick = dataRow.ItemNickName;
                        charFile.DeleteSetting("Player", "base");
                        charFile.AddSetting("Player", "pos", new object[] { textBoxPosX.Text, textBoxPosY.Text, textBoxPosZ.Text });
                        charFile.AddSetting("Player", "rotation", new object[] { 0, 0, 0 });
                        charFile.AddSetting("Player", "system", new object[] { systemNick });
                        break;
                    }
                }
                else
                {
                    charFile.DeleteSetting("Player", "pos");
                    charFile.DeleteSetting("Player", "rotation");
                }

                appServices.SaveCharFile(charFile);
            }
            this.Close();
        }
        /// <summary>
        /// Add the selected item to the parent's cargo table.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void okButton_Click(object sender, EventArgs e)
        {
            foreach (DataGridViewRow row in itemGrid.SelectedRows)
            {
                GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
                if (rowToEdit != null)
                {
                    rowToEdit.itemDescription = gameData.GetItemDescByHash(dataRow.ItemHash);
                    rowToEdit.itemCount       = (uint)numericUpDown1.Value;
                    rowToEdit.itemHash        = dataRow.ItemHash;
                }
                else
                {
                    cargoTable.AddPICargoTableRow(gameData.GetItemDescByHash(dataRow.ItemHash),
                                                  (uint)numericUpDown1.Value, dataRow.ItemHash);
                }
            }

            this.Close();
        }
        /// <summary>
        /// Add the selected item to the parent's cargo table.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void okButton_Click(object sender, EventArgs e)
        {
            if (ceItemGrid.SelectedRows.Count != 1)
            {
                return;
            }

            foreach (DataGridViewRow row in ceItemGrid.SelectedRows)
            {
                GameDataSet.HashListRow dataRow = (GameDataSet.HashListRow)((DataRowView)row.DataBoundItem).Row;
                if (rowToEdit != null)
                {
                    rowToEdit.itemDescription = gameData.GetItemDescByHash(dataRow.ItemHash);
                    rowToEdit.itemHash        = dataRow.ItemHash;
                }
                else
                {
                    equipTable.AddPIEquipmentTableRow("*", gameData.GetItemDescByHash(dataRow.ItemHash), dataRow.ItemHash, "", "");
                }
            }

            this.Close();
        }
Ejemplo n.º 15
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.");
            }
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Read a CSV file and import ship purchase lines
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonImportShipPurchaseRestrictions_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog()
            {
                Filter = "CSV (*.csv)|*.csv|All Files|*.*",
                Title  = "Open CSV File"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    // We expect the first row to contain the ship nicknames and the first
                    // column to contain the id nicknames. The first field on the first row
                    // must be empty.
                    using (StreamReader sr = File.OpenText(dialog.FileName))
                    {
                        CsvStream cs = new CsvStream(sr);

                        Dictionary <int, List <GameDataSet.HashListRow> > shipItemsByCol = new Dictionary <int, List <GameDataSet.HashListRow> >();

                        List <string> shipTypeRow = cs.GetNextRow();
                        if (shipTypeRow == null)
                        {
                            throw new Exception("No ship type row found");
                        }

                        // Validate the nicknames in each field.
                        for (int col = 1; col < shipTypeRow.Count; col++)
                        {
                            List <GameDataSet.HashListRow> shipItems = new List <GameDataSet.HashListRow>();
                            foreach (string nickname in shipTypeRow[col].Split(','))
                            {
                                if (nickname.Length > 0)
                                {
                                    GameDataSet.HashListRow item = gameData.GetItemByNickName(nickname.Trim());
                                    if (item == null)
                                    {
                                        throw new Exception(String.Format("Item '{0}' not found", nickname));
                                    }
                                    if (item.ItemType != FLGameData.GAMEDATA_SHIPS)
                                    {
                                        throw new Exception(String.Format("Item '{0}' is not ship", nickname));
                                    }
                                    shipItems.Add(item);
                                }
                            }
                            shipItemsByCol.Add(col, shipItems);
                        }

                        List <string> row = cs.GetNextRow();
                        while (row != null)
                        {
                            // Extract and verify item nicknames for this row.
                            List <GameDataSet.HashListRow> controlItems = new List <GameDataSet.HashListRow>();
                            foreach (string nickname in row[0].Split(','))
                            {
                                if (nickname.Length > 0)
                                {
                                    GameDataSet.HashListRow item = gameData.GetItemByNickName(nickname.Trim());
                                    if (item == null)
                                    {
                                        throw new Exception(String.Format("Item '{0}' not found", nickname));
                                    }
                                    controlItems.Add(item);
                                }
                            }

                            // For all cell with a 1 in them add lines to data set.
                            for (int col = 1; col < row.Count; col++)
                            {
                                if (row[col] == "1")
                                {
                                    foreach (GameDataSet.HashListRow shipItem in shipItemsByCol[col])
                                    {
                                        foreach (GameDataSet.HashListRow controlItem in controlItems)
                                        {
                                            uIDataSet.ShipPurchaseRestrictionItems.AddShipPurchaseRestrictionItemsRow(shipItem.IDSName, shipItem.ItemNickName, controlItem.IDSName, controlItem.ItemNickName);
                                        }
                                    }
                                }
                            }

                            row = cs.GetNextRow();
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(this, "Error '" + ex.Message + "'", "Error");
                }
            }
        }