Merge pull request #938 from pokecal/pokecal-patch-4

tip for stats,value about Refresh,small fix.
This commit is contained in:
Kaphotics 2017-03-13 09:01:20 -07:00 committed by GitHub
commit a3e62f6344
4 changed files with 77 additions and 2 deletions

View file

@ -178,6 +178,8 @@ namespace PKHeX.WinForms
this.L_PlazaName = new System.Windows.Forms.Label();
this.L_Vivillon = new System.Windows.Forms.Label();
this.CB_Vivillon = new System.Windows.Forms.ComboBox();
this.L_DaysFromRefreshed = new System.Windows.Forms.Label();
this.NUD_DaysFromRefreshed = new System.Windows.Forms.NumericUpDown();
this.TC_Editor.SuspendLayout();
this.Tab_Overview.SuspendLayout();
this.GB_Stats.SuspendLayout();
@ -206,6 +208,7 @@ namespace PKHeX.WinForms
((System.ComponentModel.ISupportInitialize)(this.NUD_RMStreak0)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_RCStreak0)).BeginInit();
this.Tab_Misc.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_DaysFromRefreshed)).BeginInit();
this.GB_PokeFinder.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_SnapCount)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.NUD_ThumbsRecord)).BeginInit();
@ -1590,6 +1593,8 @@ namespace PKHeX.WinForms
//
// Tab_Misc
//
this.Tab_Misc.Controls.Add(this.L_DaysFromRefreshed);
this.Tab_Misc.Controls.Add(this.NUD_DaysFromRefreshed);
this.Tab_Misc.Controls.Add(this.L_PlazaName);
this.Tab_Misc.Controls.Add(this.TB_PlazaName);
this.Tab_Misc.Controls.Add(this.CB_Fashion);
@ -1813,6 +1818,32 @@ namespace PKHeX.WinForms
this.CB_Vivillon.Size = new System.Drawing.Size(93, 20);
this.CB_Vivillon.TabIndex = 65;
//
// L_DaysFromRefreshed
//
this.L_DaysFromRefreshed.Location = new System.Drawing.Point(144, 28);
this.L_DaysFromRefreshed.Name = "L_DaysFromRefreshed";
this.L_DaysFromRefreshed.Size = new System.Drawing.Size(117, 18);
this.L_DaysFromRefreshed.TabIndex = 63;
this.L_DaysFromRefreshed.Text = "Days from Refreshed:";
this.L_DaysFromRefreshed.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// NUD_DaysFromRefreshed
//
this.NUD_DaysFromRefreshed.Location = new System.Drawing.Point(267, 30);
this.NUD_DaysFromRefreshed.Maximum = new decimal(new int[] {
255,
0,
0,
0});
this.NUD_DaysFromRefreshed.Name = "NUD_DaysFromRefreshed";
this.NUD_DaysFromRefreshed.Size = new System.Drawing.Size(42, 19);
this.NUD_DaysFromRefreshed.TabIndex = 64;
this.NUD_DaysFromRefreshed.Value = new decimal(new int[] {
255,
0,
0,
0});
//
// SAV_Trainer7
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1860,6 +1891,7 @@ namespace PKHeX.WinForms
((System.ComponentModel.ISupportInitialize)(this.NUD_RCStreak0)).EndInit();
this.Tab_Misc.ResumeLayout(false);
this.Tab_Misc.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_DaysFromRefreshed)).EndInit();
this.GB_PokeFinder.ResumeLayout(false);
this.GB_PokeFinder.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_SnapCount)).EndInit();
@ -2020,5 +2052,7 @@ namespace PKHeX.WinForms
private System.Windows.Forms.Label L_PlazaName;
private System.Windows.Forms.Label L_Vivillon;
private System.Windows.Forms.ComboBox CB_Vivillon;
private System.Windows.Forms.NumericUpDown NUD_DaysFromRefreshed;
private System.Windows.Forms.Label L_DaysFromRefreshed;
}
}

