public MonHunEquip ReloadEquip(int idx) { if (idx < 0 || idx > equipBox.Length - 1) { return(equipBox[idx]); } equipBox[idx] = MonHunEquip.Create(equipBox[idx].Serialize()); return(equipBox[idx]); }
private void comboBoxEquipType_SelectedIndexChanged(object sender, EventArgs e) { if (_equipSelectionUpdating) { return; } _selEquip.Type = comboBoxEquipType.SelectedItem.ToString(); _selEquip = selSlot.ReloadEquip(monHunEquipDataGridView.SelectedRows[0].Index); monHunEquipBindingSource[monHunEquipDataGridView.SelectedRows[0].Index] = _selEquip; UpdateSelectedEquip(_selEquip); monHunEquipDataGridView.InvalidateRow(monHunEquipDataGridView.CurrentRow.Index); }
public static MonHunEquip Create(byte[] equip) { MonHunEquip obj = null; byte tp = equip[0]; switch (tp) { case 6: obj = new MonHunTalisman(equip); break; default: obj = new MonHunEquip(equip); break; } return(obj); }
public void UpdateSelectedEquip(MonHunEquip obj) { _equipSelectionUpdating = true; comboBoxEquipType.DataSource = null; comboBoxEquipID.DataSource = null; _selEquip = obj; comboBoxEquipType.DataSource = obj.TypeAvailable; comboBoxEquipType.SelectedItem = obj.Type; comboBoxEquipID.DataSource = obj.IDAvailable; comboBoxEquipID.SelectedItem = obj.ID; numEquipLevel.Value = obj.Level; numSlots.Value = obj.Slots; if (_selEquip is MonHunTalisman) { MonHunTalisman tal = _selEquip as MonHunTalisman; comboBoxSkillFirst.DataSource = MonHunTalisman.dictSkills.Values.ToArray(); if (tal.SkillFirstKnown()) { comboBoxSkillFirst.SelectedItem = tal.SkillFirst; } else { comboBoxSkillFirst.Text = tal.SkillFirst; } comboBoxSkillSecond.BindingContext = new BindingContext(); comboBoxSkillSecond.DataSource = MonHunTalisman.dictSkills.Values.ToArray(); if (tal.SkillSecondKnown()) { comboBoxSkillSecond.SelectedItem = tal.SkillSecond; } else { comboBoxSkillSecond.Text = tal.SkillSecond; } textBoxSkillFirstValue.Text = tal.SkillFirstValue; textBoxSkillSecondValue.Text = tal.SkillSecondValue; textBoxTalRes1.Text = tal.UnkTal1; textBoxTalRes2.Text = tal.UnkTal2; } else { comboBoxSkillFirst.SelectedItem = null; comboBoxSkillFirst.DataSource = null; comboBoxSkillSecond.SelectedItem = null; comboBoxSkillSecond.DataSource = null; textBoxSkillFirstValue.Text = string.Empty; textBoxSkillSecondValue.Text = string.Empty; textBoxTalRes1.Text = string.Empty; textBoxTalRes2.Text = string.Empty; } _equipSelectionUpdating = false; }
public MonHunCharacter(MemoryStream ms) { BinaryReader reader = new BinaryReader(ms); itemBox = new MonHunItem[1400]; equipBox = new MonHunEquip[1400]; reader.BaseStream.Seek(0x0, SeekOrigin.Begin); name = System.Text.Encoding.UTF8.GetString(reader.ReadBytes(32), 0, 32); playTime = reader.ReadUInt32(); funds = reader.ReadUInt32(); hr = reader.ReadUInt16(); reader.BaseStream.Seek(0x0110, SeekOrigin.Begin); equippedWeapon = MonHunEquip.Create(reader.ReadBytes(36)); reader.BaseStream.Seek(0x1476, SeekOrigin.Begin); hrPoints = reader.ReadUInt32(); funds2 = reader.ReadUInt32(); extUnknown1 = reader.ReadUInt32(); academyPoints = reader.ReadUInt32(); berunaPoints = reader.ReadUInt32(); kokotoPoints = reader.ReadUInt32(); pokkePoints = reader.ReadUInt32(); yukumoPoints = reader.ReadUInt32(); reader.BaseStream.Seek(0x1A22, SeekOrigin.Begin); flags1 = reader.ReadBytes(8); // Item Box reader.BaseStream.Seek(0x290, SeekOrigin.Begin); uint buffer = 0; uint bits = 0; for (int i = 0; i < 1400; i++) { byte b = 0; while (bits < 18) { b = reader.ReadByte(); buffer >>= 8; buffer = (((uint)(b)) << 24) | (buffer & 0x00FFFFFF); // shift right into bits += 8; } if (bits >= 18) { uint item = (buffer >> ((int)(32 - bits))) & 0x0003FFFF; buffer = ((uint)b) << 24; bits -= 18; // Item OK itemBox[i] = new MonHunItem(item & 0x7FF, item >> 11); } } // Equipment Box reader.BaseStream.Seek(0x4667, SeekOrigin.Begin); for (int i = 0; i < 1400; i++) { equipBox[i] = MonHunEquip.Create(reader.ReadBytes(36)); } // Craftables craftables = new Craftable(ms); // Meals meals = new Meal(ms); // Combo List comboList = new ComboList(ms); }