public Item DeserializeFromFarmhandInventory(string JsonName)
        {
            //ModCore.log("Found a custom object in a chest!");
            string jsonString = JsonName;
            //ModCore.log(JsonName);
            string dataSplit  = jsonString.Split(new string[] { "<" }, StringSplitOptions.None)[2];
            string backUpGUID = dataSplit.Split('|')[0];

            string[] guidArr = jsonString.Split(new string[] { "|" }, StringSplitOptions.None);

            string infoStr = jsonString.Split(new string[] { "<" }, StringSplitOptions.None)[0];
            string guidStr = jsonString.Split(new string[] { "<" }, StringSplitOptions.None)[1];

            CustomObjectData pyTkData = ModCore.Serializer.DeserializeFromJSONString <CustomObjectData>(dataSplit);
            Type             t        = Type.GetType(pyTkData.type);
            string           id       = pyTkData.id;
            //Need Item info

            string guidName  = backUpGUID;
            string infoSplit = infoStr.Split('|')[3];

            infoSplit = infoSplit.Substring(3);
            BasicItemInformation info = ModCore.Serializer.DeserializeFromJSONString <BasicItemInformation>(infoSplit);

            CustomObject clone = (CustomObject)ModCore.ObjectManager.getItemByIDAndType(id, t);

            if (clone != null)
            {
                clone.info = info;
                ModCore.log("Guid is????:" + guidStr);
                clone.guid = Guid.Parse(guidStr);
                return(clone);
            }
            return(null);
        }
        private void convertWater()
        {
            Item item = Game1.player.Items.ToList().Find(i => i is WateringCan);

            if (item is WateringCan wc)
            {
                List <IClickableMenu> pages = _helper.Reflection.GetField <List <IClickableMenu> >(Game1.activeClickableMenu, "pages").GetValue();
                Item heldItem = _helper.Reflection.GetField <Item>(pages.Find(p => p is InventoryPage), "heldItem").GetValue();


                if (heldItem is WaterItem s && wc.WaterLeft < wc.waterCanMax)
                {
                    int w = Math.Min(s.Stack, wc.waterCanMax - wc.WaterLeft);
                    s.Stack -= w;
                    if (s.Stack <= 0)
                    {
                        _helper.Reflection.GetField <Item>(pages.Find(p => p is InventoryPage), "heldItem").SetValue(null);
                    }

                    wc.WaterLeft += w;
                    Game1.playSound("slosh");
                    return;
                }
                else if (wc.WaterLeft > 0 && heldItem == null)
                {
                    int a = Math.Min(10, wc.WaterLeft);
                    wc.WaterLeft -= a;
                    Game1.player.addItemByMenuIfNecessary(new SObject(CustomObjectData.getIndexForId("Platonymous.Water"), a));
                    Game1.playSound("glug");
                }
            }
            public static void prefix(ref TemporaryAnimatedSprite __instance, string ___textureName)
            {
                CustomObjectData c = null;

                if (dataChache.ContainsKey(__instance))
                {
                    c = dataChache[__instance];
                }
                else if (___textureName == "Maps\\springobjects")
                {
                    TemporaryAnimatedSprite obj = __instance;
                    c = __instance is IDrawFromCustomObjectData draw ? draw.data : CustomObjectData.collection.Find(o => o.Value.sdvSourceRectangle == obj.sourceRect && o.Value.bigCraftable == false).Value;
                    dataChache.AddOrReplace(__instance, c);
                }
                else
                {
                    dataChache.AddOrReplace(__instance, c);
                }

                if (c != null)
                {
                    replaceNext = true;
                    nextData    = c;
                }
                else
                {
                    replaceNext = false;
                }
            }
Esempio n. 4
0
        internal static void Register()
        {
            if (EmptyData != null)
            {
                return;
            }

            CraftingData recipe = new CraftingData("Flower Bomb",
                                                   "330 4 574 1", delivery: "none"); // 4 Clay, 1 Mudstone

            string displayName = Helper.Translation.Get("FlowerBomb.name");
            string description = Helper.Translation.Get("FlowerBomb.description");

            Texture2D emptyTexture = Helper.Content.Load <Texture2D> (
                Path.Combine("assets", "FlowerBomb-empty.png"));

            EmptyData = new CustomObjectData("kdau.FlowerBombs.FlowerBomb",
                                             $"Flower Bomb/50/-300/Crafting -8/{displayName}/{description}",
                                             emptyTexture, Color.White, type: typeof(FlowerBomb),
                                             craftingData: recipe);

            Texture2D fullTexture = Helper.Content.Load <Texture2D> (
                Path.Combine("assets", "FlowerBomb-full.png"));

            FullData = new CustomObjectData("kdau.FlowerBombs.FlowerBombFull",
                                            $"Flower Bomb (full)/50/-300/Crafting -8/{displayName}/{description}",
                                            fullTexture, Color.White, type: typeof(FlowerBomb));
        }
Esempio n. 5
0
            public static void prefix(ref SObject __instance)
            {
                CustomObjectData c = null;

                if (dataChache.ContainsKey(__instance))
                {
                    c = dataChache[__instance];
                }
                else if (!SaveHandler.hasSaveType(__instance) || __instance is IDrawFromCustomObjectData)
                {
                    SObject obj = __instance;
                    c = __instance is IDrawFromCustomObjectData draw ? draw.data : CustomObjectData.collection.Find(o => o.Value.sdvId == obj.parentSheetIndex && o.Value.bigCraftable == obj.bigCraftable).Value;
                    dataChache.AddOrReplace(__instance, c);
                }
                else
                {
                    dataChache.AddOrReplace(__instance, c);
                }

                if (c != null)
                {
                    replaceNext = true;
                    nextItem    = __instance;
                    nextData    = c;
                }
                else
                {
                    replaceNext = false;
                }
            }
        public static void load(IModHelper helper, bool cm)
        {
            Instrument.allInstruments = new Dictionary <string, Instrument>();
            SheetMusic.allSheets      = new Dictionary <string, SheetMusic>();
            Texture2D         texture = loadTexture(helper, "tilesheet.png");
            List <SheetMusic> sheets  = new List <SheetMusic>();

            var harpOfYoba = new Instrument("harp", texture, "Harp of Yoba", "Add Sheet Music to play.", new HarpAnimation());

            sheets.Add(new SheetMusic("thunder", texture, "Serenade of Thunder", "Rain on me", Microsoft.Xna.Framework.Color.Blue, !cm ? "AbigailFluteDuet" : "cm:HOY-SerenadeOfThunder:AbigailFluteDuet", 15000, new RainMagic()));
            sheets.Add(new SheetMusic("birthday", texture, "Birthday Sonata", "Popular on birthdays", Microsoft.Xna.Framework.Color.DarkBlue, !cm ? "shimmeringbastion" : "cm:HOY-BirthdaySonata:shimmeringbastion", 11000, new BirthdayMagic()));
            sheets.Add(new SheetMusic("wanderer", texture, "Ballad of the Wanderer", "Wander off and return", Microsoft.Xna.Framework.Color.Orange, !cm ? "honkytonky" : "cm:HOY-BalladOfTheWanderer:honkytonky", 12000, new TeleportMagic()));
            sheets.Add(new SheetMusic("yoba", texture, "Prelude to Yoba", "Can you hear the trees sing along", Microsoft.Xna.Framework.Color.ForestGreen, !cm ? "wedding" : "cm:HOY-PreludeToYoba:wedding", 14000, new TreeMagic()));
            sheets.Add(new SheetMusic("fisher", texture, "The Fisherman's Lament", "The old mariners lucky melody", Microsoft.Xna.Framework.Color.DarkMagenta, !cm ? "poppy" : "cm:HOY-FishermentsLament:poppy", 10000, new FisherMagic()));
            sheets.Add(new SheetMusic("dark", texture, "Ode to the Dark", "All monsters are created equal", Microsoft.Xna.Framework.Color.Red, !cm ? "tribal" : "cm:HOY-OdeToTheDark:tribal", 10000, new MonsterMagic()));
            sheets.Add(new SheetMusic("animals", texture, "Animals' Aria", "Beloved by Farmanimals", Microsoft.Xna.Framework.Color.Brown, !cm ? "tinymusicbox" : "cm:HOY-AnimalsAria:tinymusicbox", 11000, new AnimalMagic()));
            sheets.Add(new SheetMusic("adventure", texture, "Adventurer's Allegro", "An energizing tune", Microsoft.Xna.Framework.Color.LightCoral, !cm ? "aerobics" : "cm:HOY-AdventurersAllegro:aerobics", 11000, new BoosterMagic()));
            sheets.Add(new SheetMusic("granpa", texture, "Farmer's Lullaby", "Stand on fertile ground", Microsoft.Xna.Framework.Color.Magenta, !cm ? "grandpas_theme" : "cm:HOY-FarmersLullaby:grandpas_theme", 12000, new SeedMagic()));
            sheets.Add(new SheetMusic("time", texture, "Rondo of Time", "Play ahead to pass the time", Microsoft.Xna.Framework.Color.LightCyan, !cm ? "50s" : "cm:HOY-RondoOfTime:50s", 30000, new TimeMagic()));
            sheets.Add(new SheetMusic("lua", texture, "Lua Crescendo", "Play lua", Microsoft.Xna.Framework.Color.BlueViolet, HarpOfYobaReduxMod.config.luamusic, 10000, new LuaMagic(helper)));

            Texture2D sheetTexture = texture.getArea(new Rectangle(0, 0, 16, 16));
            Texture2D harpTexture  = texture.getArea(new Rectangle(32, 0, 16, 16));

            CustomObjectData.newObject("Platonymous.HarpOfYoba." + harpOfYoba.instrumentID, harpTexture, Color.White, "Harp of Yoba", "Add Sheet Music to play.", customType: typeof(Instrument));

            foreach (SheetMusic sheet in sheets)
            {
                CustomObjectData.newObject("Platonymous.HarpOfYoba." + sheet.sheetMusicID, sheetTexture, Color.White, sheet.Name, sheet.getDescription(), customType: typeof(SheetMusic));
            }

            loadLetters();
        }
Esempio n. 7
0
        public void InitData()
        {
            var cost            = new Cost();
            var paymentCurrency = new Currency();
            var project         = new Project();

            var agency  = new Agency();
            var country = new Country();
            var owner   = new CostOwner();
            var notificationSubscribers = new NotificationSubscriber();
            var userBusinessRoles       = new List <UserBusinessRole>();


            var costStages               = new List <CostStage>();
            var costStageRevisions       = new List <CostStageRevision>();
            var selectRevisionTravelCost = new TravelCost();
            var oeRevisionTravelCost     = new TravelCost();
            var region              = new Region();
            var payments            = new List <CostStageRevisionPaymentTotal>();
            var cli                 = new List <CostLineItem>();
            var stageDetails        = new CustomObjectData();
            var productionDetails   = new CustomObjectData();
            var supportingDocuments = new List <SupportingDocument>();
            var lstObjectData       = new List <CustomObjectData>();
            var costFormDetails     = new List <CostFormDetails>();
            var customFormData      = new CustomFormData();
            var approvals           = new List <Approval>();
            var approvalMembers     = new List <ApprovalMember>();
        }
Esempio n. 8
0
        public override void Entry(IModHelper helper)
        {
            SHelper  = helper;
            maxLevel = Directory.GetFiles(Path.Combine(Helper.DirectoryPath, "assets", "levels"), "*.tmx", SearchOption.AllDirectories).Count();

            TileAction exitAction = new TileAction("JoJaBan.Exit", exitGame);

            exitAction.register();
            TileAction startAction = new TileAction("JoJaBan.Start", startGame);

            startAction.register();

            helper.Events.GameLoop.GameLaunched += (o, e) =>
            {
                arcadeTexture = helper.Content.Load <Texture2D>(@"assets/arcade.png");
                arcadeData    = new CustomObjectData("JoJaBan", "JoJaBan/0/-300/Crafting -9/Play 'JoJaBan by Platonymous' at home!/true/true/0/JoJaBan", arcadeTexture, Color.White, bigCraftable: true, type: typeof(JoJaBanMachine));
                Texture2D townInterior = Helper.Content.Load <Texture2D>(@"Maps/townInterior", ContentSource.GameContent);
                boxTexture = townInterior.getArea(new Rectangle(304, 1024, 16, 32));
                boxData    = new CustomObjectData("JoJa Box", "JoJa Box/0/-300/Crafting -9/JoJa Box/true/true/0/JoJa Box", boxTexture, Color.White, bigCraftable: true, type: typeof(JoJaBox));

                if (Helper.ModRegistry.GetApi <IMobilePhoneApi>("aedenthorn.MobilePhone") is IMobilePhoneApi api)
                {
                    Texture2D appIcon = Helper.Content.Load <Texture2D>(Path.Combine("assets", "mobile_app_icon.png"));
                    bool      success = api.AddApp(Helper.ModRegistry.ModID + "MobileJoJaBan", "JoJaBan", () =>
                    {
                        startGame("", null, Vector2.Zero, "");
                    }, appIcon);
                }
            };
            helper.Events.Input.ButtonPressed += OnButtonPressed;
            helper.Events.GameLoop.SaveLoaded += (o, e) => addToCatalogue();
        }
Esempio n. 9
0
 public override void Entry(IModHelper helper)
 {
     monitor               = Monitor;
     SnakeMod.helper       = helper;
     sdata                 = new CustomObjectData("Snake", "Snake/0/-300/Crafting -9/Play 'Snake by Platonymous' at home!/true/true/0/Snake", helper.Content.Load <Texture2D>(@"Assets/arcade.png"), Color.White, bigCraftable: true, type: typeof(SnakeMachine));
     SaveEvents.AfterLoad += (o, e) => addToCatalogue();
 }
Esempio n. 10
0
 public BugNetTool(CustomObjectData data)
     : this()
 {
     sObject   = new SObject(data.sdvId, 1);
     this.data = data;
     build(AllNets.Find(n => n.FullId == data.id));
 }
Esempio n. 11
0
 public BugNetTool(CustomObjectData data, Vector2 tileLocation)
     : this()
 {
     sObject   = new SObject(tileLocation, data.sdvId);
     this.data = data;
     build(AllNets.Find(n => n.FullId == data.id));
 }
            internal static void Prefix(ref SpriteBatch __instance, KeyValuePair <Texture2D, Rectangle?> __state, ref Texture2D texture, ref Vector4 destinationRectangle, ref Rectangle?sourceRectangle, ref Color color, ref float rotation, ref Vector2 origin, ref SpriteEffects effect, ref float depth)
            {
                __state = new KeyValuePair <Texture2D, Rectangle?>(texture, sourceRectangle);

                if (!sourceRectangle.HasValue || texture == null)
                {
                    return;
                }

                Rectangle sr = sourceRectangle.Value;
                Texture2D st = texture.clone();

                if (!CustomObjectData.collection.Exists(a => a.Value.sdvSourceRectangle == sr && st == a.Value.sdvTexture))
                {
                    return;
                }

                CustomObjectData data = CustomObjectData.collection.Find(a => a.Value.sdvSourceRectangle == sr && st == a.Value.sdvTexture).Value;

                if (data.color != Color.White)
                {
                    color = data.color.multiplyWith(color);
                }

                texture         = data.texture;
                sourceRectangle = data.sourceRectangle;
            }
        public void CreateCustomObjectTest()
        {
            int customObjectId = 160;
            var customObjectData = new CustomObjectData()
                {

                    fieldValues = new List<FieldValue>()
                        {
                            new FieldValue()
                                {
                                    id = 896,
                                    value = "*****@*****.**"
                                },
                            new FieldValue()
                                {
                                    id = 898,
                                    value = "unique code"
                                }
                        }
                };

            customObjectData = _helper.CreateCustomObjectData(customObjectId, customObjectData);

            Assert.Greater(0, customObjectData.id);
        }
Esempio n. 14
0
 public override void Entry(IModHelper helper)
 {
     monitor = Monitor;
     HarmonyInstance.Create("Platonymous.ArcadePong").PatchAll(Assembly.GetExecutingAssembly());
     helper.Events.GameLoop.SaveLoaded   += (o, e) => setup();
     helper.Events.GameLoop.GameLaunched += (o, e) => pdata = new CustomObjectData("Pong", "Pong/0/-300/Crafting -9/Play 'Pong by Cat' at home!/true/true/0/Pong", Game1.bigCraftableSpriteSheet.getTile(159, 16, 32).setSaturation(0).setLight(130), Color.Yellow, bigCraftable: true, type: typeof(PongMachine));
 }
Esempio n. 15
0
        internal static void Init()
        {
            Icon       = TubesMod._helper.Content.Load <Texture2D>(@"Assets/icon.png");
            ObjectData = Blueprint.CreateObjectData(Icon, typeof(TubeObject));

            JunkObject.Init(Icon);
        }
Esempio n. 16
0
        private void testing()
        {
            CustomObjectData.newBigObject("Platonymous.BigTest", Game1.bigCraftableSpriteSheet.clone().setSaturation(0), Color.Aquamarine, "Test Machine", "Test Description", 24, craftingData: new CraftingData("Test Machine"));
            CustomObjectData.newObject("Platonymous.Rubici", Game1.objectSpriteSheet.clone().setSaturation(0), Color.Yellow, "Rubici", "Rubici Test", 16, "Rubici", "Minerals -2", 50, -300);
            new CustomObjectData("Platonymous.Rubico" + Color.Red.ToString(), "Rubico/250/-300/Minerals -2/Rubico/A precious stone that is sought after for its rich color and beautiful fluster.", Game1.objectSpriteSheet.clone().setSaturation(0), Color.Red, 16);

            Keys.K.onPressed(() => Monitor.Log($"Played: {Game1.currentGameTime.TotalGameTime.Minutes} min"));
            ButtonClick.UseToolButton.onTerrainClick <Grass>(o => Monitor.Log($"Number of Weeds: {o.numberOfWeeds}", LogLevel.Info));
            new InventoryItem(new Chest(true), 100).addToNPCShop("Pierre");
            new ItemSelector <SObject>(p => p.name == "Chest").whenAddedToInventory(l => l.useAll(i => i.name = "Test"));
            Helper.Content.Load <Texture2D>($"Maps/MenuTiles", ContentSource.GameContent).setSaturation(0).injectAs($"Maps/MenuTiles");
            Game1.objectSpriteSheet.clone().setSaturation(0).injectTileInto($"Maps/springobjects", 74);
            Game1.objectSpriteSheet.clone().setSaturation(0).injectTileInto($"Maps/springobjects", new Range(129, 166), new Range(129, 166));

            Func <string, GameLocation, Vector2, string, bool> tileActionTest = (s, l, t, ly) =>
            {
                List <string> strings = s.Split(' ').ToList();
                strings.Remove(strings[0]);
                Game1.activeClickableMenu = new DialogueBox(String.Join(" ", s));
                return(true);
            };

            Action mapMergeTest = delegate()
            {
                "Beach".toLocation().Map.mergeInto("Town".toLocation().Map, new Vector2(60, 30), new Rectangle(15, 15, 20, 20)).injectAs(@"Maps/Town");
                "Town".toLocation().clearArea(new Rectangle(60, 30, 20, 20));
                "Town".toLocation().Map.addAction(new Vector2(18, 60), new TileAction("testaction", tileActionTest).register(), "Smells interesting");
            };

            SaveEvents.AfterLoad += (s, e) => mapMergeTest();
        }
 public OreVeinTile(CustomObjectData PyTKData, BasicItemInformation Info, Vector2 TileLocation, OreResourceInformation Resource, List <ResourceInformation> ExtraDrops, int Health) : base(PyTKData, Info, TileLocation)
 {
     this.healthValue  = Health;
     this.resourceInfo = Resource;
     this.extraDrops   = ExtraDrops != null ? ExtraDrops : new List <ResourceInformation>();
     this.setHealth(this.healthValue);
     this.Price = Info.price;
 }
Esempio n. 18
0
        public async Task Process_Null_DoesNothing()
        {
            CustomObjectData data = null;

            await _target.Process(_user, data);

            _activityLogServiceMock.Verify(s => s.Log(It.IsAny <IActivityLogEntry>()), Times.Never);
        }
Esempio n. 19
0
        internal static RestRequest Get(Type type, int parentId, CustomObjectData restObj)
        {
            restObj.type = restObj.Type;

            var request = new RestRequest
            {
                RequestFormat = DataFormat.Json
            };

            switch (type)
            {
            case Type.Get:
                request.Method    = Method.GET;
                request.Resource  = restObj.Uri + "/" + parentId;
                request.Resource += "/instance/" + restObj.id + "?depth=" + restObj.depth;
                break;

            case Type.Put:
                request.Method    = Method.PUT;
                request.Resource  = restObj.Uri + "/" + parentId;
                request.Resource += "/instance/" + restObj.id;
                request.AddBody(restObj);
                break;

            case Type.Post:
                request.Method    = Method.POST;
                request.Resource  = restObj.Uri + "/" + parentId;
                request.Resource += "/instance";
                request.AddBody(restObj);
                break;

            case Type.Delete:
                request.Method    = Method.DELETE;
                request.Resource  = restObj.Uri + "/" + parentId;
                request.Resource += "/instance/" + restObj.id;
                break;

            case Type.Search:
                request.Method = Method.GET;

                var resource = new StringBuilder(100);
                resource.Append(restObj.Uri + "/" + parentId);

                var searchObj = restObj as ISearchable;
                resource.Append("/instances?count=" + searchObj.pageSize +
                                "&page=" + searchObj.page +
                                "&depth=" + restObj.depth +
                                "&search=" + searchObj.searchTerm);

                request.Resource = resource.ToString();

                break;

            default:
                throw new NotSupportedException(type.ToString());
            }
            return(request);
        }
Esempio n. 20
0
        public void Delete(int parentId, int?id)
        {
            var data = new CustomObjectData {
                id = id
            };
            var request = Request.Get(Request.Type.Delete, parentId, data);

            _baseClient.Execute <CustomObjectData>(request);
        }
Esempio n. 21
0
        public CustomObjectData Get(int parentId, int id, Depth depth = Depth.minimal)
        {
            var data = new CustomObjectData {
                id = id, depth = depth.ToString()
            };
            var request = Request.Get(Request.Type.Get, parentId, data);

            return(_baseClient.Execute <CustomObjectData>(request));
        }
Esempio n. 22
0
        private void OnGameLaunched(object sender, GameLaunchedEventArgs e)
        {
            SeedBagTool seedbag = new SeedBagTool();

            CustomObjectData.newObject("Platonymous.SeedBag.Tool", SeedBagTool.texture, Color.White, i18n.Get("Name"), i18n.Get("Empty"), 0, customType: typeof(SeedBagTool));
            InventoryItem bag = new InventoryItem(seedbag, config.Price, 1);

            bag.addToNPCShop(config.Shop);
        }
Esempio n. 23
0
 public override void Entry(IModHelper helper)
 {
     monitor = Monitor;
     helper.Events.GameLoop.GameLaunched += (o, e) =>
     {
         sdata = new CustomObjectData("2048", "2048/0/-300/Crafting -9/Play '2048 by Platonymous' at home!/true/true/0/2048", helper.Content.Load <Texture2D>(@"Assets/arcade.png"), Color.White, bigCraftable: true, type: typeof(Machine2048));
     };
     helper.Events.GameLoop.SaveLoaded += (o, e) => addToCatalogue();
 }
Esempio n. 24
0
        public override void Entry(IModHelper helper)
        {
            _monitor = Monitor;
            _helper  = helper;
            SeedBagTool seedbag = new SeedBagTool();

            addtoshop = new InventoryItem(seedbag, 30000, 1).addToNPCShop("Pierre");
            CustomObjectData.newObject("Platonymous.SeedBag.Tool", SeedBagTool.texture, Color.White, "Seed Bag", "Empty", 0, customType: typeof(SeedBagTool));
        }
Esempio n. 25
0
        public void Init(string itemName)
        {
            loadTexture();

            modObjectData                = new ModObjectData(itemName, loadDisplayName(), loadDescription());
            modObjectData.ObjectType     = Game1.content.LoadString("Strings\\StringsFromCSFiles:Tool.cs.14307");
            modObjectData.ObjectCategory = Constants.CATEGORY_WEAPON;
            modObjectData.Price          = 100;
            customObjectData             = modObjectData.CreateObjectData(texture, typeof(ToolBugNet));
        }
Esempio n. 26
0
 public Grinder(CustomObjectData PyTKData, BasicItemInformation info, List <ResourceInformation> ProducedResources = null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce = 0, bool UpdatesContainer = false, string CraftingBook = "") : base(PyTKData, info)
 {
     this.producedResources          = ProducedResources ?? new List <ResourceInformation>();
     this.energyRequiredPer10Minutes = ModCore.Configs.machinesConfig.grinderEnergyConsumption;
     this.timeToProduce = TimeToProduce;
     this.updatesContainerObjectForProduction = UpdatesContainer;
     this.MinutesUntilReady  = TimeToProduce;
     this.craftingRecipeBook = CraftingBook;
     this.createStatusBubble();
 }
Esempio n. 27
0
        public static bool DrawFix(SpriteBatch __instance, Texture2D texture, Rectangle destinationRectangle, Rectangle?sourceRectangle, Color color, Vector2 origin, float rotation = 0f, SpriteEffects effects = SpriteEffects.None, float layerDepth = 0f)
        {
            if (skip)
            {
                skip = false;
                return(true);
            }

            if (texture == null || destinationRectangle == null)
            {
                return(false);
            }

            sourceRectangle = sourceRectangle.HasValue ? sourceRectangle.Value : new Rectangle(0, 0, texture.Width, texture.Height);

            if (texture is MappedTexture2D mapped && mapped.Get(sourceRectangle.Value.X, sourceRectangle.Value.Y) is Texture2D t)
            {
                skip = true;
                __instance.Draw(t, destinationRectangle, sourceRectangle, color, rotation, origin, effects, layerDepth);
                return(false);
            }

            if (texture is ScaledTexture2D s && sourceRectangle.Value is Rectangle r)
            {
                var newDestination = new Rectangle(destinationRectangle.X, destinationRectangle.Y, (int)(destinationRectangle.Width), (int)(destinationRectangle.Height));
                var newSR          = new Rectangle?(new Rectangle((int)(r.X * s.Scale), (int)(r.Y * s.Scale), (int)(r.Width * s.Scale), (int)(r.Height * s.Scale)));
                var newOrigin      = new Vector2(origin.X * s.Scale, origin.Y * s.Scale);

                if (s.ForcedSourceRectangle.HasValue)
                {
                    newSR = s.ForcedSourceRectangle.Value;
                }

                skip = true;
                __instance.Draw(s.STexture, newDestination, newSR, color, rotation, newOrigin, effects, layerDepth);
                return(false);
            }

            if (texture != null && texture.Tag != null && texture.Tag is String tag)
            {
                CustomObjectData data = CustomObjectData.collection.ContainsKey(tag) ? CustomObjectData.collection[tag] : getDataFromSourceRectangle(sourceRectangle.Value);
                texture.Tag = "cod_object";
                Game1.bigCraftableSpriteSheet.Tag = "cod_object";
                Game1.objectSpriteSheet.Tag       = "cod_object";

                if (data != null && data.texture != null)
                {
                    skip = true;
                    __instance.Draw(data.texture, destinationRectangle, data.sourceRectangle, data.color, rotation, origin, effects, layerDepth);
                    return(false);
                }
            }

            return(true);
        }
Esempio n. 28
0
 public MultiTiledObject(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, Dictionary <Vector2, MultiTiledComponent> ObjectsList)
     : base(PyTKData, info, TileLocation)
 {
     this.objects       = new Dictionary <Vector2, StardewValley.Object>();
     this.childrenGuids = new Dictionary <Vector2, Guid>();
     foreach (var v in ObjectsList)
     {
         MultiTiledComponent component = (MultiTiledComponent)v.Value.getOne();
         this.addComponent(v.Key, component);
     }
 }
Esempio n. 29
0
 public AlloyFurnace(CustomObjectData PyTKData, BasicItemInformation info, Vector2 TileLocation, List <ResourceInformation> ProducedResources = null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce = 0, bool UpdatesContainer = false, string CraftingBook = "", MultiTiledObject obj = null) : base(PyTKData, info, TileLocation)
 {
     this.containerObject            = obj;
     this.producedResources          = ProducedResources ?? new List <ResourceInformation>();
     this.energyRequiredPer10Minutes = EnergyRequiredPer10Minutes;
     this.timeToProduce = TimeToProduce;
     this.updatesContainerObjectForProduction = UpdatesContainer;
     this.MinutesUntilReady  = TimeToProduce;
     this.craftingRecipeBook = CraftingBook;
     this.createStatusBubble();
 }
Esempio n. 30
0
        public override ICustomObject recreate(Dictionary <string, string> additionalSaveData, object replacement)
        {
            if (additionalSaveData["id"] == "na")
            {
                additionalSaveData["id"] = "Notes.Desk";
            }

            CustomObjectData data = CustomObjectData.collection[additionalSaveData["id"]];

            return(new Desk(CustomObjectData.collection[additionalSaveData["id"]], (replacement as Chest).TileLocation));
        }
Esempio n. 31
0
 public Machine(CustomObjectData PyTKData, BasicItemInformation info, List <ResourceInformation> ProducedResources = null, int EnergyRequiredPer10Minutes = 0, int TimeToProduce = 0, bool UpdatesContainer = false, string CraftingBook = "", Fluid FluidRequiredForOperation = null, int FluidAmountRequiredPerOperation = 0) : base(PyTKData, info)
 {
     this.producedResources          = ProducedResources ?? new List <ResourceInformation>();
     this.energyRequiredPer10Minutes = EnergyRequiredPer10Minutes;
     this.timeToProduce = TimeToProduce;
     this.updatesContainerObjectForProduction = UpdatesContainer;
     this.MinutesUntilReady  = TimeToProduce;
     this.craftingRecipeBook = CraftingBook;
     this.createStatusBubble();
     this.requiredFluidForOperation         = FluidRequiredForOperation;
     this.amountOfFluidRequiredForOperation = FluidAmountRequiredPerOperation;
 }
        public CustomObjectData CreateCustomObjectData(int customObjectId, CustomObjectData customObjectData)
        {
            var request = new RestRequest(Method.POST)
                {
                    RequestFormat = DataFormat.Json,
                    Resource = string.Format("/data/customObject/{0}", customObjectId)
                };

            request.AddBody(customObjectData);

            var response = _client.Execute<CustomObjectData>(request);

            return response.Data;
        }