View file

@ -40,7 +40,7 @@ namespace PKHeX.WinForms
Loading = false;
}
private readonly ToolTip Tip1 = new ToolTip(), Tip2 = new ToolTip();
private readonly ToolTip Tip1 = new ToolTip(), Tip2 = new ToolTip(), Tip3 = new ToolTip();
private readonly bool Loading;
private bool MapUpdated;
private bool editing;
@ -190,6 +190,7 @@ namespace PKHeX.WinForms
TB_PlazaName.Text = SAV.FestivalPlazaName;
CB_Vivillon.SelectedIndex = (SAV.Vivillon < CB_Vivillon.Items.Count) ? SAV.Vivillon : -1;
NUD_DaysFromRefreshed.Value = Math.Min(NUD_DaysFromRefreshed.Maximum, SAV.DaysFromRefreshed);
}
private void save()
{
@ -275,6 +276,8 @@ namespace PKHeX.WinForms
// Vivillon
if (CB_Vivillon.SelectedIndex >= 0) SAV.Vivillon = CB_Vivillon.SelectedIndex;
SAV.DaysFromRefreshed = (byte)NUD_DaysFromRefreshed.Value;
}
private void clickOT(object sender, MouseEventArgs e)
@ -391,6 +394,7 @@ namespace PKHeX.WinForms
int offset = SAV.getRecordOffset(index);
L_Offset.Text = "Offset: 0x" + offset.ToString("X3");
updateTip(index, true);
editing = false;
}
private void changeStatVal(object sender, EventArgs e)
@ -398,6 +402,38 @@ namespace PKHeX.WinForms
if (editing) return;
int index = CB_Stats.SelectedIndex;
SAV.setRecord(index, (int)NUD_Stat.Value);
updateTip(index, false);
}
private void updateTip(int index, bool updateStats)
{
switch (index)
{
case 2: // Storyline Completed Time
int seconds = (int)(CAL_AdventureStartDate.Value - new DateTime(2000, 1, 1)).TotalSeconds;
seconds -= seconds % 86400;
seconds += (int)(CAL_AdventureStartTime.Value - new DateTime(2000, 1, 1)).TotalSeconds;
Tip3.SetToolTip(NUD_Stat, dateval2str(SAV.getRecord(index), seconds));
break;
default:
Tip3.RemoveAll();
break;
}
if (updateStats)
{
string tip = "";
if (RecordList.TryGetValue(index, out tip))
Tip3.SetToolTip(CB_Stats, tip);
}
}
private string dateval2str(int value, int refval = -1)
{
string tip = "";
if (value >= 86400)
tip += (value / 86400) + "d ";
tip += new DateTime(0).AddSeconds(value).ToString("HH:mm:ss");
if (refval >= 0)
tip += Environment.NewLine + "Date: " + new DateTime(2000, 1, 1).AddSeconds(refval + value).ToString();
return tip;
}
private void B_GenTID_Click(object sender, EventArgs e)

View file

@ -98,7 +98,7 @@ namespace PKHeX.WinForms
if (!pkm.Valid)
return null;
bool inBox = slot > 0 && slot < 30;
bool inBox = slot >= 0 && slot < 30;
var sprite = pkm.Species != 0 ? pkm.Sprite(isBoxBGRed: inBox && BoxWallpaper.getWallpaperRed(SAV, box)) : null;
if (slot <= -1) // from tabs

View file

@ -500,6 +500,11 @@ namespace PKHeX.Core
get { return Data[Misc + 0x130] & 0x1F; }
set { Data[Misc + 0x130] = (byte)((Data[Misc + 0x130] & ~0x1F) | (value & 0x1F)); }
}
public int DaysFromRefreshed
{
get { return Data[Misc + 0x123]; }
set { Data[Misc + 0x123] = (byte)value; }
}
public uint UsedFestaCoins
{
get { return BitConverter.ToUInt32(Data, 0x69C98); }