implemented the ability to create hat reskins

This commit is contained in:
Bitl 2020-01-04 16:16:01 -07:00
parent dd28e4e957
commit 28a5eba968
3 changed files with 100 additions and 26 deletions

View File

@ -25,17 +25,17 @@ public static class RobloxXMLLocalizer
Pants Pants
} }
public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, string name = "") public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, string name = "", string meshname = "")
{ {
DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[0], assetdef.Ext[0], assetdef.Dir[0], assetdef.GameDir[0], name); DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[0], assetdef.Ext[0], assetdef.Dir[0], assetdef.GameDir[0], name, meshname);
} }
public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, int idIndex, int extIndex, int outputPathIndex, int inGameDirIndex, string name = "") public static void DownloadFromNodes(string filepath, AssetCacheDef assetdef, int idIndex, int extIndex, int outputPathIndex, int inGameDirIndex, string name = "", string meshname = "")
{ {
DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex], name); DownloadFromNodes(filepath, assetdef.Class, assetdef.Id[idIndex], assetdef.Ext[extIndex], assetdef.Dir[outputPathIndex], assetdef.GameDir[inGameDirIndex], name, meshname);
} }
public static void DownloadFromNodes(string filepath, string itemClassValue, string itemIdValue, string fileext, string outputPath, string inGameDir, string name = "") public static void DownloadFromNodes(string filepath, string itemClassValue, string itemIdValue, string fileext, string outputPath, string inGameDir, string name = "", string meshname = "")
{ {
string oldfile = File.ReadAllText(filepath); string oldfile = File.ReadAllText(filepath);
string fixedfile = RemoveInvalidXmlChars(ReplaceHexadecimalSymbols(oldfile)); string fixedfile = RemoveInvalidXmlChars(ReplaceHexadecimalSymbols(oldfile));
@ -62,24 +62,30 @@ public static class RobloxXMLLocalizer
{ {
if (!item3.Value.Contains("rbxasset")) if (!item3.Value.Contains("rbxasset"))
{ {
//do whatever with your value if (string.IsNullOrWhiteSpace(meshname))
string url = item3.Value;
string urlFixed = url.Replace("&", "&").Replace("amp;", "&");
string peram = "id=";
if (string.IsNullOrWhiteSpace(name))
{ {
if (urlFixed.Contains(peram)) string url = item3.Value;
string urlFixed = url.Replace("&", "&").Replace("amp;", "&");
string peram = "id=";
if (string.IsNullOrWhiteSpace(name))
{ {
string IDVal = urlFixed.After(peram); if (urlFixed.Contains(peram))
DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal); {
item3.Value = inGameDir + IDVal + fileext; string IDVal = urlFixed.After(peram);
DownloadFilesFromNode(urlFixed, outputPath, fileext, IDVal);
item3.Value = inGameDir + IDVal + fileext;
}
}
else
{
DownloadFilesFromNode(urlFixed, outputPath, fileext, name);
item3.Value = inGameDir + name + fileext;
} }
} }
else else
{ {
DownloadFilesFromNode(urlFixed, outputPath, fileext, name); item3.Value = inGameDir + meshname;
item3.Value = inGameDir + name + fileext;
} }
} }
} }

View File

@ -35,13 +35,16 @@
this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker(); this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
this.textBox1 = new System.Windows.Forms.TextBox(); this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label(); this.label1 = new System.Windows.Forms.Label();
this.comboBox2 = new System.Windows.Forms.ComboBox();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.SuspendLayout(); this.SuspendLayout();
// //
// button1 // button1
// //
this.button1.Location = new System.Drawing.Point(12, 65); this.button1.Location = new System.Drawing.Point(12, 101);
this.button1.Name = "button1"; this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(240, 21); this.button1.Size = new System.Drawing.Size(254, 21);
this.button1.TabIndex = 0; this.button1.TabIndex = 0;
this.button1.Text = "Browse and Localize Asset"; this.button1.Text = "Browse and Localize Asset";
this.button1.UseVisualStyleBackColor = true; this.button1.UseVisualStyleBackColor = true;
@ -60,17 +63,17 @@
"Shirt", "Shirt",
"T-Shirt", "T-Shirt",
"Pants"}); "Pants"});
this.comboBox1.Location = new System.Drawing.Point(12, 12); this.comboBox1.Location = new System.Drawing.Point(81, 12);
this.comboBox1.Name = "comboBox1"; this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(240, 21); this.comboBox1.Size = new System.Drawing.Size(185, 21);
this.comboBox1.TabIndex = 1; this.comboBox1.TabIndex = 1;
this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged); this.comboBox1.SelectedIndexChanged += new System.EventHandler(this.comboBox1_SelectedIndexChanged);
// //
// label2 // label2
// //
this.label2.Location = new System.Drawing.Point(12, 96); this.label2.Location = new System.Drawing.Point(12, 132);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(240, 13); this.label2.Size = new System.Drawing.Size(254, 13);
this.label2.TabIndex = 3; this.label2.TabIndex = 3;
this.label2.Text = "Idle"; this.label2.Text = "Idle";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@ -87,7 +90,7 @@
// //
this.textBox1.Location = new System.Drawing.Point(140, 39); this.textBox1.Location = new System.Drawing.Point(140, 39);
this.textBox1.Name = "textBox1"; this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(112, 20); this.textBox1.Size = new System.Drawing.Size(126, 20);
this.textBox1.TabIndex = 4; this.textBox1.TabIndex = 4;
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
// //
@ -100,12 +103,45 @@
this.label1.TabIndex = 5; this.label1.TabIndex = 5;
this.label1.Text = "Asset Name (Items Only):"; this.label1.Text = "Asset Name (Items Only):";
// //
// comboBox2
//
this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox2.FormattingEnabled = true;
this.comboBox2.Items.AddRange(new object[] {
"None"});
this.comboBox2.Location = new System.Drawing.Point(140, 65);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(126, 21);
this.comboBox2.TabIndex = 6;
this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.comboBox2_SelectedIndexChanged);
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 68);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(118, 13);
this.label3.TabIndex = 7;
this.label3.Text = "Uses Mesh (Hats Only):";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(12, 15);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(63, 13);
this.label4.TabIndex = 8;
this.label4.Text = "Asset Type:";
//
// AssetLocalizer // AssetLocalizer
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.SystemColors.ControlLightLight; this.BackColor = System.Drawing.SystemColors.ControlLightLight;
this.ClientSize = new System.Drawing.Size(264, 118); this.ClientSize = new System.Drawing.Size(278, 154);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.comboBox2);
this.Controls.Add(this.label1); this.Controls.Add(this.label1);
this.Controls.Add(this.textBox1); this.Controls.Add(this.textBox1);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
@ -131,5 +167,8 @@
private System.ComponentModel.BackgroundWorker backgroundWorker1; private System.ComponentModel.BackgroundWorker backgroundWorker1;
private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox comboBox2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
} }
} }

