XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

XFEEDToolBox

【WinUI】XFE精英危险工具箱

公开
关注 0 Fork 0 Star 0
UTF-8
using XFEEDToolBox.Core.Models;

namespace XFEEDToolBox.Core.Data;

/// <summary>Fictional sandbox, always kept outside the persistent live cache.</summary>
public static class DemoData
{
    public static PlayerState Player => new()
    {
        Commander = "CMDR EXPLORER · 演示", Ship = "Python", Credits = 15000000, CreditsReliable = true,
        CargoCapacity = 128, CargoCount = 8, MaxJumpRange = 24, Rebuy = 1800000,
        SystemName = "Sol", StationName = "演示 Galileo", MarketId = 900001,
        Docked = true, InGame = true, UpdatedAt = DateTimeOffset.UtcNow, Position = new(0, 0, 0),
        Inventory = [new("gold", "Gold", 5), new("drones", "Limpets", 3)],
        Materials = [new("iron", "Iron", 137, Group: "Raw"), new("chemicalprocessors", "Chemical Processors", 28, Group: "Manufactured"), new("dataminedwake", "Datamined Wake Exceptions", 12, Group: "Encoded")],
        Locker = [new("healthpack", "Medkit", 14, Group: "Consumables")]
    };

    public static MarketBook CreateBook()
    {
        var now = DateTimeOffset.UtcNow.AddMinutes(-8);
        var names = new[] { ("Sol", "Galileo", 0d, 0d), ("LHS 3447", "Dalton Gateway", 12d, 8d), ("Eravate", "Cleve Hub", 23d, 4d), ("Aulin", "Aulin Enterprise", 10d, -15d), ("Lave", "Lave Station", -8d, -18d), ("Diso", "Shifnalport", -18d, -4d) };
        var stations = names.Select((n, i) => new Station
        {
            MarketId = 900001 + i, SystemName = n.Item1, Name = "演示 " + n.Item2, Position = new(n.Item3, n.Item4, 0),
            MaxLandingPad = LandingPad.Large, Security = i == 4 ? SecurityLevel.Low : i % 2 == 0 ? SecurityLevel.High : SecurityLevel.Medium,
            DistanceToArrivalLs = new[] { 900d, 1450, 420, 120, 3200, 750 }[i], Type = "Coriolis", UpdatedAt = now
        }).ToArray();
        var goods = new[] { ("gold", "Gold", "Metals", 44000L), ("silver", "Silver", "Metals", 21000L), ("bertrandite", "Bertrandite", "Minerals", 16000L), ("cobalt", "Cobalt", "Metals", 12000L), ("agronomictreatment", "Agronomic Treatment", "Chemicals", 2800L), ("foodcartridges", "Food Cartridges", "Foods", 1500L), ("polymers", "Polymers", "Industrial Materials", 1100L), ("semiconductors", "Semiconductors", "Industrial Materials", 3000L), ("medicaldiagnosticequipment", "Medical Diagnostic Equipment", "Technology", 3800L), ("basicmedicines", "Basic Medicines", "Medicines", 2100L), ("computercomponents", "Computer Components", "Technology", 5200L), ("superconductors", "Superconductors", "Industrial Materials", 8000L) };
        var quotes = new List<CommodityQuote>();
        for (var i = 0; i < stations.Length; i++)
            for (var j = 0; j < goods.Length; j++)
            {
                var g = goods[j];
                var producer = i == j / 2;
                var consumer = i == (j / 2 + 1) % stations.Length;
                quotes.Add(new()
                {
                    MarketId = stations[i].MarketId, Commodity = g.Item1, DisplayName = g.Item2, Category = g.Item3,
                    BuyPrice = producer ? g.Item4 / 2 : consumer ? g.Item4 + 13000 : g.Item4, SellPrice = consumer ? g.Item4 + 12000 : producer ? g.Item4 * 4 / 10 : g.Item4 * 9 / 10,
                    MeanPrice = g.Item4, Supply = producer ? 76 : 1000, Demand = 1800, CollectedAt = now, Source = DataSource.Demonstration
                });
            }
        return new(stations, quotes);
    }
}