示例#1
0
        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);
        }
示例#2
0
        public void WriteTo(IStarboundStream stream)
        {
            stream.WriteInt32(planetOrbitalLevels);
            stream.WriteInt32(satelliteOrbitalLevels);
            stream.WriteInt32(ChunkSize);
            xyCoordRange.WriteTo(stream);
            stream.Write(zCoordRange, 0, zCoordRange.Length);
            // zCoordRange.WriteTo(stream);
            //  stream.WriteInt32(zCoordRange);

            /*
             * stream.WriteInt32(OrbitalLevels);
             * stream.WriteInt32(ChunkSize);
             * stream.WriteInt32(XyCoordinateMin);
             * stream.WriteInt32(XyCoordinateMax);
             * stream.WriteInt32(ZCoordinateMin);
             * stream.WriteInt32(ZCoordinateMax);
             * stream.WriteVLQ((ulong)Sectors.Count);
             *
             * foreach (Sector sector in Sectors)
             * {
             *  sector.WriteTo(stream);
             * }
             */
        }
 public override void Read(IStarboundStream stream)
 {
     WarptoWorld       = stream.ReadString();
     WarptoPlayer      = stream.ReadString();
     WarpAlias         = (WarpAlias)stream.ReadInt32();
     WarpActionInvalid = stream.ReadBoolean();
 }
示例#4
0
        public static CelestialInfo FromStream(IStarboundStream stream)
        {
            CelestialInfo cInfo = new CelestialInfo();

            cInfo.planetOrbitalLevels    = stream.ReadInt32();
            cInfo.satelliteOrbitalLevels = stream.ReadInt32();
            cInfo.ChunkSize    = stream.ReadInt32();
            cInfo.xyCoordRange = Vec2I.FromStream(stream);
            cInfo.zCoordRange  = stream.ReadToEnd();
            //  cInfo.zCoordRange = Vec2I.FromStream(stream); //doc lies???
            // cInfo.zCoordRange = stream.ReadInt32();

            /*
             * cInfo.OrbitalLevels = stream.ReadInt32();
             * cInfo.ChunkSize = stream.ReadInt32();
             * cInfo.XyCoordinateMin = stream.ReadInt32();
             * cInfo.XyCoordinateMax = stream.ReadInt32();
             * cInfo.ZCoordinateMin = stream.ReadInt32();
             * cInfo.ZCoordinateMax = stream.ReadInt32();
             *
             * ulong length = stream.ReadVLQ();
             *
             * for (ulong i = 0; i < length; i++)
             * {
             *  cInfo.Sectors.Add(Sector.FromStream(stream));
             * }
             */
            return(cInfo);
        }
示例#5
0
 public override void Write(IStarboundStream stream)
 {
     OutputObjectLocation.WriteTo(stream);
     OutputConnectorLocation.WriteTo(stream);
     InputObjectLocation.WriteTo(stream);
     InputConnectorLocation.WriteTo(stream);
 }
示例#6
0
 public override void Write(IStarboundStream stream)
 {
     foreach (var entity in Entities)
     {
         entity.WriteTo(stream);
     }
 }
示例#7
0
 public override void Read(IStarboundStream stream)
 {
     while ((stream.Length - stream.Position) > 0)
     {
         Entities.Add(Entity.FromStream(stream));
     }
 }
示例#8
0
        public override void Write(IStarboundStream stream)
        {
            stream.Write(AssetDigest, 0, AssetDigest.Length);

            /*
             * stream.WriteUInt8Array(AssetDigest);
             * stream.WriteUInt8Array(UUID);
             * stream.WriteString(PlayerName);
             * stream.WriteString(Species);
             * stream.Write(Shipworld,0,Shipworld.Length);
             *
             */

            //  ShipUpgrade.WriteTo(stream);
            //  ShipUpgrade.WriteTo(stream);
            // stream.WriteString(Account);

            /*
             * stream.WriteUInt8Array(AssetDigest);
             * //   stream.WriteVariant(Claim);
             * stream.WriteBoolean(UUID != null);
             * if (UUID != null)
             *  stream.WriteUInt8Array(UUID, false);
             * stream.WriteString(PlayerName);
             * stream.WriteString(Species);
             * stream.WriteUInt8Array(Shipworld);
             * //todo shipupgrades
             *
             * stream.WriteString(Account);
             * */
        }
示例#9
0
 public override void Write(IStarboundStream stream)
 {
     foreach (SpawnedEntity se in SpawnedEntities)
     {
         se.WriteTo(stream);
     }
 }
