public SharedSecretBase(SharedSecretBase copy, SecretBaseManager secretBaseManager) : this(ByteHelper.SubByteArray(0, copy.GetFinalData(), copy.Raw.Length), secretBaseManager) { Genders gender = TrainerGender; Flags = 0; TrainerGender = gender; }
public SharedSecretBase(byte[] data, SecretBaseManager secretBaseManager) { if (data.Length != 160) { throw new Exception("Shared Secret Base must be 160 bytes in length"); } this.secretBaseManager = secretBaseManager; this.raw = data; this.placedDecorations = new List <PlacedDecoration>(); this.pokemonTeam = new List <GBAPokemon>(); for (int i = 0; i < 16; i++) { byte id = raw[0x12 + i]; if (id != 0) { byte x = ByteHelper.BitsToByte(raw, 0x22 + i, 4, 4); byte y = ByteHelper.BitsToByte(raw, 0x22 + i, 0, 4); placedDecorations.Add(new PlacedDecoration(id, x, y)); } } for (int i = 0; i < 6; i++) { ushort species = LittleEndian.ToUInt16(raw, 0x7C + i * 2); if (species != 0 && PokemonDatabase.GetPokemonFromID(species) != null) { uint personality = LittleEndian.ToUInt32(raw, 0x34 + i * 4); ushort[] moves = new ushort[4]; for (int j = 0; j < 4; j++) { moves[j] = LittleEndian.ToUInt16(raw, 0x4C + j * 2 + i * 8); } ushort heldItem = LittleEndian.ToUInt16(raw, 0x88 + i * 2); byte level = raw[0x94 + i]; byte unknown = raw[0x9A + i]; GBAPokemon pokemon = new GBAPokemon(); pokemon.SpeciesID = species; pokemon.Personality = personality; pokemon.TrainerID = TrainerID; pokemon.SecretID = SecretID; pokemon.Nickname = pokemon.PokemonData.Name.ToUpper(); for (int j = 0; j < 4; j++) { pokemon.SetMoveAt(j, new Move(moves[j])); } pokemon.HeldItemID = heldItem; pokemon.Language = Languages.English; pokemon.Experience = PokemonDatabase.GetExperienceFromLevel(pokemon.PokemonData.ExperienceGroup, level); pokemon.Level = level; pokemon.RecalculateStats(); pokemonTeam.Add(pokemon); } } }
public SharedSecretBase(byte locationID, SecretBaseManager secretBaseManager) { this.secretBaseManager = secretBaseManager; this.raw = new byte[160]; this.placedDecorations = new List <PlacedDecoration>(); this.pokemonTeam = new List <GBAPokemon>(); this.LocationID = locationID; this.TrainerName = PokeManager.ManagerGameSave.TrainerName; this.TrainerGender = PokeManager.ManagerGameSave.TrainerGender; this.TrainerID = PokeManager.ManagerGameSave.TrainerID; this.SecretID = PokeManager.ManagerGameSave.SecretID; this.Language = Languages.English; }
public SharedSecretBase(PlayerSecretBase copy, SecretBaseManager secretBaseManager) : this(copy.LocationID, secretBaseManager) { TrainerName = copy.TrainerName; TrainerGender = copy.TrainerGender; TrainerID = copy.TrainerID; SecretID = copy.SecretID; Language = copy.Language; foreach (GBAPokemon pokemon in copy.PokemonTeam) { pokemonTeam.Add((GBAPokemon)pokemon.Clone()); } foreach (PlacedDecoration decoration in copy.PlacedDecorations) { placedDecorations.Add(new PlacedDecoration(decoration)); } }
public SecretBaseLocationChooser(byte location, SecretBaseManager manager, bool startInvalid) { InitializeComponent(); this.originalLocation = location; this.location = (location == 0 ? (byte)181 : location); this.manager = manager; this.startInvalid = startInvalid; for (int i = 0; i < SecretBaseDatabase.NumLocations; i++) { LocationData locationData = SecretBaseDatabase.GetLocationAt(i); ListViewItem listViewItem = new ListViewItem(); listViewItem.Tag = locationData.ID; StackPanel stackPanel = new StackPanel(); stackPanel.Orientation = Orientation.Horizontal; Grid grid = new Grid(); grid.Width = 16; grid.Height = 16; Image type = new Image(); type.Width = 16; type.Height = 16; type.HorizontalAlignment = HorizontalAlignment.Center; type.VerticalAlignment = VerticalAlignment.Center; type.Source = ResourceDatabase.GetImageFromName("SecretBaseType" + locationData.Type.ToString()); Label layout = new Label(); layout.Padding = new Thickness(0, 0, 0, 0); layout.Width = 16; layout.Height = 16; layout.HorizontalAlignment = HorizontalAlignment.Center; layout.VerticalAlignment = VerticalAlignment.Center; layout.HorizontalContentAlignment = HorizontalAlignment.Center; layout.VerticalContentAlignment = VerticalAlignment.Center; layout.Content = locationData.Layout.ToString(); layout.FontWeight = FontWeights.Bold; //layout.Foreground = new SolidColorBrush(Color.FromRgb(255, 255, 255)); grid.Children.Add(type); grid.Children.Add(layout); Label label = new Label(); label.VerticalAlignment = System.Windows.VerticalAlignment.Center; label.Padding = new Thickness(4, 0, 4, 0); label.Content = "Route " + locationData.RouteData.ID; if ((startInvalid || originalLocation != locationData.ID) && manager != null && manager.IsLocationInUse(locationData.ID)) { label.Foreground = new SolidColorBrush(Color.FromRgb(220, 0, 0)); } else if (OriginalLocationData != null && locationData.Type == OriginalLocationData.Type && locationData.Layout == OriginalLocationData.Layout) { label.Foreground = new SolidColorBrush(Color.FromRgb(0, 140, 60)); label.FontWeight = FontWeights.Bold; } stackPanel.Children.Add(grid); stackPanel.Children.Add(label); listViewItem.Content = stackPanel; listViewSecretBases.Items.Add(listViewItem); if (locationData.ID == this.location) { listViewSecretBases.SelectedIndex = listViewSecretBases.Items.Count - 1; } } if (listViewSecretBases.SelectedIndex == -1) OnLocationSelected(null, null); }
public static byte? Show(Window owner, byte location, SecretBaseManager manager = null, bool startInvalid = false) { SecretBaseLocationChooser window = new SecretBaseLocationChooser(location, manager, startInvalid); window.Owner = owner; window.ShowDialog(); if (window.DialogResult.HasValue && window.DialogResult.Value) return window.location; return null; }
public static bool Show(Window owner, byte locationID, SecretBaseManager manager, bool allowNoTeam) { SharedSecretBase secretBase = new SharedSecretBase(locationID, manager); return Show(owner, secretBase, allowNoTeam, true); }