private void SetEntry() { if (entry < 1) { return; } byte[] data = files[entry]; { data[0x00] = (byte)CB_Type.SelectedIndex; data[0x01] = (byte)CB_Quality.SelectedIndex; data[0x02] = (byte)CB_Category.SelectedIndex; data[0x03] = (byte)NUD_Power.Value; data[0x04] = (byte)NUD_Accuracy.Value; data[0x05] = (byte)NUD_PP.Value; data[0x06] = (byte)(int)NUD_Priority.Value; data[0x07] = (byte)((byte)NUD_HitMin.Value | ((byte)NUD_HitMax.Value << 4)); int inflictval = CB_Inflict.SelectedIndex; if (inflictval == CB_Inflict.Items.Count) { inflictval = -1; } Array.Copy(BitConverter.GetBytes((short)inflictval), 0, data, 0x08, 2); data[0x0A] = (byte)NUD_Inflict.Value; data[0x0B] = (byte)NUD_0xB.Value; data[0x0C] = (byte)NUD_TurnMin.Value; data[0x0D] = (byte)NUD_TurnMax.Value; data[0x0E] = (byte)NUD_CritStage.Value; data[0x0F] = (byte)NUD_Flinch.Value; Array.Copy(BitConverter.GetBytes((ushort)NUD_Effect.Value), 0, data, 0x10, 2); data[0x12] = (byte)(int)NUD_Recoil.Value; data[0x13] = (byte)NUD_Heal.Value; data[0x14] = (byte)CB_Targeting.SelectedIndex; data[0x15] = (byte)CB_Stat1.SelectedIndex; data[0x16] = (byte)CB_Stat2.SelectedIndex; data[0x17] = (byte)CB_Stat3.SelectedIndex; data[0x18] = (byte)(int)NUD_Stat1.Value; data[0x19] = (byte)(int)NUD_Stat2.Value; data[0x1A] = (byte)(int)NUD_Stat3.Value; data[0x1B] = (byte)NUD_StatP1.Value; data[0x1C] = (byte)NUD_StatP2.Value; data[0x1D] = (byte)NUD_StatP3.Value; var move = new Move7(data) { ZMove = CB_ZMove.SelectedIndex, ZPower = (int)NUD_ZPower.Value, ZEffect = CB_ZEffect.SelectedIndex, RefreshAfflictPercent = (int)NUD_RefreshAfflictPercent.Value, RefreshAfflictType = (RefreshType)CB_AfflictRefresh.SelectedIndex }; uint flagval = 0; for (int i = 0; i < CLB_Flags.Items.Count; i++) { flagval |= CLB_Flags.GetItemChecked(i) ? 1u << i : 0; } move.Flags = (MoveFlag7)flagval; } files[entry] = data; }
private void GetEntry() { if (entry < 1) { return; } byte[] data = files[entry]; { RTB.Text = moveflavor[entry].Replace("\\n", Environment.NewLine); CB_Type.SelectedIndex = data[0x00]; CB_Quality.SelectedIndex = data[0x01]; CB_Category.SelectedIndex = data[0x02]; NUD_Power.Value = data[0x3]; NUD_Accuracy.Value = data[0x4]; NUD_PP.Value = data[0x05]; NUD_Priority.Value = (sbyte)data[0x06]; NUD_HitMin.Value = data[0x7] & 0xF; NUD_HitMax.Value = data[0x7] >> 4; short inflictVal = BitConverter.ToInt16(data, 0x08); CB_Inflict.SelectedIndex = inflictVal < 0 ? CB_Inflict.Items.Count - 1 : inflictVal; NUD_Inflict.Value = data[0xA]; NUD_0xB.Value = data[0xB]; // 0xB ~ Something to deal with skipImmunity NUD_TurnMin.Value = data[0xC]; NUD_TurnMax.Value = data[0xD]; NUD_CritStage.Value = data[0xE]; NUD_Flinch.Value = data[0xF]; NUD_Effect.Value = BitConverter.ToUInt16(data, 0x10); NUD_Recoil.Value = (sbyte)data[0x12]; NUD_Heal.Value = data[0x13]; CB_Targeting.SelectedIndex = data[0x14]; CB_Stat1.SelectedIndex = data[0x15]; CB_Stat2.SelectedIndex = data[0x16]; CB_Stat3.SelectedIndex = data[0x17]; NUD_Stat1.Value = (sbyte)data[0x18]; NUD_Stat2.Value = (sbyte)data[0x19]; NUD_Stat3.Value = (sbyte)data[0x1A]; NUD_StatP1.Value = data[0x1B]; NUD_StatP2.Value = data[0x1C]; NUD_StatP3.Value = data[0x1D]; var move = new Move7(data); CB_ZMove.SelectedIndex = move.ZMove; NUD_ZPower.Value = move.ZPower; CB_ZEffect.SelectedIndex = move.ZEffect; CB_AfflictRefresh.SelectedIndex = (int)move.RefreshAfflictType; NUD_RefreshAfflictPercent.Value = move.RefreshAfflictPercent; var flags = (uint)move.Flags; for (int i = 0; i < CLB_Flags.Items.Count; i++) { CLB_Flags.SetItemChecked(i, ((flags >> i) & 1) == 1); } } }