project: fix lambda things and add mixins and rename two fields (#12)

This commit is contained in:
ThatGamerBlue
2020-01-28 17:49:43 +00:00
committed by Kyle
parent ed5acca637
commit db1bfdfb47
12 changed files with 128 additions and 77 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;
}

View File

@@ -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;

View File

@@ -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();
}