public override bool Equals(object obj)
        {
            if (obj == null || obj.GetType() != typeof(CoopUpdatePacket))
            {
                return(false);
            }
            CoopUpdatePacket other = ( CoopUpdatePacket )obj;

            if (money != other.money)
            {
                return(false);
            }
            if (moneyEarned != other.moneyEarned)
            {
                return(false);
            }
            if (rustyKey != other.rustyKey)
            {
                return(false);
            }
            if (skullKey != other.skullKey)
            {
                return(false);
            }
            if (clubCard != other.clubCard)
            {
                return(false);
            }

            return(true);
        }
Example #2
0
        public static Packet readFrom(Stream s)
        {
            BinaryReader reader = new BinaryReader(s);
            byte         type   = reader.ReadByte();

            Packet packet = null;

            switch (type)
            {
            case (byte)ID.Version: packet = new VersionPacket(); break;

            case (byte)ID.YourID: packet = new YourIDPacket(); break;

            case (byte)ID.ClientFarmerData: packet = new ClientFarmerDataPacket(); break;

            case (byte)ID.OtherFarmerData: packet = new OtherFarmerDataPacket(); break;

            case (byte)ID.WorldData: packet = new WorldDataPacket(); break;

            case (byte)ID.MovingState: packet = new MovingStatePacket(); break;

            case (byte)ID.Location: packet = new LocationPacket(); break;

            case (byte)ID.Animation: packet = new AnimationPacket(); break;

            case (byte)ID.HeldItem: packet = new HeldItemPacket(); break;

            case (byte)ID.Debris: packet = new DebrisPacket(); break;

            case (byte)ID.TerrainFeature: packet = new TerrainFeaturePacket(); break;

            case (byte)ID.Object: packet = new ObjectPacket(); break;

            case (byte)ID.HoeDirtUpdate: packet = new TerrainFeatureUpdatePacket <HoeDirt>(); break;

            case (byte)ID.FruitTreeUpdate: packet = new TerrainFeatureUpdatePacket <FruitTree>(); break;

            case (byte)ID.ObjectUpdate: packet = new ObjectUpdatePacket <StardewValley.Object>(); break;

            case (byte)ID.DoorUpdate: packet = new ObjectUpdatePacket <Door>(); break;

            case (byte)ID.FenceUpdate: packet = new FenceUpdatePacket(); break;

            case (byte)ID.CrabPotUpdate: packet = new ObjectUpdatePacket <CrabPot>(); break;

            case (byte)ID.ChestUpdate: packet = new ChestUpdatePacket(); break;

            case (byte)ID.PauseTime: packet = new PauseTimePacket(); break;

            case (byte)ID.TimeSync: packet = new TimeSyncPacket(); break;

            case (byte)ID.CoopUpdate: packet = new CoopUpdatePacket(); break;

            case (byte)ID.FestivalDancePartner: packet = new FestivalDancePartnerPacket(); break;

            case (byte)ID.ContinueEvent: packet = new ContinueEventPacket(); break;

            case (byte)ID.NextDay: packet = new NextDayPacket(); break;

            case (byte)ID.ShippingBin: packet = new ShippingBinPacket(); break;

            case (byte)ID.NPCUpdate: packet = new NPCUpdatePacket(); break;

            case (byte)ID.FarmAnimalUpdate: packet = new FarmAnimalUpdatePacket(); break;

            case (byte)ID.Spouse: packet = new SpousePacket(); break;

            case (byte)ID.Chat: packet = new ChatPacket(); break;

            case (byte)ID.BeachBridgeFixed: packet = new BeachBridgeFixedPacket(); break;

            case (byte)ID.MuseumUpdated: packet = new MuseumUpdatedPacket(); break;

            case (byte)ID.CommunityCenterUpdated: packet = new CommunityCenterUpdatedPacket(); break;

            case (byte)ID.TreeUpdate: packet = new TerrainFeatureUpdatePacket <Tree>(); break;

            case (byte)ID.FarmUpdate: packet = new FarmUpdatePacket(); break;

            case (byte)ID.Building: packet = new BuildingPacket(); break;

            case (byte)ID.BuildingUpdate: packet = new BuildingUpdatePacket(); break;

            case (byte)ID.FarmAnimal: packet = new FarmAnimalPacket(); break;

            case (byte)ID.LatestId: packet = new LatestIdPacket(); break;

            case (byte)ID.LostBooks: packet = new LostBooksPacket(); break;

            case (byte)ID.ResourceClumps: packet = new ResourceClumpsPacket(); break;
            }

            if (packet == null)
            {
                Log.warn("Bad packet?!?!?!?! ID = " + type);
                return(null);
            }
            //Log.Async("Got packet " + type);
            packet.read(reader);
            if (MultiplayerMod.ModConfig.PacketLogging == MultiplayerConfig.PacketLogAmount.All ||
                MultiplayerMod.ModConfig.PacketLogging == MultiplayerConfig.PacketLogAmount.Filtered &&
                !(packet.id == ID.MovingState || packet.id == ID.Animation || packet.id == ID.TimeSync || packet.id == ID.HeldItem))
            {
                Log.trace("<-- " + packet);
            }

            return(packet);
        }