コード例 #1
0
        public override void SendClientChanges(ModPlayer clientPlayer)
        {
            JunkoAndFriendsPlayer clone = clientPlayer as JunkoAndFriendsPlayer;

            if (clone.vanitySpecialEffect != vanitySpecialEffect)
            {
                var packet = mod.GetPacket();
                packet.Write((byte)MessageType.SyncVanitySpecialEffect);
                packet.Write((byte)player.whoAmI);
                packet.Write(vanitySpecialEffect);
                packet.Send();
            }

            if (clone.berserkerIsBerserk != berserkerIsBerserk)
            {
                var packet = mod.GetPacket();
                packet.Write((byte)MessageType.SyncBerserkerIsBerserk);
                packet.Write((byte)player.whoAmI);
                packet.Write(berserkerIsBerserk);
                packet.Send();
            }

            if (clone.berserkerDoTransformation != berserkerDoTransformation)
            {
                var packet = mod.GetPacket();
                packet.Write((byte)MessageType.SyncBerserkerDoTransformation);
                packet.Write((byte)player.whoAmI);
                packet.Write(berserkerDoTransformation);
                packet.Send();
            }

            if (clone.guraGawrDoA != guraGawrDoA)
            {
                var packet = mod.GetPacket();
                packet.Write((byte)MessageType.SyncGuraGawrDoA);
                packet.Write((byte)player.whoAmI);
                packet.Write(guraGawrDoA);
                packet.Send();
            }

            if (clone.pekoraSmoll != pekoraSmoll)
            {
                var packet = mod.GetPacket();
                packet.Write((byte)MessageType.SyncPekoraSmoll);
                packet.Write((byte)player.whoAmI);
                packet.Write(pekoraSmoll);
                packet.Send();
            }

            if (clone.berserkerHelmetFrame != berserkerHelmetFrame)
            {
                var packet = mod.GetPacket();
                packet.Write((byte)MessageType.SyncBerserkerHelmetFrame);
                packet.Write((byte)player.whoAmI);
                packet.Write((byte)berserkerHelmetFrame);
                packet.Send();
            }
        }
コード例 #2
0
        public override void clientClone(ModPlayer clientClone)
        {
            JunkoAndFriendsPlayer clone = clientClone as JunkoAndFriendsPlayer;

            clone.vanitySpecialEffect       = vanitySpecialEffect;
            clone.berserkerIsBerserk        = berserkerIsBerserk;
            clone.berserkerDoTransformation = berserkerDoTransformation;
            clone.guraGawrDoA          = guraGawrDoA;
            clone.pekoraSmoll          = pekoraSmoll;
            clone.berserkerHelmetFrame = berserkerHelmetFrame;
        }
コード例 #3
0
        public override void HandlePacket(BinaryReader reader, int whoAmI)
        {
            MessageType msgType = (MessageType)reader.ReadByte();

            switch (msgType)
            {
            case MessageType.SyncPlayer:
                byte playerNumber            = reader.ReadByte();
                JunkoAndFriendsPlayer player = Main.player[playerNumber].GetModPlayer <JunkoAndFriendsPlayer>();
                player.vanitySpecialEffect       = reader.ReadBoolean();
                player.berserkerIsBerserk        = reader.ReadBoolean();
                player.berserkerDoTransformation = reader.ReadBoolean();
                player.guraGawrDoA          = reader.ReadBoolean();
                player.pekoraSmoll          = reader.ReadBoolean();
                player.berserkerHelmetFrame = reader.ReadByte();
                break;

            case MessageType.SyncVanitySpecialEffect:
                playerNumber = reader.ReadByte();
                player       = Main.player[playerNumber].GetModPlayer <JunkoAndFriendsPlayer>();
                player.vanitySpecialEffect = reader.ReadBoolean();
                if (Main.netMode == NetmodeID.Server)
                {
                    var packet = GetPacket();
                    packet.Write((byte)MessageType.SyncVanitySpecialEffect);
                    packet.Write(playerNumber);
                    packet.Write(player.vanitySpecialEffect);
                    packet.Send(-1, playerNumber);
                }
                break;

            case MessageType.SyncBerserkerIsBerserk:
                playerNumber = reader.ReadByte();
                player       = Main.player[playerNumber].GetModPlayer <JunkoAndFriendsPlayer>();
                player.berserkerIsBerserk = reader.ReadBoolean();
                if (Main.netMode == NetmodeID.Server)
                {
                    var packet = GetPacket();
                    packet.Write((byte)MessageType.SyncBerserkerIsBerserk);
                    packet.Write(playerNumber);
                    packet.Write(player.berserkerIsBerserk);
                    packet.Send(-1, playerNumber);
                }
                break;

            case MessageType.SyncBerserkerDoTransformation:
                playerNumber = reader.ReadByte();
                player       = Main.player[playerNumber].GetModPlayer <JunkoAndFriendsPlayer>();
                player.berserkerDoTransformation = reader.ReadBoolean();
                if (Main.netMode == NetmodeID.Server)
                {
                    var packet = GetPacket();
                    packet.Write((byte)MessageType.SyncBerserkerDoTransformation);
                    packet.Write(playerNumber);
                    packet.Write(player.berserkerDoTransformation);
                    packet.Send(-1, playerNumber);
                }
                break;

            case MessageType.SyncGuraGawrDoA:
                playerNumber       = reader.ReadByte();
                player             = Main.player[playerNumber].GetModPlayer <JunkoAndFriendsPlayer>();
                player.guraGawrDoA = reader.ReadBoolean();
                if (Main.netMode == NetmodeID.Server)
                {
                    var packet = GetPacket();
                    packet.Write((byte)MessageType.SyncGuraGawrDoA);
                    packet.Write(playerNumber);
                    packet.Write(player.guraGawrDoA);
                    packet.Send(-1, playerNumber);
                }
                break;

            case MessageType.SyncPekoraSmoll:
                playerNumber       = reader.ReadByte();
                player             = Main.player[playerNumber].GetModPlayer <JunkoAndFriendsPlayer>();
                player.pekoraSmoll = reader.ReadBoolean();
                if (Main.netMode == NetmodeID.Server)
                {
                    var packet = GetPacket();
                    packet.Write((byte)MessageType.SyncPekoraSmoll);
                    packet.Write(playerNumber);
                    packet.Write(player.pekoraSmoll);
                    packet.Send(-1, playerNumber);
                }
                break;

            case MessageType.SyncBerserkerHelmetFrame:
                playerNumber = reader.ReadByte();
                player       = Main.player[playerNumber].GetModPlayer <JunkoAndFriendsPlayer>();
                player.berserkerHelmetFrame = reader.ReadByte();
                if (Main.netMode == NetmodeID.Server)
                {
                    var packet = GetPacket();
                    packet.Write((byte)MessageType.SyncBerserkerHelmetFrame);
                    packet.Write(playerNumber);
                    packet.Write((byte)player.berserkerHelmetFrame);
                    packet.Send(-1, playerNumber);
                }
                break;
            }
        }