public static List <JToken> HistoricList(HistoryList history) // may create NULL entries if some material items not found { List <JToken> eventstosend = new List <JToken>(); HistoryEntry last = history.GetLast; if (last != null && last.EventTimeUTC > DateTime.UtcNow.AddDays(-30)) { foreach (var s in history.ShipInformationList.Ships) { ShipInformation si = s.Value; if (si.State == ShipInformation.ShipState.Owned && ShipModuleData.IsShip(si.ShipFD)) { // loadout may be null if nothing in it. eventstosend.Add(InaraClass.setCommanderShipLoadout(si.ShipFD, si.ID, si.Modules.Values, DateTime.UtcNow)); eventstosend.Add(InaraClass.setCommanderShip(si.ShipFD, si.ID, DateTime.UtcNow, si.ShipUserName, si.ShipUserIdent, last.ShipInformation.ID == si.ID, null, si.HullValue, si.ModulesValue, si.Rebuy, si.StoredAtSystem, si.StoredAtStation)); } } eventstosend.Add(InaraClass.setCommanderStorageModules(last.StoredModules.StoredModules, last.EventTimeUTC)); } eventstosend = eventstosend.Where(x => x != null).ToList(); // remove any nulls return(eventstosend); }
public void LoadGame(int id, string ship, string shipfd, string name, string ident, double fuellevel, double fueltotal) // LoadGame.. { string sid = Key(shipfd, id); ShipInformation sm = EnsureShip(sid); // this either gets current ship or makes a new one. Ships[sid] = sm = sm.SetShipDetails(ship, shipfd, name, ident, fuellevel, fueltotal); // this makes a shallow copy if any data has changed.. //System.Diagnostics.Debug.WriteLine("Load Game " + sid); if (ShipModuleData.IsShip(shipfd)) { currentid = sid; } VerifyList(); }
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), StationFaction = jloc.StationFaction, // may be null }); case JournalTypeEnum.CarrierJump: var jcj = (je as JournalCarrierJump); return(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), }); case JournalTypeEnum.FSDJump: var 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, StationFaction = null, // to ensure }); case JournalTypeEnum.LoadGame: JournalLoadGame jlg = je as JournalLoadGame; bool isnotship = !ShipModuleData.IsShip(jlg.ShipFD); string shiptype = isnotship ? prev.ShipType : jlg.Ship; string shiptypefd = isnotship ? prev.ShipTypeFD : jlg.ShipFD; int shipid = isnotship ? 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 || isnotship) ? TravelStateType.Landed : prev.TravelState, ShipType = shiptype, ShipID = shipid, ShipTypeFD = shiptypefd, StationFaction = null, // to ensure }); case JournalTypeEnum.Docked: JournalDocked jdocked = (JournalDocked)je; //System.Diagnostics.Debug.WriteLine("{0} Station {1} {2}", jdocked.EventTimeUTC, jdocked.StationName, jdocked.Faction); return(new HistoryEntryStatus(prev) { TravelState = TravelStateType.Docked, MarketId = jdocked.MarketID, Wanted = jdocked.Wanted, StationName = jdocked.StationName, StationType = jdocked.StationType, StationFaction = jdocked.Faction, }); case JournalTypeEnum.Undocked: return(new HistoryEntryStatus(prev) { TravelState = TravelStateType.NormalSpace, MarketId = null, StationName = null, StationType = null, StationFaction = null, // to clear }); 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.ApproachSettlement: JournalApproachSettlement jappsettlement = (JournalApproachSettlement)je; return(new HistoryEntryStatus(prev) { BodyApproached = true, BodyType = jappsettlement.BodyType, BodyName = jappsettlement.BodyName, BodyID = jappsettlement.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.IsShip(jloadout.ShipFD)) // if ship, make a new entry { return(new HistoryEntryStatus(prev) { ShipID = jloadout.ShipId, ShipType = jloadout.Ship, ShipTypeFD = jloadout.ShipFD, }); } else { return(prev); } default: return(prev); } }
public static List <JToken> NewEntryList(HistoryEntry he) // may create NULL entries if some material items not found { List <JToken> eventstosend = new List <JToken>(); switch (he.journalEntry.EventTypeID) { case JournalTypeEnum.ShipyardBuy: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalShipyardBuy; if (je.StoreOldShipFD != null && je.StoreOldShipId.HasValue) { eventstosend.Add(InaraClass.setCommanderShip(je.StoreOldShipFD, je.StoreOldShipId.Value, he.EventTimeUTC, curship: false, starsystemName: he.System.Name, stationName: he.WhereAmI)); } if (je.SellOldShipFD != null && je.SellOldShipId.HasValue) { eventstosend.Add(InaraClass.delCommanderShip(je.SellOldShipFD, je.SellOldShipId.Value, he.EventTimeUTC)); } eventstosend.Add(InaraClass.setCommanderCredits(he.Credits, he.EventTimeUTC)); CmdrCredits = he.Credits; break; } case JournalTypeEnum.ShipyardNew: // into a new ship // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalShipyardNew; eventstosend.Add(InaraClass.setCommanderShip(je.ShipFD, je.ShipId, he.EventTimeUTC, curship: true, starsystemName: he.System.Name, stationName: he.WhereAmI)); break; } case JournalTypeEnum.ShipyardSell: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalShipyardSell; eventstosend.Add(InaraClass.delCommanderShip(je.ShipTypeFD, je.SellShipId, he.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderCredits(he.Credits, he.EventTimeUTC)); CmdrCredits = he.Credits; break; } case JournalTypeEnum.ShipyardSwap: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalShipyardSwap; eventstosend.Add(InaraClass.setCommanderShip(je.StoreOldShipFD, je.StoreShipId.Value, he.EventTimeUTC, curship: false, starsystemName: he.System.Name, stationName: he.WhereAmI)); eventstosend.Add(InaraClass.setCommanderShip(je.ShipFD, je.ShipId, he.EventTimeUTC, curship: true, starsystemName: he.System.Name, stationName: he.WhereAmI)); break; } case JournalTypeEnum.ShipyardTransfer: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalShipyardTransfer; eventstosend.Add(InaraClass.setCommanderShipTransfer(je.ShipTypeFD, je.ShipId, he.System.Name, he.WhereAmI, he.MarketID, je.nTransferTime ?? 0, he.EventTimeUTC)); break; } case JournalTypeEnum.Loadout: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalLoadout; var si = he.ShipInformation; if (si != null && je.ShipFD.HasChars() && ShipModuleData.IsShip(je.ShipFD)) // if it has an FDname (defensive) and is not SRV/Fighter { if (je.ShipId == si.ID) { eventstosend.Add(InaraClass.setCommanderShipLoadout(je.ShipFD, je.ShipId, si.Modules.Values, he.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderShip(je.ShipFD, je.ShipId, he.EventTimeUTC, je.ShipName, je.ShipIdent, true, null, je.HullValue, je.ModulesValue, je.Rebuy)); } else { System.Diagnostics.Debug.WriteLine("ERROR IN EDD Inara system:Current ship does not match loadout"); } } break; } case JournalTypeEnum.StoredModules: // VERIFIED 18/5/2018 from historic upload test { eventstosend.Add(InaraClass.setCommanderStorageModules(he.StoredModules.StoredModules, he.EventTimeUTC)); break; } case JournalTypeEnum.SetUserShipName: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalSetUserShipName; eventstosend.Add(InaraClass.setCommanderShip(je.ShipFD, je.ShipID, he.EventTimeUTC, curship: true, username: je.ShipName, userid: je.ShipIdent, starsystemName: he.System.Name, stationName: he.WhereAmI)); break; } case JournalTypeEnum.Docked: // VERIFIED 18/5/2018 from historic upload test { if (he.ShipInformation != null) // PR2754 error - a empty list can end up with he.shipinformation = null if all is hidden. { var je = he.journalEntry as JournalDocked; eventstosend.Add(InaraClass.addCommanderTravelDock(he.ShipInformation.ShipFD, he.ShipInformation.ID, je.StarSystem, je.StationName, je.MarketID, he.EventTimeUTC)); } break; } case JournalTypeEnum.FSDJump: // VERIFIED 18/5/2018 { if (he.ShipInformation != null) // PR2754 error - a empty list can end up with he.shipinformation = null if all is hidden. { var je = he.journalEntry as JournalFSDJump; eventstosend.Add(InaraClass.addCommanderTravelFSDJump(he.ShipInformation.ShipFD, he.ShipInformation.ID, je.StarSystem, je.JumpDist, he.EventTimeUTC)); } break; } case JournalTypeEnum.CarrierJump: // NEW! 26/5/2020 { if (he.ShipInformation != null) // PR2754 error - a empty list can end up with he.shipinformation = null if all is hidden. { var je = he.journalEntry as JournalCarrierJump; eventstosend.Add(InaraClass.addCommanderTravelCarrierJump(he.ShipInformation.ShipFD, he.ShipInformation.ID, je.StarSystem, he.EventTimeUTC)); } break; } case JournalTypeEnum.Location: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalLocation; eventstosend.Add(InaraClass.setCommanderTravelLocation(je.StarSystem, je.Docked ? je.StationName : null, je.Docked ? je.MarketID : null, he.EventTimeUTC)); break; } case JournalTypeEnum.MissionAccepted: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalMissionAccepted; eventstosend.Add(InaraClass.addCommanderMission(je, he.System.Name, he.WhereAmI)); break; } case JournalTypeEnum.MissionAbandoned: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalMissionAbandoned; eventstosend.Add(InaraClass.setCommanderMissionAbandoned(je.MissionId, he.EventTimeUTC)); break; } case JournalTypeEnum.MissionFailed: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalMissionFailed; eventstosend.Add(InaraClass.setCommanderMissionFailed(je.MissionId, he.EventTimeUTC)); break; } case JournalTypeEnum.MissionCompleted: // VERIFIED 18/5/2018 { var je = he.journalEntry as JournalMissionCompleted; eventstosend.Add(InaraClass.setCommanderMissionCompleted(je)); break; } case JournalTypeEnum.Rank: //rank before progress, cache { var je = he.journalEntry as JournalRank; ranksave = je; break; } case JournalTypeEnum.Progress: // progress comes after rank in journal logs { if (ranksave != null) { JournalProgress progress = he.journalEntry as JournalProgress; eventstosend.Add(InaraClass.setCommanderRankPilot("combat", (int)ranksave.Combat, progress?.Combat ?? -1, ranksave.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderRankPilot("trade", (int)ranksave.Trade, progress?.Trade ?? -1, ranksave.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderRankPilot("explore", (int)ranksave.Explore, progress?.Explore ?? -1, ranksave.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderRankPilot("empire", (int)ranksave.Empire, progress?.Empire ?? -1, ranksave.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderRankPilot("federation", (int)ranksave.Federation, progress?.Federation ?? -1, ranksave.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderRankPilot("cqc", (int)ranksave.CQC, progress?.CQC ?? -1, ranksave.EventTimeUTC)); } break; } case JournalTypeEnum.Promotion: // promotion { var promotion = he.journalEntry as JournalPromotion; if (promotion.Combat != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("combat", (int)promotion.Combat, 0, promotion.EventTimeUTC)); // by definition, since your promoted, progress = 0 } if (promotion.Trade != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("trade", (int)promotion.Trade, 0, promotion.EventTimeUTC)); // by definition, since your promoted, progress = 0 } if (promotion.Explore != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("explore", (int)promotion.Explore, 0, promotion.EventTimeUTC)); // by definition, since your promoted, progress = 0 } if (promotion.Empire != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("empire", (int)promotion.Empire, 0, promotion.EventTimeUTC)); // by definition, since your promoted, progress = 0 } if (promotion.Federation != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("federation", (int)promotion.Federation, 0, promotion.EventTimeUTC)); // by definition, since your promoted, progress = 0 } if (promotion.CQC != null) { eventstosend.Add(InaraClass.setCommanderRankPilot("cqc", (int)promotion.CQC, 0, promotion.EventTimeUTC)); // by definition, since your promoted, progress = 0 } break; } case JournalTypeEnum.Reputation: // VERIFIED 16/5/18 { var reputation = he.journalEntry as JournalReputation; eventstosend.Add(InaraClass.setCommanderReputationMajorFaction("federation", reputation.Federation.HasValue ? reputation.Federation.Value : 0, reputation.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderReputationMajorFaction("empire", reputation.Empire.HasValue ? reputation.Empire.Value : 0, reputation.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderReputationMajorFaction("independent", reputation.Independent.HasValue ? reputation.Independent.Value : 0, reputation.EventTimeUTC)); eventstosend.Add(InaraClass.setCommanderReputationMajorFaction("alliance", reputation.Alliance.HasValue ? reputation.Alliance.Value : 0, reputation.EventTimeUTC)); break; } case JournalTypeEnum.Powerplay: // VERIFIED 16/5/18 { JournalPowerplay power = he.journalEntry as JournalPowerplay; eventstosend.Add(InaraClass.setCommanderRankPower(power.Power, power.Rank, power.EventTimeUTC)); break; } case JournalTypeEnum.EngineerProgress: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalEngineerProgress; foreach (var x in je.Engineers) { eventstosend.Add(InaraClass.setCommanderRankEngineer(x.Engineer, x.Progress, x.Rank, he.EventTimeUTC)); } break; } case JournalTypeEnum.Died: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalDied; string[] killers = je.Killers != null?je.Killers.Select(x => x.Name).ToArray() : null; eventstosend.Add(InaraClass.addCommanderCombatDeath(he.System.Name, killers, he.EventTimeUTC)); break; } case JournalTypeEnum.Interdicted: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalInterdicted; eventstosend.Add(InaraClass.addCommanderCombatInterdicted(he.System.Name, je.Interdictor, je.IsPlayer, je.Submitted, he.EventTimeUTC)); break; } case JournalTypeEnum.Interdiction: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalInterdiction; eventstosend.Add(InaraClass.addCommanderCombatInterdiction(he.System.Name, je.Interdicted.HasChars() ? je.Interdicted : je.Faction, je.IsPlayer, je.Success, he.EventTimeUTC)); break; } case JournalTypeEnum.EscapeInterdiction: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalEscapeInterdiction; eventstosend.Add(InaraClass.addCommanderCombatInterdictionEscape(he.System.Name, je.Interdictor, je.IsPlayer, he.EventTimeUTC)); break; } case JournalTypeEnum.PVPKill: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalPVPKill; eventstosend.Add(InaraClass.addCommanderCombatKill(he.System.Name, je.Victim, he.EventTimeUTC)); break; } case JournalTypeEnum.CargoDepot: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalCargoDepot; if (je.CargoType.HasChars() && je.Count > 0) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.CargoType, he.EventTimeUTC)); } break; } case JournalTypeEnum.CollectCargo: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalCollectCargo; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Type, he.EventTimeUTC)); break; } case JournalTypeEnum.EjectCargo: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalEjectCargo; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Type, he.EventTimeUTC)); break; } case JournalTypeEnum.EngineerContribution: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalEngineerContribution; if (je.Commodity.HasChars()) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Commodity, he.EventTimeUTC)); } if (je.Material.HasChars()) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Material, he.EventTimeUTC)); } break; } case JournalTypeEnum.MarketBuy: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalMarketBuy; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Type, he.EventTimeUTC)); break; } case JournalTypeEnum.MarketSell: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalMarketSell; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Type, he.EventTimeUTC)); break; } case JournalTypeEnum.Cargo: //VERIFIED 16/5/18 { List <MaterialCommodities> commod = he.MaterialCommodity.Sort(true); // all commodities var listc = commod.Where(x => x.Count > 0).Select(x => new Tuple <string, int>(x.Details.FDName, x.Count)); eventstosend.Add(InaraClass.setCommanderInventoryCargo(listc, he.EventTimeUTC)); break; } case JournalTypeEnum.Materials: //VERIFIED 16/5/18 { List <MaterialCommodities> mat = he.MaterialCommodity.Sort(false); // all materials var listm = mat.Where(x => x.Count > 0).Select(x => new Tuple <string, int>(x.Details.FDName, x.Count)); eventstosend.Add(InaraClass.setCommanderInventoryMaterials(listm, he.EventTimeUTC)); break; } case JournalTypeEnum.MaterialCollected: { var je = he.journalEntry as JournalMaterialCollected; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Name, he.EventTimeUTC)); break; } case JournalTypeEnum.MaterialDiscarded: { var je = he.journalEntry as JournalMaterialDiscarded; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Name, he.EventTimeUTC)); break; } case JournalTypeEnum.MiningRefined: { var je = he.journalEntry as JournalMiningRefined; eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Type, he.EventTimeUTC)); break; } case JournalTypeEnum.MaterialTrade: // one out, one in.. //VERIFIED 16/5/18 { var je = he.journalEntry as JournalMaterialTrade; if (je.Paid != null) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Paid.Material, he.EventTimeUTC)); } if (je.Received != null) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, je.Received.Material, he.EventTimeUTC)); } break; } case JournalTypeEnum.EngineerCraft: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalEngineerCraft; if (je.Ingredients != null) { foreach (KeyValuePair <string, int> k in je.Ingredients) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, k.Key, he.EventTimeUTC)); } } break; } case JournalTypeEnum.Synthesis: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalSynthesis; if (je.Materials != null) { foreach (KeyValuePair <string, int> k in je.Materials) { eventstosend.Add(InaraClass.setCommanderInventoryItem(he.MaterialCommodity, k.Key, he.EventTimeUTC)); } } break; } case JournalTypeEnum.Statistics: //VERIFIED 16/5/18 { JournalStatistics stats = he.journalEntry as JournalStatistics; eventstosend.Add(InaraClass.setCommanderGameStatistics(stats.GetJsonCloned(), stats.EventTimeUTC)); break; } case JournalTypeEnum.CommunityGoal: //VERIFIED 16/5/18 { var je = he.journalEntry as JournalCommunityGoal; foreach (var c in je.CommunityGoals) { eventstosend.Add(InaraClass.setCommunityGoal(c, he.EventTimeUTC)); eventstosend.Add(InaraClass.setCommandersCommunityGoalProgress(c, he.EventTimeUTC)); } break; } case JournalTypeEnum.Friends: { var je = he.journalEntry as JournalFriends; if (je.StatusList != null) { for (int i = 0; i < je.StatusList.Count; i++) { string s = je.StatusList[i].ToLower(); if (s == "online" || s == "added") { eventstosend.Add(InaraClass.addCommanderFriend(je.NameList[i], he.EventTimeUTC)); } else if (s == "lost") { eventstosend.Add(InaraClass.delCommanderFriend(je.NameList[i], he.EventTimeUTC)); } } } else { string s = je.Status.ToLower(); if (s == "online" || s == "added") { eventstosend.Add(InaraClass.addCommanderFriend(je.Name, he.EventTimeUTC)); } else if (s == "lost") { eventstosend.Add(InaraClass.delCommanderFriend(je.Name, he.EventTimeUTC)); } } break; } } if (Math.Abs(CmdrCredits - he.Credits) > 500000) { eventstosend.Add(InaraClass.setCommanderCredits(he.Credits, he.EventTimeUTC)); CmdrCredits = he.Credits; } eventstosend = eventstosend.Where(x => x != null).ToList(); // remove any nulls return(eventstosend); }