Exemplo n.º 1
0
        }                                                                                    // SPECIAL USE ONLY - DOES NOT COMPUTE ALL THE OTHER STUFF

        public void Copy(HistoryList other)                                                  // Must copy all relevant items..
        {
            historylist                       = new List <HistoryEntry>(other.EntryOrder()); // clone list
            CashLedger                        = other.CashLedger;
            StarScan                          = other.StarScan;
            ShipInformationList               = other.ShipInformationList;
            CommanderId                       = other.CommanderId;
            MissionListAccumulator            = other.MissionListAccumulator;
            MaterialCommoditiesMicroResources = other.MaterialCommoditiesMicroResources;
            WeaponList                        = other.WeaponList;
            SuitList                          = other.SuitList;
            SuitLoadoutList                   = other.SuitLoadoutList;
            statisticsaccumulator             = other.statisticsaccumulator;
            Shipyards                         = other.Shipyards;
            Outfitting                        = other.Outfitting;
            Visited    = other.Visited;
            LastSystem = other.LastSystem;
        }
Exemplo n.º 2
0
        }                                         // SPECIAL USE ONLY - DOES NOT COMPUTE ALL THE OTHER STUFF

        public void Copy(HistoryList other)       // Must copy all relevant items.. been caught out by this 23/6/2017
        {
            historylist.Clear();

            foreach (var ent in other.EntryOrder())
            {
                historylist.Add(ent);
                Debug.Assert(ent.MaterialCommodity != null);
            }

            CashLedger             = other.CashLedger;
            StarScan               = other.StarScan;
            ShipInformationList    = other.ShipInformationList;
            CommanderId            = other.CommanderId;
            missionlistaccumulator = other.missionlistaccumulator;
            Shipyards              = other.Shipyards;
            Outfitting             = other.Outfitting;
            Visited    = other.Visited;
            LastSystem = other.LastSystem;
        }
Exemplo n.º 3
0
        public JToken NewSRec(EliteDangerousCore.HistoryList hl, string type, int entry)       // entry = -1 means latest
        {
            HistoryEntry he = hl.EntryOrder()[entry];

            JObject response = new JObject();

            response["responsetype"] = type;
            response["entry"]        = entry;

            JObject systemdata = new JObject();

            systemdata["System"]        = he.System.Name;
            systemdata["SystemAddress"] = he.System.SystemAddress;
            systemdata["PosX"]          = he.System.X.ToStringInvariant("0.00");
            systemdata["PosY"]          = he.System.Y.ToStringInvariant("0.00");
            systemdata["PosZ"]          = he.System.Z.ToStringInvariant("0.00");
            systemdata["EDSMID"]        = he.System.EDSMID.ToStringInvariant();
            systemdata["VisitCount"]    = hl.GetVisitsCount(he.System.Name);
            response["SystemData"]      = systemdata;

            // TBD.. if EDSMID = 0 , we may not have looked at it in the historywindow, do we want to do a lookup?

            JObject sysstate = new JObject();

            hl.ReturnSystemInfo(he, out string allegiance, out string economy, out string gov, out string faction, out string factionstate, out string security);
            sysstate["State"]      = factionstate;
            sysstate["Allegiance"] = allegiance;
            sysstate["Gov"]        = gov;
            sysstate["Economy"]    = economy;
            sysstate["Faction"]    = faction;
            sysstate["Security"]   = security;
            sysstate["MarketID"]   = he.MarketID;
            response["EDDB"]       = sysstate;

            var mcl = hl.MaterialCommoditiesMicroResources.Get(he.MaterialCommodity);

            int    cargocount = MaterialCommoditiesMicroResourceList.CargoCount(mcl);
            string shipname = "N/A", fuel = "N/A", range = "N/A", tanksize = "N/A";
            string cargo = cargocount.ToStringInvariant();

            ShipInformation si = he.ShipInformation;

            if (si != null)
            {
                shipname = si.ShipFullInfo(cargo: false, fuel: false);
                if (si.FuelLevel > 0)
                {
                    fuel = si.FuelLevel.ToStringInvariant("0.#");
                }
                if (si.FuelCapacity > 0)
                {
                    tanksize = si.FuelCapacity.ToStringInvariant("0.#");
                }

                EliteDangerousCalculations.FSDSpec fsd = si.GetFSDSpec();
                if (fsd != null)
                {
                    EliteDangerousCalculations.FSDSpec.JumpInfo ji = fsd.GetJumpInfo(cargocount,
                                                                                     si.ModuleMass() + si.HullMass(), si.FuelLevel, si.FuelCapacity / 2);
                    range = ji.cursinglejump.ToString("N2") + "ly";
                }

                int cargocap = si.CargoCapacity();

                if (cargocap > 0)
                {
                    cargo += "/" + cargocap.ToStringInvariant();
                }
            }

            JObject ship = new JObject();

            ship["Ship"]           = shipname;
            ship["Fuel"]           = fuel;
            ship["Range"]          = range;
            ship["TankSize"]       = tanksize;
            ship["Cargo"]          = cargo;
            ship["Data"]           = MaterialCommoditiesMicroResourceList.DataCount(mcl).ToStringInvariant();
            ship["Materials"]      = MaterialCommoditiesMicroResourceList.MaterialsCount(mcl).ToStringInvariant();
            ship["MicroResources"] = MaterialCommoditiesMicroResourceList.MicroResourcesCount(mcl).ToStringInvariant();
            response["Ship"]       = ship;

            JObject travel = new JObject();

            if (he.isTravelling)
            {
                travel["Dist"]         = he.TravelledDistance.ToStringInvariant("0.0");
                travel["Jumps"]        = he.Travelledjumps.ToStringInvariant();
                travel["UnknownJumps"] = he.TravelledMissingjump.ToStringInvariant();
                travel["Time"]         = he.TravelledSeconds.ToString();
            }
            else
            {
                travel["Time"] = travel["Jumps"] = travel["Dist"] = "";
            }

            response["Travel"] = travel;

            response["Bodyname"] = he.WhereAmI;

            if (he.System.HasCoordinate)         // cursystem has them?
            {
                response["HomeDist"] = he.System.Distance(EDCommander.Current.HomeSystemIOrSol).ToString("0.##");
                response["SolDist"]  = he.System.Distance(0, 0, 0).ToString("0.##");
            }
            else
            {
                response["SolDist"] = response["HomeDist"] = "-";
            }

            response["GameMode"]  = he.GameModeGroup;
            response["Credits"]   = he.Credits.ToStringInvariant();
            response["Commander"] = EDCommander.Current.Name;
            response["Mode"]      = he.TravelState.ToString();

            return(response);
        }