View File

@ -16,6 +16,7 @@ namespace NovetusLauncher
private RobloxXMLLocalizer.DLType currentType; private RobloxXMLLocalizer.DLType currentType;
private string path; private string path;
private string name; private string name;
private string meshname;
public AssetLocalizer() public AssetLocalizer()
{ {
@ -77,6 +78,22 @@ namespace NovetusLauncher
private void AssetLocalizer_Load(object sender, EventArgs e) private void AssetLocalizer_Load(object sender, EventArgs e)
{ {
comboBox1.SelectedItem = "RBXL"; comboBox1.SelectedItem = "RBXL";
comboBox2.SelectedItem = "None";
if (Directory.Exists(GlobalVars.hatdirFonts))
{
DirectoryInfo dinfo = new DirectoryInfo(GlobalVars.hatdirFonts);
FileInfo[] Files = dinfo.GetFiles("*.mesh");
foreach (FileInfo file in Files)
{
if (file.Name.Equals(String.Empty))
{
continue;
}
comboBox2.Items.Add(file.Name);
}
}
if (!Directory.Exists(GlobalVars.AssetCacheDirFonts)) if (!Directory.Exists(GlobalVars.AssetCacheDirFonts))
{ {
@ -379,7 +396,7 @@ namespace NovetusLauncher
case RobloxXMLLocalizer.DLType.Hat: case RobloxXMLLocalizer.DLType.Hat:
//meshes //meshes
worker.ReportProgress(0); worker.ReportProgress(0);
RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemHatFonts, name); RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemHatFonts, name, meshname);
RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemHatFonts, 1, 1, 1, 1, name); RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemHatFonts, 1, 1, 1, 1, name);
worker.ReportProgress(25); worker.ReportProgress(25);
RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemHatSound); RobloxXMLLocalizer.DownloadFromNodes(path, GlobalVars.ItemHatSound);
@ -464,5 +481,17 @@ namespace NovetusLauncher
{ {
name = textBox1.Text; name = textBox1.Text;
} }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox2.SelectedItem.ToString() == "None")
{
meshname = "";
}
else
{
meshname = comboBox2.SelectedItem.ToString();
}
}
} }
} }