コード例 #1
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.WorldInformation);

            int tempTime = reader.ReadInt32(); // store this value so we have the correct IsDay when evalutaing real time.

            DayMoonInfo = reader.ReadByte();
            BitArray timeInfo = new BitArray(new [] {DayMoonInfo});
            IsDay = timeInfo[0];
            IsBloodmoon = timeInfo[1];
            IsEclipse = timeInfo[2];

            RawTime = tempTime;

            MoonPhase = (MoonPhaseType) reader.ReadByte();
            MaxTilesX = reader.ReadInt16();
            MaxTilesY = reader.ReadInt16();
            SpawnX = reader.ReadInt16();
            SpawnY = reader.ReadInt16();
            WorldSurface = reader.ReadInt16();
            RockLayer = reader.ReadInt16();
            WorldId = reader.ReadInt32();
            WorldName = reader.ReadString();
            MoonType = reader.ReadByte();
            TreeBackground = reader.ReadByte();
            CorruptionBackground = reader.ReadByte();
            JungleBackground = reader.ReadByte();
            SnowBackground = reader.ReadByte();
            HallowBackground = reader.ReadByte();
            CrimsonBackground = reader.ReadByte();
            DesertBackground = reader.ReadByte();
            OceanBackground = reader.ReadByte();
            IceBackStyle = reader.ReadByte();
            JungleBackStyle = reader.ReadByte();
            HellBackStyle = reader.ReadByte();
            WindSpeedSet = reader.ReadSingle();
            CloudNumber = reader.ReadByte();
            Tree1 = reader.ReadInt32();
            Tree2 = reader.ReadInt32();
            Tree3 = reader.ReadInt32();
            TreeStyle1 = reader.ReadByte();
            TreeStyle2 = reader.ReadByte();
            TreeStyle3 = reader.ReadByte();
            TreeStyle4 = reader.ReadByte();
            CaveBack1 = reader.ReadInt32();
            CaveBack2 = reader.ReadInt32();
            CaveBack3 = reader.ReadInt32();
            CaveBackStyle1 = reader.ReadByte();
            CaveBackStyle2 = reader.ReadByte();
            CaveBackStyle3 = reader.ReadByte();
            CaveBackStyle4 = reader.ReadByte();
            Rain = reader.ReadSingle();

            BitArray events1 = new BitArray(new [] {reader.ReadByte()});
            IsShadowOrbSmashed = events1[0];
            IsEyeOfCthuluDefeated = events1[1];
            IsEowOrBrainDefeated = events1[2];
            IsSkeletronDefeated = events1[3];
            IsHardmode = events1[4];
            IsClownDefeated = events1[5];
            // events1[6] is Main.serverSideCharacter.
            IsPlanteraDefeated = events1[7];

            BitArray events2 = new BitArray(new [] {reader.ReadByte()});
            IsDestroyedDeafeated = events2[0];
            AreTwinsDefeated = events2[1];
            IsSkeletronPrimeDefeated = events2[2];
            IsAnyMechBossDefeated = events2[3];
            IsCloudBgActive = events2[4];
            IsCrimson = events2[5];
            IsPumpkinMoonActive = events2[6];
            IsSnowMoonActive = events2[7];

            BitArray events3 = new BitArray(new [] {reader.ReadByte()});
            IsExpertMode = events3[0];
            IsFastForwardingTime = events3[1];
            IsSlimeRainActive = events3[2];
            IsSlimeKingDefeated = events3[3];
            IsQueenBeeDefeated = events3[4];
            IsFishronDefeated = events3[5];
            AreMartiansDefeated = events3[6];
            AreCultistsDefeated = events3[7];

            BitArray events4 = new BitArray(new [] {reader.ReadByte()});
            IsMoonlordDefeated = events4[0];
            IsHalloweenKingDefeated = events4[1];
            IsHalloweenTreeDefeated = events4[2];
            IsChristmasIceQueenDefeated = events4[3];
            IsChristmasSantankDefeated = events4[4];
            IsChristmasTreeDefeated = events4[5];
            IsGolemDefeated = events4[6];

            InvasionType = reader.ReadSByte();
            LobbyId = reader.ReadUInt64();
        }