Ejemplo n.º 1
0
        private static void parseDataMessageFromServer(NetIncomingMessage msg)
        {
            while ((long)msg.LengthBits - msg.Position >= 8L)
            {
                switch (msg.ReadByte())
                {
                case 0:
                    Game1.otherFarmers[msg.ReadInt64()].setMoving(msg.ReadByte());
                    break;

                case 1:
                    Game1.otherFarmers[msg.ReadInt64()].updatePositionFromServer(msg.ReadVector2());
                    break;

                case 2:
                    MultiplayerUtility.receivePlayerIntroduction(msg.ReadInt64(), msg.ReadString());
                    break;

                case 3:
                {
                    long key = msg.ReadInt64();
                    Game1.otherFarmers[key].FarmerSprite.CurrentToolIndex = msg.ReadInt32();
                    if (msg.ReadByte() == 1)
                    {
                        ((FarmerSprite)Game1.otherFarmers[key].sprite).animateBackwardsOnce(msg.ReadInt32(), msg.ReadFloat());
                        msg.ReadByte();
                    }
                    else
                    {
                        ((FarmerSprite)Game1.otherFarmers[key].sprite).animateOnce(msg.ReadInt32(), msg.ReadFloat(), (int)msg.ReadByte());
                    }
                    break;
                }

                case 4:
                    MultiplayerUtility.performObjectAlteration(msg.ReadInt16(), msg.ReadInt16(), msg.ReadByte(), msg.ReadByte(), msg.ReadInt32());
                    break;

                case 5:
                    MultiplayerUtility.warpCharacter(msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadByte(), msg.ReadInt64());
                    break;

                case 6:
                    MultiplayerUtility.performSwitchHeldItem(msg.ReadInt64(), msg.ReadByte(), (int)msg.ReadInt16());
                    break;

                case 7:
                    MultiplayerUtility.performToolAction(msg.ReadByte(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt64());
                    break;

                case 8:
                    MultiplayerUtility.performDebrisPickup(msg.ReadInt32(), msg.ReadString(), msg.ReadInt64());
                    break;

                case 9:
                    MultiplayerUtility.performCheckAction(msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadInt64());
                    break;

                case 10:
                    MultiplayerUtility.receiveChatMessage(msg.ReadString(), msg.ReadInt64());
                    break;

                case 11:
                    MultiplayerUtility.receiveNameChange(msg.ReadString(), msg.ReadInt64());
                    break;

                case 12:
                    MultiplayerUtility.receiveTenMinuteSync(msg.ReadInt16());
                    break;

                case 13:
                    MultiplayerUtility.receiveBuildingChange(msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadInt64(), msg.ReadInt64());
                    break;

                case 14:
                    MultiplayerUtility.performDebrisCreate(msg.ReadInt16(), msg.ReadInt32(), msg.ReadInt32(), msg.ReadByte(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), 0L);
                    break;

                case 15:
                    MultiplayerUtility.performNPCMove(msg.ReadInt32(), msg.ReadInt32(), msg.ReadInt64());
                    break;

                case 16:
                    MultiplayerUtility.performNPCBehavior(msg.ReadInt64(), msg.ReadByte());
                    break;

                case 17:
                    MultiplayerUtility.allFarmersReadyCheck();
                    break;

                case 18:
                    MultiplayerUtility.parseServerToClientsMessage(msg.ReadString());
                    break;

                case 19:
                    MultiplayerUtility.interpretMessageToEveryone(msg.ReadInt32(), msg.ReadString(), msg.ReadInt64());
                    break;
                }
            }
        }
Ejemplo n.º 2
0
        // Token: 0x06000B40 RID: 2880 RVA: 0x000E408C File Offset: 0x000E228C
        private static void parseDataMessageFromClient(NetIncomingMessage msg)
        {
            switch (msg.ReadByte())
            {
            case 0:
                Game1.otherFarmers[msg.SenderConnection.RemoteUniqueIdentifier].setMoving(msg.ReadByte());
                return;

            case 1:
            case 2:
            case 12:
            case 15:
            case 16:
            case 18:
                break;

            case 3:
                ((FarmerSprite)Game1.otherFarmers[msg.SenderConnection.RemoteUniqueIdentifier].sprite).CurrentToolIndex = msg.ReadInt32();
                if (msg.ReadByte() == 1)
                {
                    ((FarmerSprite)Game1.otherFarmers[msg.SenderConnection.RemoteUniqueIdentifier].sprite).animateBackwardsOnce(msg.ReadInt32(), msg.ReadFloat());
                    msg.ReadByte();
                    return;
                }
                ((FarmerSprite)Game1.otherFarmers[msg.SenderConnection.RemoteUniqueIdentifier].sprite).animateOnce(msg.ReadInt32(), msg.ReadFloat(), (int)msg.ReadByte());
                return;

            case 4:
                MultiplayerUtility.serverTryToPerformObjectAlteration(msg.ReadInt16(), msg.ReadInt16(), msg.ReadByte(), msg.ReadByte(), msg.ReadInt32(), Game1.otherFarmers[msg.SenderConnection.RemoteUniqueIdentifier]);
                return;

            case 5:
                MultiplayerUtility.warpCharacter(msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadByte(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 6:
                MultiplayerUtility.performSwitchHeldItem(msg.SenderConnection.RemoteUniqueIdentifier, msg.ReadByte(), (int)msg.ReadInt16());
                return;

            case 7:
                MultiplayerUtility.performToolAction(msg.ReadByte(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.ReadByte(), msg.ReadInt16(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 8:
                MultiplayerUtility.performDebrisPickup(msg.ReadInt32(), msg.ReadString(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 9:
                MultiplayerUtility.performCheckAction(msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 10:
                MultiplayerUtility.receiveChatMessage(msg.ReadString(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 11:
                MultiplayerUtility.receiveNameChange(msg.ReadString(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 13:
                MultiplayerUtility.receiveBuildingChange(msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), msg.ReadString(), msg.SenderConnection.RemoteUniqueIdentifier, 0L);
                return;

            case 14:
                MultiplayerUtility.performDebrisCreate(msg.ReadInt16(), msg.ReadInt32(), msg.ReadInt32(), msg.ReadByte(), msg.ReadByte(), msg.ReadInt16(), msg.ReadInt16(), msg.SenderConnection.RemoteUniqueIdentifier);
                return;

            case 17:
                Game1.otherFarmers[msg.SenderConnection.RemoteUniqueIdentifier].readyConfirmation = true;
                MultiplayerUtility.allFarmersReadyCheck();
                return;

            case 19:
                MultiplayerUtility.interpretMessageToEveryone(msg.ReadInt32(), msg.ReadString(), msg.SenderConnection.RemoteUniqueIdentifier);
                break;

            default:
                return;
            }
        }