示例#10
0
        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);
        }
示例#11
0
 public override void Read(IStarboundStream stream)
 {
     OutputConnectorLocation = Vec2I.FromStream(stream);
     OutputConnectorLocation = Vec2I.FromStream(stream);
     InputObjectLocation     = Vec2I.FromStream(stream);
     InputConnectorLocation  = Vec2I.FromStream(stream);
 }
示例#12
0
        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);
        }
示例#13
0
 public override void Read(IStarboundStream stream)
 {
     /*
      * entityID = stream.ReadInt32();
      * function = stream.ReadString();
      */
     ScriptBytes = stream.ReadToEnd();
 }
示例#14
0
 public override void Write(IStarboundStream stream)
 {
     stream.WriteVLQ((ulong)Position.Count);
     Position.ForEach(p => p.WriteTo(stream));
     stream.WriteUInt8((byte)Layer);
     SourcePos.WriteTo(stream);
     TileDamage.WriteTo(stream);
 }
示例#15
0
        public void WriteTo(IStarboundStream stream)
        {
            shipLevel.WriteTo(stream);
            maxFuel.WriteTo(stream);

            //stream.WriteUInt8Array(Capabilites);
            //stream.WriteHashSet(testingSet);
        }
示例#16
0
        public static TileDamageParameters FromStream(IStarboundStream stream)
        {
            TileDamageParameters parameters = new TileDamageParameters();

            parameters.DamageFactors = stream.ReadVariant();
            parameters.TotalHealth   = stream.ReadSingle();

            return(parameters);
        }
示例#17
0
        public static DamageNotification FromStream(IStarboundStream stream)
        {
            var writeme = new DamageNotification();

            writeme.damSourceKind = stream.ReadString();
            writeme.position      = Vec2F.FromStream(stream);

            return(writeme);
        }
示例#18
0
文件: Vec2I.cs 项目: r00t-s/SharpStar
        public static Vec2I FromStream(IStarboundStream stream)
        {
            Vec2I vec = new Vec2I();

            vec.X = stream.ReadInt32();
            vec.Y = stream.ReadInt32();

            return(vec);
        }
示例#19
0
文件: Vec2F.cs 项目: r00t-s/SharpStar
        public static Vec2F FromStream(IStarboundStream stream)
        {
            Vec2F vec = new Vec2F();

            vec.X = stream.ReadSingle();
            vec.Y = stream.ReadSingle();

            return(vec);
        }
示例#20
0
 public void WriteTo(IStarboundStream stream)
 {
     stream.WriteString(SectorId);
     stream.WriteString(SectorName);
     stream.WriteDouble(SectorSeed);
     stream.WriteString(SectorPrefix);
     stream.WriteVariant(Parameters);
     stream.WriteVariant(SectorConfig);
 }
示例#21
0
        public override void Read(IStarboundStream stream)
        {
            EntityId = stream.ReadSignedVLQ();
            Death    = stream.ReadBoolean();

            Unknown = new byte[stream.Length - stream.Position];

            stream.Read(Unknown, 0, (int)(stream.Length - stream.Position));
        }
示例#22
0
 public override void Write(IStarboundStream stream)
 {
     /*
      * stream.WriteInt32(entityID);
      * stream.WriteString(function);
      */
     // stream.WriteUInt8Array(ScriptBytes);
     stream.Write(ScriptBytes, 0, ScriptBytes.Length);
 }
 public override void Read(IStarboundStream stream)
 {
     Itype = (InteractionType)stream.ReadUInt32();
     SharpStarLogger.DefaultLogger.Info("itype:" + Itype);
     EntityId = stream.ReadInt32();
     SharpStarLogger.DefaultLogger.Info("EntityID:" + EntityId);
     Results = Json.FromStream(stream);
     SharpStarLogger.DefaultLogger.Info("Results:" + Results);
 }
示例#24
0
 public override void Write(IStarboundStream stream)
 {
     /*
      * stream.WriteString(WarptoWorld);
      * stream.WriteString(WarptoPlayer);
      */
     stream.Write(poop, 0, poop.Length);
     // stream.WriteUInt8((byte) WarpAlias);
 }
示例#25
0
        public static TileDamage FromStream(IStarboundStream stream)
        {
            TileDamage dmg = new TileDamage();

            dmg.DamageType = (TileDamageType)stream.ReadUInt8();
            dmg.Amount     = stream.ReadSingle();

            return(dmg);
        }