mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-10 14:44:24 +00:00
Minor tweaks
Empty return for invalid species encountertemplate fetch Expose property for ck3 @ 0xD7 show legal memory context items rather than gen8 always
This commit is contained in:
parent
d3ae5e682f
commit
0e2dac3ff6
4 changed files with 16 additions and 10 deletions
|
@ -20,7 +20,8 @@ namespace PKHeX.Core
|
|||
memories = new Lazy<List<ComboItem>>(GetMemories);
|
||||
none = new Lazy<List<ComboItem>>(() => Util.GetCBList(new[] {string.Empty}));
|
||||
species = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.specieslist));
|
||||
item = new Lazy<List<ComboItem>>(() => GetItems(format));
|
||||
item6 = new Lazy<List<ComboItem>>(() => GetItems(6));
|
||||
item8 = new Lazy<List<ComboItem>>(() => GetItems(8));
|
||||
genloc = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.genloc));
|
||||
moves = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.movelist));
|
||||
specific = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.metXY_00000, Legal.Met_XY_0));
|
||||
|
@ -34,12 +35,13 @@ namespace PKHeX.Core
|
|||
}
|
||||
|
||||
private readonly Lazy<List<ComboItem>> memories;
|
||||
private readonly Lazy<List<ComboItem>> none, species, item, genloc, moves, specific;
|
||||
private readonly Lazy<List<ComboItem>> none, species, item6, item8, genloc, moves, specific;
|
||||
|
||||
public List<ComboItem> Memory => memories.Value;
|
||||
public List<ComboItem> None => none.Value;
|
||||
public List<ComboItem> Moves => moves.Value;
|
||||
public List<ComboItem> Items => item.Value;
|
||||
public List<ComboItem> Items6 => item6.Value;
|
||||
public List<ComboItem> Items8 => item8.Value;
|
||||
public List<ComboItem> GeneralLocations => genloc.Value;
|
||||
public List<ComboItem> SpecificLocations => specific.Value;
|
||||
public List<ComboItem> Species => species.Value;
|
||||
|
@ -55,11 +57,11 @@ namespace PKHeX.Core
|
|||
public ReadOnlySpan<string> GetMemoryQualities() => s.intensity;
|
||||
public ReadOnlySpan<string> GetMemoryFeelings(int memoryGen) => memoryGen >= 8 ? s.feeling.AsSpan(0, 25) : s.feeling.AsSpan(1, 24); // empty line for 0 in gen8+
|
||||
|
||||
public List<ComboItem> GetArgumentStrings(MemoryArgType type) => type switch
|
||||
public List<ComboItem> GetArgumentStrings(MemoryArgType type, int memoryGen) => type switch
|
||||
{
|
||||
MemoryArgType.Species => Species,
|
||||
MemoryArgType.GeneralLocation => GeneralLocations,
|
||||
MemoryArgType.Item => Items,
|
||||
MemoryArgType.Item => memoryGen == 6 ? Items6 : Items8,
|
||||
MemoryArgType.Move => Moves,
|
||||
MemoryArgType.SpecificLocation => SpecificLocations,
|
||||
_ => None,
|
||||
|
|
|
@ -139,6 +139,8 @@ namespace PKHeX.Core
|
|||
/// <returns>A consumable <see cref="IEncounterable"/> list of possible encounters.</returns>
|
||||
public static IEnumerable<IEncounterable> GenerateVersionEncounters(PKM pk, IEnumerable<int> moves, GameVersion version)
|
||||
{
|
||||
if (pk.Species == 0) // can enter this method after failing to set a species ID that cannot exist in the format
|
||||
return Array.Empty<IEncounterable>();
|
||||
pk.Version = (int)version;
|
||||
var format = pk.Format;
|
||||
if (format is 2 && version is GameVersion.RD or GameVersion.GN or GameVersion.BU or GameVersion.YW)
|
||||
|
|
|
@ -183,7 +183,7 @@ namespace PKHeX.Core
|
|||
public override int MarkValue { get => SwapBits(Data[0xCF], 1, 2); protected set => Data[0xCF] = (byte)SwapBits(value, 1, 2); }
|
||||
public override int PKRS_Days { get => Math.Max((sbyte)Data[0xD0], (sbyte)0); set => Data[0xD0] = (byte)(value == 0 ? 0xFF : value & 0xF); }
|
||||
|
||||
private int PartySlot { get => Data[0xD7]; set => Data[0xD7] = (byte)value; } // or not; only really used while in party?
|
||||
public int PartySlot { get => Data[0xD7]; set => Data[0xD7] = (byte)value; } // or not; only really used while in party?
|
||||
public int ShadowID { get => BigEndian.ToUInt16(Data, 0xD8); set => BigEndian.GetBytes((ushort)value).CopyTo(Data, 0xD8); }
|
||||
public int Purification { get => BigEndian.ToInt32(Data, 0xDC); set => BigEndian.GetBytes(value).CopyTo(Data, 0xDC); }
|
||||
public uint EXP_Shadow { get => BigEndian.ToUInt32(Data, 0xC0); set => BigEndian.GetBytes(value).CopyTo(Data, 0xC0); }
|
||||
|
|
|
@ -237,9 +237,10 @@ namespace PKHeX.WinForms
|
|||
{
|
||||
if (sender == CB_CTMemory)
|
||||
{
|
||||
int memoryGen = pkm.Generation;
|
||||
int memory = WinFormsUtil.GetIndex((ComboBox)sender);
|
||||
var memIndex = Memories.GetMemoryArgType(memory, pkm.Generation);
|
||||
var argvals = MemStrings.GetArgumentStrings(memIndex);
|
||||
var memIndex = Memories.GetMemoryArgType(memory, memoryGen);
|
||||
var argvals = MemStrings.GetArgumentStrings(memIndex, memoryGen);
|
||||
CB_CTVar.InitializeBinding();
|
||||
CB_CTVar.DataSource = new BindingSource(argvals, null);
|
||||
LCTV.Text = TextArgs.GetMemoryCategory(memIndex, pkm.Generation);
|
||||
|
@ -247,9 +248,10 @@ namespace PKHeX.WinForms
|
|||
}
|
||||
else
|
||||
{
|
||||
int memoryGen = pkm.Format;
|
||||
int memory = WinFormsUtil.GetIndex((ComboBox)sender);
|
||||
var memIndex = Memories.GetMemoryArgType(memory, pkm.Format);
|
||||
var argvals = MemStrings.GetArgumentStrings(memIndex);
|
||||
var memIndex = Memories.GetMemoryArgType(memory, memoryGen);
|
||||
var argvals = MemStrings.GetArgumentStrings(memIndex, memoryGen);
|
||||
CB_OTVar.InitializeBinding();
|
||||
CB_OTVar.DataSource = new BindingSource(argvals, null);
|
||||
LOTV.Text = TextArgs.GetMemoryCategory(memIndex, pkm.Format);
|
||||
|
|
Loading…
Reference in a new issue