feat: biem boem bam
This commit is contained in:
@@ -53,9 +53,18 @@ import net.runelite.api.IntegerNode;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.MenuAction;
|
||||
import static net.runelite.api.MenuAction.*;
|
||||
import static net.runelite.api.MenuAction.PLAYER_EIGTH_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_FIFTH_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_FIRST_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_FOURTH_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_SECOND_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_SEVENTH_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_SIXTH_OPTION;
|
||||
import static net.runelite.api.MenuAction.PLAYER_THIRD_OPTION;
|
||||
import static net.runelite.api.MenuAction.UNKNOWN;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.MessageNode;
|
||||
import net.runelite.api.Model;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.api.NameableContainer;
|
||||
@@ -68,6 +77,7 @@ import net.runelite.api.Point;
|
||||
import net.runelite.api.Prayer;
|
||||
import net.runelite.api.Projectile;
|
||||
import net.runelite.api.ScriptEvent;
|
||||
import net.runelite.api.Sequence;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.SpritePixels;
|
||||
import net.runelite.api.StructComposition;
|
||||
@@ -124,8 +134,8 @@ import net.runelite.api.widgets.WidgetConfig;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.api.widgets.WidgetItem;
|
||||
import net.runelite.api.widgets.WidgetType;
|
||||
import net.runelite.rs.api.RSArchive;
|
||||
import net.runelite.rs.api.RSAbstractArchive;
|
||||
import net.runelite.rs.api.RSArchive;
|
||||
import net.runelite.rs.api.RSChatChannel;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSEnumComposition;
|
||||
@@ -133,6 +143,7 @@ import net.runelite.rs.api.RSFriendSystem;
|
||||
import net.runelite.rs.api.RSIndexedSprite;
|
||||
import net.runelite.rs.api.RSInterfaceParent;
|
||||
import net.runelite.rs.api.RSItemContainer;
|
||||
import net.runelite.rs.api.RSModelData;
|
||||
import net.runelite.rs.api.RSNPC;
|
||||
import net.runelite.rs.api.RSNode;
|
||||
import net.runelite.rs.api.RSNodeDeque;
|
||||
@@ -2311,5 +2322,33 @@ public abstract class RSClientMixin implements RSClient
|
||||
scene.setTileShapes(Arrays.copyOf(tileShapes, tileShapes.length));
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
public Model loadModel(int id)
|
||||
{
|
||||
return loadModel(id, null, null);
|
||||
}
|
||||
|
||||
@Inject
|
||||
public Model loadModel(int id, short[] colorToFind, short[] colorToReplace)
|
||||
{
|
||||
RSModelData modeldata = client.getModelData(client.getObjectDefinition_modelsArchive(), id, 0);
|
||||
|
||||
if (colorToFind != null)
|
||||
{
|
||||
for (int i = 0; i < colorToFind.length; ++i)
|
||||
{
|
||||
modeldata.recolor(colorToFind[i], colorToReplace[i]);
|
||||
}
|
||||
}
|
||||
|
||||
return modeldata.toModel(modeldata.getAmbient() + 64, modeldata.getContrast() + 850, -30, -50, -30);
|
||||
}
|
||||
|
||||
@Inject
|
||||
public Sequence loadAnimation(int id)
|
||||
{
|
||||
return client.getSequenceDefinition(id);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
package net.runelite.mixins;
|
||||
|
||||
import net.runelite.api.RuneLiteObject;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.events.GraphicsObjectCreated;
|
||||
import net.runelite.api.mixins.Copy;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.api.mixins.Replace;
|
||||
import net.runelite.api.mixins.Shadow;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSGraphicsObject;
|
||||
import net.runelite.rs.api.RSModel;
|
||||
import net.runelite.rs.api.RSRuneLiteObject;
|
||||
|
||||
@Mixin(RSGraphicsObject.class)
|
||||
public abstract class RSGraphicsObjectMixin implements RSGraphicsObject
|
||||
@@ -27,4 +32,34 @@ public abstract class RSGraphicsObjectMixin implements RSGraphicsObject
|
||||
{
|
||||
return new LocalPoint(this.getX(), this.getY());
|
||||
}
|
||||
|
||||
|
||||
@Copy("advance")
|
||||
@Replace("advance")
|
||||
public void copy$advance(int var1)
|
||||
{
|
||||
if (this instanceof RuneLiteObject)
|
||||
{
|
||||
((RSRuneLiteObject) this).advanceRL(var1);
|
||||
}
|
||||
else
|
||||
{
|
||||
copy$advance(var1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Copy("getModel")
|
||||
@Replace("getModel")
|
||||
public RSModel copy$getModel()
|
||||
{
|
||||
if (this instanceof RuneLiteObject)
|
||||
{
|
||||
return ((RSRuneLiteObject) this).getModelRl();
|
||||
}
|
||||
else
|
||||
{
|
||||
return copy$getModel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.runelite.mixins;
|
||||
|
||||
import net.runelite.api.IterableHashTable;
|
||||
import net.runelite.api.Node;
|
||||
import net.runelite.api.NodeCache;
|
||||
import net.runelite.api.mixins.*;
|
||||
import net.runelite.rs.api.RSBuffer;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
@@ -16,6 +17,16 @@ public abstract class RSObjectCompositionMixin implements RSObjectComposition
|
||||
@Inject
|
||||
private int accessBitMask = 0;
|
||||
|
||||
@MethodHook(value = "<init>", end = true)
|
||||
@Inject
|
||||
public void rl$init()
|
||||
{
|
||||
NodeCache cachedModels2 = client.getCachedModels2();
|
||||
cachedModels2.setCapacity(256);
|
||||
cachedModels2.setRemainingCapacity(256);
|
||||
cachedModels2.reset();
|
||||
}
|
||||
|
||||
@Inject
|
||||
@Override
|
||||
public int getAccessBitMask()
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
/*
|
||||
* Copyright (c) 2018, OpenOSRS
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
package net.runelite.mixins;
|
||||
|
||||
import net.runelite.api.Model;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Sequence;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.mixins.Inject;
|
||||
import net.runelite.api.mixins.Mixin;
|
||||
import net.runelite.api.mixins.Shadow;
|
||||
import net.runelite.rs.api.RSClient;
|
||||
import net.runelite.rs.api.RSModel;
|
||||
import net.runelite.rs.api.RSRuneLiteObject;
|
||||
import net.runelite.rs.api.RSSequenceDefinition;
|
||||
|
||||
@Mixin(RSRuneLiteObject.class)
|
||||
public abstract class RuneLiteObjectMixin implements RSRuneLiteObject
|
||||
{
|
||||
@Shadow("client")
|
||||
private static RSClient client;
|
||||
|
||||
@Inject
|
||||
private static boolean loop;
|
||||
|
||||
@Inject
|
||||
private static RSModel model;
|
||||
|
||||
@Inject
|
||||
RuneLiteObjectMixin()
|
||||
{
|
||||
setFinished(true);
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setModel(Model var1)
|
||||
{
|
||||
model = (RSModel) var1;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setLocation(LocalPoint localPoint, int plane)
|
||||
{
|
||||
setX(localPoint.getX());
|
||||
setY(localPoint.getY());
|
||||
setLevel(plane);
|
||||
setHeight(Perspective.getTileHeight(client, localPoint, plane));
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void advanceRL(int var1)
|
||||
{
|
||||
if (getSequenceDefinition() != null)
|
||||
{
|
||||
if (!finished())
|
||||
{
|
||||
setFrameCycle(getFrameCycle() + var1);
|
||||
|
||||
while (getFrameCycle() > getSequenceDefinition().getFrameLengths()[getFrame()])
|
||||
{
|
||||
setFrameCycle(getFrameCycle() - getSequenceDefinition().getFrameLengths()[getFrame()]);
|
||||
setFrame(getFrame() + 1);
|
||||
if (getFrame() >= getSequenceDefinition().getFrameIDs().length)
|
||||
{
|
||||
setFinished(true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (loop && finished())
|
||||
{
|
||||
setFinished(false);
|
||||
setFrame(0);
|
||||
setFrameCycle(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
public boolean isActive()
|
||||
{
|
||||
return !finished();
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setActive(boolean active)
|
||||
{
|
||||
if (finished() == active)
|
||||
{
|
||||
setFinished(!active);
|
||||
|
||||
if (active)
|
||||
{
|
||||
setFrame(0);
|
||||
setFrameCycle(0);
|
||||
client.getGraphicsObjectDeque().addFirst(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
unlink();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setShouldLoop(boolean var1)
|
||||
{
|
||||
loop = var1;
|
||||
}
|
||||
|
||||
@Inject
|
||||
public void setAnimation(Sequence var1)
|
||||
{
|
||||
setFrame(0);
|
||||
setFrameCycle(0);
|
||||
setSequenceDefinition((RSSequenceDefinition) var1);
|
||||
}
|
||||
|
||||
@Inject
|
||||
public RSModel getModelRl()
|
||||
{
|
||||
RSModel model = RuneLiteObjectMixin.model;
|
||||
if (getSequenceDefinition() != null)
|
||||
{
|
||||
model = getSequenceDefinition().transformSpotAnimationModel(model, getFrame());
|
||||
}
|
||||
else
|
||||
{
|
||||
model = model.toSharedModel(true);
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user