Various mixin/injector additions

This commit is contained in:
Lucas
2019-06-08 11:58:34 +02:00
parent ffcb7b8b45
commit 2c38de7061
37 changed files with 852 additions and 158 deletions

View File

@@ -5,6 +5,7 @@ import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.MethodHook;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClanChat;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSMessage;
@@ -70,4 +71,13 @@ public abstract class RSMessageMixin implements RSMessage
runeLiteFormatMessage = null;
rl$timestamp = (int) (System.currentTimeMillis() / 1000L);
}
@Inject
@Override
public boolean isFromClanMate()
{
RSClanChat cc = client.getClanMemberManager();
return cc != null && cc.isMember(this.getSenderUsername());
}
}

View File

@@ -135,7 +135,7 @@ public abstract class RSTileMixin implements RSTile
wallObjectSpawned.setWallObject(current);
client.getCallbacks().post(wallObjectSpawned);
}
else if (current != null && previous != null)
else if (current != null)
{
WallObjectChanged wallObjectChanged = new WallObjectChanged();
wallObjectChanged.setTile(this);
@@ -168,7 +168,7 @@ public abstract class RSTileMixin implements RSTile
decorativeObjectSpawned.setDecorativeObject(current);
client.getCallbacks().post(decorativeObjectSpawned);
}
else if (current != null && previous != null)
else if (current != null)
{
DecorativeObjectChanged decorativeObjectChanged = new DecorativeObjectChanged();
decorativeObjectChanged.setTile(this);
@@ -201,7 +201,7 @@ public abstract class RSTileMixin implements RSTile
groundObjectSpawned.setGroundObject(current);
client.getCallbacks().post(groundObjectSpawned);
}
else if (current != null && previous != null)
else if (current != null)
{
GroundObjectChanged groundObjectChanged = new GroundObjectChanged();
groundObjectChanged.setTile(this);
@@ -263,7 +263,7 @@ public abstract class RSTileMixin implements RSTile
gameObjectSpawned.setGameObject(current);
client.getCallbacks().post(gameObjectSpawned);
}
else if (current != null && previous != null)
else if (current != null)
{
GameObjectChanged gameObjectsChanged = new GameObjectChanged();
gameObjectsChanged.setTile(this);

View File

@@ -258,6 +258,11 @@ public abstract class RSWidgetMixin implements RSWidget
for (int i = 0; i < itemIds.length; ++i)
{
if (itemIds[i] <= 0)
{
continue;
}
WidgetItem item = getWidgetItem(i);
if (item != null)
@@ -287,17 +292,15 @@ public abstract class RSWidgetMixin implements RSWidget
int itemId = itemIds[index];
int itemQuantity = itemQuantities[index];
Point widgetCanvasLocation = getCanvasLocation();
if (itemId <= 0 || itemQuantity <= 0 || columns <= 0)
if (columns <= 0)
{
return null;
}
int row = index / columns;
int col = index % columns;
int itemX = widgetCanvasLocation.getX() + ((ITEM_SLOT_SIZE + xPitch) * col);
int itemY = widgetCanvasLocation.getY() + ((ITEM_SLOT_SIZE + yPitch) * row);
int itemX = rl$x + ((ITEM_SLOT_SIZE + xPitch) * col);
int itemY = rl$y + ((ITEM_SLOT_SIZE + yPitch) * row);
Rectangle bounds = new Rectangle(itemX - 1, itemY - 1, ITEM_SLOT_SIZE, ITEM_SLOT_SIZE);
return new WidgetItem(itemId - 1, itemQuantity, index, bounds, this);