예제 #1
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.SpawnBossInvsaion);

            PlayerId = (byte)reader.ReadInt16(); // i have no idea why this is a short.
            SpawnId = reader.ReadInt16();
        }
예제 #2
0
 protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
 {
     CheckForValidType(type, TerrPacketType.Time);
     IsDay = reader.ReadBoolean();
     Time = reader.ReadInt32();
     SunModY = reader.ReadInt16();
     MoonModY = reader.ReadInt16();
 }
예제 #3
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.NpcHomeUpdate);

            UniqueNpcId = reader.ReadInt16();
            HomeTileX = reader.ReadInt16();
            HomeTileY = reader.ReadInt16();
            IsHomeless = reader.ReadByte() != 0;
        }
예제 #4
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            if (type != TerrPacketType.SetInventory) throw new ArgumentException(nameof(type));

            PlayerId = reader.ReadByte();
            SlotId = reader.ReadByte();
            Stack = reader.ReadInt16();
            Prefix = reader.ReadByte();
            Id = reader.ReadInt16();
        }
예제 #5
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.UpdateNpcName);

            UniqueNpcId = reader.ReadInt16();
            Name = reader.ReadString();
        }
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.DestroyProjectile);

            ProjectileId = reader.ReadInt16();
            PlayerId = reader.ReadByte();
        }
예제 #7
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.KillMe);

            PlayerId = reader.ReadByte();
            HitDirection = reader.ReadByte();
            Damage = reader.ReadInt16();
            WasPvP = reader.ReadBoolean();
            DeathText = reader.ReadString();
        }
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.ProjectileUpdate);

            UniqueId = reader.ReadInt16();
            Position = new ValPair<float>(reader);
            Velocity = new ValPair<float>(reader);
            Knockback = reader.ReadSingle();
            Damage = reader.ReadInt16();
            OwnerPlayerId = reader.ReadByte();
            Type = reader.ReadInt16();
            AiFlags = new BitArray(new[] { reader.ReadByte() });

            List<float> aiBuilder = new List<float>();

            for (byte i = 0; i < MaxAi; i++)
                if (AiFlags[i])
                    aiBuilder.Add(reader.ReadSingle());

            Ai = aiBuilder.ToArray();
        }
예제 #9
0
 protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
 {
     NpcType = reader.ReadInt16();
     KillCount = reader.ReadInt32();
 }
예제 #10
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.PlayerDamage);

            PlayerId = reader.ReadByte();
            HitDirecion = reader.ReadByte();
            Damage = reader.ReadInt16();
            DeathText = reader.ReadString();
            Flags = reader.ReadByte();
        }
예제 #11
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.AddNpcBuff);

            PlayerId = reader.ReadByte();
            Buff = reader.ReadByte();
            Time = reader.ReadInt16();
        }
예제 #12
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.HealOtherPlayer);

            PlayerId = reader.ReadByte();
            HealAmount = reader.ReadInt16();
        }
예제 #13
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.UpdateItemOwner);

            ItemId = reader.ReadInt16();
            Owner = reader.ReadByte();
        }
예제 #14
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.NpcUpdate);

            UniqueId = reader.ReadInt16();
            Position = new ValPair<float>(reader);
            Velocity = new ValPair<float>(reader);
            TargetPlayerId = reader.ReadByte();
            Flags = new BitArray(new[] {reader.ReadByte()});
            /* 
               the size of the float[] Ai array is determined by ai flags at indexes 3, 4, 5, 6. 
               Each ai flag sets the ai array size to the previous size + 1. T
               he first one sets the size to 0, we ignore it.
            
               doesn't seem to work for now

            byte aiSize = 0;
            if (Flags[3])
                aiSize = 1;
            if (Flags[4])
                aiSize = 2;
            if (Flags[5])
                aiSize = 3;

            if (aiSize > 0)
            {
                Ai = new float[aiSize];
                for (byte i = 0; i < aiSize; i++)
                    Ai[i] = reader.ReadSingle();
            }

            NpcId = reader.ReadInt16();
            if (reader.BaseStream.Position != reader.BaseStream.Length)
            {
                Life = reader.ReadInt32();
                ReleaseOwner = reader.ReadByte();
            }
            */
        }
예제 #15
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.UpdateItemDrop, TerrPacketType.UpdateItemDrop2);

            Item = new GameItem();
            UniqueId = reader.ReadInt16();
            Position = new ValPair<float>(reader);
            Velocity = new ValPair<float>(reader);
            Item.Stack = reader.ReadInt16();
            Item.Prefix = reader.ReadByte();
            NoDelay = reader.ReadByte();
            Item.Id = reader.ReadInt16();
        }
예제 #16
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.RemoveItemOwner);

            ItemIndex = reader.ReadInt16();
        }
예제 #17
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.StrikeNpcWithHeldItem);

            NpcId = reader.ReadInt16();
            PlayerId = reader.ReadByte();
        }
예제 #18
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();
        }
예제 #19
0
        protected override void ReadPayload(PayloadReader reader, TerrPacketType type)
        {
            CheckForValidType(type, TerrPacketType.SetActiveNpc);

            PlayerId = reader.ReadByte();
            NpcTalkTarget = reader.ReadInt16();
        }