public static DeserializedChest ToDeserializedChest(this CustomChest customChest, long playerId, int inventoryIndex) { var deserializedChest = customChest.ToDeserializedChest(inventoryIndex); deserializedChest.PlayerId = playerId; return(deserializedChest); }
public static DeserializedChest ToDeserializedChest(this CustomChest customChest, string locationName, Vector2 position, int inventoryIndex) { var deserializedChest = customChest.ToDeserializedChest(locationName, position); deserializedChest.InventoryIndex = inventoryIndex; return(deserializedChest); }
private void Register(CustomChest customChest) { _monitor.VerboseLog($"Registering {customChest.Config.Name} ({customChest.Config.Id})"); Game1.bigCraftablesInformation[customChest.Config.Id] = customChest.BigCraftableInfo; CraftingRecipe.craftingRecipes[customChest.Config.Name] = customChest.RecipeString; Game1.player.craftingRecipes[customChest.Config.Name] = 0; }
public static DeserializedChest ToDeserializedChest(this CustomChest customChest, int inventoryIndex) { return(new DeserializedChest { InventoryIndex = inventoryIndex, ChestType = customChest.ChestType, Name = customChest.name }); }
public static Chest ToChest(this CustomChest customChest) { var chest = new Chest(true); chest.items.AddRange(customChest.items); chest.playerChoiceColor.Value = customChest.playerChoiceColor.Value; chest.name = customChest.name; chest.Stack = customChest.Stack; return(chest); }
public static DeserializedChest ToDeserializedChest(this CustomChest customChest, string locationName, Vector2 position) { return(new DeserializedChest { LocationName = locationName, PositionX = position.X, PositionY = position.Y, ChestType = customChest.ChestType, Name = customChest.name }); }
protected override void ClearNulls() { MegaStorageMod.Logger.VerboseLog("ClearNulls (Magic). CurrentRow: " + _currentRow); var skippedItems = CustomChest.items.Take(ItemsPerRow * _currentRow).ToList(); var shownItems = ItemsToGrabMenu.actualInventory.ToList(); MegaStorageMod.Logger.VerboseLog("Skipped items: " + skippedItems.Count); MegaStorageMod.Logger.VerboseLog("Shown items: " + shownItems.Count); CustomChest.items.Clear(); CustomChest.items.AddRange(skippedItems); CustomChest.items.AddRange(shownItems); CustomChest.clearNulls(); Refresh(); }
private void PatchSprite(IAssetDataForImage assetImage, CustomChest customChest) { var sprite = _modHelper.Content.Load <Texture2D>(customChest.Config.SpritePath); var destinationRect = Game1.getSourceRectForStandardTileSheet(Game1.bigCraftableSpriteSheet, customChest.ParentSheetIndex, 16, 32); var sourceRect = new Rectangle(0, 0, 16, 32); _monitor.VerboseLog($"Destination rect: ({destinationRect.X}, {destinationRect.Y}) - ({destinationRect.Width}, {destinationRect.Height})"); try { assetImage.PatchImage(sprite, targetArea: destinationRect, sourceArea: sourceRect); } catch (Exception ex) { _monitor.Log("Error while patching bigCraftableSpriteSheet: " + ex.Message); } }
public MagicItemGrabMenu(CustomChest customChest) : base(customChest) { _currentRow = 0; Refresh(); }