Skip to content

Commit

Permalink
Refactoring tooltip
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwwwwzx committed Dec 3, 2017
1 parent 56fa46f commit c4064be
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 38 deletions.
14 changes: 5 additions & 9 deletions 3DSRNGTool/Gen7/Gen7Encounter/LocationTable7.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ public static int[] getLocation(int category, bool IsUltra)
TableNow = IsUltra ? USUMTable : SMTable;
switch (category)
{
case 1: return IsUltra ? UBLocationList2 : UBLocationList;
case 2: return IsUltra ? QRLocationList2 : QRLocationList;
case 1:
case 2:
return (IsUltra ? PKMW7.Species_USUM : PKMW7.Species_SM)[category].List
.Skip(1).SelectMany(pk => (pk as PKMW7).Location).ToArray();
default: return TableNow.Select(t => t.Locationidx).ToArray();
}
}
Expand Down Expand Up @@ -1302,12 +1304,6 @@ public static int[] getLocation(int category, bool IsUltra)
#endregion
};

public readonly static int[] UBLocationList = PKMW7.Species_SM[1].List.Skip(1).SelectMany(pk => (pk as PKMW7).Location).ToArray();

public readonly static int[] UBLocationList2 = PKMW7.Species_USUM[1].List.Skip(1).SelectMany(pk => (pk as PKMW7).Location).ToArray();

public readonly static int[] QRLocationList = PKMW7.Species_SM[2].List.Skip(1).SelectMany(pk => (pk as PKMW7).Location).ToArray();

public readonly static int[] QRLocationList2 = PKMW7.Species_USUM[2].List.Skip(1).SelectMany(pk => (pk as PKMW7).Location).ToArray();
public readonly static int[] RustlingSpots = { 046, 052, 058, 064, 158, 166 };
}
}
2 changes: 1 addition & 1 deletion 3DSRNGTool/Gen7/PKMW7.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class PKMW7 : Pokemon
new PKMW7 { Species = 797, Level = 65, Location = new []{134,124}, Rate = new byte[]{30,30}, Version = GameVersion.MN,}, // Celesteela
new PKMW7 { Species = 798, Level = 60, Location = new []{134,376,632}, Rate = new byte[]{30,30,30}, Version = GameVersion.SN,}, // Kartana
new PKMW7 { Species = 799, Level = 70, Location = new []{694}, Rate = new byte[]{80},}, // Guzzlord
new PKMW7 { Species = 800, Level = 75, Location = new []{548}, Rate = new byte[]{05},}, // Necrozma
new PKMW7 { Species = 800, Level = 75, Location = new []{546}, Rate = new byte[]{05},}, // Necrozma
}
},
new PokemonList
Expand Down
31 changes: 22 additions & 9 deletions 3DSRNGTool/MainForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 29 additions & 19 deletions 3DSRNGTool/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,17 @@ private void Seed_ValueChanged(object sender, EventArgs e)
Properties.Settings.Default.Save();
}

private void UpdateTip(string msg)
{
if (Tip.Visible = msg != null)
{
DGVToolTip.SetToolTip(RNGInfo, "Tip: " + msg);
DGVToolTip.SetToolTip(Tip, "Tip: " + msg);
}
else
DGVToolTip.RemoveAll();
}

