project: fix lambda things and add mixins and rename two fields (#12)
This commit is contained in:
@@ -67,7 +67,7 @@ public class BankItemQuery extends WidgetItemQuery
|
||||
Rectangle bounds = child.getBounds();
|
||||
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
|
||||
// Index is set to 0 because the widget's index does not correlate to the order in the bank
|
||||
widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), 0, bounds, child));
|
||||
widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), 0, bounds, child, false));
|
||||
}
|
||||
}
|
||||
return widgetItems;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class DialogQuery extends WidgetItemQuery
|
||||
// set bounds to same size as default inventory
|
||||
Rectangle bounds = child.getBounds();
|
||||
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
|
||||
widgetItems.add(new WidgetItem(child.getId(), child.getItemQuantity(), i - 1, bounds, child));
|
||||
widgetItems.add(new WidgetItem(child.getId(), child.getItemQuantity(), i - 1, bounds, child, false));
|
||||
}
|
||||
}
|
||||
return widgetItems;
|
||||
|
||||
@@ -30,6 +30,7 @@ import java.util.Collection;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.QueryResults;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
@@ -79,10 +80,20 @@ public class InventoryWidgetItemQuery extends WidgetItemQuery
|
||||
for (int i = 0; i < children.length; i++)
|
||||
{
|
||||
Widget child = children[i];
|
||||
boolean isDragged = child.isWidgetItemDragged(child.getItemId());
|
||||
int dragOffsetX = 0;
|
||||
int dragOffsetY = 0;
|
||||
|
||||
if (isDragged)
|
||||
{
|
||||
Point p = child.getWidgetItemDragOffsets();
|
||||
dragOffsetX = p.getX();
|
||||
dragOffsetY = p.getY();
|
||||
}
|
||||
// set bounds to same size as default inventory
|
||||
Rectangle bounds = child.getBounds();
|
||||
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
|
||||
widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), i, bounds, child));
|
||||
bounds.setBounds(bounds.x + dragOffsetX, bounds.y + dragOffsetY, 32, 32);
|
||||
widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), i, bounds, child, isDragged));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class ShopItemQuery extends WidgetItemQuery
|
||||
// set bounds to same size as default inventory
|
||||
Rectangle bounds = child.getBounds();
|
||||
bounds.setBounds(bounds.x - 1, bounds.y - 1, 32, 32);
|
||||
widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), i - 1, bounds, child));
|
||||
widgetItems.add(new WidgetItem(child.getItemId(), child.getItemQuantity(), i - 1, bounds, child, false)); // todo: maybe this shouldnt just be "false"
|
||||
}
|
||||
}
|
||||
return widgetItems;
|
||||
|
||||
@@ -946,4 +946,8 @@ public interface Widget
|
||||
* @param args A ScriptID, then the args for the script
|
||||
*/
|
||||
void setOnReleaseListener(Object ...args);
|
||||
|
||||
boolean isWidgetItemDragged(int index);
|
||||
|
||||
Point getWidgetItemDragOffsets();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user