using System; using System.Collections.Generic; using System.Linq; namespace PKHeX.Core { public class MemoryStrings { private readonly GameStrings s; public MemoryStrings(GameStrings strings) { s = strings; memories = new Lazy>(GetMemories); none = new Lazy>(() => Util.GetCBList(new[] {""}, null)); species = new Lazy>(() => Util.GetCBList(s.specieslist.Take(Legal.MaxSpeciesID_6 + 1).ToArray(), null)); item = new Lazy>(() => Util.GetCBList(s.itemlist, Memories.MemoryItems)); genloc = new Lazy>(() => Util.GetCBList(s.genloc, null)); moves = new Lazy>(() => Util.GetCBList(s.movelist.Take(622).ToArray(), null)); // Hyperspace Fury specific = new Lazy>(() => Util.GetCBList(s.metXY_00000, Legal.Met_XY_0)); } private readonly Lazy> memories; private readonly Lazy> none, species, item, genloc, moves, specific; public List Memory => memories.Value; public List None => none.Value; public List Moves => moves.Value; public List Items => item.Value; public List GeneralLocations => genloc.Value; public List SpecificLocations => specific.Value; public List Species => species.Value; private List 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); var memory_list1 = Util.GetCBList(new[] { mems[0] }, null); return Util.GetOffsetCBList(memory_list1, mems, 0, allowed); } public List GetMemoryQualities() { List list = new List(); for (int i = 0; i < 7; i++) list.Add(s.memories[2 + i]); return list; } public List GetMemoryFeelings() { List list = new List(); for (int i = 0; i < 24; i++) list.Add(s.memories[10 + i]); return list; } public List GetArgumentStrings(MemoryArgType memIndex) { switch (memIndex) { default: return None; case MemoryArgType.Species: return Species; case MemoryArgType.GeneralLocation: return GeneralLocations; case MemoryArgType.Item: return Items; case MemoryArgType.Move: return Moves; case MemoryArgType.SpecificLocation: return SpecificLocations; } } } }