Esempio n. 1
0
    private void ChangeNickname(object sender, MouseEventArgs e)
    {
        TextBox tb = (TextBox)sender;

        // Special Character Form
        if (ModifierKeys != Keys.Control)
        {
            return;
        }

        var team      = LB_DataEntry.SelectedIndex;
        var member    = (int)NUP_PartyIndex.Value - 1;
        int offset    = (team * (4 + (6 * HallFame6Entity.SIZE))) + (member * HallFame6Entity.SIZE);
        var nicktrash = data.AsSpan(offset + 0x18, 26);
        var text      = tb.Text;

        SAV.SetString(nicktrash, text.AsSpan(), 12, StringConverterOption.ClearZero);
        var d = new TrashEditor(tb, nicktrash, SAV);

        d.ShowDialog();
        tb.Text = d.FinalString;
        d.FinalBytes.CopyTo(nicktrash);

        TB_Nickname.Text = StringConverter6.GetString(nicktrash);
    }
Esempio n. 2
0
        private void NUP_PartyIndex_ValueChanged(object sender, EventArgs e)
        {
            editing = false;
            int index  = LB_DataEntry.SelectedIndex;
            int offset = (index * 0x1B4) + ((Convert.ToInt32(NUP_PartyIndex.Value) - 1) * 0x48);

            if (offset < 0)
            {
                return;
            }

            int species = ReadUInt16LittleEndian(data.AsSpan(offset + 0x00));

            CB_Species.SelectedValue = species;
            int item = ReadUInt16LittleEndian(data.AsSpan(offset + 0x02));

            CB_HeldItem.SelectedValue = item;
            int move1 = ReadUInt16LittleEndian(data.AsSpan(offset + 0x04));
            int move2 = ReadUInt16LittleEndian(data.AsSpan(offset + 0x06));
            int move3 = ReadUInt16LittleEndian(data.AsSpan(offset + 0x08));
            int move4 = ReadUInt16LittleEndian(data.AsSpan(offset + 0x0A));

            CB_Move1.SelectedValue = move1;
            CB_Move2.SelectedValue = move2;
            CB_Move3.SelectedValue = move3;
            CB_Move4.SelectedValue = move4;

            uint EC = ReadUInt32LittleEndian(data.AsSpan(offset + 0xC));

            TB_EC.Text = EC.ToString("X8");

            TB_TID.Text = ReadUInt16LittleEndian(data.AsSpan(offset + 0x10)).ToString("00000");
            TB_SID.Text = ReadUInt16LittleEndian(data.AsSpan(offset + 0x12)).ToString("00000");

            TB_Nickname.Text = StringConverter6.GetString(data.AsSpan(offset + 0x18, 26));
            TB_OT.Text       = StringConverter6.GetString(data.AsSpan(offset + 0x30, 26));

            uint slgf   = ReadUInt32LittleEndian(data.AsSpan(offset + 0x14));
            uint form   = slgf & 0x1F;
            uint gender = slgf >> 5 & 3; // 0 M; 1 F; 2 G
            uint level  = slgf >> 7 & 0x7F;
            uint shiny  = slgf >> 14 & 0x1;
            uint nick   = ReadUInt16LittleEndian(data.AsSpan(offset + 0x16));

            CHK_Shiny.Checked = shiny == 1;

            TB_Level.Text = level.ToString("000");

            CHK_Nicknamed.Checked = nick == 1;

            SetForms();
            CB_Form.SelectedIndex = (int)form;
            SetGenderLabel((int)gender);
            UpdateNickname(sender, e);
            bpkx.Image = SpriteUtil.GetSprite(species, (int)form, (int)gender, 0, item, false, shiny == 1, 6);
            editing    = true;
        }
Esempio n. 3
0
        private static bool ReadTrainer(ICollection <string> result, ReadOnlySpan <byte> data)
        {
            ulong pssID = ReadUInt64LittleEndian(data);

            if (pssID == 0)
            {
                return(false); // no data
            }
            string otname  = StringConverter6.GetString(data.Slice(0x08, 0x1A));
            string message = StringConverter6.GetString(data.Slice(0x22, 0x22));

            // Trim terminated

            // uint unk1  = ReadUInt32LittleEndian(data[0x44..]);
            // ulong unk2 = ReadUInt64LittleEndian(data[0x48..]);
            // uint unk3  = ReadUInt32LittleEndian(data[0x50..]);
            // uint unk4  = ReadUInt16LittleEndian(data[0x54..]);
            byte regionID  = data[0x56];
            byte countryID = data[0x57];
            byte game      = data[0x5A];
            // ulong outfit = ReadUInt64LittleEndian(data.AsSpan(ofs + 0x5C));
            int favpkm = ReadUInt16LittleEndian(data[0x9C..]) & 0x7FF;
Esempio n. 4
0
        private void AddEntryDescription(int offset, List <string> s, int species)
        {
            int helditem = ReadUInt16LittleEndian(data.AsSpan(offset + 0x02));
            int move1    = ReadUInt16LittleEndian(data.AsSpan(offset + 0x04));
            int move2    = ReadUInt16LittleEndian(data.AsSpan(offset + 0x06));
            int move3    = ReadUInt16LittleEndian(data.AsSpan(offset + 0x08));
            int move4    = ReadUInt16LittleEndian(data.AsSpan(offset + 0x0A));

            int TID = ReadUInt16LittleEndian(data.AsSpan(offset + 0x10));
            int SID = ReadUInt16LittleEndian(data.AsSpan(offset + 0x12));

            uint slgf = ReadUInt32LittleEndian(data.AsSpan(offset + 0x14));
            // uint form = slgf & 0x1F;
            uint gender = slgf >> 5 & 3; // 0 M; 1 F; 2 G
            uint level  = slgf >> 7 & 0x7F;
            uint shiny  = slgf >> 14 & 0x1;
            // uint unkn = slgf >> 15;

            string nickname = StringConverter6.GetString(data.AsSpan(offset + 0x18, 26));
            string OTname   = StringConverter6.GetString(data.AsSpan(offset + 0x30, 26));

            string genderstr = gendersymbols[(int)gender];
            string shinystr  = shiny == 1 ? "Yes" : "No";

            var str = GameInfo.Strings;

            s.Add($"Name: {nickname}");
            s.Add($" ({str.Species[species]} - {genderstr})");
            s.Add($"Level: {level}");
            s.Add($"Shiny: {shinystr}");
            s.Add($"Held Item: {str.Item[helditem]}");
            s.Add($"Move 1: {str.Move[move1]}");
            s.Add($"Move 2: {str.Move[move2]}");
            s.Add($"Move 3: {str.Move[move3]}");
            s.Add($"Move 4: {str.Move[move4]}");
            s.Add($"OT: {OTname} ({TID}/{SID})");
            s.Add(string.Empty);
        }