private void updateCrewInfo(CrewMember c) { crewNameBox.Text = c.name; for (int i = 0; i < raceIDs.Length; i++) if (raceIDs[i] == c.race) crewRaceList.SelectedIndex = i; crewIsDroneCheckbox.Checked = c.isDrone; crewHealthBox.Maximum = crewHealthBar.Maximum = c.race == "energy" ? 70 : c.race == "rock" ? 150 : c.race == "crystal" ? 125 : 100; crewHealthBar.Value = c.health; crewHealthBox.Value = (decimal)c.health; }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { DialogResult result = openFileDialog.ShowDialog(); if (result == DialogResult.OK) { Stream stream = openFileDialog.OpenFile(); FTLContinueReader reader = new FTLContinueReader(stream); version = reader.readInt(); unknown1 = reader.readInt(); //unknown value //-----STATS----- shipsDefeated = reader.readInt(); jumpsInSector = reader.readInt(); scrapCollected = reader.readInt(); crewRecruited = reader.readInt(); //-----SHIP DESIGNATION----- shipDesignationName = reader.readString(); shipDesignationID = reader.readString(); unknown2 = reader.readInt(); //unknown value unknown3 = reader.readInt(); //unknown value //-----SCORE----- int num = reader.readInt(); stats.Clear(); for (int i = 0; i < num; i++) { string name = reader.readString(); int value = reader.readInt(); stats.Add(name, value); statsGrid.Rows.Add(name, value); Console.WriteLine(name + ": " + value); } //-----SHIP----- shipID = reader.readString(); for (int i = 0; i < shipIDs.Length; i++) if (shipIDs[i] == shipID) shipIDList.SelectedIndex = i; shipName = shipNameBox.Text = reader.readString(); shipArtID = reader.readString(); for (int i = 0; i < shipArtIDs.Length; i++) if (shipArtIDs[i] == shipArtID) shipArtList.SelectedIndex = i; matchArtCheckbox.Checked = shipArtList.SelectedIndex == shipIDList.SelectedIndex; //-----CREW OVERVIEW----- num = reader.readInt(); crewOverview.Clear(); for (int i = 0; i < num; i++) { CrewMemberOverview c = new CrewMemberOverview(); c.race = reader.readString(); c.name = reader.readString(); crewOverview.Add(c); } //-----SHIP RESOURCES----- shipHull = shipHullBar.Value = reader.readInt(); shipHullBox.Value = (decimal)shipHull; fuel = reader.readInt(); fuelBox.Value = (decimal)fuel; droneParts = reader.readInt(); dronePartsBox.Value = (decimal)droneParts; missiles = reader.readInt(); missilesBox.Value = (decimal)missiles; scrap = reader.readInt(); scrapBox.Value = (decimal)scrap; //-----CREW MEMBERS----- num = reader.readInt(); crewMembers.Clear(); for (int i = 0; i < num; i++) { CrewMember c = new CrewMember(); c.name = reader.readString(); c.race = reader.readString(); c.isDrone = reader.readInt() == 1; c.health = reader.readInt(); c.x = reader.readInt(); c.y = reader.readInt(); c.room = reader.readInt(); c.roomTile = reader.readInt(); c.unknown = reader.readInt(); c.pilotingSkill = reader.readInt(); c.engineSkill = reader.readInt(); c.shieldSkill = reader.readInt(); c.weaponSkill = reader.readInt(); c.repairSkill = reader.readInt(); c.combatSkill = reader.readInt(); c.gender = reader.readInt(); c.repairsStat = reader.readInt(); c.killsStat = reader.readInt(); c.evasionsStat = reader.readInt(); c.jumpsStat = reader.readInt(); c.masteriesStat = reader.readInt(); crewMembers.Add(c); crewList.Items.Add(c.name + " (" + raceToHumanReadable(c.race) + ")"); } crewList.SelectedIndex = 0; updateCrewInfo(crewMembers[0]); for (int i = 0; i < systemNames.Length; i++) { ShipSystem s = new ShipSystem(); s.capacity = reader.readInt(); if (s.capacity > 0) { s.powerBars = reader.readInt(); s.damageProgress = reader.readInt(); s.ionizedBars = reader.readInt(); s.deionizationTicks = reader.readInt(); s.repairProgress = reader.readInt(); s.damageProgress = reader.readInt(); } systems.Add(s); } byte[] unread = reader.Reader.ReadBytes((int) (reader.Reader.BaseStream.Length - reader.Reader.BaseStream.Position)); for (int i = 0; i < unread.Length; i++) unreadBox.AppendText(unread[i] + (char.IsLetterOrDigit((char) unread[i]) ? " -> " + (char) unread[i] : "") + "\n"); } }