Example #1
0
 private DeliveryChest GetDeliveryChestFromMessage(SerializableChestLocation message)
 {
     foreach (GameLocation location in LocationHelper.GetAccessibleLocations())
     {
         if (location.NameOrUniqueName == message.Location)
         {
             Item item;
             if (message.isFridge)
             {
                 if (location is FarmHouse house && Game1.player.HouseUpgradeLevel > 0)
                 {
                     item = house.fridge.Value;
                 }
                 else
                 {
                     break;
                 }
             }
             else
             {
                 item = location.getObjectAtTile(message.X, message.Y);
             }
             if (item != null && item is Chest chest)
             {
                 DeliveryChest dchest;
                 if (DeliveryChests.TryGetValue(chest, out dchest))
                 {
                     return(dchest);
                 }
                 dchest = new DeliveryChest(chest);
                 DeliveryChests[chest] = dchest;
                 return(dchest);
             }
         }
     }