Minor cleanup

Change pk6 type ref to pk7 (removes Training Bags from pk7 property
list)
Move QR7 extra text to bottom line
Add placeholder pokefinder stat properties
This commit is contained in:
Kurt 2016-11-28 23:02:25 -08:00
parent 964265f305
commit f41149bb59
3 changed files with 74 additions and 27 deletions

View file

@ -11,16 +11,17 @@ namespace PKHeX
{
public partial class QR : Form
{
public PKM pkm;
private readonly PKM pkm;
private readonly Image icon;
private Image qr;
public Image qr;
public Image icon;
public string top;
public string bottom;
public string left;
public string right;
private readonly string Line1;
private readonly string Line2;
private readonly string Line3;
private readonly string Line4;
private string extraText;
public QR(Image qr, Image icon, string top, string bottom, string left, string right, PKM pk = null)
public QR(Image qr, Image icon, string line1, string line2, string line3, string line4, PKM pk = null)
{
InitializeComponent();
pkm = pk;
@ -29,17 +30,15 @@ namespace PKHeX
const int stretch = 50;
Height += stretch;
if (pkm != null && pkm.Format == 7)
{
if (pkm != null && pkm.Format == 7)
Height += 40;
}
this.qr = qr;
this.icon = icon;
this.top = top;
this.bottom = bottom;
this.left = left;
this.right = right;
Line1 = line1;
Line2 = line2;
Line3 = line3;
Line4 = line4;
if (pkm != null && pkm.Format == 7)
updateBoxSlotCopies(null, null);
@ -47,7 +46,7 @@ namespace PKHeX
RefreshImage();
}
public void RefreshImage()
private void RefreshImage()
{
Font font = Main.unicode ? FontLabel.Font : PKX.getPKXFont((float)8.25);
Image preview = new Bitmap(45, 45);
@ -65,10 +64,10 @@ namespace PKHeX
g.FillRectangle(new SolidBrush(Color.White), 0, 0, newpic.Width, newpic.Height);
g.DrawImage(pic, 0, 0);
g.DrawString(top, font, Brushes.Black, new PointF(18, qr.Height - 5));
g.DrawString(bottom, font, Brushes.Black, new PointF(18, qr.Height + 8));
g.DrawString(left.Replace(Environment.NewLine, "/").Replace("//", " ").Replace(":/", ": "), font, Brushes.Black, new PointF(18, qr.Height + 20));
g.DrawString(right, font, Brushes.Black, new PointF(18, qr.Height + 32));
g.DrawString(Line1, font, Brushes.Black, new PointF(18, qr.Height - 5));
g.DrawString(Line2, font, Brushes.Black, new PointF(18, qr.Height + 8));
g.DrawString(Line3.Replace(Environment.NewLine, "/").Replace("//", " ").Replace(":/", ": "), font, Brushes.Black, new PointF(18, qr.Height + 20));
g.DrawString(Line4 + extraText, font, Brushes.Black, new PointF(18, qr.Height + 32));
}
PB_QR.BackgroundImage = newpic;
}
@ -153,12 +152,10 @@ namespace PKHeX
var copies = (int) NUD_Copies.Value;
var new_qr = QR7.GenerateQRCode7((PK7)pkm, box, slot, copies);
qr = new_qr;
this.SuspendLayout();
var old_t = top;
top += $" (Box {box+1}, Slot {slot+1}, {copies} cop{(copies > 1 ? "ies" : "y")})";
SuspendLayout();
extraText = $" (Box {box+1}, Slot {slot+1}, {copies} cop{(copies > 1 ? "ies" : "y")})";
RefreshImage();
top = old_t;
this.ResumeLayout();
ResumeLayout();
}
}
}

View file

