public static void setItemDataSource(bool HaX, int MaxItemID, IEnumerable <ushort> allowed, int generation, GameVersion game, GameStrings s) { string[] items = s.getItemStrings(generation, game); ItemDataSource = Util.getCBList(items, (allowed == null || HaX ? Enumerable.Range(0, MaxItemID) : allowed.Select(i => (int)i)).ToArray()); }
public static void InitializeDataSources(GameStrings s) { int[] ball_nums = { 007, 576, 013, 492, 497, 014, 495, 493, 496, 494, 011, 498, 008, 006, 012, 015, 009, 005, 499, 010, 001, 016, 851 }; int[] ball_vals = { 007, 025, 013, 017, 022, 014, 020, 018, 021, 019, 011, 023, 008, 006, 012, 015, 009, 005, 024, 010, 001, 016, 026 }; BallDataSource = Util.getVariedCBList(s.itemlist, ball_nums, ball_vals); SpeciesDataSource = Util.getCBList(s.specieslist, null); NatureDataSource = Util.getCBList(s.natures, null); AbilityDataSource = Util.getCBList(s.abilitylist, null); VersionDataSource = Util.getCBList(s.gamelist, Legal.Games_7sm, Legal.Games_6oras, Legal.Games_6xy, Legal.Games_5, Legal.Games_4, Legal.Games_4e, Legal.Games_4r, Legal.Games_3, Legal.Games_3e, Legal.Games_3r, Legal.Games_3s); HaXMoveDataSource = Util.getCBList(s.movelist, null); MoveDataSource = HaXMoveDataSource.Where(m => !Legal.Z_Moves.Contains(m.Value)).ToList(); #region Met Locations // Gen 2 { var met_list = Util.getCBList(s.metGSC_00000, Enumerable.Range(0, 0x5F).ToArray()); met_list = Util.getOffsetCBList(met_list, s.metGSC_00000, 00000, new[] { 0x7E, 0x7F }); metGen2 = met_list; } // Gen 3 { var met_list = Util.getCBList(s.metRSEFRLG_00000, Enumerable.Range(0, 213).ToArray()); met_list = Util.getOffsetCBList(met_list, s.metRSEFRLG_00000, 00000, new[] { 253, 254, 255 }); metGen3 = met_list; var cxd_list = Util.getCBList(s.metCXD_00000, Enumerable.Range(0, s.metCXD_00000.Length).ToArray()).Where(c => c.Text.Length > 0).ToList(); metGen3CXD = cxd_list; } // Gen 4 { var met_list = Util.getCBList(s.metHGSS_00000, new[] { 0 }); met_list = Util.getOffsetCBList(met_list, s.metHGSS_02000, 2000, new[] { 2000 }); met_list = Util.getOffsetCBList(met_list, s.metHGSS_02000, 2000, new[] { 2002 }); met_list = Util.getOffsetCBList(met_list, s.metHGSS_03000, 3000, new[] { 3001 }); met_list = Util.getOffsetCBList(met_list, s.metHGSS_00000, 0000, Legal.Met_HGSS_0); met_list = Util.getOffsetCBList(met_list, s.metHGSS_02000, 2000, Legal.Met_HGSS_2); met_list = Util.getOffsetCBList(met_list, s.metHGSS_03000, 3000, Legal.Met_HGSS_3); metGen4 = met_list; } // Gen 5 { var met_list = Util.getCBList(s.metBW2_00000, new[] { 0 }); met_list = Util.getOffsetCBList(met_list, s.metBW2_60000, 60001, new[] { 60002 }); met_list = Util.getOffsetCBList(met_list, s.metBW2_30000, 30001, new[] { 30003 }); met_list = Util.getOffsetCBList(met_list, s.metBW2_00000, 00000, Legal.Met_BW2_0); met_list = Util.getOffsetCBList(met_list, s.metBW2_30000, 30001, Legal.Met_BW2_3); met_list = Util.getOffsetCBList(met_list, s.metBW2_40000, 40001, Legal.Met_BW2_4); met_list = Util.getOffsetCBList(met_list, s.metBW2_60000, 60001, Legal.Met_BW2_6); metGen5 = met_list; } // Gen 6 { var met_list = Util.getCBList(s.metXY_00000, new[] { 0 }); met_list = Util.getOffsetCBList(met_list, s.metXY_60000, 60001, new[] { 60002 }); met_list = Util.getOffsetCBList(met_list, s.metXY_30000, 30001, new[] { 30002 }); met_list = Util.getOffsetCBList(met_list, s.metXY_00000, 00000, Legal.Met_XY_0); met_list = Util.getOffsetCBList(met_list, s.metXY_30000, 30001, Legal.Met_XY_3); met_list = Util.getOffsetCBList(met_list, s.metXY_40000, 40001, Legal.Met_XY_4); met_list = Util.getOffsetCBList(met_list, s.metXY_60000, 60001, Legal.Met_XY_6); metGen6 = met_list; } // Gen 7 { var met_list = Util.getCBList(s.metSM_00000, new[] { 0 }); met_list = Util.getOffsetCBList(met_list, s.metSM_60000, 60001, new[] { 60002 }); met_list = Util.getOffsetCBList(met_list, s.metSM_30000, 30001, new[] { 30002 }); met_list = Util.getOffsetCBList(met_list, s.metSM_00000, 00000, Legal.Met_SM_0); met_list = Util.getOffsetCBList(met_list, s.metSM_30000, 30001, Legal.Met_SM_3); met_list = Util.getOffsetCBList(met_list, s.metSM_40000, 40001, Legal.Met_SM_4); met_list = Util.getOffsetCBList(met_list, s.metSM_60000, 60001, Legal.Met_SM_6); metGen7 = met_list; } #endregion }