public override Item getOne() { ExpandableInventoryObject ExpandableInventoryObject = new ExpandableInventoryObject(this.parentSheetIndex, this.tileLocation, this.allInventories, inventoryMaxSize, this.drawColor); /* * drawPosition = this.drawPosition; * defaultBoundingBox = this.defaultBoundingBox; * boundingBox = this.boundingBox; * currentRotation = this.currentRotation - 1; * rotations = this.rotations; * rotate(); */ return(ExpandableInventoryObject); }
public ExpandableItemGrabMenu(Revitalize.Objects.Generic.ExpandableInventoryObject ExpandableObject, List <Item> inventory, int rows, bool reverseGrab, bool showReceivingMenu, InventoryMenu.highlightThisItem highlightFunction, ExpandableItemGrabMenu.behaviorOnItemSelect behaviorOnItemSelectFunction, string message, ExpandableItemGrabMenu.behaviorOnItemSelect behaviorOnItemGrab = null, bool snapToBottom = false, bool canBeExitedWithKey = false, bool playRightClickSound = true, bool allowRightClick = true, bool showOrganizeButton = false, int source = 0, Item sourceItem = null) : base(highlightFunction, true, true, 0, 0) { this.expandableObject = ExpandableObject; this.source = source; this.message = message; this.reverseGrab = reverseGrab; this.showReceivingMenu = showReceivingMenu; this.playRightClickSound = playRightClickSound; this.allowRightClick = allowRightClick; this.inventory.showGrayedOutSlots = true; this.sourceItem = sourceItem; this.Rows = rows; if (source == 1 && sourceItem != null && sourceItem is Chest) { this.chestColorPicker = new DiscreteColorPicker(this.xPositionOnScreen, this.yPositionOnScreen - Game1.tileSize - IClickableMenu.borderWidth * 2, 0, new Chest(true)); this.chestColorPicker.colorSelection = this.chestColorPicker.getSelectionFromColor((sourceItem as Chest).playerChoiceColor); (this.chestColorPicker.itemToDrawColored as Chest).playerChoiceColor = this.chestColorPicker.getColorFromSelection(this.chestColorPicker.colorSelection); this.colorPickerToggleButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + Game1.tileSize + Game1.pixelZoom * 5, 16 * Game1.pixelZoom, 16 * Game1.pixelZoom), Game1.mouseCursors, new Rectangle(119, 469, 16, 16), (float)Game1.pixelZoom, false) { hoverText = Game1.content.LoadString("Strings\\UI:Toggle_ColorPicker", new object[0]) }; } if (snapToBottom) { base.movePosition(0, Game1.viewport.Height - (this.yPositionOnScreen + this.height - IClickableMenu.spaceToClearTopBorder)); this.snappedtoBottom = true; } this.ItemsToGrabMenu = new InventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, inventory, highlightFunction, inventory.Capacity, Rows, 0, 0, true); this.behaviorFunction = behaviorOnItemSelectFunction; this.behaviorOnItemGrab = behaviorOnItemGrab; this.canExitOnKey = canBeExitedWithKey; if (showOrganizeButton) { this.organizeButton = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + this.height / 3 - Game1.tileSize, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize", new object[0]), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), (float)Game1.pixelZoom, false); } if ((Game1.isAnyGamePadButtonBeingPressed() || !Game1.lastCursorMotionWasMouse) && this.ItemsToGrabMenu.actualInventory.Count > 0 && Game1.activeClickableMenu == null) { Game1.setMousePosition(this.inventory.inventory[0].bounds.Center); } TextureDataNode d; Dictionaries.spriteFontList.TryGetValue("leftArrow", out d); TextureDataNode f; Dictionaries.spriteFontList.TryGetValue("rightArrow", out f); this.LeftButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 3, this.yPositionOnScreen / 4, Game1.tileSize, Game1.tileSize), d.texture, new Rectangle(0, 0, 16, 16), 4f, false); this.RightButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize, this.yPositionOnScreen / 4, Game1.tileSize, Game1.tileSize), f.texture, new Rectangle(0, 0, 16, 16), 4f, false); }
public ExpandableItemGrabMenu(Revitalize.Objects.Generic.ExpandableInventoryObject ExpandableObject, List <Item> inventory, int rows) : base(null, true, true, 0, 0) { expandableObject = ExpandableObject; Rows = rows; this.ItemsToGrabMenu = new StardewValley.Menus.InventoryMenu(this.xPositionOnScreen + Game1.tileSize / 2, this.yPositionOnScreen, false, inventory, null, inventory.Capacity, Rows, 0, 0, true); capacity = inventory.Capacity; // Log.AsyncO("MAX LOAD"+this.capacity); this.reverseGrab = true; this.organizeButton = new ClickableTextureComponent("", new Rectangle(this.xPositionOnScreen + this.width, this.yPositionOnScreen + this.height / 3 - Game1.tileSize, Game1.tileSize, Game1.tileSize), "", Game1.content.LoadString("Strings\\UI:ItemGrab_Organize", new object[0]), Game1.mouseCursors, new Rectangle(162, 440, 16, 16), (float)Game1.pixelZoom, false); TextureDataNode d; Dictionaries.spriteFontList.TryGetValue("leftArrow", out d); TextureDataNode f; Dictionaries.spriteFontList.TryGetValue("rightArrow", out f); this.LeftButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize / 3, this.yPositionOnScreen / 4, Game1.tileSize, Game1.tileSize), d.texture, new Rectangle(0, 0, 16, 16), 4f, false); this.RightButton = new ClickableTextureComponent(new Rectangle(this.xPositionOnScreen + Game1.tileSize, this.yPositionOnScreen / 4, Game1.tileSize, Game1.tileSize), f.texture, new Rectangle(0, 0, 16, 16), 4f, false); this.inventory.showGrayedOutSlots = true; }
public override bool placementAction(GameLocation location, int x, int y, StardewValley.Farmer who = null) { // Log.AsyncC(x); // Log.AsyncM(y); return(false); if (location is FarmHouse) { Point point = new Point(x / Game1.tileSize, y / Game1.tileSize); List <Rectangle> walls = FarmHouse.getWalls((location as FarmHouse).upgradeLevel); this.tileLocation = new Vector2((float)point.X, (float)point.Y); bool flag = false; if (this.Decoration_type == 6 || this.Decoration_type == 13 || this.parentSheetIndex == 1293) { int num = (this.parentSheetIndex == 1293) ? 3 : 0; bool flag2 = false; foreach (Rectangle current in walls) { if ((this.Decoration_type == 6 || this.Decoration_type == 13 || num != 0) && current.Y + num == point.Y && current.Contains(point.X, point.Y - num)) { flag2 = true; break; } } if (!flag2) { Game1.showRedMessage("Must be placed on wall"); return(false); } flag = true; } for (int i = point.X; i < point.X + this.getTilesWide(); i++) { for (int j = point.Y; j < point.Y + this.getTilesHigh(); j++) { if (location.doesTileHaveProperty(i, j, "NoFurniture", "Back") != null) { Game1.showRedMessage("Furniture can't be placed here"); return(false); } if (!flag && Utility.pointInRectangles(walls, i, j)) { Game1.showRedMessage("Can't place on wall"); return(false); } if (location.getTileIndexAt(i, j, "Buildings") != -1) { return(false); } } } this.boundingBox = new Rectangle(x / Game1.tileSize, y / Game1.tileSize, this.boundingBox.Width, this.boundingBox.Height); foreach (KeyValuePair <Vector2, StardewValley.Object> c in location.objects) { StardewValley.Object ehh = c.Value; if (((ehh.GetType()).ToString()).Contains("ExpandableInventoryObject")) { ExpandableInventoryObject current2 = (ExpandableInventoryObject)ehh; if (current2.Decoration_type == 11 && current2.heldObject == null && current2.getBoundingBox(current2.tileLocation).Intersects(this.boundingBox)) { current2.performObjectDropInAction(this, false, (who == null) ? Game1.player : who); bool result = true; return(result); } } } foreach (StardewValley.Farmer current3 in location.getFarmers()) { if (current3.GetBoundingBox().Intersects(this.boundingBox)) { Game1.showRedMessage("Can't place on top of a person."); bool result = false; return(result); } } this.updateDrawPosition(); for (int i = 0; i <= this.boundingBox.X / Game1.tileSize; i++) { base.placementAction(location, x + 1, y, who); } for (int i = 0; i <= this.boundingBox.Y / Game1.tileSize; i++) { base.placementAction(location, x, y + 1, who); } return(true); } else { Point point = new Point(x / Game1.tileSize, y / Game1.tileSize); // List<Rectangle> walls = FarmHouse.getWalls((location as FarmHouse).upgradeLevel); this.tileLocation = new Vector2((float)point.X, (float)point.Y); bool flag = false; if (this.Decoration_type == 6 || this.Decoration_type == 13 || this.parentSheetIndex == 1293) { int num = (this.parentSheetIndex == 1293) ? 3 : 0; bool flag2 = false; /* * foreach (Rectangle current in walls) * { * if ((this.Decoration_type == 6 || this.Decoration_type == 13 || num != 0) && current.Y + num == point.Y && current.Contains(point.X, point.Y - num)) * { * flag2 = true; * break; * } * } */ if (!flag2) { Game1.showRedMessage("Must be placed on wall"); return(false); } flag = true; } for (int i = point.X; i < point.X + this.getTilesWide(); i++) { for (int j = point.Y; j < point.Y + this.getTilesHigh(); j++) { if (location.doesTileHaveProperty(i, j, "NoFurniture", "Back") != null) { Game1.showRedMessage("Furniture can't be placed here"); return(false); } /* * if (!flag && Utility.pointInRectangles(walls, i, j)) * { * Game1.showRedMessage("Can't place on wall"); * return false; * } */ if (location.getTileIndexAt(i, j, "Buildings") != -1) { return(false); } } } this.boundingBox = new Rectangle(x / Game1.tileSize, y / Game1.tileSize, this.boundingBox.Width, this.boundingBox.Height); /* * foreach (Furniture current2 in (location as FarmHouse).furniture) * { * if (current2.furniture_type == 11 && current2.heldObject == null && current2.getBoundingBox(current2.tileLocation).Intersects(this.boundingBox)) * { * current2.performObjectDropInAction(this, false, (who == null) ? Game1.player : who); * bool result = true; * return result; * } * } */ foreach (StardewValley.Farmer current3 in location.getFarmers()) { if (current3.GetBoundingBox().Intersects(this.boundingBox)) { Game1.showRedMessage("Can't place on top of a person."); bool result = false; return(result); } } this.updateDrawPosition(); this.thisLocation = Game1.player.currentLocation; return(Util.placementAction(this, location, x, y, who)); } }
public override bool canBePlacedHere(GameLocation l, Vector2 tile) { if ((l is FarmHouse)) { for (int i = 0; i < this.boundingBox.Width / Game1.tileSize; i++) { for (int j = 0; j < this.boundingBox.Height / Game1.tileSize; j++) { Vector2 vector = tile * (float)Game1.tileSize + new Vector2((float)i, (float)j) * (float)Game1.tileSize; vector.X += (float)(Game1.tileSize / 2); vector.Y += (float)(Game1.tileSize / 2); foreach (KeyValuePair <Vector2, StardewValley.Object> something in l.objects) { StardewValley.Object obj = something.Value; if ((obj.GetType()).ToString().Contains("ExpandableInventoryObject")) { ExpandableInventoryObject current = (ExpandableInventoryObject)obj; if (current.Decoration_type == 11 && current.getBoundingBox(current.tileLocation).Contains((int)vector.X, (int)vector.Y) && current.heldObject == null && this.getTilesWide() == 1) { bool result = true; return(result); } if ((current.Decoration_type != 12 || this.Decoration_type == 12) && current.getBoundingBox(current.tileLocation).Contains((int)vector.X, (int)vector.Y)) { bool result = false; return(result); } } } } } return(base.canBePlacedHere(l, tile)); } else { // Game1.showRedMessage("NOT FARMHOUSE"); for (int i = 0; i < this.boundingBox.Width / Game1.tileSize; i++) { for (int j = 0; j < this.boundingBox.Height / Game1.tileSize; j++) { Vector2 vector = tile * (float)Game1.tileSize + new Vector2((float)i, (float)j) * (float)Game1.tileSize; vector.X += (float)(Game1.tileSize / 2); vector.Y += (float)(Game1.tileSize / 2); /* * foreach (ExpandableInventoryObject current in (l as FarmHouse).ExpandableInventoryObject) * { * if (current.Decoration_type == 11 && current.getBoundingBox(current.tileLocation).Contains((int)vector.X, (int)vector.Y) && current.heldObject == null && this.getTilesWide() == 1) * { * bool result = true; * return result; * } * if ((current.Decoration_type != 12 || this.Decoration_type == 12) && current.getBoundingBox(current.tileLocation).Contains((int)vector.X, (int)vector.Y)) * { * bool result = false; * return result; * } * } */ } } return(base.canBePlacedHere(l, tile)); } }