public static ShipUpgrades FromStream(IStarboundStream stream) { var su = new ShipUpgrades(); su.shipLevel = Json.FromStream(stream); su.maxFuel = Json.FromStream(stream); su.Capabilites = stream.ReadUInt8Array(); string temp = null; //todo this is really stupid. fixme foreach (var s in su.Capabilites) { temp += s; } //su.bah = stream.WriteVariant() // su.testingSet = stream.ReadHashSet(); /* * foreach (string s in test) * { * } */ return(su); }
public static SpawnedEntity FromStream(IStarboundStream stream) { SpawnedEntity se; EntityType et = (EntityType)stream.ReadUInt8(); byte[] storeData = stream.ReadUInt8Array((int)(stream.Length - stream.Position)); using (StarboundStream ss = new StarboundStream(storeData)) { if (et == EntityType.Projectile) { var sp = new SpawnedProjectile(); sp.ProjectileKey = ss.ReadString(); sp.Parameters = ss.ReadVariant(); se = sp; } else { se = new SpawnedEntity(); } } se.EntityType = et; se.StoreData = storeData; return(se); }
public static CelestialLog FromStream(IStarboundStream stream) { CelestialLog log = new CelestialLog(); byte[] logDat = stream.ReadUInt8Array(); using (StarboundStream s = new StarboundStream(logDat)) { uint visited = s.ReadUInt32(); for (int i = 0; i < visited; i++) { log.Visited.Add(s.ReadSystemCoordinate()); } uint sectors = s.ReadUInt32(); for (int i = 0; i < sectors; i++) { log.Sectors.Add(new LogSector { SectorName = s.ReadString(), Unknown = s.ReadBoolean() }); } s.ReadUInt8(); //unknown log.CurrentSystem = s.ReadSystemCoordinate(); log.CurrentLocation = s.ReadWorldCoordinate(); log.HomeCoordinate = s.ReadWorldCoordinate(); } return(log); }
// public byte[] Shipupgrades; // //public string Account; //public Variant Claim; //remove? public override void Read(IStarboundStream stream) { // AssetDigest = stream.ReadToEnd(); AssetDigest = stream.ReadUInt8Array(); SharpStarLogger.DefaultLogger.Info(string.Format("AsD:{0}", AssetDigest.Length)); UUID = stream.ReadUInt8Array(16); SharpStarLogger.DefaultLogger.Info(string.Format("uuid:{0}", UUID.Length)); PlayerName = stream.ReadString(); SharpStarLogger.DefaultLogger.Info(string.Format("player name:{0}", PlayerName)); Species = stream.ReadString(); SharpStarLogger.DefaultLogger.Info(string.Format("species:{0}", Species)); Shipworld = stream.ReadUInt8Array(); SharpStarLogger.DefaultLogger.Info(string.Format("Sw:{0}", Shipworld.Length)); ShipUpgrade = ShipUpgrades.FromStream(stream); Account = stream.ReadString(); SharpStarLogger.DefaultLogger.Info(string.Format("Account:{0}", Account)); // Shipupgrades = stream.ReadToEnd(); //SharpStarLogger.DefaultLogger.Info(string.Format("Sw:{0}", Shipupgrades.Length)); // ShipUpgrade = ShipUpgrades.FromStream(stream); // SharpStarLogger.DefaultLogger.Info(string.Format("AsD:{0},{1},{2}", ShipUpgrade.shipLevel.Value,ShipUpgrade.maxFuel.Value,ShipUpgrade.Capabilites.Length)); //Account = stream.ReadString(); // SharpStarLogger.DefaultLogger.Info(string.Format("AsD:{0}UUID:{1}PN:{2}SP:{3}SHW:{4}SHU:{5}"UUID,PlayerName,Shipworld,ShipUpgrade)); /* * AssetDigest = stream.ReadUInt8Array(); * // Claim = stream.ReadVariant(); * bool uuid = stream.ReadBoolean(); * if (uuid) * UUID = stream.ReadUInt8Array(16); * PlayerName = stream.ReadString(); * Species = stream.ReadString(); * Shipworld = stream.ReadUInt8Array(); * //todo shipupgrades * * */ }
public static Document FromStream(IStarboundStream stream) { Document doc = new Document(); doc.Name = stream.ReadString(); stream.ReadUInt8(); doc.Version = DataConverter.BigEndian.GetInt32(stream.ReadUInt8Array(4), 0); doc.Data = stream.ReadVariant(); return(doc); }
public override void Read(IStarboundStream stream) { ClientId = stream.ReadUInt32(); UUID = stream.ReadUInt8Array(16); cInfo = CelestialInfo.FromStream(stream); /* * CelestialInfos = new List<CelestialInfo>(); * * ulong length = stream.ReadVLQ(); * * for (ulong i = 0; i < length; i++) * { * CelestialInfos.Add(CelestialInfo.FromStream(stream)); * } */ }
public override void Read(IStarboundStream stream) { Sky = stream.ReadUInt8Array(); Weather = stream.ReadUInt8Array(); }
public static Entity FromStream(IStarboundStream stream) { EntityType et = (EntityType)stream.ReadUInt8(); byte[] storeData = stream.ReadUInt8Array(); Entity ent; if (et == EntityType.Projectile) { ProjectileEntity pent = new ProjectileEntity(); using (StarboundStream s = new StarboundStream(storeData)) { pent.Projectile = s.ReadString(); pent.Information = s.ReadVariant().Value as VariantDict; pent.Unknown1 = s.ReadUInt8Array(17); pent.ThrowerEntityId = s.ReadSignedVLQ(); pent.Unknown2 = s.ReadUInt8Array((int)(s.Length - s.Position)); } ent = pent; } else if (et == EntityType.Player) { PlayerEntity pent = new PlayerEntity(); using (StarboundStream s = new StarboundStream(storeData)) { /* * bool uuid = s.ReadBoolean(); * * if (uuid) * { */ byte[] uuidDat = s.ReadUInt8Array(16); pent.UUID = BitConverter.ToString(uuidDat, 0).Replace("-", "").ToLower(); //} } ent = pent; } else if (et == EntityType.Object) { ObjectEntity oent = new ObjectEntity(); using (StarboundStream s = new StarboundStream(storeData)) { oent.Object = s.ReadString(); oent.Information = s.ReadVariant(); oent.Unknown = s.ReadUInt8Array((int)(s.Length - s.Position)); } ent = oent; } else { ent = new Entity(); } ent.EntityType = et; ent.StoreData = storeData; ent.EntityId = stream.ReadSignedVLQ(); return(ent); }
public override void Read(IStarboundStream stream) { Data = stream.ReadUInt8Array((int)(stream.Length - stream.Position)); //if (Data.Length != 0) //{ // using (MemoryStream ms = new MemoryStream(Data)) // { // using (StarboundStream s = new StarboundStream(ms)) // { // byte[] data = s.ReadUInt8Array(); // if (data.Length > 8) // { // using (MemoryStream ms2 = new MemoryStream(data)) // { // using (StarboundStream s2 = new StarboundStream(ms2)) // { // byte bufLength = s2.ReadUInt8(); // if (bufLength == 10 && (s2.Length - s2.Position) >= 1000) // { // World = new World(); // World.Read(s2.ReadUInt8Array()); // } // else if (bufLength == 2) // { // int discarded; // int vlq = (int)s2.ReadVLQ(out discarded); // if (vlq == 4 && s2.Length - s2.Position >= 1000) //World data is at least over 1000 bytes, probably more // { // byte[] unknown1 = s2.ReadUInt8Array(30); // byte[] d = s2.ReadUInt8Array(); // World = new World(); // World.Read(d); // } // } // } // } // } // } // } //} }