Transfer Commit

This commit is contained in:
Viaron
2014-08-06 20:29:53 -04:00
parent e3324de2ad
commit 64543d398d
25 changed files with 1799 additions and 0 deletions
+114
View File
@@ -0,0 +1,114 @@
namespace ProjectSWGScriptEditor.Editors
{
partial class BonusSetEditor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.scriptPathLbl = new System.Windows.Forms.Label();
this.scriptTreeView = new System.Windows.Forms.TreeView();
this.objectTemplateTb = new System.Windows.Forms.TextBox();
this.addRequiredItemBtn = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// scriptPathLbl
//
this.scriptPathLbl.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.scriptPathLbl.AutoSize = true;
this.scriptPathLbl.Location = new System.Drawing.Point(12, 271);
this.scriptPathLbl.Name = "scriptPathLbl";
this.scriptPathLbl.Size = new System.Drawing.Size(59, 13);
this.scriptPathLbl.TabIndex = 0;
this.scriptPathLbl.Text = "Script Path";
//
// scriptTreeView
//
this.scriptTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.scriptTreeView.Location = new System.Drawing.Point(12, 12);
this.scriptTreeView.Name = "scriptTreeView";
this.scriptTreeView.Size = new System.Drawing.Size(372, 256);
this.scriptTreeView.TabIndex = 1;
//
// objectTemplateTb
//
this.objectTemplateTb.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.objectTemplateTb.Location = new System.Drawing.Point(390, 12);
this.objectTemplateTb.Name = "objectTemplateTb";
this.objectTemplateTb.Size = new System.Drawing.Size(232, 20);
this.objectTemplateTb.TabIndex = 4;
this.objectTemplateTb.Text = "Object STF Name or Object Template";
//
// addRequiredItemBtn
//
this.addRequiredItemBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.addRequiredItemBtn.Location = new System.Drawing.Point(390, 38);
this.addRequiredItemBtn.Name = "addRequiredItemBtn";
this.addRequiredItemBtn.Size = new System.Drawing.Size(232, 23);
this.addRequiredItemBtn.TabIndex = 5;
this.addRequiredItemBtn.Text = "Add Required Item";
this.addRequiredItemBtn.UseVisualStyleBackColor = true;
this.addRequiredItemBtn.Click += new System.EventHandler(this.addRequiredItemBtn_Click);
//
// label1
//
this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.label1.Location = new System.Drawing.Point(390, 64);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(232, 204);
this.label1.TabIndex = 6;
this.label1.Text = "Warning:\r\nThis editor automically saves changes - please do not make a change wit" +
"hout being positive of the changes. \r\n\r\nThis is temporary.\r\n";
//
// BonusSetEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(634, 293);
this.Controls.Add(this.label1);
this.Controls.Add(this.addRequiredItemBtn);
this.Controls.Add(this.objectTemplateTb);
this.Controls.Add(this.scriptTreeView);
this.Controls.Add(this.scriptPathLbl);
this.Name = "BonusSetEditor";
this.Text = "Bonus Set Editor";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label scriptPathLbl;
private System.Windows.Forms.TreeView scriptTreeView;
private System.Windows.Forms.TextBox objectTemplateTb;
private System.Windows.Forms.Button addRequiredItemBtn;
private System.Windows.Forms.Label label1;
}
}
@@ -0,0 +1,79 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace ProjectSWGScriptEditor.Editors
{
public partial class BonusSetEditor : Form
{
public BonusSetEditor(string scriptPath)
{
InitializeComponent();
scriptPathLbl.Text = scriptPath;
loadScriptIntoForm();
if (!this.IsDisposed) this.Show();
}
private void loadScriptIntoForm()
{
scriptTreeView.Nodes.Clear();
string[] file = File.ReadAllLines(scriptPathLbl.Text);
TreeNode bonusSetNameNode = scriptTreeView.Nodes.Add("Set Name: ");
TreeNode requiredItemsNode = scriptTreeView.Nodes.Add("Required Items");
TreeNode bonusesNode = scriptTreeView.Nodes.Add("Bonuses");
try
{
for (int i = 0; i < file.Length; i++)
{
if (file[i].Contains("bonusSet = BonusSetTemplate"))
{
bonusSetNameNode.Text = "Set Name: " + file[i].Split('"')[1];
}
else if (file[i].Contains("bonusSet.addRequiredItem"))
{
requiredItemsNode.Nodes.Add(file[i].Split('"')[1]);
}
else if (file[i].Contains("if wornItems == "))
{
string requiredItemCount = file[i].Split('=')[2];
TreeNode bonusNode = bonusesNode.Nodes.Add(requiredItemCount);
int temp = i + 1;
while (!(file[temp].Contains("elif wornItems == ") || file[temp].Contains("else:")))
{
bonusNode.Nodes.Add(file[temp]);
temp++;
}
}
}
}
catch (Exception ex)
{
MessageBox.Show("The editor has encountered an error while trying to parse the selected script.");
this.Close();
}
}
private void addRequiredItemBtn_Click(object sender, EventArgs e)
{
List<String> file = File.ReadAllLines(scriptPathLbl.Text).ToList<String>();
foreach (string line in file)
{
if (line.Contains("bonusSet.addRequiredItem"))
{
file.Insert(file.IndexOf(line) + 1, "\tbonusSet.addRequiredItem(\"" + objectTemplateTb.Text + "\")");
File.WriteAllLines(scriptPathLbl.Text, file);
loadScriptIntoForm();
return;
}
}
}
}
}
@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
+220
View File
@@ -0,0 +1,220 @@
namespace ProjectSWGScriptEditor.Editors
{
partial class LootEditor
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tabControl1 = new System.Windows.Forms.TabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.lootPoolListbox = new System.Windows.Forms.ListBox();
this.lootPoolContentsDataView = new System.Windows.Forms.DataGridView();
this.itemName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.itemChance = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.listBox1 = new System.Windows.Forms.ListBox();
this.createLootPool = new System.Windows.Forms.Button();
this.deleteLootPool = new System.Windows.Forms.Button();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.lootPoolContentsDataView)).BeginInit();
this.tabPage2.SuspendLayout();
this.SuspendLayout();
//
// tabControl1
//
this.tabControl1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tabControl1.Controls.Add(this.tabPage1);
this.tabControl1.Controls.Add(this.tabPage2);
this.tabControl1.Location = new System.Drawing.Point(12, 12);
this.tabControl1.Name = "tabControl1";
this.tabControl1.SelectedIndex = 0;
this.tabControl1.Size = new System.Drawing.Size(714, 491);
this.tabControl1.TabIndex = 0;
//
// tabPage1
//
this.tabPage1.Controls.Add(this.splitContainer1);
this.tabPage1.Location = new System.Drawing.Point(4, 22);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(706, 465);
this.tabPage1.TabIndex = 0;
this.tabPage1.Text = "Loot Pools";
this.tabPage1.UseVisualStyleBackColor = true;
//
// splitContainer1
//
this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.splitContainer1.Location = new System.Drawing.Point(6, 6);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.deleteLootPool);
this.splitContainer1.Panel1.Controls.Add(this.createLootPool);
this.splitContainer1.Panel1.Controls.Add(this.lootPoolListbox);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.lootPoolContentsDataView);
this.splitContainer1.Size = new System.Drawing.Size(694, 453);
this.splitContainer1.SplitterDistance = 230;
this.splitContainer1.TabIndex = 2;
//
// lootPoolListbox
//
this.lootPoolListbox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lootPoolListbox.FormattingEnabled = true;
this.lootPoolListbox.Location = new System.Drawing.Point(3, 46);
this.lootPoolListbox.Name = "lootPoolListbox";
this.lootPoolListbox.Size = new System.Drawing.Size(224, 407);
this.lootPoolListbox.TabIndex = 0;
this.lootPoolListbox.SelectedIndexChanged += new System.EventHandler(this.lootPoolListbox_SelectedIndexChanged);
//
// lootPoolContentsDataView
//
this.lootPoolContentsDataView.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
this.lootPoolContentsDataView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.lootPoolContentsDataView.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.itemName,
this.itemChance});
this.lootPoolContentsDataView.Dock = System.Windows.Forms.DockStyle.Fill;
this.lootPoolContentsDataView.Location = new System.Drawing.Point(0, 0);
this.lootPoolContentsDataView.Name = "lootPoolContentsDataView";
this.lootPoolContentsDataView.Size = new System.Drawing.Size(460, 453);
this.lootPoolContentsDataView.TabIndex = 1;
this.lootPoolContentsDataView.CellValueChanged += new System.Windows.Forms.DataGridViewCellEventHandler(this.lootPoolContentsDataView_CellValueChanged);
this.lootPoolContentsDataView.RowsRemoved += new System.Windows.Forms.DataGridViewRowsRemovedEventHandler(this.lootPoolContentsDataView_RowsRemoved);
//
// itemName
//
this.itemName.HeaderText = "Item";
this.itemName.Name = "itemName";
this.itemName.ReadOnly = true;
//
// itemChance
//
this.itemChance.HeaderText = "Item Chance";
this.itemChance.Name = "itemChance";
//
// tabPage2
//
this.tabPage2.Controls.Add(this.listBox1);
this.tabPage2.Controls.Add(this.comboBox1);
this.tabPage2.Location = new System.Drawing.Point(4, 22);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(707, 415);
this.tabPage2.TabIndex = 1;
this.tabPage2.Text = "Loot Items";
this.tabPage2.UseVisualStyleBackColor = true;
//
// comboBox1
//
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Location = new System.Drawing.Point(6, 6);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 21);
this.comboBox1.TabIndex = 0;
//
// listBox1
//
this.listBox1.FormattingEnabled = true;
this.listBox1.Location = new System.Drawing.Point(7, 33);
this.listBox1.Name = "listBox1";
this.listBox1.Size = new System.Drawing.Size(120, 95);
this.listBox1.TabIndex = 1;
//
// createLootPool
//
this.createLootPool.Dock = System.Windows.Forms.DockStyle.Top;
this.createLootPool.Location = new System.Drawing.Point(0, 0);
this.createLootPool.Name = "createLootPool";
this.createLootPool.Size = new System.Drawing.Size(230, 23);
this.createLootPool.TabIndex = 1;
this.createLootPool.Text = "Create";
this.createLootPool.UseVisualStyleBackColor = true;
this.createLootPool.Click += new System.EventHandler(this.createLootPool_Click);
//
// deleteLootPool
//
this.deleteLootPool.Dock = System.Windows.Forms.DockStyle.Top;
this.deleteLootPool.Location = new System.Drawing.Point(0, 23);
this.deleteLootPool.Name = "deleteLootPool";
this.deleteLootPool.Size = new System.Drawing.Size(230, 23);
this.deleteLootPool.TabIndex = 2;
this.deleteLootPool.Text = "Delete";
this.deleteLootPool.UseVisualStyleBackColor = true;
//
// LootEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(738, 515);
this.Controls.Add(this.tabControl1);
this.Name = "LootEditor";
this.Text = "LootEditor";
this.tabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.lootPoolContentsDataView)).EndInit();
this.tabPage2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TabControl tabControl1;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.DataGridView lootPoolContentsDataView;
private System.Windows.Forms.ListBox lootPoolListbox;
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.DataGridViewTextBoxColumn itemName;
private System.Windows.Forms.DataGridViewTextBoxColumn itemChance;
private System.Windows.Forms.ListBox listBox1;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Button deleteLootPool;
private System.Windows.Forms.Button createLootPool;
}
}
@@ -0,0 +1,150 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace ProjectSWGScriptEditor.Editors
{
public partial class LootEditor : Form
{
string scriptPath;
bool ready = false;
public LootEditor(string scriptPath)
{
InitializeComponent();
this.scriptPath = scriptPath;
loadScriptIntoForm();
if (!this.IsDisposed) this.Show();
this.Activate();
}
private void loadScriptIntoForm()
{
string[] files = Directory.GetFiles(scriptPath + "/lootPools");
for (int i = 0; i < files.Length; i++)
{
lootPoolListbox.Items.Add(Path.GetFileNameWithoutExtension(files[i]));
}
}
private void parseLootGroup(string filepath)
{
lootPoolContentsDataView.Rows.Clear();
try
{
string[] file = File.ReadAllLines(filepath);
for (int i = 0; i < file.Length; i++)
{
string line = file[i].TrimStart();
if (line.Contains("itemNames()"))
{
line = file[i + 1];
line = line.Replace("return [", "");
line = line.Replace("]", "");
line = line.Replace("'", "");
string[] lineContents = line.Split(',');
for (int a = 0; a < lineContents.Length; a++)
{
lootPoolContentsDataView.Rows.Add(lineContents[a]);
}
}
if (line.Contains("itemChances()"))
{
line = file[i + 1];
line = line.Replace("return [", "");
line = line.Replace("]", "");
string[] lineContents = line.Split(',');
for (int a = 0; a < lineContents.Length; a++)
{
lootPoolContentsDataView.Rows[a].Cells[1].Value = lineContents[a];
}
}
}
int totalChance = 0;
for (int i = 0; i < lootPoolContentsDataView.Rows.Count - 1; i++)
{
totalChance += Int32.Parse((string) lootPoolContentsDataView.Rows[i].Cells[1].Value);
}
ready = true;
//lootPoolContentsDataView.Rows.Add("Total Items: " + (lootPoolContentsDataView.Rows.Count - 1), "Total Chance: " + totalChance);
}
catch (Exception ex)
{
MessageBox.Show("The editor has encountered an error while trying to parse the selected loot pool.");
}
}
public void saveLootGroupData()
{
string filePath = scriptPath + "/lootPools/" + lootPoolListbox.Text + ".py";
StringBuilder sbuilder = new StringBuilder();
sbuilder.AppendLine("def itemNames():");
sbuilder.Append("\treturn [");
for (int i = 0; i < lootPoolContentsDataView.Rows.Count - 1; i++)
{
if (lootPoolContentsDataView.Rows[i].Cells[0].Value == null) continue;
sbuilder.Append("'" + ((String)lootPoolContentsDataView.Rows[i].Cells[0].Value).TrimStart() + "'");
if (i < lootPoolContentsDataView.Rows.Count - 2) sbuilder.Append(",");
}
sbuilder.Append("]");
sbuilder.AppendLine();
sbuilder.AppendLine("def itemChances():");
sbuilder.Append("\treturn [");
for (int i = 0; i < lootPoolContentsDataView.Rows.Count - 1; i++)
{
if (lootPoolContentsDataView.Rows[i].Cells[1].Value == null) continue;
sbuilder.Append(((String)lootPoolContentsDataView.Rows[i].Cells[1].Value).TrimStart());
if (i < lootPoolContentsDataView.Rows.Count - 2) sbuilder.Append(",");
}
sbuilder.Append("]");
Console.WriteLine(filePath);
File.WriteAllText(filePath, sbuilder.ToString());
}
private void lootPoolListbox_SelectedIndexChanged(object sender, EventArgs e)
{
ready = false;
parseLootGroup(scriptPath + "/lootPools/" + lootPoolListbox.Text + ".py");
}
private void lootPoolContentsDataView_CellValueChanged(object sender, DataGridViewCellEventArgs e)
{
if(ready) saveLootGroupData();
}
private void lootPoolContentsDataView_RowsRemoved(object sender, DataGridViewRowsRemovedEventArgs e)
{
if (ready) saveLootGroupData();
}
private void createLootPool_Click(object sender, EventArgs e)
{
}
}
}
@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="itemName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="itemChance.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="itemName.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="itemChance.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>