@ -195,7 +195,7 @@ namespace PKHeX
/* 23 */ // = 0x54400; // [100] FishingSpot
/* 24 */ // = 0x54600; // [10528] LiveMatchData
/* 25 */ // = 0x64C00; // [204] BattleSpotData
/* 26 */ // = 0x65000; // [B60] PokeFinderSave
/* 26 */ PokeFinderSave = 0x65000; // [B60] PokeFinderSave
/* 27 */ WondercardFlags = 0x65C00; // [3F50] MysteryGiftSave
/* 28 */ // = 0x69C00; // [358] Record
/* 29 */ // = 0x6A000; // [728] Data Block
@ -243,6 +243,7 @@ namespace PKHeX
private int ItemInfo { get; set; } = int.MinValue;
private int Overworld { get; set; } = int.MinValue;
private int JoinFestaData { get; set; } = int.MinValue;
private int PokeFinderSave { get; set; } = int.MinValue;
// Accessible as SAV7
public int TrainerCard { get; private set; } = 0x14000;
@ -465,6 +466,55 @@ namespace PKHeX
public ulong AlolaTime { get { return BitConverter.ToUInt64(Data, AdventureInfo + 0x48); } set { BitConverter.GetBytes(value).CopyTo(Data, AdventureInfo+0x48);} }
public ushort PokeFinderCameraVersion
{
get { return BitConverter.ToUInt16(Data, PokeFinderSave + 0x00); }
set { BitConverter.GetBytes(value).CopyTo(Data, PokeFinderSave + 0x00); }
}
public bool PokeFinderGyroFlag
{
get { return BitConverter.ToUInt16(Data, PokeFinderSave + 0x02) == 1; }
set { BitConverter.GetBytes((ushort)(value ? 1 : 0)).CopyTo(Data, PokeFinderSave + 0x04); }
}
public uint PokeFinderSnapCount
{
get { return BitConverter.ToUInt32(Data, PokeFinderSave + 0x04); }
set
{
if (value > 9999999) // Top bound is unchecked, check anyway
value = 9999999;
BitConverter.GetBytes(value).CopyTo(Data, PokeFinderSave + 0x04);
}
}
public uint PokeFinderThumbsTotalValue
{
get { return BitConverter.ToUInt32(Data, PokeFinderSave + 0x0C); }
set
{
BitConverter.GetBytes(value).CopyTo(Data, PokeFinderSave + 0x0C);
}
}
public uint PokeFinderThumbsHighValue
{
get { return BitConverter.ToUInt32(Data, PokeFinderSave + 0x10); }
set
{
if (value > 9999999) // 9mil;
value = 9999999;
BitConverter.GetBytes(value).CopyTo(Data, PokeFinderSave + 0x10);
if (value > PokeFinderThumbsTotalValue)
PokeFinderThumbsHighValue = value;
}
}
public ushort PokeFinderTutorialFlags
{
get { return BitConverter.ToUInt16(Data, PokeFinderSave + 0x14); }
set { BitConverter.GetBytes(value).CopyTo(Data, PokeFinderSave + 0x14); }
}
// Inventory
public override InventoryPouch[] Inventory
{

View file

@ -21,7 +21,7 @@ namespace PKHeX
private const string CONST_RAND = "$rand";
private const string CONST_SHINY = "$shiny";
private int currentFormat = -1;
private static readonly string[] pk7 = ReflectUtil.getPropertiesCanWritePublic(typeof(PK6)).OrderBy(i => i).ToArray();
private static readonly string[] pk7 = ReflectUtil.getPropertiesCanWritePublic(typeof(PK7)).OrderBy(i => i).ToArray();
private static readonly string[] pk6 = ReflectUtil.getPropertiesCanWritePublic(typeof(PK6)).OrderBy(i=>i).ToArray();
private static readonly string[] pk5 = ReflectUtil.getPropertiesCanWritePublic(typeof(PK5)).OrderBy(i=>i).ToArray();
private static readonly string[] pk4 = ReflectUtil.getPropertiesCanWritePublic(typeof(PK4)).OrderBy(i=>i).ToArray();