private void Category_SelectedIndexChanged(object sender, EventArgs e)
{
Properties.Settings.Default.Category = (byte)CB_Category.SelectedIndex;
Expand Down Expand Up @@ -567,7 +578,7 @@ private void RNGMethod_Changed(object sender, EventArgs e)
{
Properties.Settings.Default.Method = Method;

DGVToolTip.RemoveAll();
UpdateTip(null);

DGV.Visible = Method < 4;
DGV_ID.Visible = Method == 4;
Expand Down Expand Up @@ -610,10 +621,7 @@ private void RNGMethod_Changed(object sender, EventArgs e)
B_OpenTool.Visible = gen6timeline_available || IsHorde;

if (MainRNGEgg.Checked)
{
DGVToolTip.SetToolTip(L_NPC, "Tips: NPC can be 4-8");
DGVToolTip.SetToolTip(NPC, "Tips: NPC can be 4-8");
}
UpdateTip("NPC can be 4-8");

SpecialOnly.Visible = Method == 2 && Gen7 && CB_Category.SelectedIndex > 0;
L_Ball.Visible = Ball.Visible = Gen7 && Method == 3;
Expand Down Expand Up @@ -689,7 +697,7 @@ private void NPC_ValueChanged(object sender, EventArgs e)
(NPC.Value == 0 ? BlinkFOnly : SafeFOnly).Visible = true;
gen7tool?.UpdatePara(npc: NPC.Value);
}

private void Raining_CheckedChanged(object sender, EventArgs e)
{
gen7tool?.UpdatePara(raining: Raining.Checked);
Expand All @@ -706,6 +714,10 @@ private void MetLocation_SelectedIndexChanged(object sender, EventArgs e)
Correction.Value = tmp.Correction;
Raining.Enabled = true;
Raining.Checked = tmp.Raining;
if (LocationTable7.RustlingSpots.Contains(tmp.Location))
UpdateTip("Correction and NPC might be different from default setting when there are rustling spots");
else
UpdateTip(null);
Lv_min.Value = ea.VersionDifference && (Ver == 6 || Ver == 8) ? tmp.LevelMinMoon : tmp.LevelMin;
Lv_max.Value = ea.VersionDifference && (Ver == 6 || Ver == 8) ? tmp.LevelMaxMoon : tmp.LevelMax;
}
Expand Down Expand Up @@ -889,7 +901,7 @@ private void SetPersonalInfo(int Species, int Forme, bool skip = false)
}
else // Fall through
{
Fidget.Visible =
Fidget.Visible =
ChainLength.Visible = L_ChainLength.Visible = SuctionCups.Visible =
FirstEncounter.Visible = L_WildIVsCnt.Visible = WildIVsCnt.Visible =
CB_HAUnlocked.Visible = CB_3rdSlotUnlocked.Visible = false;
Expand Down Expand Up @@ -931,18 +943,16 @@ private void Poke_SelectedIndexChanged(object sender, EventArgs e)
}
switch (specform)
{
case 382:
case 383:
DGVToolTip.SetToolTip(Timedelay, "Tips: The delay varies from 2700-4000, depends on save and console");
DGVToolTip.SetToolTip(ConsiderDelay, "Tips: The delay varies from 2700-4000, depends on save and console"); break; // Grondon / Kyogre
case 791:
case 792:
DGVToolTip.SetToolTip(L_NPC, "Tips: NPC can be 2 or 6, it depends on save");
DGVToolTip.SetToolTip(NPC, "Tips: NPC can be 2 or 6, it depends on save"); break; // SolLuna
case 801:
DGVToolTip.SetToolTip(L_NPC, "Tips: NPC can be 6 or 7. Depends on the person walking by");
DGVToolTip.SetToolTip(NPC, "Tips: NPC can be 6 or 7. Depends on the person walking by"); break; // Magearna
default: DGVToolTip.RemoveAll(); break;
case 382 when Gen6:
case 383 when Gen6: // Grondon / Kyogre
UpdateTip("The delay varies from 2700-4000, depends on save and console"); break;
case 791 when Gen7 && !IsUltra:
case 792 when Gen7 && !IsUltra: // SolLuna
UpdateTip("NPC can be 2 or 6, it depends on save"); break;
case 801: // Magearna
UpdateTip("NPC can be 6 or 7. Depends on the person walking by"); break;
default:
UpdateTip(null); break;
}

Sta_AbilityLocked.Enabled = Sta_Ability.Enabled =
Expand Down

0 comments on commit c4064be

Please sign in to comment.