xytext fix and clarity refactoring

This commit is contained in:
Kurt
2015-04-07 00:02:29 -07:00
parent 55172aa441
commit e2201ab6fb
5 changed files with 51 additions and 53 deletions

View File

@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Media;

View File

@@ -108,25 +108,23 @@ private void changeIndex(object sender, EventArgs e)
bool dumping;
private void getEntry()
{
if (loaded)
if (!loaded) return;
if (Main.oras && entry == 384 && !dumping) // Current Mon is Rayquaza
Util.Alert("Rayquaza is special and uses a different activator for its evolution. If it knows Dragon Ascent, it can Mega Evolve", "Don't edit its evolution table if you want to keep this functionality.");
byte[] data = File.ReadAllBytes(files[entry]);
foreach (ComboBox CB in forme_spec)
Personal.setForms(entry, CB, AltForms);
for (int i = 0; i < 3; i++)
{
if (Main.oras && entry == 384 && !dumping) // Current Mon is Rayquaza
Util.Alert("Rayquaza is special and uses a different activator for its evolution. If it knows Dragon Ascent, it can Mega Evolve", "Don't edit its evolution table if you want to keep this functionality.");
byte[] data = File.ReadAllBytes(files[entry]);
foreach (ComboBox CB in forme_spec)
Personal.setForms(entry, CB, AltForms);
for (int i = 0; i < 3; i++)
{
ushort method = BitConverter.ToUInt16(data, 2 + (i * 8));
ushort form = BitConverter.ToUInt16(data, i * 8);
int item = BitConverter.ToUInt16(data, 4 + i * 8);
checkbox_spec[i].Checked = (method == 1);
forme_spec[i].SelectedIndex = form;
item_spec[i].SelectedValue = item;
}
ushort method = BitConverter.ToUInt16(data, 2 + (i * 8));
ushort form = BitConverter.ToUInt16(data, i * 8);
int item = BitConverter.ToUInt16(data, 4 + i * 8);
checkbox_spec[i].Checked = (method == 1);
forme_spec[i].SelectedIndex = form;
item_spec[i].SelectedValue = item;
}
}
private void setEntry()
@@ -156,27 +154,8 @@ private void setEntry()
private void Update_PBs(object sender, EventArgs e)
{
if (loaded)
{
for (int i = 0; i < checkbox_spec.Length; i++)
{
CheckBox CB = checkbox_spec[i];
if (CB.Checked)
{
UpdateImage(picturebox_spec[0][i], entry, 0, (int)(item_spec[i]).SelectedValue, 0);
UpdateImage(picturebox_spec[1][i], entry, (forme_spec[i]).SelectedIndex, (int)(item_spec[i]).SelectedValue, 0);
}
else
{
UpdateImage(picturebox_spec[0][i], 0, 0, (int)(item_spec[i]).SelectedValue, 0);
UpdateImage(picturebox_spec[1][i], 0, 0, (int)(item_spec[i]).SelectedValue, 0);
}
}
}
}
private void Update_PBs(int i)
{
if (loaded)
if (!loaded) return;
for (int i = 0; i < checkbox_spec.Length; i++)
{
CheckBox CB = checkbox_spec[i];
if (CB.Checked)
@@ -191,6 +170,22 @@ private void Update_PBs(int i)
}
}
}
private void Update_PBs(int i)
{
if (!loaded) return;
CheckBox CB = checkbox_spec[i];
if (CB.Checked)
{
UpdateImage(picturebox_spec[0][i], entry, 0, (int)(item_spec[i]).SelectedValue, 0);
UpdateImage(picturebox_spec[1][i], entry, (forme_spec[i]).SelectedIndex, (int)(item_spec[i]).SelectedValue, 0);
}
else
{
UpdateImage(picturebox_spec[0][i], 0, 0, (int)(item_spec[i]).SelectedValue, 0);
UpdateImage(picturebox_spec[1][i], 0, 0, (int)(item_spec[i]).SelectedValue, 0);
}
}
private void UpdateImage(PictureBox bpkx, int species, int form, int item, int gender)
{

View File

@@ -509,7 +509,9 @@ private void Setup()
CB_Battle_Type.Items.Add("Rotation");
CB_Battle_Type.Items.Add("Horde");
megaEvos = (Main.oras) ? new[] { 15, 18, 80, 208, 254, 260, 302, 319, 323, 334, 362, 373, 376, 380, 381, 428, 475, 531, 719, 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 } : new[] { 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 };
megaEvos = (Main.oras)
? new[] { 15, 18, 80, 208, 254, 260, 302, 319, 323, 334, 362, 373, 376, 380, 381, 428, 475, 531, 719, 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 }
: new[] { 3, 6, 9, 65, 94, 115, 127, 130, 142, 150, 181, 212, 214, 229, 248, 257, 282, 303, 306, 308, 310, 354, 359, 445, 448, 460 };
CB_TrainerID.SelectedIndex = 1;
start = false;

View File

@@ -48,7 +48,9 @@ private void B_Save_Click(object sender, EventArgs e)
if (CHK_StoryMEvos.Checked)
{
RSTE.rEnsureMEvo = Main.oras ? (new int[] { 178, 235, 557, 583, 687, 698, 699, 700, 701, 713, 906, 907, 908, 909, 910, 911, 912, 913, 942, 944, 946 }) : (new int[] { 188, 263, 276, 277, 519, 520, 521, 526, 599, 600, 601 });
RSTE.rEnsureMEvo = Main.oras
? (new [] { 178, 235, 557, 583, 687, 698, 699, 700, 701, 713, 906, 907, 908, 909, 910, 911, 912, 913, 942, 944, 946 })
: (new [] { 188, 263, 276, 277, 519, 520, 521, 526, 599, 600, 601 });
}
else
{

View File

@@ -36,16 +36,16 @@ private void dumpTXT_Click(object sender, EventArgs e)
tw.WriteLine("~~~~~~~~~~~~~~~");
tw.WriteLine("Text File : " + i);
tw.WriteLine("~~~~~~~~~~~~~~~");
if (data != null)
foreach (string line in data)
{
tw.WriteLine(newline
? line.Replace("\\n\\n", " ")
.Replace("\\n", " ")
.Replace("\\c", "")
.Replace("\\r", "")
: line);
}
if (data == null) continue;
foreach (string line in data)
{
tw.WriteLine(newline
? line.Replace("\\n\\n", " ")
.Replace("\\n", " ")
.Replace("\\c", "")
.Replace("\\r", "")
: line);
}
}
File.WriteAllBytes(path, ms.ToArray());
}
@@ -260,7 +260,7 @@ internal static byte[] getBytesForFile(string[] lines)
else if (val == 0x2640) val = 0xE08F; // ♀
// Variables
else if (val == '[' || val == '\\') // Variable
if (val == '[' || val == '\\') // Variable
encryptVar(bz, lines[i], ref j, ref key);
// Text