2020-03-22 19:05:26 +00:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using MessagePack;
|
|
|
|
|
|
using Newtonsoft.Json;
|
2020-03-24 00:02:23 +00:00
|
|
|
|
using Unity.Mathematics;
|
2020-03-29 04:19:24 +01:00
|
|
|
|
using static Unity.Mathematics.math;
|
2020-03-22 19:05:26 +00:00
|
|
|
|
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public class ZoneData : DatabaseEntry, INamedEntry
|
|
|
|
|
|
{
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[JsonProperty("name"), Key(1)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public string Name;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("position"), Key(2)]
|
2020-03-24 00:02:23 +00:00
|
|
|
|
public float2 Position = 500;
|
2020-03-22 19:05:26 +00:00
|
|
|
|
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[JsonProperty("wormholes"), Key(3)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public List<Guid> Wormholes = new List<Guid>();
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("stations"), Key(4)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public List<Guid> Stations = new List<Guid>();
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("planets"), Key(5)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public List<Guid> Planets = new List<Guid>();
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("orbits"), Key(6)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public List<Guid> Orbits = new List<Guid>();
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("radius"), Key(7)]
|
2020-03-29 04:19:24 +01:00
|
|
|
|
public float Radius = 2000;
|
|
|
|
|
|
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[JsonProperty("visited"), Key(8)]
|
2020-03-29 04:19:24 +01:00
|
|
|
|
public bool Visited;
|
|
|
|
|
|
|
2020-03-22 19:05:26 +00:00
|
|
|
|
[IgnoreMember] public string EntryName
|
|
|
|
|
|
{
|
|
|
|
|
|
get => Name;
|
|
|
|
|
|
set => Name = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
2020-04-16 03:08:18 +01:00
|
|
|
|
public class StationData : DatabaseEntry, INamedEntry
|
2020-03-22 19:05:26 +00:00
|
|
|
|
{
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[JsonProperty("name"), Key(1)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public string Name;
|
|
|
|
|
|
|
|
|
|
|
|
// Can be Planet or Orbit
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[JsonProperty("parent"), Key(2)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public Guid Parent;
|
|
|
|
|
|
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[JsonProperty("owner"), Key(3)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public Guid Owner;
|
|
|
|
|
|
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[JsonProperty("inventory"), Key(4)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public List<ItemInstance> Inventory = new List<ItemInstance>();
|
|
|
|
|
|
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[JsonProperty("buying"), Key(5)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public Dictionary<Guid, float> BuyPrices = new Dictionary<Guid, float>();
|
|
|
|
|
|
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[JsonProperty("selling"), Key(6)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public Dictionary<Guid, float> SellPrices = new Dictionary<Guid, float>();
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("zone"), Key(7)]
|
2020-03-26 02:49:09 +00:00
|
|
|
|
public Guid Zone;
|
|
|
|
|
|
|
2020-03-22 19:05:26 +00:00
|
|
|
|
[IgnoreMember] public string EntryName
|
|
|
|
|
|
{
|
|
|
|
|
|
get => Name;
|
|
|
|
|
|
set => Name = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public class PlanetData : DatabaseEntry, INamedEntry
|
|
|
|
|
|
{
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[JsonProperty("name"), Key(1)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public string Name;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("orbit"), Key(2)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public Guid Orbit;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("mass"), Key(3)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public float Mass;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("zone"), Key(4)]
|
2020-03-26 02:49:09 +00:00
|
|
|
|
public Guid Zone;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("belt"), Key(5)]
|
2020-03-30 17:54:54 +01:00
|
|
|
|
public bool Belt;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
2020-04-16 03:08:18 +01:00
|
|
|
|
[JsonProperty("resources"), Key(6)]
|
2020-04-09 07:48:45 +01:00
|
|
|
|
public Dictionary<Guid, float> Resources = new Dictionary<Guid, float>();
|
2020-03-30 17:54:54 +01:00
|
|
|
|
|
2020-03-30 03:11:57 +01:00
|
|
|
|
// [JsonProperty("radius")] [Key(5)]
|
|
|
|
|
|
// public float GravityRadius;
|
2020-03-29 04:19:24 +01:00
|
|
|
|
|
2020-03-22 19:05:26 +00:00
|
|
|
|
[IgnoreMember] public string EntryName
|
|
|
|
|
|
{
|
|
|
|
|
|
get => Name;
|
|
|
|
|
|
set => Name = value;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[RethinkTable("Galaxy"), MessagePackObject, JsonObject(MemberSerialization.OptIn)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public class OrbitData : DatabaseEntry
|
|
|
|
|
|
{
|
2020-04-09 07:48:45 +01:00
|
|
|
|
[JsonProperty("parent"), Key(1)]
|
2020-03-29 04:19:24 +01:00
|
|
|
|
public Guid Parent;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("distance"), Key(2)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public float Distance;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("phase"), Key(3)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public float Phase;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("period"), Key(4)]
|
2020-03-22 19:05:26 +00:00
|
|
|
|
public float Period;
|
2020-04-09 07:48:45 +01:00
|
|
|
|
|
|
|
|
|
|
[JsonProperty("zone"), Key(5)]
|
2020-03-26 02:49:09 +00:00
|
|
|
|
public Guid Zone;
|
2020-03-29 04:19:24 +01:00
|
|
|
|
|
|
|
|
|
|
public static float2 Evaluate(float phase)
|
|
|
|
|
|
{
|
|
|
|
|
|
phase *= (PI * 2);
|
|
|
|
|
|
return new float2(sin(phase), cos(phase));
|
|
|
|
|
|
}
|
2020-03-22 19:05:26 +00:00
|
|
|
|
}
|