2018-05-19 17:04:07 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace PKHeX.Core
|
|
|
|
|
{
|
2019-10-04 02:09:02 +00:00
|
|
|
|
public sealed class MemoryStrings
|
2018-05-19 17:04:07 +00:00
|
|
|
|
{
|
|
|
|
|
private readonly GameStrings s;
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-05-19 17:04:07 +00:00
|
|
|
|
public MemoryStrings(GameStrings strings)
|
|
|
|
|
{
|
|
|
|
|
s = strings;
|
|
|
|
|
memories = new Lazy<List<ComboItem>>(GetMemories);
|
2019-02-08 05:40:20 +00:00
|
|
|
|
none = new Lazy<List<ComboItem>>(() => Util.GetCBList(new[] {string.Empty}));
|
2019-02-02 07:08:03 +00:00
|
|
|
|
species = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.specieslist.Take(Legal.MaxSpeciesID_6 + 1).ToArray()));
|
2018-05-19 17:04:07 +00:00
|
|
|
|
item = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.itemlist, Memories.MemoryItems));
|
2019-02-02 07:08:03 +00:00
|
|
|
|
genloc = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.genloc));
|
|
|
|
|
moves = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.movelist.Take(622).ToArray())); // Hyperspace Fury
|
2018-05-19 17:04:07 +00:00
|
|
|
|
specific = new Lazy<List<ComboItem>>(() => Util.GetCBList(s.metXY_00000, Legal.Met_XY_0));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private readonly Lazy<List<ComboItem>> memories;
|
|
|
|
|
private readonly Lazy<List<ComboItem>> none, species, item, 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> GeneralLocations => genloc.Value;
|
|
|
|
|
public List<ComboItem> SpecificLocations => specific.Value;
|
|
|
|
|
public List<ComboItem> Species => species.Value;
|
|
|
|
|
|
|
|
|
|
private List<ComboItem> GetMemories()
|
|
|
|
|
{
|
|
|
|
|
// Memory Chooser
|
|
|
|
|
int memorycount = s.memories.Length - 38;
|
|
|
|
|
string[] mems = new string[memorycount];
|
|
|
|
|
int[] allowed = new int[memorycount];
|
|
|
|
|
for (int i = 0; i < memorycount; i++)
|
|
|
|
|
{
|
|
|
|
|
mems[i] = s.memories[38 + i];
|
|
|
|
|
allowed[i] = i + 1;
|
|
|
|
|
}
|
|
|
|
|
Array.Resize(ref allowed, allowed.Length - 1);
|
2019-02-02 07:08:03 +00:00
|
|
|
|
var memory_list1 = Util.GetCBList(new[] { mems[0] });
|
2019-02-15 19:47:35 +00:00
|
|
|
|
Util.AddCBWithOffset(memory_list1, mems, 0, allowed);
|
|
|
|
|
return memory_list1;
|
2018-05-19 17:04:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-02 02:55:08 +00:00
|
|
|
|
public string[] GetMemoryQualities()
|
2018-05-19 17:04:07 +00:00
|
|
|
|
{
|
2018-09-02 02:55:08 +00:00
|
|
|
|
var list = new string[7];
|
|
|
|
|
for (int i = 0; i < list.Length; i++)
|
|
|
|
|
list[i] = s.memories[2 + i];
|
2018-05-19 17:04:07 +00:00
|
|
|
|
return list;
|
|
|
|
|
}
|
2018-08-03 03:11:42 +00:00
|
|
|
|
|
2018-09-02 02:55:08 +00:00
|
|
|
|
public string[] GetMemoryFeelings()
|
2018-05-19 17:04:07 +00:00
|
|
|
|
{
|
2018-09-02 02:55:08 +00:00
|
|
|
|
var list = new string[24];
|
2018-05-19 17:04:07 +00:00
|
|
|
|
for (int i = 0; i < 24; i++)
|
2018-09-02 02:55:08 +00:00
|
|
|
|
list[i] = s.memories[10 + i];
|
2018-05-19 17:04:07 +00:00
|
|
|
|
return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public List<ComboItem> GetArgumentStrings(MemoryArgType memIndex)
|
|
|
|
|
{
|
2019-10-05 03:10:50 +00:00
|
|
|
|
return memIndex switch
|
2018-05-19 17:04:07 +00:00
|
|
|
|
{
|
2019-10-05 03:10:50 +00:00
|
|
|
|
MemoryArgType.Species => Species,
|
|
|
|
|
MemoryArgType.GeneralLocation => GeneralLocations,
|
|
|
|
|
MemoryArgType.Item => Items,
|
|
|
|
|
MemoryArgType.Move => Moves,
|
|
|
|
|
MemoryArgType.SpecificLocation => SpecificLocations,
|
|
|
|
|
_ => None
|
|
|
|
|
};
|
2018-05-19 17:04:07 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|