public static HistoryEntry FromJournalEntry(JournalEntry je, HistoryEntry prev) { ISystem isys = prev == null ? new SystemClass("Unknown") : prev.System; if (je.EventTypeID == JournalTypeEnum.Location || je.EventTypeID == JournalTypeEnum.FSDJump || je.EventTypeID == JournalTypeEnum.CarrierJump) { JournalLocOrJump jl = je as JournalLocOrJump; ISystem newsys; if (jl != null && jl.HasCoordinate) // LAZY LOAD IF it has a co-ord.. the front end will when it needs it { newsys = new SystemClass(jl.StarSystem, jl.StarPos.X, jl.StarPos.Y, jl.StarPos.Z) { EDSMID = 0, // not an EDSM entry SystemAddress = jl.SystemAddress, Population = jl.Population ?? 0, Faction = jl.Faction, Government = jl.EDGovernment, Allegiance = jl.EDAllegiance, State = jl.EDState, Security = jl.EDSecurity, PrimaryEconomy = jl.EDEconomy, Power = jl.PowerList, PowerState = jl.PowerplayState, Source = jl.StarPosFromEDSM ? SystemSource.FromEDSM : SystemSource.FromJournal, }; SystemCache.FindCachedJournalSystem(newsys); // this puts it in the cache // If it was a new system, pass the coords back to the StartJump if (prev != null && prev.journalEntry is JournalStartJump) { prev.System = newsys; // give the previous startjump our system.. } } else { // NOTE Rob: 09-JAN-2018 I've removed the Jumpstart looking up a system by name since they were using up lots of lookup time during history reading. // This is used for pre 2.2 systems without co-ords, which now should be limited. // JumpStart still gets the system when the FSD loc is processed, see above. // Jumpstart was also screwing about with the EDSM ID fill in which was broken. This is now working again. newsys = new SystemClass(jl.StarSystem); // this will be a synthesised one } isys = newsys; } HistoryEntry he = new HistoryEntry { journalEntry = je, System = isys, EntryStatus = HistoryEntryStatus.Update(prev?.EntryStatus, je, isys.Name) }; he.TravelStatus = HistoryTravelStatus.Update(prev?.TravelStatus, prev, he); // need a real he so can't do that as part of the constructor. return(he); }
public HistoryEntryStatus(HistoryEntryStatus prevstatus) { this.BodyName = prevstatus.BodyName; this.BodyID = prevstatus.BodyID; this.BodyType = prevstatus.BodyType; this.StationName = prevstatus.StationName; this.StationType = prevstatus.StationType; this.MarketId = prevstatus.MarketId; this.TravelState = prevstatus.TravelState; this.ShipID = prevstatus.ShipID; this.ShipType = prevstatus.ShipType; this.OnCrewWithCaptain = prevstatus.OnCrewWithCaptain; this.GameMode = prevstatus.GameMode; this.Group = prevstatus.Group; this.Wanted = prevstatus.Wanted; this.BodyApproached = prevstatus.BodyApproached; }
public HistoryEntryStatus(HistoryEntryStatus prevstatus) { BodyName = prevstatus.BodyName; BodyID = prevstatus.BodyID; BodyType = prevstatus.BodyType; StationName = prevstatus.StationName; StationType = prevstatus.StationType; MarketId = prevstatus.MarketId; TravelState = prevstatus.TravelState; ShipID = prevstatus.ShipID; ShipType = prevstatus.ShipType; ShipTypeFD = prevstatus.ShipTypeFD; OnCrewWithCaptain = prevstatus.OnCrewWithCaptain; GameMode = prevstatus.GameMode; Group = prevstatus.Group; Wanted = prevstatus.Wanted; BodyApproached = prevstatus.BodyApproached; StationFaction = prevstatus.StationFaction; }
public static HistoryEntry FromJournalEntry(JournalEntry je, HistoryEntry prev, out bool journalupdate, SQLiteConnectionSystem conn = null) { ISystem isys = prev == null ? new SystemClass("Unknown") : prev.System; int indexno = prev == null ? 1 : prev.Indexno + 1; journalupdate = false; if (je.EventTypeID == JournalTypeEnum.Location || je.EventTypeID == JournalTypeEnum.FSDJump) { JournalLocOrJump jl = je as JournalLocOrJump; ISystem newsys; if (jl != null && jl.HasCoordinate) // LAZY LOAD IF it has a co-ord.. the front end will when it needs it { newsys = new SystemClass(jl.StarSystem, jl.StarPos.X, jl.StarPos.Y, jl.StarPos.Z) { EDSMID = jl.EdsmID < 0 ? 0 : jl.EdsmID, // pass across the EDSMID for the lazy load process. Faction = jl.Faction, Government = jl.EDGovernment, PrimaryEconomy = jl.EDEconomy, Security = jl.EDSecurity, Population = jl.Population ?? 0, State = jl.EDState, Allegiance = jl.EDAllegiance, UpdateDate = jl.EventTimeUTC, status = SystemStatusEnum.EDDiscovery, SystemAddress = jl.SystemAddress, }; // If it was a new system, pass the coords back to the StartJump if (prev != null && prev.journalEntry is JournalStartJump) { prev.System = newsys; // give the previous startjump our system.. } } else { // NOTE Rob: 09-JAN-2018 I've removed the Jumpstart looking up a system by name since they were using up lots of lookup time during history reading. // This is used for pre 2.2 systems without co-ords, which now should be limited. // JumpStart still gets the system when the FSD loc is processed, see above. // Jumpstart was also screwing about with the EDSM ID fill in which was broken. This is now working again. // Default one newsys = new SystemClass(jl.StarSystem); newsys.EDSMID = je.EdsmID; ISystem s = SystemCache.FindSystem(newsys, conn); // has no co-ord, did we find it? if (s != null) // found a system.. { if (jl != null && jl.HasCoordinate) // if journal Loc, and journal has a star position, use that instead of EDSM.. { s.X = Math.Round(jl.StarPos.X * 32.0) / 32.0; s.Y = Math.Round(jl.StarPos.Y * 32.0) / 32.0; s.Z = Math.Round(jl.StarPos.Z * 32.0) / 32.0; } //Debug.WriteLine("HistoryList found system {0} {1}", s.id_edsm, s.name); newsys = s; if (jl != null && je.EdsmID <= 0 && newsys.EDSMID > 0) // only update on a JL.. { journalupdate = true; Debug.WriteLine("HE EDSM ID update requested {0} {1}", newsys.EDSMID, newsys.Name); } } else { newsys.EDSMID = -1; // mark as checked but not found } } JournalFSDJump jfsd = je as JournalFSDJump; if (jfsd != null) { if (jfsd.JumpDist <= 0 && isys.HasCoordinate && newsys.HasCoordinate) // if no JDist, its a really old entry, and if previous has a co-ord { jfsd.JumpDist = isys.Distance(newsys); // fill it out here if (jfsd.JumpDist > 0) { journalupdate = true; Debug.WriteLine("Je Jump distance update(3) requested {0} {1} {2}", newsys.EDSMID, newsys.Name, jfsd.JumpDist); } } } isys = newsys; } HistoryEntry he = new HistoryEntry { Indexno = indexno, journalEntry = je, System = isys, EntryStatus = HistoryEntryStatus.Update(prev?.EntryStatus, je, isys.Name) }; if (prev != null) { if (prev.StopMarker) // if we had a stop marker previously, means the next one needs to clear the counters { he.travelling = false; // still travelling if its a start marker he.travelled_distance = 0; he.travelled_seconds = new TimeSpan(0); he.travelled_missingjump = 0; he.travelled_jumps = 0; } else { he.travelling = prev.travelling; he.travelled_distance = prev.travelled_distance; he.travelled_seconds = prev.travelled_seconds; he.travelled_missingjump = prev.travelled_missingjump; he.travelled_jumps = prev.travelled_jumps; } } if (he.StartMarker) // start marker, start travelling { he.travelling = true; } if (he.travelling) { if (he.IsFSDJump && !he.MultiPlayer) // if jump, and not multiplayer.. { double dist = ((JournalFSDJump)je).JumpDist; if (dist <= 0) { he.travelled_missingjump++; } else { he.travelled_distance += dist; he.travelled_jumps++; } } if (prev != null) { TimeSpan diff = he.EventTimeUTC.Subtract(prev.EventTimeUTC); if (he.EntryType != JournalTypeEnum.LoadGame && diff < new TimeSpan(2, 0, 0)) // time between last entry and load game is not real time { he.travelled_seconds += diff; } } } return(he); }
public static HistoryEntry FromJournalEntry(JournalEntry je, HistoryEntry prev, out bool journalupdate, SQLiteConnectionSystem conn = null) { ISystem isys = prev == null ? new SystemClass("Unknown") : prev.System; int indexno = prev == null ? 1 : prev.Indexno + 1; journalupdate = false; if (je.EventTypeID == JournalTypeEnum.Location || je.EventTypeID == JournalTypeEnum.FSDJump) { JournalLocOrJump jl = je as JournalLocOrJump; ISystem newsys; if (jl != null && jl.HasCoordinate) // LAZY LOAD IF it has a co-ord.. the front end will when it needs it { newsys = new SystemClass(jl.StarSystem, jl.StarPos.X, jl.StarPos.Y, jl.StarPos.Z) { EDSMID = jl.EdsmID < 0 ? 0 : jl.EdsmID, // pass across the EDSMID for the lazy load process. SystemAddress = jl.SystemAddress, Population = jl.Population ?? 0, Faction = jl.Faction, Government = jl.EDGovernment, Allegiance = jl.EDAllegiance, State = jl.EDState, Security = jl.EDSecurity, PrimaryEconomy = jl.EDEconomy, Power = jl.PowerList, PowerState = jl.PowerplayState, status = SystemStatusEnum.EDDiscovery, }; // If it was a new system, pass the coords back to the StartJump if (prev != null && prev.journalEntry is JournalStartJump) { prev.System = newsys; // give the previous startjump our system.. } } else { // NOTE Rob: 09-JAN-2018 I've removed the Jumpstart looking up a system by name since they were using up lots of lookup time during history reading. // This is used for pre 2.2 systems without co-ords, which now should be limited. // JumpStart still gets the system when the FSD loc is processed, see above. // Jumpstart was also screwing about with the EDSM ID fill in which was broken. This is now working again. // Default one newsys = new SystemClass(jl.StarSystem); newsys.EDSMID = je.EdsmID; ISystem s = SystemCache.FindSystem(newsys, conn); // has no co-ord, did we find it? if (s != null) // found a system.. { if (jl != null && jl.HasCoordinate) // if journal Loc, and journal has a star position, use that instead of EDSM.. { s.X = Math.Round(jl.StarPos.X * 32.0) / 32.0; s.Y = Math.Round(jl.StarPos.Y * 32.0) / 32.0; s.Z = Math.Round(jl.StarPos.Z * 32.0) / 32.0; } //Debug.WriteLine("HistoryList found system {0} {1}", s.id_edsm, s.name); newsys = s; if (jl != null && je.EdsmID <= 0 && newsys.EDSMID > 0) // only update on a JL.. { journalupdate = true; Debug.WriteLine("HE EDSM ID update requested {0} {1}", newsys.EDSMID, newsys.Name); } } else { newsys.EDSMID = -1; // mark as checked but not found } } JournalFSDJump jfsd = je as JournalFSDJump; if (jfsd != null) { if (jfsd.JumpDist <= 0 && isys.HasCoordinate && newsys.HasCoordinate) // if no JDist, its a really old entry, and if previous has a co-ord { jfsd.JumpDist = isys.Distance(newsys); // fill it out here if (jfsd.JumpDist > 0) { journalupdate = true; Debug.WriteLine("Je Jump distance update(3) requested {0} {1} {2}", newsys.EDSMID, newsys.Name, jfsd.JumpDist); } } } isys = newsys; } HistoryEntry he = new HistoryEntry { Indexno = indexno, journalEntry = je, System = isys, EntryStatus = HistoryEntryStatus.Update(prev?.EntryStatus, je, isys.Name) }; he.TravelStatus = HistoryTravelStatus.Update(prev?.TravelStatus, prev, he); // need a real he so can't do that as part of the constructor. return(he); }
public static HistoryEntryStatus Update(HistoryEntryStatus prev, JournalEntry je, string curStarSystem) { if (prev == null) { prev = new HistoryEntryStatus(); } switch (je.EventTypeID) { case JournalTypeEnum.Location: JournalLocation jloc = je as JournalLocation; TravelStateType t = jloc.Docked ? TravelStateType.Docked : (jloc.Latitude.HasValue ? TravelStateType.Landed : TravelStateType.NormalSpace); return(new HistoryEntryStatus(prev) // Bodyapproach copy over we should be in the same state as last.. { TravelState = t, MarketId = jloc.MarketID, BodyID = jloc.BodyID, BodyType = jloc.BodyType, BodyName = jloc.Body, Wanted = jloc.Wanted, StationName = jloc.StationName.Alt(null), // if empty string, set to null StationType = jloc.StationType.Alt(null), }); case JournalTypeEnum.FSDJump: JournalFSDJump jfsd = (je as JournalFSDJump); return(new HistoryEntryStatus(prev) { TravelState = TravelStateType.Hyperspace, MarketId = null, BodyID = -1, BodyType = "Star", BodyName = jfsd.StarSystem, Wanted = jfsd.Wanted, StationName = null, StationType = null, BodyApproached = false, }); case JournalTypeEnum.LoadGame: JournalLoadGame jlg = je as JournalLoadGame; bool isbuggy = ShipModuleData.IsSRV(jlg.ShipFD); string shiptype = isbuggy ? prev.ShipType : jlg.Ship; string shiptypefd = isbuggy ? prev.ShipTypeFD : jlg.ShipFD; int shipid = isbuggy ? prev.ShipID : jlg.ShipId; return(new HistoryEntryStatus(prev) // Bodyapproach copy over we should be in the same state as last.. { OnCrewWithCaptain = null, // can't be in a crew at this point GameMode = jlg.GameMode, // set game mode Group = jlg.Group, // and group, may be empty TravelState = (jlg.StartLanded || isbuggy) ? TravelStateType.Landed : prev.TravelState, ShipType = shiptype, ShipID = shipid, ShipTypeFD = shiptypefd, }); case JournalTypeEnum.Docked: JournalDocked jdocked = (JournalDocked)je; return(new HistoryEntryStatus(prev) { TravelState = TravelStateType.Docked, MarketId = jdocked.MarketID, Wanted = jdocked.Wanted, StationName = jdocked.StationName, StationType = jdocked.StationType, }); case JournalTypeEnum.Undocked: return(new HistoryEntryStatus(prev) { TravelState = TravelStateType.NormalSpace, MarketId = null, StationName = null, StationType = null, }); case JournalTypeEnum.Touchdown: if (((JournalTouchdown)je).PlayerControlled == true) // can get this when not player controlled { return(new HistoryEntryStatus(prev) { TravelState = TravelStateType.Landed, }); } else { return(prev); } case JournalTypeEnum.Liftoff: if (((JournalLiftoff)je).PlayerControlled == true) // can get this when not player controlled { return(new HistoryEntryStatus(prev) { TravelState = TravelStateType.NormalSpace, }); } else { return(prev); } case JournalTypeEnum.SupercruiseExit: JournalSupercruiseExit jsexit = (JournalSupercruiseExit)je; return(new HistoryEntryStatus(prev) { TravelState = TravelStateType.NormalSpace, BodyName = (prev.BodyApproached) ? prev.BodyName : jsexit.Body, BodyType = (prev.BodyApproached) ? prev.BodyType : jsexit.BodyType, BodyID = (prev.BodyApproached) ? prev.BodyID : jsexit.BodyID, }); case JournalTypeEnum.SupercruiseEntry: return(new HistoryEntryStatus(prev) { TravelState = TravelStateType.Hyperspace, BodyName = !prev.BodyApproached ? curStarSystem : prev.BodyName, BodyType = !prev.BodyApproached ? "Star" : prev.BodyType, BodyID = !prev.BodyApproached ? -1 : prev.BodyID, }); case JournalTypeEnum.ApproachBody: JournalApproachBody jappbody = (JournalApproachBody)je; return(new HistoryEntryStatus(prev) { BodyApproached = true, BodyType = jappbody.BodyType, BodyName = jappbody.Body, BodyID = jappbody.BodyID, }); case JournalTypeEnum.LeaveBody: JournalLeaveBody jlbody = (JournalLeaveBody)je; return(new HistoryEntryStatus(prev) { BodyApproached = false, BodyType = "Star", BodyName = curStarSystem, BodyID = -1, }); case JournalTypeEnum.StartJump: if (prev.TravelState != TravelStateType.Hyperspace) // checking we are into hyperspace, we could already be if in a series of jumps { return(new HistoryEntryStatus(prev) { TravelState = TravelStateType.Hyperspace, }); } else { return(prev); } case JournalTypeEnum.ShipyardBuy: return(new HistoryEntryStatus(prev) { ShipID = -1, ShipType = ((JournalShipyardBuy)je).ShipType // BUY does not have ship id, but the new entry will that is written later - journals 8.34 }); case JournalTypeEnum.ShipyardNew: JournalShipyardNew jsnew = (JournalShipyardNew)je; return(new HistoryEntryStatus(prev) { ShipID = jsnew.ShipId, ShipType = jsnew.ShipType, ShipTypeFD = jsnew.ShipFD, }); case JournalTypeEnum.ShipyardSwap: JournalShipyardSwap jsswap = (JournalShipyardSwap)je; return(new HistoryEntryStatus(prev) { ShipID = jsswap.ShipId, ShipType = jsswap.ShipType, ShipTypeFD = jsswap.ShipFD, }); case JournalTypeEnum.JoinACrew: return(new HistoryEntryStatus(prev) { OnCrewWithCaptain = ((JournalJoinACrew)je).Captain }); case JournalTypeEnum.QuitACrew: return(new HistoryEntryStatus(prev) { OnCrewWithCaptain = null }); case JournalTypeEnum.Died: return(new HistoryEntryStatus(prev) { BodyName = "Unknown", BodyID = -1, BodyType = "Unknown", StationName = "Unknown", StationType = "Unknown", MarketId = null, TravelState = TravelStateType.Docked, OnCrewWithCaptain = null, BodyApproached = false, // we have to clear this, we can't tell if we are going back to another place.. }); case JournalTypeEnum.Loadout: var jloadout = (JournalLoadout)je; if (!ShipModuleData.IsSRV(jloadout.ShipFD)) // just double checking! { return(new HistoryEntryStatus(prev) { ShipID = jloadout.ShipId, ShipType = jloadout.Ship, ShipTypeFD = jloadout.ShipFD, }); } else { return(prev); } default: return(prev); } }
public static HistoryEntryStatus Update(HistoryEntryStatus prev, JournalEntry je, string curStarSystem) { if (prev == null) { prev = new HistoryEntryStatus(); } HistoryEntryStatus hes = prev; switch (je.EventTypeID) { case JournalTypeEnum.Location: { JournalLocation jloc = je as JournalLocation; bool locinstation = jloc.StationType.HasChars() || prev.StationType.HasChars(); // second is required due to alpha 4 stationtype being missing TravelStateType t = jloc.Docked ? (jloc.Multicrew == true ? TravelStateType.MulticrewDocked : TravelStateType.Docked) : (jloc.InSRV == true) ? (jloc.Multicrew == true ? TravelStateType.MulticrewSRV : TravelStateType.SRV) : // lat is pre 4.0 check jloc.Taxi == true ? TravelStateType.TaxiNormalSpace : // can't be in dropship, must be in normal space. jloc.OnFoot == true ? (locinstation ? TravelStateType.OnFootStarPort : TravelStateType.OnFootPlanet) : jloc.Latitude.HasValue ? (jloc.Multicrew == true ? TravelStateType.MulticrewLanded : TravelStateType.Landed) : jloc.Multicrew == true ? TravelStateType.MulticrewNormalSpace : TravelStateType.NormalSpace; hes = new HistoryEntryStatus(prev) // Bodyapproach copy over we should be in the same state as last.. { TravelState = t, MarketId = jloc.MarketID, BodyID = jloc.BodyID, BodyType = jloc.BodyType, BodyName = jloc.Body, Wanted = jloc.Wanted, StationName = jloc.StationName.Alt(jloc.Docked || locinstation ? jloc.Body : null), StationType = jloc.StationType.Alt(prev.StationType).Alt(jloc.Docked || locinstation ? jloc.BodyType : null), StationFaction = jloc.StationFaction, // may be null }; break; } case JournalTypeEnum.CarrierJump: var jcj = (je as JournalCarrierJump); hes = new HistoryEntryStatus(prev) // we are docked on a carrier { TravelState = TravelStateType.Docked, MarketId = jcj.MarketID, BodyID = jcj.BodyID, BodyType = jcj.BodyType, BodyName = jcj.Body, Wanted = jcj.Wanted, StationName = jcj.StationName.Alt(null), // if empty string, set to null StationType = jcj.StationType.Alt(null), }; break; case JournalTypeEnum.SupercruiseEntry: { var sc = je as JournalSupercruiseEntry; hes = new HistoryEntryStatus(prev) { TravelState = sc.Taxi == true ? (prev.TravelState == TravelStateType.DropShipNormalSpace ? TravelStateType.DropShipSupercruise : TravelStateType.TaxiSupercruise): sc.Multicrew == true ? TravelStateType.MulticrewSupercruise : TravelStateType.Supercruise, BodyName = !prev.BodyApproached ? curStarSystem : prev.BodyName, BodyType = !prev.BodyApproached ? "Star" : prev.BodyType, BodyID = !prev.BodyApproached ? -1 : prev.BodyID, BookedDropship = false, StationName = null, StationType = null, StationFaction = null, // to clear }; break; } case JournalTypeEnum.SupercruiseExit: { JournalSupercruiseExit jsexit = (JournalSupercruiseExit)je; hes = new HistoryEntryStatus(prev) { TravelState = jsexit.Taxi == true ? (prev.TravelState == TravelStateType.DropShipSupercruise ? TravelStateType.DropShipNormalSpace : TravelStateType.TaxiNormalSpace) : jsexit.Multicrew == true ? TravelStateType.MulticrewNormalSpace : TravelStateType.NormalSpace, BodyName = (prev.BodyApproached) ? prev.BodyName : jsexit.Body, BodyType = (prev.BodyApproached) ? prev.BodyType : jsexit.BodyType, BodyID = (prev.BodyApproached) ? prev.BodyID : jsexit.BodyID, }; break; } case JournalTypeEnum.FSDJump: { var jfsd = (je as JournalFSDJump); hes = new HistoryEntryStatus(prev) { // transition to XSupercruise TravelState = jfsd.Taxi == true ? (prev.TravelState == TravelStateType.DropShipSupercruise || prev.TravelState == TravelStateType.DropShipNormalSpace ? TravelStateType.DropShipSupercruise : TravelStateType.TaxiSupercruise) : jfsd.Multicrew == true ? TravelStateType.MulticrewSupercruise : TravelStateType.Supercruise, MarketId = null, BodyID = -1, BodyType = "Star", BodyName = jfsd.StarSystem, Wanted = jfsd.Wanted, StationName = null, StationType = null, StationFaction = null, // to ensure BodyApproached = false, }; break; } case JournalTypeEnum.LoadGame: JournalLoadGame jlg = je as JournalLoadGame; hes = new HistoryEntryStatus(prev) { OnCrewWithCaptain = null, // can't be in a crew at this point GameMode = jlg.GameMode, // set game mode Group = jlg.Group, // and group, may be empty TravelState = jlg.InSuit ? (prev.TravelState) : jlg.InTaxi ? TravelStateType.TaxiNormalSpace : jlg.InSRV ? TravelStateType.SRV : prev.TravelState != TravelStateType.Unknown ? prev.TravelState : TravelStateType.Docked, ShipType = jlg.InShip ? jlg.Ship : prev.ShipType, ShipID = jlg.InShip ? jlg.ShipId : prev.ShipID, ShipTypeFD = jlg.InShip ? jlg.ShipFD : prev.ShipTypeFD, BookedDropship = false, // to ensure }; break; case JournalTypeEnum.Docked: // Docked not seen when in Taxi. { JournalDocked jdocked = (JournalDocked)je; //System.Diagnostics.Debug.WriteLine("{0} Docked {1} {2} {3}", jdocked.EventTimeUTC, jdocked.StationName, jdocked.StationType, jdocked.Faction); hes = new HistoryEntryStatus(prev) { TravelState = jdocked.Taxi == true ? TravelStateType.TaxiDocked : jdocked.Multicrew == true ? TravelStateType.MulticrewDocked : TravelStateType.Docked, MarketId = jdocked.MarketID, Wanted = jdocked.Wanted, StationName = jdocked.StationName.Alt("Unknown"), StationType = jdocked.StationType.Alt("Station"), StationFaction = jdocked.Faction, }; break; } case JournalTypeEnum.Undocked: // undocked not seen when in taxi { var ju = je as JournalUndocked; hes = new HistoryEntryStatus(prev) { TravelState = ju.Taxi == true ? (prev.TravelState == TravelStateType.DropShipDocked ? TravelStateType.DropShipNormalSpace : TravelStateType.TaxiNormalSpace) : ju.Multicrew == true ? TravelStateType.MulticrewNormalSpace : TravelStateType.NormalSpace, MarketId = null, StationName = null, StationType = null, StationFaction = null, // to clear }; break; } case JournalTypeEnum.Embark: // foot-> SRV/Ship in multicrew or not. { var em = (JournalEmbark)je; hes = new HistoryEntryStatus(prev) { TravelState = em.SRV ? (em.Multicrew ? TravelStateType.MulticrewSRV : TravelStateType.SRV) : em.Taxi ? (prev.BookedDropship ? TravelStateType.DropShipDocked : TravelStateType.TaxiDocked) : em.Multicrew ? (prev.TravelState == TravelStateType.OnFootPlanet ? TravelStateType.MulticrewLanded : TravelStateType.MulticrewDocked): prev.TravelState == TravelStateType.OnFootPlanet ? TravelStateType.Landed: TravelStateType.Docked, BookedDropship = false, // update others tbd }; break; } case JournalTypeEnum.Disembark: // SRV/Ship -> on foot var disem = (JournalDisembark)je; bool instation = disem.StationType.HasChars() || prev.StationType.HasChars(); hes = new HistoryEntryStatus(prev) { TravelState = disem.SRV ? TravelStateType.OnFootPlanet : disem.OnStation == true ? TravelStateType.OnFootStarPort : disem.OnPlanet == true && instation ? TravelStateType.OnFootPlanetaryPort : TravelStateType.OnFootPlanet, StationName = disem.StationType.HasChars() ? disem.StationName.Alt("Unknown") : prev.StationName, // copying it over due to bug in alpha4 StationType = disem.StationType.HasChars() ? disem.StationType : prev.StationType, }; break; case JournalTypeEnum.DropshipDeploy: hes = new HistoryEntryStatus(prev) { TravelState = TravelStateType.OnFootPlanet, }; break; case JournalTypeEnum.LaunchSRV: hes = new HistoryEntryStatus(prev) { TravelState = TravelStateType.SRV }; break; case JournalTypeEnum.DockSRV: hes = new HistoryEntryStatus(prev) { TravelState = TravelStateType.Landed }; break; case JournalTypeEnum.Touchdown: // tbd do something with Body etc var td = (JournalTouchdown)je; if (td.PlayerControlled == true) // can get this when not player controlled { hes = new HistoryEntryStatus(prev) { TravelState = prev.TravelState == TravelStateType.MulticrewNormalSpace ? TravelStateType.MulticrewLanded : TravelStateType.Landed, }; } else { hes = prev; } break; case JournalTypeEnum.Liftoff: // tbd do something with Body etc var loff = (JournalLiftoff)je; if (loff.PlayerControlled == true) // can get this when not player controlled { hes = new HistoryEntryStatus(prev) { TravelState = prev.TravelState == TravelStateType.MulticrewLanded ? TravelStateType.MulticrewNormalSpace : TravelStateType.NormalSpace, }; } else { hes = prev; } break; case JournalTypeEnum.FighterDestroyed: case JournalTypeEnum.DockFighter: { if (prev.TravelState == TravelStateType.Fighter) { hes = new HistoryEntryStatus(prev) { TravelState = TravelStateType.NormalSpace }; } break; } case JournalTypeEnum.LaunchFighter: { var j = je as JournalLaunchFighter; if (j.PlayerControlled) { hes = new HistoryEntryStatus(prev) { TravelState = TravelStateType.Fighter, }; } break; } case JournalTypeEnum.ApproachBody: JournalApproachBody jappbody = (JournalApproachBody)je; hes = new HistoryEntryStatus(prev) { BodyApproached = true, BodyType = jappbody.BodyType, BodyName = jappbody.Body, BodyID = jappbody.BodyID, }; break; case JournalTypeEnum.ApproachSettlement: JournalApproachSettlement jappsettlement = (JournalApproachSettlement)je; hes = new HistoryEntryStatus(prev) { BodyApproached = true, BodyType = jappsettlement.BodyType, BodyName = jappsettlement.BodyName, BodyID = jappsettlement.BodyID, }; break; case JournalTypeEnum.LeaveBody: JournalLeaveBody jlbody = (JournalLeaveBody)je; hes = new HistoryEntryStatus(prev) { BodyApproached = false, BodyType = "Star", BodyName = curStarSystem, BodyID = -1, }; break; case JournalTypeEnum.ShipyardBuy: hes = new HistoryEntryStatus(prev) { ShipID = ulong.MaxValue, ShipType = ((JournalShipyardBuy)je).ShipType // BUY does not have ship id, but the new entry will that is written later - journals 8.34 }; break; case JournalTypeEnum.JoinACrew: hes = new HistoryEntryStatus(prev) { OnCrewWithCaptain = ((JournalJoinACrew)je).Captain }; break; case JournalTypeEnum.QuitACrew: hes = new HistoryEntryStatus(prev) { OnCrewWithCaptain = null }; break; case JournalTypeEnum.Died: hes = new HistoryEntryStatus(prev) { TravelState = TravelStateType.Unknown, OnCrewWithCaptain = null, BodyApproached = false, // we have to clear this, we can't tell if we are going back to another place.. BookedDropship = false, }; break; case JournalTypeEnum.Loadout: var jloadout = (JournalLoadout)je; if (ItemData.IsShip(jloadout.ShipFD)) // if ship, make a new entry { hes = new HistoryEntryStatus(prev) { ShipID = jloadout.ShipId, ShipType = jloadout.Ship, ShipTypeFD = jloadout.ShipFD, }; } break; case JournalTypeEnum.ShipyardNew: JournalShipyardNew jsnew = (JournalShipyardNew)je; hes = new HistoryEntryStatus(prev) { ShipID = jsnew.ShipId, ShipType = jsnew.ShipType, ShipTypeFD = jsnew.ShipFD, }; break; case JournalTypeEnum.ShipyardSwap: { JournalShipyardSwap jsswap = (JournalShipyardSwap)je; hes = new HistoryEntryStatus(prev) { ShipID = jsswap.ShipId, ShipType = jsswap.ShipType, ShipTypeFD = jsswap.ShipFD, }; break; } case JournalTypeEnum.BookDropship: hes = new HistoryEntryStatus(prev) { BookedDropship = true, }; break; case JournalTypeEnum.CancelDropship: case JournalTypeEnum.BookTaxi: hes = new HistoryEntryStatus(prev) { BookedDropship = false, }; break; } return(hes); }