mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-23 20:43:07 +00:00
Improve slot lock detection
Uses sm lock indication (same placement), now only appears for teams that are locked slots that are not locked but assigned to a team are now indicated as such, no prevention / moving to adjust team values is done. #661
This commit is contained in:
parent
93cc7472da
commit
750044ea31
9 changed files with 78 additions and 24 deletions
|
@ -3768,8 +3768,11 @@ namespace PKHeX
|
||||||
var sprite = pk.Species != 0 ? pk.Sprite : null;
|
var sprite = pk.Species != 0 ? pk.Sprite : null;
|
||||||
int slot = getSlot(pb);
|
int slot = getSlot(pb);
|
||||||
bool locked = slot < 30 && SAV.getIsSlotLocked(CB_BoxSelect.SelectedIndex, slot);
|
bool locked = slot < 30 && SAV.getIsSlotLocked(CB_BoxSelect.SelectedIndex, slot);
|
||||||
|
bool team = slot < 30 && SAV.getIsTeamSet(CB_BoxSelect.SelectedIndex, slot);
|
||||||
if (locked)
|
if (locked)
|
||||||
sprite = Util.LayerImage(sprite, Properties.Resources.locked, 5, 0, 1);
|
sprite = Util.LayerImage(sprite, Properties.Resources.locked, 26, 0, 1);
|
||||||
|
else if (team)
|
||||||
|
sprite = Util.LayerImage(sprite, Properties.Resources.team, 21, 0, 1);
|
||||||
pb.Image = sprite;
|
pb.Image = sprite;
|
||||||
if (pb.BackColor == Color.Red)
|
if (pb.BackColor == Color.Red)
|
||||||
pb.BackColor = Color.Transparent;
|
pb.BackColor = Color.Transparent;
|
||||||
|
@ -3798,8 +3801,11 @@ namespace PKHeX
|
||||||
var sprite = p.Species != 0 ? p.Sprite : null;
|
var sprite = p.Species != 0 ? p.Sprite : null;
|
||||||
int slot = getSlot(pb);
|
int slot = getSlot(pb);
|
||||||
bool locked = slot < 30 && SAV.getIsSlotLocked(CB_BoxSelect.SelectedIndex, slot);
|
bool locked = slot < 30 && SAV.getIsSlotLocked(CB_BoxSelect.SelectedIndex, slot);
|
||||||
|
bool team = slot < 30 && SAV.getIsTeamSet(CB_BoxSelect.SelectedIndex, slot);
|
||||||
if (locked)
|
if (locked)
|
||||||
sprite = Util.LayerImage(sprite, Properties.Resources.locked, 5, 0, 1);
|
sprite = Util.LayerImage(sprite, Properties.Resources.locked, 26, 0, 1);
|
||||||
|
else if (team)
|
||||||
|
sprite = Util.LayerImage(sprite, Properties.Resources.team, 21, 0, 1);
|
||||||
pb.Image = sprite;
|
pb.Image = sprite;
|
||||||
pb.BackColor = Color.Transparent;
|
pb.BackColor = Color.Transparent;
|
||||||
pb.Visible = true;
|
pb.Visible = true;
|
||||||
|
|
|
@ -3779,6 +3779,9 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="Resources\img\ribbons\ribbonbattletreemaster.png" />
|
<None Include="Resources\img\ribbons\ribbonbattletreemaster.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="Resources\img\misc\team.png" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
|
38
PKHeX/Properties/Resources.Designer.cs
generated
38
PKHeX/Properties/Resources.Designer.cs
generated
|
@ -12302,16 +12302,15 @@ namespace PKHeX.Properties {
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to PKHeX - By Kaphotics
|
/// Looks up a localized string similar to PKHeX - By Kaphotics
|
||||||
///http://projectpokemon.org/
|
///http://projectpokemon.org/pkhex
|
||||||
///http://projectpokemon.org/forums/showthread.php?36986
|
|
||||||
///
|
///
|
||||||
///11/18/16 - New Update:
|
///16/12/21 - New Update:
|
||||||
/// - Added: Sun/Moon Support
|
/// - Legality: Fine tuned problematic cases (Island Scan, SOS slots, Ash Greninja, result descriptions).
|
||||||
/// - - Initial legality checking. Postgame encounters (Scan/Poke Pelago/etc) unsupported at this time.
|
/// - Added: Battle Box slot indication and edit prevention for Generation 7 save files.
|
||||||
/// - - QR Exporting for use with custom firmware patched code.
|
/// - Added: Party Drag&Drop
|
||||||
/// - - Trainer Editor and limited Pokedex editor
|
/// - Added: Zygarde Core stored count; also improved subform "Collect All" button method.
|
||||||
/// - Added: KChart, a personal info (base stats) viewer. Hold Shift when opening the PKM Database from the Tools drop-down.
|
/// - Added: Pokédex forme editing (Gen7).
|
||||||
/// - Added: Legal mo [rest of string was truncated]";.
|
/// - Added: Advanced randomization for Batch Editor. Syntax: $x,y to have a random va [rest of string was truncated]";.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string changelog {
|
internal static string changelog {
|
||||||
get {
|
get {
|
||||||
|
@ -12611,7 +12610,8 @@ namespace PKHeX.Properties {
|
||||||
/// Looks up a localized string similar to 3100 Is Alolan Champion + Magearna Event Active
|
/// Looks up a localized string similar to 3100 Is Alolan Champion + Magearna Event Active
|
||||||
///3487 Received Magearna Gift
|
///3487 Received Magearna Gift
|
||||||
///1216 Received Gift Cosmog
|
///1216 Received Gift Cosmog
|
||||||
///0499 Received Gift Type:Null.
|
///0499 Received Gift Type:Null
|
||||||
|
///0160 Moone[0] / Sunne Portal [1].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string flags_sm {
|
internal static string flags_sm {
|
||||||
get {
|
get {
|
||||||
|
@ -17952,7 +17952,7 @@ namespace PKHeX.Properties {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to 20161118.
|
/// Looks up a localized string similar to 20161221.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string ProgramVersion {
|
internal static string ProgramVersion {
|
||||||
get {
|
get {
|
||||||
|
@ -20873,6 +20873,16 @@ namespace PKHeX.Properties {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap team {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("team", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized string similar to -
|
/// Looks up a localized string similar to -
|
||||||
///Duftnote
|
///Duftnote
|
||||||
|
@ -33492,10 +33502,10 @@ namespace PKHeX.Properties {
|
||||||
///ライチュウ
|
///ライチュウ
|
||||||
///サンド
|
///サンド
|
||||||
///サンドパン
|
///サンドパン
|
||||||
///ニドラン
|
///ニドラン♀
|
||||||
///ニドリーナ
|
///ニドリーナ
|
||||||
///ニドクイン
|
///ニドクイン
|
||||||
///ニドラン
|
///ニドラン♂
|
||||||
///ニドリーノ
|
///ニドリーノ
|
||||||
///ニドキング
|
///ニドキング
|
||||||
///ピッピ
|
///ピッピ
|
||||||
|
@ -33542,7 +33552,7 @@ namespace PKHeX.Properties {
|
||||||
///ゴローニャ
|
///ゴローニャ
|
||||||
///ポニータ
|
///ポニータ
|
||||||
///ギャロップ
|
///ギャロップ
|
||||||
///ヤドン [rest of string was truncated]";.
|
///ヤ [rest of string was truncated]";.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal static string text_species_ja {
|
internal static string text_species_ja {
|
||||||
get {
|
get {
|
||||||
|
|
|
@ -7369,4 +7369,7 @@
|
||||||
<data name="ribbonbattletreemaster" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="ribbonbattletreemaster" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\img\ribbons\ribbonbattletreemaster.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\img\ribbons\ribbonbattletreemaster.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="team" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\img\misc\team.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
Binary file not shown.
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 393 B |
BIN
PKHeX/Resources/img/misc/team.png
Normal file
BIN
PKHeX/Resources/img/misc/team.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 555 B |
|
@ -30,17 +30,29 @@ namespace PKHeX
|
||||||
{
|
{
|
||||||
PokeDex = -1; // Disabled
|
PokeDex = -1; // Disabled
|
||||||
LockedSlots = new int[0];
|
LockedSlots = new int[0];
|
||||||
|
TeamSlots = new int[0];
|
||||||
}
|
}
|
||||||
else // Valid slot locking info present
|
else // Valid slot locking info present
|
||||||
{
|
{
|
||||||
int lockedCount = 0;
|
int lockedCount = 0, teamCount = 0;
|
||||||
for (int i = 0; i < LockedSlots.Length; i++)
|
for (int i = 0; i < TeamCount; i++)
|
||||||
{
|
{
|
||||||
short val = BitConverter.ToInt16(Data, BattleBoxFlags + i*2);
|
bool locked = Data[PCBackgrounds - TeamCount - i] == 1;
|
||||||
if (val >= 0)
|
for (int j = 0; j < 6; j++)
|
||||||
LockedSlots[lockedCount++] = (BoxSlotCount*(val >> 8) + (val & 0xFF)) & 0xFFFF;
|
{
|
||||||
|
short val = BitConverter.ToInt16(Data, BattleBoxFlags + (i*6 + j) * 2);
|
||||||
|
if (val < 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var slotVal = (BoxSlotCount*(val >> 8) + (val & 0xFF)) & 0xFFFF;
|
||||||
|
|
||||||
|
if (locked)
|
||||||
|
LockedSlots[lockedCount++] = slotVal;
|
||||||
|
else TeamSlots[teamCount++] = slotVal;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Array.Resize(ref LockedSlots, lockedCount);
|
Array.Resize(ref LockedSlots, lockedCount);
|
||||||
|
Array.Resize(ref TeamSlots, teamCount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -237,7 +249,10 @@ namespace PKHeX
|
||||||
PCFlags = PCLayout + 0x5E0;
|
PCFlags = PCLayout + 0x5E0;
|
||||||
|
|
||||||
FashionLength = 0x1A08;
|
FashionLength = 0x1A08;
|
||||||
LockedSlots = new int[36];
|
|
||||||
|
TeamCount = 6;
|
||||||
|
LockedSlots = new int[6*TeamCount];
|
||||||
|
TeamSlots = new int[6*TeamCount];
|
||||||
}
|
}
|
||||||
else // Empty input
|
else // Empty input
|
||||||
{
|
{
|
||||||
|
@ -260,6 +275,7 @@ namespace PKHeX
|
||||||
private int PokeFinderSave { get; set; } = int.MinValue;
|
private int PokeFinderSave { get; set; } = int.MinValue;
|
||||||
private int BattleTree { get; set; } = int.MinValue;
|
private int BattleTree { get; set; } = int.MinValue;
|
||||||
private int BattleBoxFlags { get; set; } = int.MinValue;
|
private int BattleBoxFlags { get; set; } = int.MinValue;
|
||||||
|
private int TeamCount { get; set; } = int.MinValue;
|
||||||
|
|
||||||
// Accessible as SAV7
|
// Accessible as SAV7
|
||||||
public int TrainerCard { get; private set; } = 0x14000;
|
public int TrainerCard { get; private set; } = 0x14000;
|
||||||
|
@ -915,6 +931,14 @@ namespace PKHeX
|
||||||
int slotIndex = slot + BoxSlotCount*box;
|
int slotIndex = slot + BoxSlotCount*box;
|
||||||
return LockedSlots.Any(s => s == slotIndex);
|
return LockedSlots.Any(s => s == slotIndex);
|
||||||
}
|
}
|
||||||
|
public override bool getIsTeamSet(int box, int slot)
|
||||||
|
{
|
||||||
|
if (slot >= 30 || box >= BoxCount)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
int slotIndex = slot + BoxSlotCount * box;
|
||||||
|
return TeamSlots.Any(s => s == slotIndex);
|
||||||
|
}
|
||||||
|
|
||||||
public override int DaycareSeedSize => 32; // 128 bits
|
public override int DaycareSeedSize => 32; // 128 bits
|
||||||
public override int getDaycareSlotOffset(int loc, int slot)
|
public override int getDaycareSlotOffset(int loc, int slot)
|
||||||
|
|
|
@ -355,6 +355,7 @@ namespace PKHeX
|
||||||
public virtual byte[] BoxFlags { get { return null; } set { } }
|
public virtual byte[] BoxFlags { get { return null; } set { } }
|
||||||
public virtual int CurrentBox { get { return 0; } set { } }
|
public virtual int CurrentBox { get { return 0; } set { } }
|
||||||
protected int[] LockedSlots = new int[0];
|
protected int[] LockedSlots = new int[0];
|
||||||
|
protected int[] TeamSlots = new int[0];
|
||||||
|
|
||||||
protected virtual int getBoxWallpaperOffset(int box) { return -1; }
|
protected virtual int getBoxWallpaperOffset(int box) { return -1; }
|
||||||
public int getBoxWallpaper(int box)
|
public int getBoxWallpaper(int box)
|
||||||
|
@ -459,6 +460,7 @@ namespace PKHeX
|
||||||
{
|
{
|
||||||
return LockedSlots.Any(slot => BoxStart*BoxSlotCount <= slot && slot < (BoxEnd + 1)*BoxSlotCount);
|
return LockedSlots.Any(slot => BoxStart*BoxSlotCount <= slot && slot < (BoxEnd + 1)*BoxSlotCount);
|
||||||
}
|
}
|
||||||
|
public virtual bool getIsTeamSet(int box, int slot) { return false; }
|
||||||
|
|
||||||
public void sortBoxes(int BoxStart = 0, int BoxEnd = -1)
|
public void sortBoxes(int BoxStart = 0, int BoxEnd = -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -115,8 +115,11 @@ namespace PKHeX
|
||||||
var sprite = p.Species != 0 ? p.Sprite : null;
|
var sprite = p.Species != 0 ? p.Sprite : null;
|
||||||
int slot = getSlot(pb);
|
int slot = getSlot(pb);
|
||||||
bool locked = slot < 30 && SAV.getIsSlotLocked(CB_BoxSelect.SelectedIndex, slot);
|
bool locked = slot < 30 && SAV.getIsSlotLocked(CB_BoxSelect.SelectedIndex, slot);
|
||||||
|
bool team = slot < 30 && SAV.getIsTeamSet(CB_BoxSelect.SelectedIndex, slot);
|
||||||
if (locked)
|
if (locked)
|
||||||
sprite = Util.LayerImage(sprite, Properties.Resources.locked, 5, 0, 1);
|
sprite = Util.LayerImage(sprite, Properties.Resources.locked, 26, 0, 1);
|
||||||
|
else if (team)
|
||||||
|
sprite = Util.LayerImage(sprite, Properties.Resources.team, 21, 0, 1);
|
||||||
pb.Image = sprite;
|
pb.Image = sprite;
|
||||||
pb.BackColor = Color.Transparent;
|
pb.BackColor = Color.Transparent;
|
||||||
}
|
}
|
||||||
|
@ -125,8 +128,11 @@ namespace PKHeX
|
||||||
var sprite = pk.Species != 0 ? pk.Sprite : null;
|
var sprite = pk.Species != 0 ? pk.Sprite : null;
|
||||||
int slot = getSlot(pb);
|
int slot = getSlot(pb);
|
||||||
bool locked = slot < 30 && SAV.getIsSlotLocked(CB_BoxSelect.SelectedIndex, slot);
|
bool locked = slot < 30 && SAV.getIsSlotLocked(CB_BoxSelect.SelectedIndex, slot);
|
||||||
|
bool team = slot < 30 && SAV.getIsTeamSet(CB_BoxSelect.SelectedIndex, slot);
|
||||||
if (locked)
|
if (locked)
|
||||||
sprite = Util.LayerImage(sprite, Properties.Resources.locked, 5, 0, 1);
|
sprite = Util.LayerImage(sprite, Properties.Resources.locked, 26, 0, 1);
|
||||||
|
else if (team)
|
||||||
|
sprite = Util.LayerImage(sprite, Properties.Resources.team, 21, 0, 1);
|
||||||
pb.Image = sprite;
|
pb.Image = sprite;
|
||||||
if (pb.BackColor == Color.Red)
|
if (pb.BackColor == Color.Red)
|
||||||
pb.BackColor = Color.Transparent;
|
pb.BackColor = Color.Transparent;
|
||||||
|
|
Loading…
Reference in a new issue