Merge pull request #3089 from open-osrs/upstream-1512

This commit is contained in:
Owain van Brakel
2021-12-16 13:10:35 +01:00
committed by GitHub
164 changed files with 5888 additions and 3091 deletions
+2 -2
View File
@@ -25,9 +25,9 @@
object ProjectVersions {
const val launcherVersion = "2.2.0"
const val rlVersion = "1.8.6"
const val rlVersion = "1.8.7"
const val openosrsVersion = "4.16.2"
const val openosrsVersion = "4.17.0"
const val rsversion = 202
const val cacheversion = 165
@@ -12,45 +12,40 @@ public class ModelDefinition
public int id;
public int vertexCount = 0;
public int[] vertexPositionsX;
public int[] vertexPositionsY;
public int[] vertexPositionsZ;
public int[] vertexX;
public int[] vertexY;
public int[] vertexZ;
public transient VertexNormal[] vertexNormals;
public int faceCount;
public int[] faceVertexIndices1;
public int[] faceVertexIndices2;
public int[] faceVertexIndices3;
public byte[] faceAlphas;
public int[] faceIndices1;
public int[] faceIndices2;
public int[] faceIndices3;
public byte[] faceTransparencies;
public short[] faceColors;
public byte[] faceRenderPriorities;
public byte[] faceRenderTypes;
public transient FaceNormal[] faceNormals;
public int textureTriangleCount;
public short[] textureTriangleVertexIndices1;
public short[] textureTriangleVertexIndices2;
public short[] textureTriangleVertexIndices3;
public int numTextureFaces;
public short[] texIndices1;
public short[] texIndices2;
public short[] texIndices3;
public transient float[][] faceTextureUCoordinates;
public transient float[][] faceTextureVCoordinates;
public short[] texturePrimaryColors;
public short[] faceTextures;
public byte[] textureCoordinates;
public byte[] textureCoords;
public byte[] textureRenderTypes;
public int[] vertexSkins;
public int[] faceSkins;
public int[] packedVertexGroups;
public int[] packedTransparencyVertexGroups;
public byte priority;
public short[] aShortArray2574;
public short[] aShortArray2575;
public short[] aShortArray2577;
public short[] aShortArray2578;
public byte[] aByteArray2580;
public short[] aShortArray2586;
private transient int[][] vertexGroups;
public int[][] animayaGroups;
public int[][] animayaScales;
private transient int[] origVX;
private transient int[] origVY;
@@ -77,17 +72,17 @@ public class ModelDefinition
for (var1 = 0; var1 < this.faceCount; ++var1)
{
int vertexA = this.faceVertexIndices1[var1];
int vertexB = this.faceVertexIndices2[var1];
int vertexC = this.faceVertexIndices3[var1];
int vertexA = this.faceIndices1[var1];
int vertexB = this.faceIndices2[var1];
int vertexC = this.faceIndices3[var1];
int xA = this.vertexPositionsX[vertexB] - this.vertexPositionsX[vertexA];
int yA = this.vertexPositionsY[vertexB] - this.vertexPositionsY[vertexA];
int zA = this.vertexPositionsZ[vertexB] - this.vertexPositionsZ[vertexA];
int xA = this.vertexX[vertexB] - this.vertexX[vertexA];
int yA = this.vertexY[vertexB] - this.vertexY[vertexA];
int zA = this.vertexZ[vertexB] - this.vertexZ[vertexA];
int xB = this.vertexPositionsX[vertexC] - this.vertexPositionsX[vertexA];
int yB = this.vertexPositionsY[vertexC] - this.vertexPositionsY[vertexA];
int zB = this.vertexPositionsZ[vertexC] - this.vertexPositionsZ[vertexA];
int xB = this.vertexX[vertexC] - this.vertexX[vertexA];
int yB = this.vertexY[vertexC] - this.vertexY[vertexA];
int zB = this.vertexZ[vertexC] - this.vertexZ[vertexA];
// Compute cross product
int var11 = yA * zB - yB * zA;
@@ -168,13 +163,13 @@ public class ModelDefinition
for (int i = 0; i < faceCount; i++)
{
int textureCoordinate;
if (textureCoordinates == null)
if (textureCoords == null)
{
textureCoordinate = -1;
}
else
{
textureCoordinate = textureCoordinates[i];
textureCoordinate = textureCoords[i];
}
int textureIdx;
@@ -215,33 +210,33 @@ public class ModelDefinition
if (textureRenderType == 0)
{
int faceVertexIdx1 = faceVertexIndices1[i];
int faceVertexIdx2 = faceVertexIndices2[i];
int faceVertexIdx3 = faceVertexIndices3[i];
int faceVertexIdx1 = faceIndices1[i];
int faceVertexIdx2 = faceIndices2[i];
int faceVertexIdx3 = faceIndices3[i];
short triangleVertexIdx1 = textureTriangleVertexIndices1[textureCoordinate];
short triangleVertexIdx2 = textureTriangleVertexIndices2[textureCoordinate];
short triangleVertexIdx3 = textureTriangleVertexIndices3[textureCoordinate];
short triangleVertexIdx1 = texIndices1[textureCoordinate];
short triangleVertexIdx2 = texIndices2[textureCoordinate];
short triangleVertexIdx3 = texIndices3[textureCoordinate];
float triangleX = (float) vertexPositionsX[triangleVertexIdx1];
float triangleY = (float) vertexPositionsY[triangleVertexIdx1];
float triangleZ = (float) vertexPositionsZ[triangleVertexIdx1];
float triangleX = (float) vertexX[triangleVertexIdx1];
float triangleY = (float) vertexY[triangleVertexIdx1];
float triangleZ = (float) vertexZ[triangleVertexIdx1];
float f_882_ = (float) vertexPositionsX[triangleVertexIdx2] - triangleX;
float f_883_ = (float) vertexPositionsY[triangleVertexIdx2] - triangleY;
float f_884_ = (float) vertexPositionsZ[triangleVertexIdx2] - triangleZ;
float f_885_ = (float) vertexPositionsX[triangleVertexIdx3] - triangleX;
float f_886_ = (float) vertexPositionsY[triangleVertexIdx3] - triangleY;
float f_887_ = (float) vertexPositionsZ[triangleVertexIdx3] - triangleZ;
float f_888_ = (float) vertexPositionsX[faceVertexIdx1] - triangleX;
float f_889_ = (float) vertexPositionsY[faceVertexIdx1] - triangleY;
float f_890_ = (float) vertexPositionsZ[faceVertexIdx1] - triangleZ;
float f_891_ = (float) vertexPositionsX[faceVertexIdx2] - triangleX;
float f_892_ = (float) vertexPositionsY[faceVertexIdx2] - triangleY;
float f_893_ = (float) vertexPositionsZ[faceVertexIdx2] - triangleZ;
float f_894_ = (float) vertexPositionsX[faceVertexIdx3] - triangleX;
float f_895_ = (float) vertexPositionsY[faceVertexIdx3] - triangleY;
float f_896_ = (float) vertexPositionsZ[faceVertexIdx3] - triangleZ;
float f_882_ = (float) vertexX[triangleVertexIdx2] - triangleX;
float f_883_ = (float) vertexY[triangleVertexIdx2] - triangleY;
float f_884_ = (float) vertexZ[triangleVertexIdx2] - triangleZ;
float f_885_ = (float) vertexX[triangleVertexIdx3] - triangleX;
float f_886_ = (float) vertexY[triangleVertexIdx3] - triangleY;
float f_887_ = (float) vertexZ[triangleVertexIdx3] - triangleZ;
float f_888_ = (float) vertexX[faceVertexIdx1] - triangleX;
float f_889_ = (float) vertexY[faceVertexIdx1] - triangleY;
float f_890_ = (float) vertexZ[faceVertexIdx1] - triangleZ;
float f_891_ = (float) vertexX[faceVertexIdx2] - triangleX;
float f_892_ = (float) vertexY[faceVertexIdx2] - triangleY;
float f_893_ = (float) vertexZ[faceVertexIdx2] - triangleZ;
float f_894_ = (float) vertexX[faceVertexIdx3] - triangleX;
float f_895_ = (float) vertexY[faceVertexIdx3] - triangleY;
float f_896_ = (float) vertexZ[faceVertexIdx3] - triangleZ;
float f_897_ = f_883_ * f_887_ - f_884_ * f_886_;
float f_898_ = f_884_ * f_885_ - f_882_ * f_887_;
@@ -274,7 +269,7 @@ public class ModelDefinition
public void computeAnimationTables()
{
if (this.vertexSkins != null)
if (this.packedVertexGroups != null)
{
int[] groupCounts = new int[256];
int numGroups = 0;
@@ -282,7 +277,7 @@ public class ModelDefinition
for (var3 = 0; var3 < this.vertexCount; ++var3)
{
var4 = this.vertexSkins[var3];
var4 = this.packedVertexGroups[var3];
++groupCounts[var4];
if (var4 > numGroups)
{
@@ -300,10 +295,10 @@ public class ModelDefinition
for (var3 = 0; var3 < this.vertexCount; this.vertexGroups[var4][groupCounts[var4]++] = var3++)
{
var4 = this.vertexSkins[var3];
var4 = this.packedVertexGroups[var3];
}
this.vertexSkins = null;
this.packedVertexGroups = null;
}
// triangleSkinValues is here
@@ -314,13 +309,13 @@ public class ModelDefinition
int sin = CircularAngle.SINE[orientation];
int cos = CircularAngle.COSINE[orientation];
assert vertexPositionsX.length == vertexPositionsY.length;
assert vertexPositionsY.length == vertexPositionsZ.length;
assert vertexX.length == vertexY.length;
assert vertexY.length == vertexZ.length;
for (int i = 0; i < vertexPositionsX.length; ++i)
for (int i = 0; i < vertexX.length; ++i)
{
vertexPositionsX[i] = vertexPositionsX[i] * cos + vertexPositionsZ[i] * sin >> 16;
vertexPositionsZ[i] = vertexPositionsZ[i] * cos - vertexPositionsX[i] * sin >> 16;
vertexX[i] = vertexX[i] * cos + vertexZ[i] * sin >> 16;
vertexZ[i] = vertexZ[i] * cos - vertexX[i] * sin >> 16;
}
reset();
@@ -333,23 +328,23 @@ public class ModelDefinition
return;
}
System.arraycopy(origVX, 0, vertexPositionsX, 0, origVX.length);
System.arraycopy(origVY, 0, vertexPositionsY, 0, origVY.length);
System.arraycopy(origVZ, 0, vertexPositionsZ, 0, origVZ.length);
System.arraycopy(origVX, 0, vertexX, 0, origVX.length);
System.arraycopy(origVY, 0, vertexY, 0, origVY.length);
System.arraycopy(origVZ, 0, vertexZ, 0, origVZ.length);
}
public void animate(int type, int[] frameMap, int dx, int dy, int dz)
{
if (origVX == null)
{
origVX = Arrays.copyOf(vertexPositionsX, vertexPositionsX.length);
origVY = Arrays.copyOf(vertexPositionsY, vertexPositionsY.length);
origVZ = Arrays.copyOf(vertexPositionsZ, vertexPositionsZ.length);
origVX = Arrays.copyOf(vertexX, vertexX.length);
origVY = Arrays.copyOf(vertexY, vertexY.length);
origVZ = Arrays.copyOf(vertexZ, vertexZ.length);
}
final int[] verticesX = vertexPositionsX;
final int[] verticesY = vertexPositionsY;
final int[] verticesZ = vertexPositionsZ;
final int[] verticesX = vertexX;
final int[] verticesY = vertexY;
final int[] verticesZ = vertexZ;
int var6 = frameMap.length;
int var7;
int var8;
@@ -512,14 +507,14 @@ public class ModelDefinition
int var1;
for (var1 = 0; var1 < this.vertexCount; ++var1)
{
this.vertexPositionsZ[var1] = -this.vertexPositionsZ[var1];
this.vertexZ[var1] = -this.vertexZ[var1];
}
for (var1 = 0; var1 < this.faceCount; ++var1)
{
int var2 = this.faceVertexIndices1[var1];
this.faceVertexIndices1[var1] = this.faceVertexIndices3[var1];
this.faceVertexIndices3[var1] = var2;
int var2 = this.faceIndices1[var1];
this.faceIndices1[var1] = this.faceIndices3[var1];
this.faceIndices3[var1] = var2;
}
reset();
@@ -529,9 +524,9 @@ public class ModelDefinition
{
for (int var1 = 0; var1 < this.vertexCount; ++var1)
{
int var2 = this.vertexPositionsX[var1];
this.vertexPositionsX[var1] = this.vertexPositionsZ[var1];
this.vertexPositionsZ[var1] = -var2;
int var2 = this.vertexX[var1];
this.vertexX[var1] = this.vertexZ[var1];
this.vertexZ[var1] = -var2;
}
reset();
@@ -541,8 +536,8 @@ public class ModelDefinition
{
for (int var1 = 0; var1 < this.vertexCount; ++var1)
{
this.vertexPositionsX[var1] = -this.vertexPositionsX[var1];
this.vertexPositionsZ[var1] = -this.vertexPositionsZ[var1];
this.vertexX[var1] = -this.vertexX[var1];
this.vertexZ[var1] = -this.vertexZ[var1];
}
reset();
@@ -552,9 +547,9 @@ public class ModelDefinition
{
for (int var1 = 0; var1 < this.vertexCount; ++var1)
{
int var2 = this.vertexPositionsZ[var1];
this.vertexPositionsZ[var1] = this.vertexPositionsX[var1];
this.vertexPositionsX[var1] = -var2;
int var2 = this.vertexZ[var1];
this.vertexZ[var1] = this.vertexX[var1];
this.vertexX[var1] = -var2;
}
reset();
@@ -571,9 +566,9 @@ public class ModelDefinition
{
for (int var4 = 0; var4 < this.vertexCount; ++var4)
{
this.vertexPositionsX[var4] = this.vertexPositionsX[var4] * var1 / 128;
this.vertexPositionsY[var4] = var2 * this.vertexPositionsY[var4] / 128;
this.vertexPositionsZ[var4] = var3 * this.vertexPositionsZ[var4] / 128;
this.vertexX[var4] = this.vertexX[var4] * var1 / 128;
this.vertexY[var4] = var2 * this.vertexY[var4] / 128;
this.vertexZ[var4] = var3 * this.vertexZ[var4] / 128;
}
reset();
@@ -610,9 +605,9 @@ public class ModelDefinition
{
for (int i = 0; i < this.vertexCount; i++)
{
this.vertexPositionsX[i] += xOffset;
this.vertexPositionsY[i] += yOffset;
this.vertexPositionsZ[i] += zOffset;
this.vertexX[i] += xOffset;
this.vertexY[i] += yOffset;
this.vertexZ[i] += zOffset;
}
this.reset();
}
File diff suppressed because it is too large Load Diff
@@ -227,22 +227,22 @@ public class ItemSpriteFactory
litModel.field1856 = new int[def.faceCount];
litModel.field1854 = new int[def.faceCount];
litModel.field1823 = new int[def.faceCount];
if (def.textureTriangleCount > 0 && def.textureCoordinates != null)
if (def.numTextureFaces > 0 && def.textureCoords != null)
{
int[] var9 = new int[def.textureTriangleCount];
int[] var9 = new int[def.numTextureFaces];
int var10;
for (var10 = 0; var10 < def.faceCount; ++var10)
{
if (def.textureCoordinates[var10] != -1)
if (def.textureCoords[var10] != -1)
{
++var9[def.textureCoordinates[var10] & 255];
++var9[def.textureCoords[var10] & 255];
}
}
litModel.field1852 = 0;
for (var10 = 0; var10 < def.textureTriangleCount; ++var10)
for (var10 = 0; var10 < def.numTextureFaces; ++var10)
{
if (var9[var10] > 0 && def.textureRenderTypes[var10] == 0)
{
@@ -256,13 +256,13 @@ public class ItemSpriteFactory
var10 = 0;
for (int i = 0; i < def.textureTriangleCount; ++i)
for (int i = 0; i < def.numTextureFaces; ++i)
{
if (var9[i] > 0 && def.textureRenderTypes[i] == 0)
{
litModel.field1844[var10] = def.textureTriangleVertexIndices1[i] & '\uffff';
litModel.field1865[var10] = def.textureTriangleVertexIndices2[i] & '\uffff';
litModel.field1846[var10] = def.textureTriangleVertexIndices3[i] & '\uffff';
litModel.field1844[var10] = def.texIndices1[i] & '\uffff';
litModel.field1865[var10] = def.texIndices2[i] & '\uffff';
litModel.field1846[var10] = def.texIndices3[i] & '\uffff';
var9[i] = var10++;
}
else
@@ -275,9 +275,9 @@ public class ItemSpriteFactory
for (int i = 0; i < def.faceCount; ++i)
{
if (def.textureCoordinates[i] != -1)
if (def.textureCoords[i] != -1)
{
litModel.field1840[i] = (byte) var9[def.textureCoordinates[i] & 255];
litModel.field1840[i] = (byte) var9[def.textureCoords[i] & 255];
}
else
{
@@ -299,13 +299,13 @@ public class ItemSpriteFactory
}
byte faceAlpha;
if (def.faceAlphas == null)
if (def.faceTransparencies == null)
{
faceAlpha = 0;
}
else
{
faceAlpha = def.faceAlphas[faceIdx];
faceAlpha = def.faceTransparencies[faceIdx];
}
short faceTexture;
@@ -355,15 +355,15 @@ public class ItemSpriteFactory
else
{
int var15 = def.faceColors[faceIdx] & '\uffff';
vertexNormal = def.vertexNormals[def.faceVertexIndices1[faceIdx]];
vertexNormal = def.vertexNormals[def.faceIndices1[faceIdx]];
tmp = (y * vertexNormal.y + z * vertexNormal.z + x * vertexNormal.x) / (var7 * vertexNormal.magnitude) + ambient;
litModel.field1856[faceIdx] = method2608(var15, tmp);
vertexNormal = def.vertexNormals[def.faceVertexIndices2[faceIdx]];
vertexNormal = def.vertexNormals[def.faceIndices2[faceIdx]];
tmp = (y * vertexNormal.y + z * vertexNormal.z + x * vertexNormal.x) / (var7 * vertexNormal.magnitude) + ambient;
litModel.field1854[faceIdx] = method2608(var15, tmp);
vertexNormal = def.vertexNormals[def.faceVertexIndices3[faceIdx]];
vertexNormal = def.vertexNormals[def.faceIndices3[faceIdx]];
tmp = (y * vertexNormal.y + z * vertexNormal.z + x * vertexNormal.x) / (var7 * vertexNormal.magnitude) + ambient;
litModel.field1823[faceIdx] = method2608(var15, tmp);
@@ -385,15 +385,15 @@ public class ItemSpriteFactory
}
else
{
vertexNormal = def.vertexNormals[def.faceVertexIndices1[faceIdx]];
vertexNormal = def.vertexNormals[def.faceIndices1[faceIdx]];
tmp = (y * vertexNormal.y + z * vertexNormal.z + x * vertexNormal.x) / (var7 * vertexNormal.magnitude) + ambient;
litModel.field1856[faceIdx] = bound2to126(tmp);
vertexNormal = def.vertexNormals[def.faceVertexIndices2[faceIdx]];
vertexNormal = def.vertexNormals[def.faceIndices2[faceIdx]];
tmp = (y * vertexNormal.y + z * vertexNormal.z + x * vertexNormal.x) / (var7 * vertexNormal.magnitude) + ambient;
litModel.field1854[faceIdx] = bound2to126(tmp);
vertexNormal = def.vertexNormals[def.faceVertexIndices3[faceIdx]];
vertexNormal = def.vertexNormals[def.faceIndices3[faceIdx]];
tmp = (y * vertexNormal.y + z * vertexNormal.z + x * vertexNormal.x) / (var7 * vertexNormal.magnitude) + ambient;
litModel.field1823[faceIdx] = bound2to126(tmp);
@@ -401,15 +401,15 @@ public class ItemSpriteFactory
}
litModel.verticesCount = def.vertexCount;
litModel.verticesX = def.vertexPositionsX;
litModel.verticesY = def.vertexPositionsY;
litModel.verticesZ = def.vertexPositionsZ;
litModel.verticesX = def.vertexX;
litModel.verticesY = def.vertexY;
litModel.verticesZ = def.vertexZ;
litModel.indicesCount = def.faceCount;
litModel.indices1 = def.faceVertexIndices1;
litModel.indices2 = def.faceVertexIndices2;
litModel.indices3 = def.faceVertexIndices3;
litModel.indices1 = def.faceIndices1;
litModel.indices2 = def.faceIndices2;
litModel.indices3 = def.faceIndices3;
litModel.field1838 = def.faceRenderPriorities;
litModel.field1882 = def.faceAlphas;
litModel.field1882 = def.faceTransparencies;
litModel.field1842 = def.priority;
litModel.field1841 = def.faceTextures;
return litModel;
@@ -53,9 +53,9 @@ public class ObjExporter
for (int i = 0; i < model.vertexCount; ++i)
{
objWriter.println("v " + model.vertexPositionsX[i] + " "
+ model.vertexPositionsY[i] * -1 + " "
+ model.vertexPositionsZ[i] * -1);
objWriter.println("v " + model.vertexX[i] + " "
+ model.vertexY[i] * -1 + " "
+ model.vertexZ[i] * -1);
}
if (model.faceTextures != null)
@@ -78,9 +78,9 @@ public class ObjExporter
for (int i = 0; i < model.faceCount; ++i)
{
int x = model.faceVertexIndices1[i] + 1;
int y = model.faceVertexIndices2[i] + 1;
int z = model.faceVertexIndices3[i] + 1;
int x = model.faceIndices1[i] + 1;
int y = model.faceIndices2[i] + 1;
int z = model.faceIndices3[i] + 1;
objWriter.println("usemtl m" + i);
if (model.faceTextures != null)
@@ -129,9 +129,9 @@ public class ObjExporter
int alpha = 0;
if (model.faceAlphas != null)
if (model.faceTransparencies != null)
{
alpha = model.faceAlphas[i] & 0xFF;
alpha = model.faceTransparencies[i] & 0xFF;
}
if (alpha != 0)
@@ -47,6 +47,13 @@ public class CheckCast extends Instruction implements TypeInstruction
super(instructions, InstructionType.CHECKCAST);
}
public CheckCast(Instructions instructions, Type type)
{
super(instructions, InstructionType.CHECKCAST);
this.type = type;
}
public CheckCast(Instructions instructions, InstructionType type)
{
super(instructions, type);
@@ -1,111 +0,0 @@
/*
* Copyright (c) 2017. l2-
* 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.http.api.hiscore;
import java.util.Objects;
public class SingleHiscoreSkillResult
{
private String player;
private String skillName;
private Skill skill;
public String getPlayer()
{
return player;
}
public void setPlayer(String player)
{
this.player = player;
}
public String getSkillName()
{
return skillName;
}
public void setSkillName(String skillName)
{
this.skillName = skillName;
}
public Skill getSkill()
{
return skill;
}
public void setSkill(Skill skill)
{
this.skill = skill;
}
@Override
public int hashCode()
{
int hash = 7;
hash = 37 * hash + Objects.hashCode(this.player);
hash = 37 * hash + Objects.hashCode(this.skillName);
hash = 37 * hash + Objects.hashCode(this.skill);
return hash;
}
@Override
public boolean equals(Object obj)
{
if (this == obj)
{
return true;
}
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final SingleHiscoreSkillResult other = (SingleHiscoreSkillResult) obj;
if (!Objects.equals(this.player, other.player))
{
return false;
}
if (!Objects.equals(this.skillName, other.skillName))
{
return false;
}
if (!Objects.equals(this.skill, other.skill))
{
return false;
}
return true;
}
@Override
public String toString()
{
return "SingleHiscoreSkillResult{" + "player=" + player + ", skillName=" + skillName + ", skill=" + skill + '}';
}
}
@@ -1,75 +0,0 @@
/*
* Copyright (c) 2018, AeonLucid <https://github.com/AeonLucid>
* 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.http.api.osbuddy;
import com.google.gson.JsonParseException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.HttpUrl;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
@Slf4j
@AllArgsConstructor
public class OSBGrandExchangeClient
{
private final OkHttpClient client;
public OSBGrandExchangeResult lookupItem(int itemId) throws IOException
{
final HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
.addPathSegment("osb")
.addPathSegment("ge")
.addQueryParameter("itemId", Integer.toString(itemId))
.build();
log.debug("Built URI: {}", url);
final Request request = new Request.Builder()
.url(url)
.build();
try (final Response response = client.newCall(request).execute())
{
if (!response.isSuccessful())
{
throw new IOException("Error looking up item id: " + response);
}
final InputStream in = response.body().byteStream();
return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in, StandardCharsets.UTF_8), OSBGrandExchangeResult.class);
}
catch (JsonParseException ex)
{
throw new IOException(ex);
}
}
}
@@ -13,6 +13,7 @@ import static com.openosrs.injector.rsapi.RSApi.RL_API_BASE;
import com.openosrs.injector.rsapi.RSApiClass;
import com.openosrs.injector.rsapi.RSApiMethod;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@@ -340,6 +341,11 @@ public interface InjectUtil
}
static Type apiToDeob(InjectData data, Type api)
{
return apiToDeob(data, api, null);
}
static Type apiToDeob(InjectData data, Type api, Type deobType)
{
if (api.isPrimitive())
{
@@ -354,29 +360,43 @@ public interface InjectUtil
else if (internalName.startsWith(RL_API_BASE))
{
Class rlApiC = new Class(internalName);
RSApiClass highestKnown = data.getRsApi().withInterface(rlApiC);
Set<RSApiClass> allClasses = data.getRsApi().withInterface(rlApiC);
// Cheeky unchecked exception
assert highestKnown != null : "No rs api class implements rl api class " + rlApiC.toString();
assert allClasses.size() > 0 : "No rs api class implements rl api class " + rlApiC.toString();
boolean changed;
do
if (allClasses.size() == 1)
{
changed = false;
for (RSApiClass interf : highestKnown.getApiInterfaces())
RSApiClass highestKnown = allClasses.stream().findFirst().get();
boolean changed;
do
{
if (interf.getInterfaces().contains(rlApiC))
changed = false;
for (RSApiClass interf : highestKnown.getApiInterfaces())
{
highestKnown = interf;
changed = true;
break;
if (interf.getInterfaces().contains(rlApiC))
{
highestKnown = interf;
changed = true;
break;
}
}
}
while (changed);
return apiToDeob(data, Type.getType(highestKnown.getName(), api.getDimensions()));
}
else
{
for (RSApiClass rsApiClass : allClasses)
{
if (rsApiClass.getName().contains(deobType.getInternalName()))
{
return apiToDeob(data, Type.getType(rsApiClass.getName(), api.getDimensions()));
}
}
}
while (changed);
return apiToDeob(data, Type.getType(highestKnown.getName(), api.getDimensions()));
}
return api;
@@ -23,7 +23,8 @@ import com.openosrs.injector.injectors.raw.Occluder;
import com.openosrs.injector.injectors.raw.RasterizerAlpha;
import com.openosrs.injector.injectors.raw.RenderDraw;
import com.openosrs.injector.injectors.raw.CopyRuneLiteClasses;
import com.openosrs.injector.injectors.raw.RuneLiteIterableHashTable;
import com.openosrs.injector.injectors.raw.RuneLiteIterables;
import com.openosrs.injector.injectors.raw.RuneliteMenuEntry;
import com.openosrs.injector.injectors.raw.RuneliteObject;
import com.openosrs.injector.injectors.raw.ScriptVM;
import com.openosrs.injector.rsapi.RSApi;
@@ -117,7 +118,7 @@ public class Injector extends InjectData implements InjectTaskHandler
inject(new CopyRuneLiteClasses(this));
inject(new RuneLiteIterableHashTable(this));
inject(new RuneLiteIterables(this));
inject(new RuneliteObject(this));
@@ -150,6 +151,8 @@ public class Injector extends InjectData implements InjectTaskHandler
inject(new AddPlayerToMenu(this));
inject(new RuneliteMenuEntry(this));
validate(new InjectorValidator(this));
transform(new SourceChanger(this));
@@ -131,7 +131,7 @@ public class RSApiInjector extends AbstractInjector
}
else if (sig.size() == 0)
{
Type type = InjectUtil.apiToDeob(inject, sig.getReturnValue());
Type type = InjectUtil.apiToDeob(inject, sig.getReturnValue(), deobType);
if (deobType.equals(type))
{
continue;
@@ -19,6 +19,7 @@ import net.runelite.asm.Type;
import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.Instructions;
import net.runelite.asm.attributes.code.instructions.CheckCast;
import net.runelite.asm.attributes.code.instructions.GetField;
import net.runelite.asm.attributes.code.instructions.GetStatic;
import net.runelite.asm.attributes.code.instructions.InvokeSpecial;
@@ -35,7 +36,10 @@ public class CopyRuneLiteClasses extends AbstractInjector
{
private static final List<String> RUNELITE_OBJECTS = List.of(
"RuneLiteObject",
"RuneLiteIterableHashTable"
"RuneLiteIterableLinkDeque",
"RuneLiteIterableNodeDeque",
"RuneLiteIterableNodeHashTable",
"RuneLiteMenuEntry"
);
public CopyRuneLiteClasses(InjectData inject)
@@ -226,6 +230,11 @@ public class CopyRuneLiteClasses extends AbstractInjector
iterator.set(new New(ins, inject.toVanilla(deobClass)));
}
}
else if (i instanceof CheckCast)
{
CheckCast clazz = ((CheckCast) i);
iterator.set(new CheckCast(ins, getObfuscatedSignature(clazz.getType_())));
}
}
}
}
@@ -1,61 +0,0 @@
/*
* Copyright (c) 2021, Owain van Brakel <https://github.com/Owain94>
* All rights reserved.
*
* This code is licensed under GPL3, see the complete license in
* the LICENSE file in the root directory of this submodule.
*/
package com.openosrs.injector.injectors.raw;
import com.openosrs.injector.injection.InjectData;
import com.openosrs.injector.injectors.AbstractInjector;
import java.util.List;
import net.runelite.asm.ClassFile;
import net.runelite.asm.Method;
import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.InstructionType;
import net.runelite.asm.attributes.code.Instructions;
import net.runelite.asm.attributes.code.instructions.ALoad;
import net.runelite.asm.attributes.code.instructions.Dup;
import net.runelite.asm.attributes.code.instructions.InvokeSpecial;
import net.runelite.asm.attributes.code.instructions.New;
import net.runelite.asm.attributes.code.instructions.Return;
import net.runelite.asm.signature.Signature;
public class RuneLiteIterableHashTable extends AbstractInjector
{
private static final String RUNELITE_ITERABLE_HASHTABLE = "RuneLiteIterableHashTable";
public RuneLiteIterableHashTable(InjectData inject)
{
super(inject);
}
public void inject()
{
ClassFile runeliteIterableHashTableVanilla = inject.vanilla.findClass(RUNELITE_ITERABLE_HASHTABLE);
final ClassFile nodeHashTableVanilla = inject.toVanilla(
inject.getDeobfuscated()
.findClass("NodeHashTable")
);
Method copy = new Method(nodeHashTableVanilla, "iterator", new Signature("()Ljava/util/Iterator;"));
copy.setPublic();
final Code code = new Code(copy);
code.setMaxStack(3);
copy.setCode(code);
nodeHashTableVanilla.addMethod(copy);
final Instructions instructions = code.getInstructions();
final List<Instruction> ins = instructions.getInstructions();
ins.add(new New(instructions, runeliteIterableHashTableVanilla.getPoolClass()));
ins.add(new Dup(instructions));
ins.add(new ALoad(instructions, 0));
ins.add(new InvokeSpecial(instructions, new net.runelite.asm.pool.Method(runeliteIterableHashTableVanilla.getPoolClass(), "<init>", new Signature("(L" + nodeHashTableVanilla.getName() + ";)V"))));
ins.add(new Return(instructions, InstructionType.ARETURN));
}
}
@@ -0,0 +1,124 @@
/*
* Copyright (c) 2021, Owain van Brakel <https://github.com/Owain94>
* All rights reserved.
*
* This code is licensed under GPL3, see the complete license in
* the LICENSE file in the root directory of this submodule.
*/
package com.openosrs.injector.injectors.raw;
import com.openosrs.injector.injection.InjectData;
import com.openosrs.injector.injectors.AbstractInjector;
import java.util.List;
import net.runelite.asm.ClassFile;
import net.runelite.asm.Method;
import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.InstructionType;
import net.runelite.asm.attributes.code.Instructions;
import net.runelite.asm.attributes.code.instructions.ALoad;
import net.runelite.asm.attributes.code.instructions.Dup;
import net.runelite.asm.attributes.code.instructions.InvokeSpecial;
import net.runelite.asm.attributes.code.instructions.New;
import net.runelite.asm.attributes.code.instructions.Return;
import net.runelite.asm.signature.Signature;
public class RuneLiteIterables extends AbstractInjector
{
private static final String RUNELITE_ITERABLE_HASHTABLE = "RuneLiteIterableNodeHashTable";
private static final String RUNELITE_ITERABLE_NODE_DEQUE = "RuneLiteIterableNodeDeque";
private static final String RUNELITE_ITERABLE_LINK_DEQUE = "RuneLiteIterableLinkDeque";
public RuneLiteIterables(InjectData inject)
{
super(inject);
}
public void inject()
{
injectHashTable();
injectNodeDeque();
injectLinkDeque();
}
public void injectHashTable()
{
ClassFile runeliteIterableHashTableVanilla = inject.vanilla.findClass(RUNELITE_ITERABLE_HASHTABLE);
final ClassFile nodeHashTableVanilla = inject.toVanilla(
inject.getDeobfuscated()
.findClass(RUNELITE_ITERABLE_HASHTABLE.replace("RuneLiteIterable", ""))
);
Method copy = new Method(nodeHashTableVanilla, "iterator", new Signature("()Ljava/util/Iterator;"));
copy.setPublic();
final Code code = new Code(copy);
code.setMaxStack(3);
copy.setCode(code);
nodeHashTableVanilla.addMethod(copy);
final Instructions instructions = code.getInstructions();
final List<Instruction> ins = instructions.getInstructions();
ins.add(new New(instructions, runeliteIterableHashTableVanilla.getPoolClass()));
ins.add(new Dup(instructions));
ins.add(new ALoad(instructions, 0));
ins.add(new InvokeSpecial(instructions, new net.runelite.asm.pool.Method(runeliteIterableHashTableVanilla.getPoolClass(), "<init>", new Signature("(L" + nodeHashTableVanilla.getName() + ";)V"))));
ins.add(new Return(instructions, InstructionType.ARETURN));
}
public void injectNodeDeque()
{
ClassFile runeliteIterableNodeDequeVanilla = inject.vanilla.findClass(RUNELITE_ITERABLE_NODE_DEQUE);
final ClassFile nodeDequeVanilla = inject.toVanilla(
inject.getDeobfuscated()
.findClass(RUNELITE_ITERABLE_NODE_DEQUE.replace("RuneLiteIterable", ""))
);
Method copy = new Method(nodeDequeVanilla, "iterator", new Signature("()Ljava/util/Iterator;"));
copy.setPublic();
final Code code = new Code(copy);
code.setMaxStack(3);
copy.setCode(code);
nodeDequeVanilla.addMethod(copy);
final Instructions instructions = code.getInstructions();
final List<Instruction> ins = instructions.getInstructions();
ins.add(new New(instructions, runeliteIterableNodeDequeVanilla.getPoolClass()));
ins.add(new Dup(instructions));
ins.add(new ALoad(instructions, 0));
ins.add(new InvokeSpecial(instructions, new net.runelite.asm.pool.Method(runeliteIterableNodeDequeVanilla.getPoolClass(), "<init>", new Signature("(L" + nodeDequeVanilla.getName() + ";)V"))));
ins.add(new Return(instructions, InstructionType.ARETURN));
}
public void injectLinkDeque()
{
ClassFile runeliteIterableLinkDequeVanilla = inject.vanilla.findClass(RUNELITE_ITERABLE_LINK_DEQUE);
final ClassFile linkDequeVanilla = inject.toVanilla(
inject.getDeobfuscated()
.findClass(RUNELITE_ITERABLE_LINK_DEQUE.replace("RuneLiteIterable", ""))
);
Method copy = new Method(linkDequeVanilla, "iterator", new Signature("()Ljava/util/Iterator;"));
copy.setPublic();
final Code code = new Code(copy);
code.setMaxStack(3);
copy.setCode(code);
linkDequeVanilla.addMethod(copy);
final Instructions instructions = code.getInstructions();
final List<Instruction> ins = instructions.getInstructions();
ins.add(new New(instructions, runeliteIterableLinkDequeVanilla.getPoolClass()));
ins.add(new Dup(instructions));
ins.add(new ALoad(instructions, 0));
ins.add(new InvokeSpecial(instructions, new net.runelite.asm.pool.Method(runeliteIterableLinkDequeVanilla.getPoolClass(), "<init>", new Signature("(L" + linkDequeVanilla.getName() + ";)V"))));
ins.add(new Return(instructions, InstructionType.ARETURN));
}
}
@@ -0,0 +1,99 @@
/*
* Copyright (c) 2021, Owain van Brakel <https://github.com/Owain94>
* All rights reserved.
*
* This code is licensed under GPL3, see the complete license in
* the LICENSE file in the root directory of this submodule.
*/
package com.openosrs.injector.injectors.raw;
import com.openosrs.injector.InjectUtil;
import com.openosrs.injector.injection.InjectData;
import com.openosrs.injector.injectors.AbstractInjector;
import java.util.List;
import java.util.ListIterator;
import net.runelite.asm.ClassFile;
import net.runelite.asm.Method;
import net.runelite.asm.attributes.Code;
import net.runelite.asm.attributes.code.Instruction;
import net.runelite.asm.attributes.code.InstructionType;
import net.runelite.asm.attributes.code.Instructions;
import net.runelite.asm.attributes.code.instructions.BAStore;
import net.runelite.asm.attributes.code.instructions.Dup;
import net.runelite.asm.attributes.code.instructions.ILoad;
import net.runelite.asm.attributes.code.instructions.InvokeSpecial;
import net.runelite.asm.attributes.code.instructions.InvokeStatic;
import net.runelite.asm.attributes.code.instructions.New;
import net.runelite.asm.attributes.code.instructions.Return;
import net.runelite.asm.signature.Signature;
public class RuneliteMenuEntry extends AbstractInjector
{
private static final String RUNELITE_MENU_ENTRY = "RuneLiteMenuEntry";
public RuneliteMenuEntry(InjectData inject)
{
super(inject);
}
public void inject()
{
addInvoke();
addSwap(InjectUtil.findMethod(inject, "incrementMenuEntries"));
addSwap(InjectUtil.findMethod(inject, "decrementMenuEntries"));
}
private void addInvoke()
{
ClassFile runeliteMenuEntryVanilla = inject.vanilla.findClass(RUNELITE_MENU_ENTRY);
final ClassFile clientVanilla = inject.toVanilla(
inject.getDeobfuscated()
.findClass("Client")
);
Method copy = clientVanilla.findMethod("newRuneliteMenuEntry");
copy.setPublic();
final Code code = new Code(copy);
code.setMaxStack(3);
copy.setCode(code);
final Instructions instructions = code.getInstructions();
final List<Instruction> ins = instructions.getInstructions();
ins.add(new New(instructions, runeliteMenuEntryVanilla.getPoolClass()));
ins.add(new Dup(instructions));
ins.add(new ILoad(instructions, 0));
ins.add(new InvokeSpecial(instructions, new net.runelite.asm.pool.Method(runeliteMenuEntryVanilla.getPoolClass(), "<init>", new Signature("(I)V"))));
ins.add(new Return(instructions, InstructionType.ARETURN));
}
private void addSwap(Method method)
{
final ClassFile clientVanilla = inject.toVanilla(
inject.getDeobfuscated()
.findClass("Client")
);
Instructions ins = method.getCode().getInstructions();
ListIterator<Instruction> iterator = ins.getInstructions().listIterator();
while (iterator.hasNext())
{
Instruction i = iterator.next();
if (!(i instanceof BAStore))
{
continue;
}
ILoad i1 = new ILoad(ins, 2);
InvokeStatic i2 = new InvokeStatic(ins, new net.runelite.asm.pool.Method(clientVanilla.getPoolClass(), "swapMenuEntries", new Signature("(I)V")));
iterator.add(i1);
iterator.add(i2);
return;
}
}
}
@@ -15,8 +15,10 @@ import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import lombok.Getter;
import lombok.NoArgsConstructor;
import net.runelite.asm.Type;
@@ -111,23 +113,19 @@ public class RSApi implements Iterable<RSApiClass>
return findClass(name) != null;
}
public RSApiClass withInterface(Class interf)
public Set<RSApiClass> withInterface(Class interf)
{
RSApiClass clazz = findClass(interf.getName());
if (clazz != null)
{
return clazz;
}
Set<RSApiClass> classes = new HashSet<>();
for (RSApiClass apiC : this)
{
if (apiC.getInterfaces().contains(interf))
{
return apiC;
classes.add(apiC);
}
}
return null;
return classes;
}
@NotNull
@@ -636,6 +636,13 @@ public interface Client extends GameEngine
*/
World[] getWorldList();
/**
* Create a new menu entry
* @param idx the index to create the menu entry at. Accepts negative indexes eg. -1 inserts at the end.
* @return the newly created menu entry
*/
MenuEntry createMenuEntry(int idx);
/**
* Gets an array of currently open right-click menu entries that can be
* clicked and activated.
@@ -1133,7 +1140,7 @@ public interface Client extends GameEngine
* @param id the ID of the animation. Any int is allowed, but implementations in the client
* should be defined in {@link AnimationID}
*/
Sequence loadAnimation(int id);
Animation loadAnimation(int id);
/**
* Gets the music volume
@@ -1341,7 +1348,7 @@ public interface Client extends GameEngine
/**
* Retrieve the nameable container containing friends
*/
NameableContainer<Friend> getFriendContainer();
FriendContainer getFriendContainer();
/**
* Retrieve the nameable container containing ignores
@@ -2117,24 +2124,6 @@ public interface Client extends GameEngine
*/
void scaleSprite(int[] canvas, int[] pixels, int color, int pixelX, int pixelY, int canvasIdx, int canvasOffset, int newWidth, int newHeight, int pixelWidth, int pixelHeight, int oldWidth);
/**
* Get the MenuEntry at client.getMenuOptionCount() - 1
* <p>
* This is useful so you don't have to use getMenuEntries,
* which will create a big array, when you only want to change
* the left click one.
*/
MenuEntry getLeftClickMenuEntry();
/**
* Set the MenuEntry at client.getMenuOptionCount() - 1
* <p>
* This is useful so you don't have to use setMenuEntries,
* which will arraycopy a big array to several smaller arrays lol,
* when you only want to change the left click one.
*/
void setLeftClickMenuEntry(MenuEntry entry);
/**
* If this field is set to true, getting 5 minute logged won't show
* the "You have been disconnected." message anymore.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, AeonLucid <https://github.com/AeonLucid>
* Copyright (c) 2021, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,17 +22,16 @@
* (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.http.api.osbuddy;
package net.runelite.api;
import java.time.Instant;
import lombok.Data;
@Data
public class OSBGrandExchangeResult
/**
* A nameable container of friends
*/
public interface FriendContainer extends NameableContainer<Friend>
{
private int item_id;
private int buy_average;
private int sell_average;
private int overall_average;
private Instant last_update;
/**
* Get the recent logins/logouts of friends from the last few seconds
* @return
*/
Deque<PendingLogin> getPendingLogins();
}
@@ -12206,11 +12206,11 @@ public final class ItemID
public static final int NIHIL_SHARD = 26231;
public static final int ANCIENT_GODSWORD = 26233;
public static final int ZARYTE_VAMBRACES = 26235;
public static final int ZARYTE_BOW_UNCHARGED = 26237;
public static final int ZARYTE_BOW = 26239;
public static final int ZARYTE_BOW = 26237;
public static final int ZARYTE_BOW_26239 = 26239;
public static final int VIRTUS_MASK = 26241;
public static final int VIRTUS_ROBE_TOP = 26243;
public static final int VIRTUS_ROBE_LEGS = 26245;
public static final int VIRTUS_ROBE_BOTTOMS = 26245;
public static final int PUMPKIN_PIE = 26247;
public static final int JEREDS_EMPTY_WINE_BOTTLE = 26250;
public static final int AD_COUPON = 26252;
@@ -12222,5 +12222,67 @@ public final class ItemID
public static final int STUDDED_BODY_26264 = 26264;
public static final int CONDENSED_GOLD = 26266;
public static final int GOLD_SINK = 26269;
public static final int FESTIVE_CINNAMON = 26270;
public static final int FESTIVE_HOLLY = 26272;
public static final int FESTIVE_WHITE_WINE = 26274;
public static final int NOTES_26276 = 26276;
public static final int MAGICAL_CLEANING_POTION = 26278;
public static final int PINK_STAINED_PLATEBODY = 26280;
public static final int PINK_STAINED_PLATELEGS = 26282;
public static final int PINK_STAINED_FULL_HELM = 26284;
public static final int CLEAN_PLATEBODY = 26286;
public static final int CLEAN_PLATELEGS = 26288;
public static final int CLEAN_FULL_HELM = 26290;
public static final int FESTIVE_GINGERBREAD_GNOMES = 26292;
public static final int FESTIVE_MULLED_WINE = 26294;
public static final int SNOW = 26296;
public static final int SECRET_SANTA_PRESENT = 26298;
public static final int SECRET_SANTA_PRESENT_26300 = 26300;
public static final int SECRET_SANTA_PRESENT_26302 = 26302;
public static final int CHOCOLATE_CHIPS = 26304;
public static final int CHOCOLATE_CHIPS_26306 = 26306;
public static final int A_BIG_PRESENT = 26308;
public static final int FESTIVE_ELF_SLIPPERS = 26310;
public static final int FESTIVE_ELF_HAT = 26312;
public static final int SNOWMAN_RING = 26314;
public static final int SECRET_SANTA_PRESENT_RED = 26316;
public static final int SECRET_SANTA_PRESENT_BLUE = 26318;
public static final int SECRET_SANTA_PRESENT_GREEN = 26320;
public static final int SECRET_SANTA_PRESENT_BLACK = 26322;
public static final int SECRET_SANTA_PRESENT_GOLD = 26324;
public static final int LITTLE_SNOWBALL = 26326;
public static final int SMALL_SNOWBALL = 26328;
public static final int NORMAL_SNOWBALL = 26330;
public static final int BIG_SNOWBALL = 26332;
public static final int LARGE_SNOWBALL = 26334;
public static final int HUGE_SNOWBALL = 26336;
public static final int HUMONGOUS_SNOWBALL = 26338;
public static final int ANCIENT_BREW4 = 26340;
public static final int ANCIENT_BREW3 = 26342;
public static final int ANCIENT_BREW2 = 26344;
public static final int ANCIENT_BREW1 = 26346;
public static final int NEXLING = 26348;
public static final int ANCIENT_MIX2 = 26350;
public static final int ANCIENT_MIX1 = 26353;
public static final int FROZEN_KEY_26356 = 26356;
public static final int FROZEN_KEY_PIECE_ARMADYL = 26358;
public static final int FROZEN_KEY_PIECE_BANDOS = 26360;
public static final int FROZEN_KEY_PIECE_ZAMORAK = 26362;
public static final int FROZEN_KEY_PIECE_SARADOMIN = 26364;
public static final int IMPORTANT_LETTER = 26366;
public static final int NIHIL_DUST = 26368;
public static final int ANCIENT_HILT = 26370;
public static final int NIHIL_HORN = 26372;
public static final int ZARYTE_CROSSBOW = 26374;
public static final int TORVA_FULL_HELM_DAMAGED = 26376;
public static final int TORVA_PLATEBODY_DAMAGED = 26378;
public static final int TORVA_PLATELEGS_DAMAGED = 26380;
public static final int TORVA_FULL_HELM = 26382;
public static final int TORVA_PLATEBODY = 26384;
public static final int TORVA_PLATELEGS = 26386;
public static final int ECUMENICAL_KEY_SHARD = 26388;
public static final int BLOOD_ESSENCE = 26390;
public static final int BLOOD_ESSENCE_ACTIVE = 26392;
public static final int BANDOSIAN_COMPONENTS = 26394;
/* This file is automatically generated. Do not edit. */
}
@@ -24,141 +24,90 @@
*/
package net.runelite.api;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.function.Consumer;
/**
* A menu entry in a right-click menu.
*/
@Data
@NoArgsConstructor
public class MenuEntry implements Cloneable
public interface MenuEntry
{
/**
* The option text added to the menu. (ie. "Walk here", "Use")
*/
private String option;
String getOption();
MenuEntry setOption(String option);
/**
* The target of the action. (ie. Item or Actor name)
* <p>
* If the option does not apply to any target, this field
* will be set to empty string.
*/
private String target;
String getTarget();
MenuEntry setTarget(String target);
/**
* An identifier value for the target of the action.
*/
private int identifier;
int getIdentifier();
MenuEntry setIdentifier(int identifier);
/**
* The action the entry will trigger.
* {@link MenuAction}
*/
private int opcode;
MenuAction getType();
MenuEntry setType(MenuAction type);
/**
* An additional parameter for the action.
*/
private int param0;
int getParam0();
MenuEntry setParam0(int param0);
/**
* A second additional parameter for the action.
*/
private int param1;
int getParam1();
MenuEntry setParam1(int param1);
/**
* If this field is true and you have single mouse button on and this entry is
* If this is true and you have single mouse button on and this entry is
* the top entry the right click menu will not be opened when you left click
*
* This is used for shift click
*/
private boolean forceLeftClick;
public MenuEntry(String option, String target, int type, int opcode, int param0, int param1, boolean forceLeftClick)
{
this.option = option;
this.target = target;
this.identifier = type;
this.opcode = opcode;
this.param0 = param0;
this.param1 = param1;
this.forceLeftClick = forceLeftClick;
}
@Override
public MenuEntry clone()
{
try
{
return (MenuEntry) super.clone();
}
catch (CloneNotSupportedException ex)
{
throw new RuntimeException(ex);
}
}
public void setActionParam0(int i)
{
this.param0 = i;
}
public int getActionParam0()
{
return this.param0;
}
public int getParam0()
{
return this.param0;
}
public void setParam0(int i)
{
this.param0 = i;
}
public void setParam1(int i)
{
this.param1 = i;
}
public int getParam1()
{
return this.param1;
}
public void setActionParam1(int i)
{
this.param1 = i;
}
public int getActionParam1()
{
return this.param1;
}
public void setType(int i)
{
this.opcode = i;
}
public int getType()
{
return this.opcode;
}
public void setId(int i)
{
this.identifier = i;
}
public int getId()
{
return this.identifier;
}
boolean isForceLeftClick();
MenuEntry setForceLeftClick(boolean forceLeftClick);
/**
* Get opcode, but as it's enum counterpart
* Deprioritized menus are sorted in the menu to be below the other menu entries.
* @return
*/
public MenuAction getMenuAction()
{
return MenuAction.of(getOpcode());
}
}
boolean isDeprioritized();
MenuEntry setDeprioritized(boolean deprioritized);
/**
* Set a callback to be called when this menu option is clicked
* @param callback
* @return
*/
MenuEntry onClick(Consumer<MenuEntry> callback);
@Deprecated
int getOpcode();
@Deprecated
void setOpcode(int opcode);
@Deprecated
int getActionParam0();
@Deprecated
void setActionParam0(int param0);
@Deprecated
int getActionParam1();
@Deprecated
void setActionParam1(int param0);
@Deprecated
MenuAction getMenuAction();
}
@@ -55,13 +55,13 @@ public interface Model extends Renderable
int[] getVerticesZ();
int getTrianglesCount();
int getFaceCount();
int[] getTrianglesX();
int[] getFaceIndices1();
int[] getTrianglesY();
int[] getFaceIndices2();
int[] getTrianglesZ();
int[] getFaceIndices3();
int[] getFaceColors1();
@@ -69,7 +69,7 @@ public interface Model extends Renderable
int[] getFaceColors3();
byte[] getTriangleTransparencies();
byte[] getFaceTransparencies();
int getSceneId();
void setSceneId(int sceneId);
@@ -109,4 +109,9 @@ public interface Model extends Renderable
int[] getVertexNormalsX();
int[] getVertexNormalsY();
int[] getVertexNormalsZ();
byte getOverrideAmount();
byte getOverrideHue();
byte getOverrideSaturation();
byte getOverrideLuminance();
}
@@ -9477,5 +9477,49 @@ public final class NpcID
public static final int REGENT = 11229;
public static final int GROUP_STORAGE_TUTOR = 11230;
public static final int GROUP_IRON_TUTOR = 11231;
public static final int TINY_SNOWBALL = 11232;
public static final int MINI_SNOWBALL = 11233;
public static final int LITTLE_SNOWBALL = 11234;
public static final int SMALL_SNOWBALL = 11235;
public static final int NORMAL_SNOWBALL = 11236;
public static final int BIG_SNOWBALL = 11237;
public static final int LARGE_SNOWBALL = 11238;
public static final int HUGE_SNOWBALL = 11239;
public static final int HUMONGOUS_SNOWBALL = 11240;
public static final int BUOY = 11241;
public static final int GURL = 11242;
public static final int BUOY_11243 = 11243;
public static final int GURL_11244 = 11244;
public static final int HERQUIN_11245 = 11245;
public static final int CECILIA_11247 = 11247;
public static final int LARRY_11248 = 11248;
public static final int SANTAS_THRONE = 11249;
public static final int SANTA = 11250;
public static final int WAYNE_11251 = 11251;
public static final int WYSON_THE_GARDENER_11252 = 11252;
public static final int HAIRDRESSER_11254 = 11254;
public static final int SIR_VYVIN_11255 = 11255;
public static final int XI_PLZPETDOGZ_XIX = 11259;
public static final int DRAKE_11260 = 11260;
public static final int DUCK_11261 = 11261;
public static final int NEXLING = 11276;
public static final int NEXLING_11277 = 11277;
public static final int NEX = 11278;
public static final int NEX_11279 = 11279;
public static final int NEX_11280 = 11280;
public static final int NEX_11281 = 11281;
public static final int NEX_11282 = 11282;
public static final int FUMUS = 11283;
public static final int UMBRA = 11284;
public static final int CRUOR = 11285;
public static final int GLACIES = 11286;
public static final int MESSENGER = 11287;
public static final int ASHUELOT_REIS = 11288;
public static final int ASHUELOT_REIS_11289 = 11289;
public static final int SPIRITUAL_WARRIOR_11290 = 11290;
public static final int SPIRITUAL_RANGER_11291 = 11291;
public static final int SPIRITUAL_MAGE_11292 = 11292;
public static final int BLOOD_REAVER = 11293;
public static final int BLOOD_REAVER_11294 = 11294;
/* This file is automatically generated. Do not edit. */
}
@@ -13837,5 +13837,69 @@ public final class NullItemID
public static final int NULL_26265 = 26265;
public static final int NULL_26267 = 26267;
public static final int NULL_26268 = 26268;
public static final int NULL_26271 = 26271;
public static final int NULL_26273 = 26273;
public static final int NULL_26275 = 26275;
public static final int NULL_26277 = 26277;
public static final int NULL_26279 = 26279;
public static final int NULL_26281 = 26281;
public static final int NULL_26283 = 26283;
public static final int NULL_26285 = 26285;
public static final int NULL_26287 = 26287;
public static final int NULL_26289 = 26289;
public static final int NULL_26291 = 26291;
public static final int NULL_26293 = 26293;
public static final int NULL_26295 = 26295;
public static final int NULL_26297 = 26297;
public static final int NULL_26299 = 26299;
public static final int NULL_26301 = 26301;
public static final int NULL_26303 = 26303;
public static final int NULL_26305 = 26305;
public static final int NULL_26307 = 26307;
public static final int NULL_26309 = 26309;
public static final int NULL_26311 = 26311;
public static final int NULL_26313 = 26313;
public static final int NULL_26315 = 26315;
public static final int NULL_26317 = 26317;
public static final int NULL_26319 = 26319;
public static final int NULL_26321 = 26321;
public static final int NULL_26323 = 26323;
public static final int NULL_26325 = 26325;
public static final int NULL_26327 = 26327;
public static final int NULL_26329 = 26329;
public static final int NULL_26331 = 26331;
public static final int NULL_26333 = 26333;
public static final int NULL_26335 = 26335;
public static final int NULL_26337 = 26337;
public static final int NULL_26339 = 26339;
public static final int NULL_26341 = 26341;
public static final int NULL_26343 = 26343;
public static final int NULL_26345 = 26345;
public static final int NULL_26347 = 26347;
public static final int NULL_26349 = 26349;
public static final int NULL_26351 = 26351;
public static final int NULL_26352 = 26352;
public static final int NULL_26354 = 26354;
public static final int NULL_26355 = 26355;
public static final int NULL_26357 = 26357;
public static final int NULL_26359 = 26359;
public static final int NULL_26361 = 26361;
public static final int NULL_26363 = 26363;
public static final int NULL_26365 = 26365;
public static final int NULL_26367 = 26367;
public static final int NULL_26369 = 26369;
public static final int NULL_26371 = 26371;
public static final int NULL_26373 = 26373;
public static final int NULL_26375 = 26375;
public static final int NULL_26377 = 26377;
public static final int NULL_26379 = 26379;
public static final int NULL_26381 = 26381;
public static final int NULL_26383 = 26383;
public static final int NULL_26385 = 26385;
public static final int NULL_26387 = 26387;
public static final int NULL_26389 = 26389;
public static final int NULL_26391 = 26391;
public static final int NULL_26393 = 26393;
public static final int NULL_26395 = 26395;
/* This file is automatically generated. Do not edit. */
}
@@ -1738,6 +1738,26 @@ public final class NullNpcID
public static final int NULL_11222 = 11222;
public static final int NULL_11223 = 11223;
public static final int NULL_11224 = 11224;
public static final int NULL_11246 = 11246;
public static final int NULL_11253 = 11253;
public static final int NULL_11256 = 11256;
public static final int NULL_11257 = 11257;
public static final int NULL_11258 = 11258;
public static final int NULL_11262 = 11262;
public static final int NULL_11263 = 11263;
public static final int NULL_11264 = 11264;
public static final int NULL_11265 = 11265;
public static final int NULL_11266 = 11266;
public static final int NULL_11267 = 11267;
public static final int NULL_11268 = 11268;
public static final int NULL_11269 = 11269;
public static final int NULL_11270 = 11270;
public static final int NULL_11271 = 11271;
public static final int NULL_11272 = 11272;
public static final int NULL_11273 = 11273;
public static final int NULL_11274 = 11274;
public static final int NULL_11275 = 11275;
public static final int NULL_11295 = 11295;
public static final int NULL_11296 = 11296;
/* This file is automatically generated. Do not edit. */
}
@@ -21006,5 +21006,67 @@ public final class NullObjectID
public static final int NULL_42849 = 42849;
public static final int NULL_42850 = 42850;
public static final int NULL_42851 = 42851;
public static final int NULL_42873 = 42873;
public static final int NULL_42874 = 42874;
public static final int NULL_42875 = 42875;
public static final int NULL_42876 = 42876;
public static final int NULL_42877 = 42877;
public static final int NULL_42882 = 42882;
public static final int NULL_42883 = 42883;
public static final int NULL_42884 = 42884;
public static final int NULL_42893 = 42893;
public static final int NULL_42894 = 42894;
public static final int NULL_42896 = 42896;
public static final int NULL_42897 = 42897;
public static final int NULL_42898 = 42898;
public static final int NULL_42899 = 42899;
public static final int NULL_42900 = 42900;
public static final int NULL_42901 = 42901;
public static final int NULL_42902 = 42902;
public static final int NULL_42903 = 42903;
public static final int NULL_42904 = 42904;
public static final int NULL_42905 = 42905;
public static final int NULL_42906 = 42906;
public static final int NULL_42909 = 42909;
public static final int NULL_42910 = 42910;
public static final int NULL_42911 = 42911;
public static final int NULL_42912 = 42912;
public static final int NULL_42913 = 42913;
public static final int NULL_42914 = 42914;
public static final int NULL_42915 = 42915;
public static final int NULL_42916 = 42916;
public static final int NULL_42917 = 42917;
public static final int NULL_42918 = 42918;
public static final int NULL_42919 = 42919;
public static final int NULL_42920 = 42920;
public static final int NULL_42921 = 42921;
public static final int NULL_42922 = 42922;
public static final int NULL_42923 = 42923;
public static final int NULL_42924 = 42924;
public static final int NULL_42925 = 42925;
public static final int NULL_42926 = 42926;
public static final int NULL_42927 = 42927;
public static final int NULL_42945 = 42945;
public static final int NULL_42946 = 42946;
public static final int NULL_42947 = 42947;
public static final int NULL_42948 = 42948;
public static final int NULL_42949 = 42949;
public static final int NULL_42950 = 42950;
public static final int NULL_42951 = 42951;
public static final int NULL_42952 = 42952;
public static final int NULL_42953 = 42953;
public static final int NULL_42954 = 42954;
public static final int NULL_42955 = 42955;
public static final int NULL_42956 = 42956;
public static final int NULL_42957 = 42957;
public static final int NULL_42958 = 42958;
public static final int NULL_42959 = 42959;
public static final int NULL_42960 = 42960;
public static final int NULL_42961 = 42961;
public static final int NULL_42962 = 42962;
public static final int NULL_42963 = 42963;
public static final int NULL_42964 = 42964;
public static final int NULL_42967 = 42967;
public static final int NULL_42968 = 42968;
/* This file is automatically generated. Do not edit. */
}
@@ -21832,5 +21832,60 @@ public final class ObjectID
public static final int FROZEN_DOOR = 42840;
public static final int FROZEN_DOOR_42841 = 42841;
public static final int GOLD_SINK_42852 = 42852;
public static final int SIGN_42853 = 42853;
public static final int SCUFFED_SNOW = 42854;
public static final int SNOWMAN = 42855;
public static final int SNOWMAN_42856 = 42856;
public static final int SNOWMAN_42857 = 42857;
public static final int SNOWMAN_42858 = 42858;
public static final int SNOWMAN_42859 = 42859;
public static final int SNOWMAN_42860 = 42860;
public static final int SNOWMAN_42861 = 42861;
public static final int SNOWMAN_42862 = 42862;
public static final int SNOWMAN_42863 = 42863;
public static final int SNOWMAN_42864 = 42864;
public static final int SPADE_42865 = 42865;
public static final int PILE_OF_SNOW = 42866;
public static final int BUSH_42867 = 42867;
public static final int PILE_OF_SNOW_42868 = 42868;
public static final int PILE_OF_SNOW_42869 = 42869;
public static final int CHRISTMAS_TREE = 42870;
public static final int CHRISTMAS_TREE_42871 = 42871;
public static final int CHRISTMAS_TREE_42872 = 42872;
public static final int PRESENTS = 42878;
public static final int PRESENTS_42879 = 42879;
public static final int PRESENTS_42880 = 42880;
public static final int PRESENTS_42881 = 42881;
public static final int POTTED_TREE = 42885;
public static final int POTTED_TREE_42886 = 42886;
public static final int MARKET_STALL_42887 = 42887;
public static final int MARKET_STALL_42888 = 42888;
public static final int MARKET_STALL_42889 = 42889;
public static final int MARKET_STALL_42890 = 42890;
public static final int MARKET_STALL_42891 = 42891;
public static final int MARKET_STALL_42892 = 42892;
public static final int ROBIN = 42895;
public static final int DEAD_TREE_42907 = 42907;
public static final int DEAD_OAK_42908 = 42908;
public static final int SANTAS_SLEIGH = 42928;
public static final int SANTAS_THRONE = 42929;
public static final int SANTAS_SACK = 42930;
public static final int FROZEN_DOOR_42931 = 42931;
public static final int FROZEN_DOOR_42932 = 42932;
public static final int DOOR_42933 = 42933;
public static final int DOOR_42934 = 42934;
public static final int ANCIENT_PLAQUE = 42935;
public static final int SCOREBOARD_42936 = 42936;
public static final int ANCIENT_BARRIER = 42937;
public static final int ANCIENT_BARRIER_42938 = 42938;
public static final int ANCIENT_BARRIER_42939 = 42939;
public static final int ANCIENT_BARRIER_42940 = 42940;
public static final int ANCIENT_BARRIER_42941 = 42941;
public static final int SHADOW = 42942;
public static final int STALAGMITE_42943 = 42943;
public static final int STALAGMITE_42944 = 42944;
public static final int ALTAR_42965 = 42965;
public static final int ANCIENT_FORGE = 42966;
public static final int BROKEN_CROSSBOW_42969 = 42969;
/* This file is automatically generated. Do not edit. */
}
@@ -0,0 +1,45 @@
/*
* Copyright (c) 2021, Adam <Adam@sigterm.info>
* 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.api;
/**
* A pending friend login/out. This is used to suppress world hop notifications
* by buffering the pending logins to try to match a pending logout with a pending
* login and cancel both.
*/
public interface PendingLogin
{
/**
* The name of the player
* @return
*/
String getName();
/**
* The world the player logged into, or 0 if a logout.
* @return
*/
short getWorld();
}
@@ -782,9 +782,9 @@ public class Perspective
final int radius = 5;
int[][] tris = new int[][]{
m.getTrianglesX(),
m.getTrianglesY(),
m.getTrianglesZ()
m.getFaceIndices1(),
m.getFaceIndices2(),
m.getFaceIndices3()
};
int vpX1 = client.getViewportXOffset();
@@ -792,10 +792,10 @@ public class Perspective
int vpX2 = vpX1 + client.getViewportWidth();
int vpY2 = vpY1 + client.getViewportHeight();
List<RectangleUnion.Rectangle> rects = new ArrayList<>(m.getTrianglesCount());
List<RectangleUnion.Rectangle> rects = new ArrayList<>(m.getFaceCount());
nextTri:
for (int tri = 0; tri < m.getTrianglesCount(); tri++)
for (int tri = 0; tri < m.getFaceCount(); tri++)
{
if (faceColors3[tri] == -2)
{
@@ -198,7 +198,9 @@ public enum Quest
FAMILY_PEST(329, "Family Pest"),
MAGE_ARENA_II(330, "Mage Arena II"),
IN_SEARCH_OF_KNOWLEDGE(3143, "In Search of Knowledge"),
DADDYS_HOME(1688, "Daddy's Home");
DADDYS_HOME(1688, "Daddy's Home"),
THE_FROZEN_DOOR(3768, "The Frozen Door"),
;
@Getter
private final int id;
@@ -41,7 +41,7 @@ public interface RuneLiteObject extends GraphicsObject
* Sets the animation of the RuneLiteObject
* If animation is null model will be static
*/
void setAnimation(Sequence animation);
void setAnimation(Animation animation);
/**
* Sets whether the animation of the RuneLiteObject should loop when the animation ends.
@@ -257,6 +257,12 @@ public final class ScriptID
@ScriptArguments(integer = 15)
public static final int FRIENDS_CHAT_CHANNEL_REBUILD = 1658;
/**
* Builds the widget that holds all of the players inside a clan chat
*/
@ScriptArguments(integer = 7)
public static final int CLAN_SIDEPANEL_DRAW = 4396;
/**
* Builds the widget for making an offer in Grand Exchange
*/
@@ -31,7 +31,7 @@ public class ClientTick
{
public static final ClientTick INSTANCE = new ClientTick();
private ClientTick()
public ClientTick()
{
// noop
}
@@ -25,24 +25,59 @@
package net.runelite.api.events;
import lombok.Getter;
import net.runelite.api.MenuEntry;
import lombok.Setter;
import net.runelite.api.MenuAction;
/**
* An event when a new entry is added to a right-click menu.
*/
public class MenuEntryAdded extends MenuEntry
public class MenuEntryAdded
{
// Here for RuneLite compatibility (different parameter order)
public MenuEntryAdded(String option, String target, int type, int identifier, int actionParam0, int actionParam1)
{
super(option, target, identifier, type, actionParam0, actionParam1, false);
this(option, target, identifier, type, actionParam0, actionParam1, false);
}
public MenuEntryAdded(String option, String target, int identifier, int opcode, int param0, int param1, boolean forceLeftClick)
public MenuEntryAdded(String option, String target, int identifier, int type, int param0, int param1, boolean forceLeftClick)
{
super(option, target, identifier, opcode, param0, param1, forceLeftClick);
this.option = option;
this.target = target;
this.identifier = identifier;
this.type = type;
this.actionParam0 = param0;
this.actionParam1 = param1;
this.forceLeftClick = forceLeftClick;
}
@Getter
@Setter
private String option;
@Getter
@Setter
private String target;
@Getter
@Setter
private int type;
@Getter
@Setter
private int identifier;
@Getter
@Setter
private int actionParam0;
@Getter
@Setter
private int actionParam1;
@Getter
@Setter
private boolean forceLeftClick;
/**
* If this is set to true client mixin will update
* the menu entry with the modified values.
@@ -51,10 +86,52 @@ public class MenuEntryAdded extends MenuEntry
* been multiple changes
*/
@Getter
@Setter
private boolean modified;
public void setModified()
{
this.modified = true;
}
@Deprecated
public int getParam0()
{
return actionParam0;
}
@Deprecated
public void setParam0(int param)
{
actionParam0 = param;
}
@Deprecated
public int getParam1()
{
return actionParam1;
}
@Deprecated
public void setParam1(int param)
{
actionParam1 = param;
}
@Deprecated
public int getOpcode()
{
return type;
}
@Deprecated
public void setOpcode(int opcode)
{
type = opcode;
}
@Deprecated
public MenuAction getMenuAction()
{
return MenuAction.of(type);
}
}
@@ -91,8 +91,8 @@ public class MenuOptionClicked
{
this.setMenuOption(entry.getOption());
this.setMenuTarget(entry.getTarget());
this.setId(entry.getId());
this.setMenuAction(MenuAction.of(entry.getOpcode()));
this.setId(entry.getIdentifier());
this.setMenuAction(entry.getType());
this.setParam0(entry.getParam0());
this.setParam1(entry.getParam1());
}
@@ -32,6 +32,7 @@ import net.runelite.api.widgets.WidgetInfo;
* A MenuManager widget menu was clicked. This event is fired only for MenuManager managed custom menus.
*/
@Data
@Deprecated
public class WidgetMenuOptionClicked
{
/**
@@ -51,4 +52,4 @@ public class WidgetMenuOptionClicked
* The widget id of the widget that was clicked.
*/
private int widgetId;
}
}
@@ -185,6 +185,7 @@ public final class WidgetID
public static final int GRAVESTONE_GROUP_ID = 672;
public static final int POH_TREASURE_CHEST_INVENTORY_GROUP_ID = 674;
public static final int GROUP_IRON_GROUP_ID = 726;
public static final int GROUP_STORAGE_GROUP_ID = 724;
static class WorldMap
{
@@ -308,6 +309,11 @@ public final class WidgetID
static final int EQUIPMENT_BUTTON = 113;
}
static class GroupStorage
{
static final int ITEM_CONTAINER = 10;
}
static class GrandExchange
{
static final int WINDOW_CONTAINER = 0;
@@ -1352,11 +1358,15 @@ public final class WidgetID
static class Clan
{
static final int LAYER = 0;
static final int HEADER = 1;
static final int MEMBERS = 6;
}
static class ClanGuest
{
static final int LAYER = 0;
static final int HEADER = 1;
static final int MEMBERS = 6;
}
}
@@ -153,6 +153,8 @@ public enum WidgetInfo
BANK_SETTINGS_BUTTON(WidgetID.BANK_GROUP_ID, WidgetID.Bank.SETTINGS_BUTTON),
BANK_TUTORIAL_BUTTON(WidgetID.BANK_GROUP_ID, WidgetID.Bank.TUTORIAL_BUTTON),
GROUP_STORAGE_ITEM_CONTAINER(WidgetID.GROUP_STORAGE_GROUP_ID, WidgetID.GroupStorage.ITEM_CONTAINER),
GRAND_EXCHANGE_WINDOW_CONTAINER(WidgetID.GRAND_EXCHANGE_GROUP_ID, WidgetID.GrandExchange.WINDOW_CONTAINER),
GRAND_EXCHANGE_OFFER_CONTAINER(WidgetID.GRAND_EXCHANGE_GROUP_ID, WidgetID.GrandExchange.OFFER_CONTAINER),
GRAND_EXCHANGE_OFFER_TEXT(WidgetID.GRAND_EXCHANGE_GROUP_ID, WidgetID.GrandExchange.OFFER_DESCRIPTION),
@@ -554,7 +556,12 @@ public enum WidgetInfo
TEMPOROSS_STATUS_INDICATOR(WidgetID.TEMPOROSS_GROUP_ID, WidgetID.TemporossStatus.STATUS_INDICATOR),
CLAN_LAYER(WidgetID.CLAN_GROUP_ID, WidgetID.Clan.LAYER),
CLAN_HEADER(WidgetID.CLAN_GROUP_ID, WidgetID.Clan.HEADER),
CLAN_MEMBER_LIST(WidgetID.CLAN_GROUP_ID, WidgetID.Clan.MEMBERS),
CLAN_GUEST_LAYER(WidgetID.CLAN_GUEST_GROUP_ID, WidgetID.ClanGuest.LAYER),
CLAN_GUEST_HEADER(WidgetID.CLAN_GUEST_GROUP_ID, WidgetID.ClanGuest.HEADER),
CLAN_GUEST_MEMBER_LIST(WidgetID.CLAN_GUEST_GROUP_ID, WidgetID.ClanGuest.MEMBERS),
//OpenOSRS
@@ -75,6 +75,7 @@ dependencies {
implementation(group = "net.sf.jopt-simple", name = "jopt-simple", version = "5.0.4")
implementation(group = "org.madlonkay", name = "desktopsupport", version = "0.6.0")
implementation(group = "org.apache.commons", name = "commons-text", version = "1.9")
implementation(group = "org.apache.commons", name = "commons-csv", version = "1.9.0")
implementation(group = "commons-io", name = "commons-io", version = "2.8.0")
implementation(group = "org.jetbrains", name = "annotations", version = "22.0.0")
implementation(group = "com.github.zafarkhaja", name = "java-semver", version = "0.9.0")
@@ -29,7 +29,7 @@ import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import net.runelite.api.Player;
import net.runelite.http.api.hiscore.HiscoreResult;
import net.runelite.client.hiscore.HiscoreResult;
@Getter
@Setter
@@ -33,9 +33,9 @@ import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.ItemMapping;
import net.runelite.client.hiscore.HiscoreClient;
import net.runelite.client.hiscore.HiscoreResult;
import net.runelite.client.util.PvPUtil;
import net.runelite.http.api.hiscore.HiscoreClient;
import net.runelite.http.api.hiscore.HiscoreResult;
import net.runelite.http.api.item.ItemEquipmentStats;
import net.runelite.http.api.item.ItemStats;
import okhttp3.OkHttpClient;
@@ -395,7 +395,6 @@ public class RuneLite
// Add core overlays
WidgetOverlay.createOverlays(overlayManager, client).forEach(overlayManager::add);
overlayManager.add(worldMapOverlay.get());
eventBus.register(worldMapOverlay.get());
overlayManager.add(tooltipOverlay.get());
playerManager.get();
@@ -99,11 +99,9 @@ class ConfigInvocationHandler implements InvocationHandler
}
// Convert value to return type
Class<?> returnType = method.getReturnType();
try
{
Object objectValue = ConfigManager.stringToObject(value, returnType);
Object objectValue = manager.stringToObject(value, method.getGenericReturnType());
cache.put(method, objectValue == null ? NULL : objectValue);
return objectValue;
}
@@ -155,7 +153,7 @@ class ConfigInvocationHandler implements InvocationHandler
}
else
{
String newValueStr = ConfigManager.objectToString(newValue);
String newValueStr = manager.objectToString(newValue);
manager.setConfiguration(group.value(), item.keyName(), newValueStr);
}
return null;
@@ -24,13 +24,14 @@
*/
package net.runelite.client.config;
import java.lang.reflect.Type;
import lombok.Value;
@Value
public class ConfigItemDescriptor implements ConfigObject
{
private final ConfigItem item;
private final Class<?> type;
private final Type type;
private final Range range;
private final Alpha alpha;
private final Units units;
@@ -30,6 +30,7 @@ import com.google.common.collect.ComparisonChain;
import com.google.common.collect.ImmutableSet;
import com.google.common.hash.Hasher;
import com.google.common.hash.Hashing;
import com.google.gson.Gson;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Point;
@@ -44,6 +45,7 @@ import java.io.OutputStreamWriter;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Proxy;
import java.lang.reflect.Type;
import java.nio.channels.FileChannel;
@@ -129,6 +131,7 @@ public class ConfigManager
private final File settingsFileInput;
private final EventBus eventBus;
private final OkHttpClient okHttpClient;
private final Gson gson;
private AccountSession session;
private ConfigClient configClient;
@@ -153,13 +156,15 @@ public class ConfigManager
ScheduledExecutorService scheduledExecutorService,
EventBus eventBus,
OkHttpClient okHttpClient,
@Nullable Client client)
@Nullable Client client,
Gson gson)
{
this.settingsFileInput = config;
this.eventBus = eventBus;
this.okHttpClient = okHttpClient;
this.client = client;
this.propertiesFile = getPropertiesFile();
this.gson = gson;
scheduledExecutorService.scheduleWithFixedDelay(this::sendConfig, 30, 30, TimeUnit.SECONDS);
}
@@ -413,17 +418,12 @@ public class ConfigManager
return properties.getProperty(getWholeKey(groupName, profile, key));
}
public <T> T getConfiguration(String groupName, String key, Class<T> clazz)
public <T> T getConfiguration(String groupName, String key, Type clazz)
{
return getConfiguration(groupName, null, key, clazz);
}
public <T> Object getConfiguration(String groupName, String key, Type clazz)
{
return getConfiguration(groupName, null, key, clazz);
}
public <T> T getRSProfileConfiguration(String groupName, String key, Class<T> clazz)
public <T> T getRSProfileConfiguration(String groupName, String key, Type clazz)
{
String rsProfileKey = this.rsProfileKey;
if (rsProfileKey == null)
@@ -434,31 +434,14 @@ public class ConfigManager
return getConfiguration(groupName, rsProfileKey, key, clazz);
}
public <T> T getConfiguration(String groupName, String profile, String key, Type clazz)
public <T> T getConfiguration(String groupName, String profile, String key, Type type)
{
String value = getConfiguration(groupName, profile, key);
if (!Strings.isNullOrEmpty(value))
{
try
{
return (T) stringToObject(value, (Class<?>) clazz);
}
catch (Exception e)
{
log.warn("Unable to unmarshal {} ", getWholeKey(groupName, profile, key), e);
}
}
return null;
}
public <T> T getConfiguration(String groupName, String profile, String key, Class<T> clazz)
{
String value = getConfiguration(groupName, profile, key);
if (!Strings.isNullOrEmpty(value))
{
try
{
return (T) stringToObject(value, clazz);
return (T) stringToObject(value, type);
}
catch (Exception e)
{
@@ -511,12 +494,12 @@ public class ConfigManager
eventBus.post(configChanged);
}
public void setConfiguration(String groupName, String profile, String key, Object value)
public <T> void setConfiguration(String groupName, String profile, String key, T value)
{
setConfiguration(groupName, profile, key, objectToString(value));
}
public void setConfiguration(String groupName, String key, Object value)
public <T> void setConfiguration(String groupName, String key, T value)
{
// do not save consumers for buttons, they cannot be changed anyway
if (value instanceof Consumer)
@@ -527,7 +510,7 @@ public class ConfigManager
setConfiguration(groupName, null, key, value);
}
public void setRSProfileConfiguration(String groupName, String key, Object value)
public <T> void setRSProfileConfiguration(String groupName, String key, T value)
{
String rsProfileKey = this.rsProfileKey;
if (rsProfileKey == null)
@@ -673,7 +656,7 @@ public class ConfigManager
.filter(m -> m.getParameterCount() == 0 && m.isAnnotationPresent(ConfigItem.class))
.map(m -> new ConfigItemDescriptor(
m.getDeclaredAnnotation(ConfigItem.class),
m.getReturnType(),
m.getGenericReturnType(),
m.getDeclaredAnnotation(Range.class),
m.getDeclaredAnnotation(Alpha.class),
m.getDeclaredAnnotation(Units.class)
@@ -748,7 +731,7 @@ public class ConfigManager
{
// This checks if it is set and is also unmarshallable to the correct type; so
// we will overwrite invalid config values with the default
Object current = getConfiguration(group.value(), item.keyName(), method.getReturnType());
Object current = getConfiguration(group.value(), item.keyName(), method.getGenericReturnType());
if (current != null)
{
continue; // something else is already set
@@ -783,7 +766,7 @@ public class ConfigManager
}
}
static Object stringToObject(String str, Class<?> type)
Object stringToObject(String str, Type type)
{
if (type == boolean.class || type == Boolean.class)
{
@@ -824,7 +807,7 @@ public class ConfigManager
int height = Integer.parseInt(splitStr[3]);
return new Rectangle(x, y, width, height);
}
if (type.isEnum())
if (type instanceof Class && ((Class<?>) type).isEnum())
{
return Enum.valueOf((Class<? extends Enum>) type, str);
}
@@ -859,6 +842,14 @@ public class ConfigManager
{
return Base64.getUrlDecoder().decode(str);
}
if (type instanceof ParameterizedType)
{
ParameterizedType parameterizedType = (ParameterizedType) type;
if (parameterizedType.getRawType() == Set.class)
{
return gson.fromJson(str, parameterizedType);
}
}
if (type == EnumSet.class)
{
try
@@ -898,7 +889,7 @@ public class ConfigManager
}
@Nullable
static String objectToString(Object object)
String objectToString(Object object)
{
if (object instanceof Color)
{
@@ -954,7 +945,10 @@ public class ConfigManager
return ((EnumSet) object).toArray()[0].getClass().getCanonicalName() + "{" + object.toString() + "}";
}
if (object instanceof Set)
{
return gson.toJson(object, Set.class);
}
return object == null ? null : object.toString();
}
@@ -22,7 +22,7 @@
* (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.http.api.hiscore;
package net.runelite.client.hiscore;
import java.io.IOException;
import java.util.concurrent.CompletableFuture;
@@ -64,28 +64,6 @@ public class HiscoreClient
return lookup(username, HiscoreEndpoint.NORMAL);
}
public SingleHiscoreSkillResult lookup(String username, HiscoreSkill skill, HiscoreEndpoint endpoint) throws IOException
{
HiscoreResult result = lookupSync(username, endpoint.getHiscoreURL());
if (result == null)
{
return null;
}
Skill requested = result.getSkill(skill);
SingleHiscoreSkillResult skillResult = new SingleHiscoreSkillResult();
skillResult.setPlayer(username);
skillResult.setSkillName(skill.getName());
skillResult.setSkill(requested);
return skillResult;
}
public SingleHiscoreSkillResult lookup(String username, HiscoreSkill skill) throws IOException
{
return lookup(username, skill, HiscoreEndpoint.NORMAL);
}
private HiscoreResult lookupSync(String username, HttpUrl hiscoreUrl) throws IOException
{
try (Response response = client.newCall(buildRequest(username, hiscoreUrl)).execute())
@@ -109,7 +87,7 @@ public class HiscoreClient
@Override
public void onResponse(Call call, Response response) throws IOException
{
try
try // NOPMD: UseTryWithResources
{
future.complete(processResponse(username, response));
}
@@ -156,9 +134,7 @@ public class HiscoreClient
{
CSVParser parser = CSVParser.parse(responseStr, CSVFormat.DEFAULT);
HiscoreResultBuilder hiscoreBuilder = new HiscoreResultBuilder();
hiscoreBuilder.setPlayer(username);
HiscoreResultBuilder hiscoreBuilder = new HiscoreResultBuilder(username);
int count = 0;
for (CSVRecord record : parser.getRecords())
@@ -186,4 +162,4 @@ public class HiscoreClient
return hiscoreBuilder.build();
}
}
}
@@ -23,8 +23,7 @@
* 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.http.api.hiscore;
package net.runelite.client.hiscore;
import lombok.Getter;
import okhttp3.HttpUrl;
@@ -46,6 +45,6 @@ public enum HiscoreEndpoint
HiscoreEndpoint(String name, String hiscoreURL)
{
this.name = name;
this.hiscoreURL = HttpUrl.parse(hiscoreURL);
this.hiscoreURL = HttpUrl.get(hiscoreURL);
}
}
}
@@ -22,7 +22,7 @@
* (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.client.game;
package net.runelite.client.hiscore;
import com.google.common.cache.CacheLoader;
import com.google.common.util.concurrent.ListenableFuture;
@@ -31,11 +31,8 @@ import com.google.common.util.concurrent.MoreExecutors;
import java.io.IOException;
import java.util.concurrent.ScheduledExecutorService;
import lombok.extern.slf4j.Slf4j;
import static net.runelite.client.game.HiscoreManager.EMPTY;
import static net.runelite.client.game.HiscoreManager.NONE;
import net.runelite.http.api.hiscore.HiscoreClient;
import net.runelite.http.api.hiscore.HiscoreEndpoint;
import net.runelite.http.api.hiscore.HiscoreResult;
import static net.runelite.client.hiscore.HiscoreManager.EMPTY;
import static net.runelite.client.hiscore.HiscoreManager.NONE;
@Slf4j
class HiscoreLoader extends CacheLoader<HiscoreManager.HiscoreKey, HiscoreResult>
@@ -22,7 +22,7 @@
* (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.client.game;
package net.runelite.client.hiscore;
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.LoadingCache;
@@ -33,9 +33,6 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AllArgsConstructor;
import lombok.Data;
import net.runelite.http.api.hiscore.HiscoreClient;
import net.runelite.http.api.hiscore.HiscoreEndpoint;
import net.runelite.http.api.hiscore.HiscoreResult;
import okhttp3.OkHttpClient;
@Singleton
@@ -56,7 +53,7 @@ public class HiscoreManager
private final HiscoreClient hiscoreClient;
@Inject
public HiscoreManager(ScheduledExecutorService executor, OkHttpClient okHttpClient)
private HiscoreManager(ScheduledExecutorService executor, OkHttpClient okHttpClient)
{
hiscoreClient = new HiscoreClient(okHttpClient);
hiscoreCache = CacheBuilder.newBuilder()
@@ -22,7 +22,7 @@
* (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.http.api.hiscore;
package net.runelite.client.hiscore;
import lombok.Data;
@@ -93,6 +93,7 @@ public class HiscoreResult
private Skill kreearra;
private Skill krilTsutsaroth;
private Skill mimic;
private Skill nex;
private Skill nightmare;
private Skill phosanisNightmare;
private Skill obor;
@@ -119,77 +120,77 @@ public class HiscoreResult
switch (skill)
{
case ATTACK:
return getAttack();
return attack;
case DEFENCE:
return getDefence();
return defence;
case STRENGTH:
return getStrength();
return strength;
case HITPOINTS:
return getHitpoints();
return hitpoints;
case RANGED:
return getRanged();
return ranged;
case PRAYER:
return getPrayer();
return prayer;
case MAGIC:
return getMagic();
return magic;
case COOKING:
return getCooking();
return cooking;
case WOODCUTTING:
return getWoodcutting();
return woodcutting;
case FLETCHING:
return getFletching();
return fletching;
case FISHING:
return getFishing();
return fishing;
case FIREMAKING:
return getFiremaking();
return firemaking;
case CRAFTING:
return getCrafting();
return crafting;
case SMITHING:
return getSmithing();
return smithing;
case MINING:
return getMining();
return mining;
case HERBLORE:
return getHerblore();
return herblore;
case AGILITY:
return getAgility();
return agility;
case THIEVING:
return getThieving();
return thieving;
case SLAYER:
return getSlayer();
return slayer;
case FARMING:
return getFarming();
return farming;
case RUNECRAFT:
return getRunecraft();
return runecraft;
case HUNTER:
return getHunter();
return hunter;
case CONSTRUCTION:
return getConstruction();
return construction;
case LEAGUE_POINTS:
return getLeaguePoints();
return leaguePoints;
case OVERALL:
return getOverall();
return overall;
case BOUNTY_HUNTER_HUNTER:
return getBountyHunterHunter();
return bountyHunterHunter;
case BOUNTY_HUNTER_ROGUE:
return getBountyHunterRogue();
return bountyHunterRogue;
case CLUE_SCROLL_ALL:
return getClueScrollAll();
return clueScrollAll;
case CLUE_SCROLL_BEGINNER:
return getClueScrollBeginner();
return clueScrollBeginner;
case CLUE_SCROLL_EASY:
return getClueScrollEasy();
return clueScrollEasy;
case CLUE_SCROLL_MEDIUM:
return getClueScrollMedium();
return clueScrollMedium;
case CLUE_SCROLL_HARD:
return getClueScrollHard();
return clueScrollHard;
case CLUE_SCROLL_ELITE:
return getClueScrollElite();
return clueScrollElite;
case CLUE_SCROLL_MASTER:
return getClueScrollMaster();
return clueScrollMaster;
case LAST_MAN_STANDING:
return getLastManStanding();
return lastManStanding;
case SOUL_WARS_ZEAL:
return getSoulWarsZeal();
return soulWarsZeal;
case ABYSSAL_SIRE:
return abyssalSire;
case ALCHEMICAL_HYDRA:
@@ -244,6 +245,8 @@ public class HiscoreResult
return krilTsutsaroth;
case MIMIC:
return mimic;
case NEX:
return nex;
case NIGHTMARE:
return nightmare;
case PHOSANIS_NIGHTMARE:
@@ -22,21 +22,18 @@
* (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.http.api.hiscore;
package net.runelite.client.hiscore;
import java.util.ArrayList;
import java.util.List;
import lombok.RequiredArgsConstructor;
@RequiredArgsConstructor
class HiscoreResultBuilder
{
private String player;
private final String player;
private final List<Skill> skills = new ArrayList<>();
public void setPlayer(String player)
{
this.player = player;
}
void setNextSkill(Skill skill)
{
skills.add(skill);
@@ -118,6 +115,10 @@ class HiscoreResultBuilder
hiscoreResult.setKreearra(skills.get(index++));
hiscoreResult.setKrilTsutsaroth(skills.get(index++));
hiscoreResult.setMimic(skills.get(index++));
if (skills.size() > 83)
{
hiscoreResult.setNex(skills.get(index++));
}
hiscoreResult.setNightmare(skills.get(index++));
hiscoreResult.setPhosanisNightmare(skills.get(index++));
hiscoreResult.setObor(skills.get(index++));
@@ -22,13 +22,13 @@
* (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.http.api.hiscore;
package net.runelite.client.hiscore;
import lombok.AllArgsConstructor;
import lombok.Getter;
import static net.runelite.http.api.hiscore.HiscoreSkillType.SKILL;
import static net.runelite.http.api.hiscore.HiscoreSkillType.ACTIVITY;
import static net.runelite.http.api.hiscore.HiscoreSkillType.BOSS;
import static net.runelite.client.hiscore.HiscoreSkillType.SKILL;
import static net.runelite.client.hiscore.HiscoreSkillType.ACTIVITY;
import static net.runelite.client.hiscore.HiscoreSkillType.BOSS;
@AllArgsConstructor
@Getter
@@ -97,6 +97,7 @@ public enum HiscoreSkill
KREEARRA("Kree'Arra", BOSS),
KRIL_TSUTSAROTH("K'ril Tsutsaroth", BOSS),
MIMIC("Mimic", BOSS),
NEX("Nex", BOSS),
NIGHTMARE("Nightmare", BOSS),
PHOSANIS_NIGHTMARE("Phosani's Nightmare", BOSS),
OBOR("Obor", BOSS),
@@ -22,7 +22,7 @@
* (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.http.api.hiscore;
package net.runelite.client.hiscore;
public enum HiscoreSkillType
{
@@ -30,4 +30,4 @@ public enum HiscoreSkillType
SKILL,
ACTIVITY,
BOSS
}
}
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Trevor <https://github.com/Trevor159>
* Copyright (c) 2021, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,11 +22,14 @@
* (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.api;
package net.runelite.client.hiscore;
/**
* Represents an animation of a renderable
*/
public interface Sequence
import lombok.Value;
@Value
public class Skill
{
}
int rank;
int level;
long experience;
}
@@ -27,10 +27,10 @@ package net.runelite.client.menus;
import com.google.common.base.Preconditions;
import com.google.common.collect.LinkedHashMultimap;
import com.google.common.collect.Multimap;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Consumer;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
@@ -67,6 +67,7 @@ public class MenuManager
{
this.client = client;
this.eventBus = eventBus;
eventBus.register(this);
}
@@ -74,10 +75,12 @@ public class MenuManager
* Adds a CustomMenuOption to the list of managed menu options.
*
* @param customMenuOption The custom menu to add
* @param callback callback to be called when the menu is clicked
*/
public void addManagedCustomMenu(WidgetMenuOption customMenuOption)
public void addManagedCustomMenu(WidgetMenuOption customMenuOption, Consumer<MenuEntry> callback)
{
managedMenuOptions.put(customMenuOption.getWidgetId(), customMenuOption);
customMenuOption.callback = callback;
}
/**
@@ -113,7 +116,7 @@ public class MenuManager
return;
}
int widgetId = event.getParam1();
int widgetId = event.getActionParam1();
Collection<WidgetMenuOption> options = managedMenuOptions.get(widgetId);
if (options.isEmpty())
{
@@ -122,11 +125,10 @@ public class MenuManager
MenuEntry[] menuEntries = client.getMenuEntries();
MenuEntry[] newMenuEntries = Arrays.copyOf(menuEntries, menuEntries.length + options.size());
// Menu entries are sorted with higher-index entries appearing toward the top of the minimenu, so insert older
// managed menu entries at higher indices and work backward for newer entries so newly-added entries appear at
// the bottom
int insertIdx = newMenuEntries.length - 1;
int insertIdx = -1;
for (WidgetMenuOption currentMenu : options)
{
// Exit if we've inserted the managed menu entries already
@@ -135,16 +137,42 @@ public class MenuManager
return;
}
MenuEntry menuEntry = new MenuEntry();
menuEntry.setOption(currentMenu.getMenuOption());
menuEntry.setParam1(widgetId);
menuEntry.setTarget(currentMenu.getMenuTarget());
menuEntry.setType(MenuAction.RUNELITE.getId());
client.createMenuEntry(insertIdx--)
.setOption(currentMenu.getMenuOption())
.setTarget(currentMenu.getMenuTarget())
.setType(MenuAction.RUNELITE)
.setParam1(widgetId)
.onClick(currentMenu.callback);
}
}
newMenuEntries[insertIdx--] = menuEntry;
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event)
{
if (event.getMenuAction() != MenuAction.RUNELITE)
{
return;
}
client.setMenuEntries(newMenuEntries);
int widgetId = event.getParam1();
Collection<WidgetMenuOption> options = managedMenuOptions.get(widgetId);
for (WidgetMenuOption curMenuOption : options)
{
if (curMenuOption.getMenuTarget().equals(event.getMenuTarget())
&& curMenuOption.getMenuOption().equals(event.getMenuOption()))
{
WidgetMenuOptionClicked widgetMenuOptionClicked = new WidgetMenuOptionClicked();
widgetMenuOptionClicked.setMenuOption(event.getMenuOption());
widgetMenuOptionClicked.setMenuTarget(event.getMenuTarget());
widgetMenuOptionClicked.setWidget(curMenuOption.getWidget());
widgetMenuOptionClicked.setWidgetId(curMenuOption.getWidgetId());
eventBus.post(widgetMenuOptionClicked);
return;
}
}
}
public void addPlayerMenuItem(String menuText)
@@ -198,33 +226,6 @@ public class MenuManager
addPlayerMenuItem(newIdx, menuText);
}
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event)
{
if (event.getMenuAction() != MenuAction.RUNELITE)
{
return;
}
int widgetId = event.getParam1();
Collection<WidgetMenuOption> options = managedMenuOptions.get(widgetId);
for (WidgetMenuOption curMenuOption : options)
{
if (curMenuOption.getMenuTarget().equals(event.getMenuTarget())
&& curMenuOption.getMenuOption().equals(event.getMenuOption()))
{
WidgetMenuOptionClicked customMenu = new WidgetMenuOptionClicked();
customMenu.setMenuOption(event.getMenuOption());
customMenu.setMenuTarget(event.getMenuTarget());
customMenu.setWidget(curMenuOption.getWidget());
customMenu.setWidgetId(curMenuOption.getWidgetId());
eventBus.post(customMenu);
return;
}
}
}
private void addPlayerMenuItem(int playerOptionIndex, String menuText)
{
client.getPlayerOptions()[playerOptionIndex] = menuText;
@@ -25,9 +25,11 @@
package net.runelite.client.menus;
import java.awt.Color;
import java.util.function.Consumer;
import javax.annotation.Nullable;
import lombok.Getter;
import lombok.Setter;
import net.runelite.api.MenuEntry;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.ui.JagexColors;
import net.runelite.client.util.ColorUtil;
@@ -65,6 +67,8 @@ public final class WidgetMenuOption
@Getter
private final int widgetId;
Consumer<MenuEntry> callback;
/**
* Creates a menu to be added to right click menus. The menu will only be added if match is found within the menu options
*
@@ -341,9 +341,7 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener
@Subscribe
public void onMenuEntryAdded(MenuEntryAdded event)
{
MenuEntry[] entries = client.getMenuEntries();
if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
if (event.getActionParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
&& event.getOption().equals("Examine"))
{
Widget container = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER);
@@ -357,87 +355,80 @@ public class BankTagsPlugin extends Plugin implements MouseWheelListener
text += " (" + tagCount + ")";
}
MenuEntry editTags = new MenuEntry();
editTags.setParam0(event.getActionParam0());
editTags.setParam1(event.getParam1());
editTags.setTarget(event.getTarget());
editTags.setOption(text);
editTags.setType(MenuAction.RUNELITE.getId());
editTags.setIdentifier(event.getIdentifier());
entries = Arrays.copyOf(entries, entries.length + 1);
entries[entries.length - 1] = editTags;
client.setMenuEntries(entries);
client.createMenuEntry(-1)
.setParam0(event.getActionParam0())
.setParam1(event.getActionParam1())
.setTarget(event.getTarget())
.setOption(text)
.setType(MenuAction.RUNELITE)
.setIdentifier(event.getIdentifier())
.onClick(this::editTags);
}
tabInterface.handleAdd(event);
}
private void editTags(MenuEntry entry)
{
int inventoryIndex = entry.getParam0();
ItemContainer bankContainer = client.getItemContainer(InventoryID.BANK);
if (bankContainer == null)
{
return;
}
Item[] items = bankContainer.getItems();
if (inventoryIndex < 0 || inventoryIndex >= items.length)
{
return;
}
Item item = bankContainer.getItems()[inventoryIndex];
if (item == null)
{
return;
}
int itemId = item.getId();
ItemComposition itemComposition = itemManager.getItemComposition(itemId);
String name = itemComposition.getName();
// Get both tags and vartags and append * to end of vartags name
Collection<String> tags = tagManager.getTags(itemId, false);
tagManager.getTags(itemId, true).stream()
.map(i -> i + "*")
.forEach(tags::add);
String initialValue = Text.toCSV(tags);
chatboxPanelManager.openTextInput(name + " tags:<br>(append " + VAR_TAG_SUFFIX + " for variation tag)")
.addCharValidator(FILTERED_CHARS)
.value(initialValue)
.onDone((Consumer<String>) (newValue) ->
clientThread.invoke(() ->
{
// Split inputted tags to vartags (ending with *) and regular tags
final Collection<String> newTags = new ArrayList<>(Text.fromCSV(newValue.toLowerCase()));
final Collection<String> newVarTags = new ArrayList<>(newTags).stream().filter(s -> s.endsWith(VAR_TAG_SUFFIX)).map(s ->
{
newTags.remove(s);
return s.substring(0, s.length() - VAR_TAG_SUFFIX.length());
}).collect(Collectors.toList());
// And save them
tagManager.setTagString(itemId, Text.toCSV(newTags), false);
tagManager.setTagString(itemId, Text.toCSV(newVarTags), true);
// Check both previous and current tags in case the tag got removed in new tags or in case
// the tag got added in new tags
tabInterface.updateTabIfActive(Text.fromCSV(initialValue.toLowerCase().replaceAll(Pattern.quote(VAR_TAG_SUFFIX), "")));
tabInterface.updateTabIfActive(Text.fromCSV(newValue.toLowerCase().replaceAll(Pattern.quote(VAR_TAG_SUFFIX), "")));
}))
.build();
}
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event)
{
if (event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
&& event.getMenuAction() == MenuAction.RUNELITE
&& event.getMenuOption().startsWith(EDIT_TAGS_MENU_OPTION))
{
event.consume();
int inventoryIndex = event.getParam0();
ItemContainer bankContainer = client.getItemContainer(InventoryID.BANK);
if (bankContainer == null)
{
return;
}
Item[] items = bankContainer.getItems();
if (inventoryIndex < 0 || inventoryIndex >= items.length)
{
return;
}
Item item = bankContainer.getItems()[inventoryIndex];
if (item == null)
{
return;
}
int itemId = item.getId();
ItemComposition itemComposition = itemManager.getItemComposition(itemId);
String name = itemComposition.getName();
// Get both tags and vartags and append * to end of vartags name
Collection<String> tags = tagManager.getTags(itemId, false);
tagManager.getTags(itemId, true).stream()
.map(i -> i + "*")
.forEach(tags::add);
String initialValue = Text.toCSV(tags);
chatboxPanelManager.openTextInput(name + " tags:<br>(append " + VAR_TAG_SUFFIX + " for variation tag)")
.addCharValidator(FILTERED_CHARS)
.value(initialValue)
.onDone((Consumer<String>) (newValue) ->
clientThread.invoke(() ->
{
// Split inputted tags to vartags (ending with *) and regular tags
final Collection<String> newTags = new ArrayList<>(Text.fromCSV(newValue.toLowerCase()));
final Collection<String> newVarTags = new ArrayList<>(newTags).stream().filter(s -> s.endsWith(VAR_TAG_SUFFIX)).map(s ->
{
newTags.remove(s);
return s.substring(0, s.length() - VAR_TAG_SUFFIX.length());
}).collect(Collectors.toList());
// And save them
tagManager.setTagString(itemId, Text.toCSV(newTags), false);
tagManager.setTagString(itemId, Text.toCSV(newVarTags), true);
// Check both previous and current tags in case the tag got removed in new tags or in case
// the tag got added in new tags
tabInterface.updateTabIfActive(Text.fromCSV(initialValue.toLowerCase().replaceAll(Pattern.quote(VAR_TAG_SUFFIX), "")));
tabInterface.updateTabIfActive(Text.fromCSV(newValue.toLowerCase().replaceAll(Pattern.quote(VAR_TAG_SUFFIX), "")));
}))
.build();
}
else
{
tabInterface.handleClick(event);
}
tabInterface.handleClick(event);
}
@Subscribe
@@ -618,38 +618,32 @@ public class TabInterface
return;
}
MenuEntry[] entries = client.getMenuEntries();
if (activeTab != null
&& event.getParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
&& event.getActionParam1() == WidgetInfo.BANK_ITEM_CONTAINER.getId()
&& event.getOption().equals("Examine"))
{
entries = createMenuEntry(event, REMOVE_TAG + " (" + activeTab.getTag() + ")", event.getTarget(), entries);
client.setMenuEntries(entries);
createMenuEntry(event, REMOVE_TAG + " (" + activeTab.getTag() + ")", event.getTarget());
}
else if (event.getParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId()
else if (event.getActionParam1() == WidgetInfo.BANK_DEPOSIT_INVENTORY.getId()
&& event.getOption().equals("Deposit inventory"))
{
entries = createMenuEntry(event, TAG_INVENTORY, event.getTarget(), entries);
createMenuEntry(event, TAG_INVENTORY, event.getTarget());
if (activeTab != null)
{
entries = createMenuEntry(event, TAG_INVENTORY, ColorUtil.wrapWithColorTag(activeTab.getTag(), HILIGHT_COLOR), entries);
createMenuEntry(event, TAG_INVENTORY, ColorUtil.wrapWithColorTag(activeTab.getTag(), HILIGHT_COLOR));
}
client.setMenuEntries(entries);
}
else if (event.getParam1() == WidgetInfo.BANK_DEPOSIT_EQUIPMENT.getId()
else if (event.getActionParam1() == WidgetInfo.BANK_DEPOSIT_EQUIPMENT.getId()
&& event.getOption().equals("Deposit worn items"))
{
entries = createMenuEntry(event, TAG_GEAR, event.getTarget(), entries);
createMenuEntry(event, TAG_GEAR, event.getTarget());
if (activeTab != null)
{
entries = createMenuEntry(event, TAG_GEAR, ColorUtil.wrapWithColorTag(activeTab.getTag(), HILIGHT_COLOR), entries);
createMenuEntry(event, TAG_GEAR, ColorUtil.wrapWithColorTag(activeTab.getTag(), HILIGHT_COLOR));
}
client.setMenuEntries(entries);
}
}
@@ -773,7 +767,6 @@ public class TabInterface
{
entry.setOption(TAG_SEARCH + Text.removeTags(entry.getTarget()) + (shiftDown ? VAR_TAG_SUFFIX : ""));
entry.setTarget(draggedWidget.getName());
client.setMenuEntries(entries);
}
if (entry.getOption().equals(SCROLL_UP))
@@ -1195,17 +1188,14 @@ public class TabInterface
searchButtonBackground.setSpriteId(SpriteID.EQUIPMENT_SLOT_TILE);
}
private static MenuEntry[] createMenuEntry(MenuEntryAdded event, String option, String target, MenuEntry[] entries)
private void createMenuEntry(MenuEntryAdded event, String option, String target)
{
final MenuEntry entry = new MenuEntry();
entry.setParam0(event.getActionParam0());
entry.setParam1(event.getParam1());
entry.setTarget(target);
entry.setOption(option);
entry.setType(MenuAction.RUNELITE.getId());
entry.setIdentifier(event.getIdentifier());
entries = Arrays.copyOf(entries, entries.length + 1);
entries[entries.length - 1] = entry;
return entries;
client.createMenuEntry(-1)
.setParam0(event.getActionParam0())
.setParam1(event.getActionParam1())
.setTarget(target)
.setOption(option)
.setType(MenuAction.RUNELITE)
.setIdentifier(event.getIdentifier());
}
}
@@ -294,7 +294,7 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
{
for (MenuEntry menuEntry : menuEntries)
{
MenuAction action = MenuAction.of(menuEntry.getType());
MenuAction action = menuEntry.getType();
switch (action)
{
case CANCEL:
@@ -206,6 +206,18 @@ public interface ChatChannelConfig extends Config
return false;
}
@ConfigItem(
keyName = "clanChatShowOnlineMemberCount",
name = "Show Online Member Count",
description = "Shows the number of online clan members at the end of the clan's name.",
position = 1,
section = clanChatSection
)
default boolean clanChatShowOnlineMemberCount()
{
return false;
}
@ConfigItem(
keyName = "guestClanChatShowJoinLeave",
name = "Show Join/Leave",
@@ -217,4 +229,16 @@ public interface ChatChannelConfig extends Config
{
return false;
}
@ConfigItem(
keyName = "guestClanChatShowOnlineMemberCount",
name = "Show Online Member Count",
description = "Shows the number of online guest clan members at the end of the clan's name.",
position = 1,
section = guestClanChatSection
)
default boolean guestClanChatShowOnlineMemberCount()
{
return false;
}
}
@@ -145,6 +145,8 @@ public class ChatChannelPlugin extends Plugin
{
clientThread.invoke(() -> colorIgnoredPlayers(config.showIgnoresColor()));
}
rebuildClanTitle();
}
@Override
@@ -153,6 +155,7 @@ public class ChatChannelPlugin extends Plugin
chats = null;
clientThread.invoke(() -> colorIgnoredPlayers(Color.WHITE));
rebuildFriendsChat();
rebuildClanTitle();
}
@Subscribe
@@ -167,6 +170,8 @@ public class ChatChannelPlugin extends Plugin
Color ignoreColor = config.showIgnores() ? config.showIgnoresColor() : Color.WHITE;
clientThread.invoke(() -> colorIgnoredPlayers(ignoreColor));
rebuildClanTitle();
}
}
@@ -606,6 +611,18 @@ public class ChatChannelPlugin extends Plugin
chatTitle.setText(chatTitle.getText() + " (" + friendsChatManager.getCount() + "/100)");
}
}
else if (event.getScriptId() == ScriptID.CLAN_SIDEPANEL_DRAW)
{
if (config.clanChatShowOnlineMemberCount())
{
updateClanTitle(WidgetInfo.CLAN_HEADER, client.getClanChannel());
}
if (config.guestClanChatShowOnlineMemberCount())
{
updateClanTitle(WidgetInfo.CLAN_GUEST_HEADER, client.getGuestClanChannel());
}
}
}
private void insertRankIcon(final ChatMessage message)
@@ -740,4 +757,35 @@ public class ChatChannelPlugin extends Plugin
listWidget.setTextColor(ignoreColor.getRGB());
}
}
private void rebuildClanTitle()
{
clientThread.invokeLater(() ->
{
Widget w = client.getWidget(WidgetInfo.CLAN_LAYER);
if (w != null)
{
client.runScript(w.getOnVarTransmitListener());
}
});
clientThread.invokeLater(() ->
{
Widget w = client.getWidget(WidgetInfo.CLAN_GUEST_LAYER);
if (w != null)
{
client.runScript(w.getOnVarTransmitListener());
}
});
}
private void updateClanTitle(WidgetInfo widget, ClanChannel channel)
{
Widget header = client.getWidget(widget);
if (header != null && channel != null)
{
Widget title = header.getChild(0);
title.setText(title.getText() + " (" + channel.getMembers().size() + ")");
}
}
}
@@ -82,6 +82,11 @@ import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ChatInput;
import net.runelite.client.game.ItemManager;
import net.runelite.client.hiscore.HiscoreClient;
import net.runelite.client.hiscore.HiscoreEndpoint;
import net.runelite.client.hiscore.HiscoreResult;
import net.runelite.client.hiscore.HiscoreSkill;
import net.runelite.client.hiscore.Skill;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
@@ -90,12 +95,6 @@ import net.runelite.client.util.QuantityFormatter;
import net.runelite.client.util.Text;
import net.runelite.http.api.chat.ChatClient;
import net.runelite.http.api.chat.Duels;
import net.runelite.http.api.hiscore.HiscoreClient;
import net.runelite.http.api.hiscore.HiscoreEndpoint;
import net.runelite.http.api.hiscore.HiscoreResult;
import net.runelite.http.api.hiscore.HiscoreSkill;
import net.runelite.http.api.hiscore.SingleHiscoreSkillResult;
import net.runelite.http.api.hiscore.Skill;
import net.runelite.http.api.item.ItemPrice;
import okhttp3.OkHttpClient;
import org.apache.commons.text.WordUtils;
@@ -1372,16 +1371,14 @@ public class ChatCommandsPlugin extends Plugin
try
{
final SingleHiscoreSkillResult result = hiscoreClient.lookup(lookup.getName(), skill, lookup.getEndpoint());
final HiscoreResult result = hiscoreClient.lookup(lookup.getName(), lookup.getEndpoint());
if (result == null)
{
log.warn("unable to look up skill {} for {}: not found", skill, search);
return;
}
final Skill hiscoreSkill = result.getSkill();
final Skill hiscoreSkill = result.getSkill(skill);
ChatMessageBuilder chatMessageBuilder = new ChatMessageBuilder()
.append(ChatColorType.NORMAL)
.append("Level ")
@@ -201,6 +201,9 @@ public class ChatFilterPlugin extends Plugin
case NPC_EXAMINE:
case OBJECT_EXAMINE:
case SPAM:
case CLAN_MESSAGE:
case CLAN_GUEST_MESSAGE:
case CLAN_GIM_MESSAGE:
if (config.filterGameChat())
{
message = censorMessage(null, message);
@@ -25,7 +25,6 @@
*/
package net.runelite.client.plugins.chathistory;
import com.google.common.base.Strings;
import com.google.common.collect.EvictingQueue;
import com.google.inject.Provides;
import java.awt.Toolkit;
@@ -83,8 +82,6 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
private Queue<MessageNode> messageQueue;
private Deque<String> friends;
private String currentMessage = null;
@Inject
private Client client;
@@ -121,7 +118,6 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
messageQueue = null;
friends.clear();
friends = null;
currentMessage = null;
keyManager.unregisterKeyListener(this);
}
@@ -195,7 +191,7 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
// Use second entry as first one can be walk here with transparent chatbox
final MenuEntry entry = event.getMenuEntries()[event.getMenuEntries().length - 2];
if (entry.getType() != MenuAction.CC_OP_LOW_PRIORITY.getId() && entry.getType() != MenuAction.RUNELITE.getId())
if (entry.getType() != MenuAction.CC_OP_LOW_PRIORITY && entry.getType() != MenuAction.RUNELITE)
{
return;
}
@@ -236,16 +232,17 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
return;
}
currentMessage = messageContents.getText();
String currentMessage = messageContents.getText();
final MenuEntry menuEntry = new MenuEntry();
menuEntry.setOption(COPY_TO_CLIPBOARD);
menuEntry.setTarget(entry.getTarget());
menuEntry.setType(MenuAction.RUNELITE.getId());
menuEntry.setParam0(entry.getParam0());
menuEntry.setParam1(entry.getParam1());
menuEntry.setIdentifier(entry.getIdentifier());
client.setMenuEntries(ArrayUtils.insert(1, client.getMenuEntries(), menuEntry));
client.createMenuEntry(1)
.setOption(COPY_TO_CLIPBOARD)
.setTarget(entry.getTarget())
.setType(MenuAction.RUNELITE)
.onClick(e ->
{
final StringSelection stringSelection = new StringSelection(Text.removeTags(currentMessage));
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null);
});
}
@Subscribe
@@ -258,11 +255,6 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
{
clearChatboxHistory(ChatboxTab.of(event.getParam1()));
}
else if (COPY_TO_CLIPBOARD.equals(menuOption) && !Strings.isNullOrEmpty(currentMessage))
{
final StringSelection stringSelection = new StringSelection(Text.removeTags(currentMessage));
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null);
}
}
@Subscribe
@@ -279,10 +271,8 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
return;
}
final MenuEntry clearEntry = new MenuEntry();
clearEntry.setTarget("");
clearEntry.setType(MenuAction.RUNELITE_HIGH_PRIORITY.getId());
clearEntry.setParam0(entry.getActionParam0());
final MenuEntry clearEntry = client.createMenuEntry(-2)
.setType(MenuAction.RUNELITE_HIGH_PRIORITY);
clearEntry.setParam1(entry.getActionParam1());
final StringBuilder optionBuilder = new StringBuilder();
@@ -299,9 +289,6 @@ public class ChatHistoryPlugin extends Plugin implements KeyListener
optionBuilder.append(CLEAR_HISTORY);
clearEntry.setOption(optionBuilder.toString());
final MenuEntry[] menuEntries = client.getMenuEntries();
client.setMenuEntries(ArrayUtils.insert(menuEntries.length - 1, menuEntries, clearEntry));
}
private void clearMessageQueue(ChatboxTab tab)
File diff suppressed because it is too large Load Diff
@@ -490,7 +490,6 @@ public class DevToolsPlugin extends Plugin
}
entry.setTarget(entry.getTarget() + " " + ColorUtil.prependColorTag("(" + info + ")", JagexColors.MENU_TARGET));
client.setMenuEntries(entries);
}
}
}
@@ -48,16 +48,16 @@ public class WidgetInfoTableModel extends AbstractTableModel
private static final int COL_FIELD = 0;
private static final int COL_VALUE = 1;
private final List<WidgetField> fields = populateWidgetFields();
private final List<WidgetField<?>> fields = populateWidgetFields();
private Widget widget = null;
private Map<WidgetField, Object> values = null;
private Map<WidgetField<?>, Object> values = null;
public void setWidget(Widget w)
{
clientThread.invoke(() ->
{
Map<WidgetField, Object> newValues = w == null ? null : fields.stream().collect(ImmutableMap.toImmutableMap(
Map<WidgetField<?>, Object> newValues = w == null ? null : fields.stream().collect(ImmutableMap.toImmutableMap(
Function.identity(),
i -> i.getValue(w)
));
@@ -137,9 +137,9 @@ public class WidgetInfoTableModel extends AbstractTableModel
});
}
private List<WidgetField> populateWidgetFields()
private List<WidgetField<?>> populateWidgetFields()
{
List<WidgetField> out = new ArrayList<>();
List<WidgetField<?>> out = new ArrayList<>();
out.add(new WidgetField<>("Id", Widget::getId));
out.add(new WidgetField<>("Type", Widget::getType, Widget::setType, Integer.class));
@@ -209,6 +209,11 @@ public class WidgetInfoTableModel extends AbstractTableModel
}
return null;
}));
out.add(new WidgetField<>("OnOpListener", Widget::getOnOpListener));
out.add(new WidgetField<>("OnKeyListener", Widget::getOnKeyListener));
out.add(new WidgetField<>("OnLoadListener", Widget::getOnLoadListener));
out.add(new WidgetField<>("OnInvTransmitListener", Widget::getOnInvTransmitListener));
out.add(new WidgetField<>("OnVarTransmitListener", Widget::getOnVarTransmitListener));
return out;
}
@@ -487,7 +487,7 @@ class WidgetInspector extends DevToolsFrame
client.setSpellSelected(false);
ev.consume();
Object target = getWidgetOrWidgetItemForMenuOption(ev.getMenuAction().getId(), ev.getParam0(), ev.getParam1());
Object target = getWidgetOrWidgetItemForMenuOption(ev.getMenuAction(), ev.getParam0(), ev.getParam1());
if (target == null)
{
return;
@@ -516,8 +516,8 @@ class WidgetInspector extends DevToolsFrame
for (int i = 0; i < menuEntries.length; i++)
{
MenuEntry entry = menuEntries[i];
if (entry.getType() != MenuAction.ITEM_USE_ON_WIDGET.getId()
&& entry.getType() != MenuAction.SPELL_CAST_ON_WIDGET.getId())
if (entry.getType() != MenuAction.ITEM_USE_ON_WIDGET
&& entry.getType() != MenuAction.SPELL_CAST_ON_WIDGET)
{
continue;
}
@@ -532,8 +532,6 @@ class WidgetInspector extends DevToolsFrame
entry.setTarget(ColorUtil.wrapWithColorTag(name, color));
}
client.setMenuEntries(menuEntries);
}
Color colorForWidget(int index, int length)
@@ -543,9 +541,9 @@ class WidgetInspector extends DevToolsFrame
return Color.getHSBColor(h, 1, 1);
}
Object getWidgetOrWidgetItemForMenuOption(int type, int param0, int param1)
Object getWidgetOrWidgetItemForMenuOption(MenuAction type, int param0, int param1)
{
if (type == MenuAction.SPELL_CAST_ON_WIDGET.getId())
if (type == MenuAction.SPELL_CAST_ON_WIDGET)
{
Widget w = client.getWidget(param1);
if (param0 != -1)
@@ -555,7 +553,7 @@ class WidgetInspector extends DevToolsFrame
return w;
}
else if (type == MenuAction.ITEM_USE_ON_WIDGET.getId())
else if (type == MenuAction.ITEM_USE_ON_WIDGET)
{
Widget w = client.getWidget(param1);
return w.getWidgetItem(param0);
@@ -93,6 +93,7 @@ enum Emoji
XD("Xd"),
SPOON("--o"),
WEARY_FACE("Dx"),
ROCKETSHIP("<gt>==<gt>"), // >==>
;
private static final Map<String, Emoji> emojiMap;
@@ -28,9 +28,11 @@ import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("friendlist")
@ConfigGroup(FriendListConfig.GROUP)
public interface FriendListConfig extends Config
{
String GROUP = "friendlist";
@ConfigItem(
keyName = "showWorldOnLogin",
name = "Show world on login",
@@ -26,30 +26,40 @@
package net.runelite.client.plugins.friendlist;
import com.google.inject.Provides;
import java.time.temporal.ChronoUnit;
import java.util.Iterator;
import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
import net.runelite.api.ChatPlayer;
import net.runelite.api.Client;
import net.runelite.api.Friend;
import net.runelite.api.Ignore;
import net.runelite.api.MenuAction;
import net.runelite.api.MessageNode;
import net.runelite.api.NameableContainer;
import net.runelite.api.PendingLogin;
import net.runelite.api.ScriptID;
import net.runelite.api.VarPlayer;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.ScriptPostFired;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.task.Schedule;
import net.runelite.client.util.Text;
@PluginDescriptor(
name = "Friend List",
description = "Add extra information to the friend and ignore lists"
)
@Slf4j
public class FriendListPlugin extends Plugin
{
private static final int MAX_FRIENDS_P2P = 400;
@@ -58,12 +68,21 @@ public class FriendListPlugin extends Plugin
private static final int MAX_IGNORES_P2P = 400;
private static final int MAX_IGNORES_F2P = 100;
private static final String HIDE_NOTIFICATIONS = "Hide notifications";
private static final String SHOW_NOTIFICATIONS = "Show notifications";
@Inject
private Client client;
@Inject
private FriendListConfig config;
@Inject
private ConfigManager configManager;
@Inject
private ChatMessageManager chatMessageManager;
@Provides
FriendListConfig getConfig(ConfigManager configManager)
{
@@ -144,6 +163,46 @@ public class FriendListPlugin extends Plugin
}
}
@Subscribe
public void onMenuEntryAdded(MenuEntryAdded event)
{
final int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
// Look for "Message" on friends list
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() && event.getOption().equals("Message"))
{
String friend = Text.toJagexName(Text.removeTags(event.getTarget()));
client.createMenuEntry(-1)
.setOption(isHideNotification(friend) ? SHOW_NOTIFICATIONS : HIDE_NOTIFICATIONS)
.setType(MenuAction.RUNELITE)
.setTarget(event.getTarget()) //Preserve color codes here
.onClick(e ->
{
boolean hidden = isHideNotification(friend);
setHideNotifications(friend, !hidden);
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.CONSOLE)
.value("Login notifications for " + friend + " are now " + (hidden ? "shown." : "hidden."))
.build());
});
}
}
@Schedule(period = 5, unit = ChronoUnit.SECONDS)
public void setHideNotifications()
{
for (Iterator<PendingLogin> it = client.getFriendContainer().getPendingLogins().iterator(); it.hasNext(); )
{
PendingLogin pendingLogin = it.next();
if (isHideNotification(Text.toJagexName(pendingLogin.getName())))
{
log.debug("Removing login notification for {}", pendingLogin.getName());
it.remove();
}
}
}
private void setFriendsListTitle(final String title)
{
Widget friendListTitleWidget = client.getWidget(WidgetInfo.FRIEND_CHAT_TITLE);
@@ -173,4 +232,21 @@ public class FriendListPlugin extends Plugin
return null;
}
private void setHideNotifications(String friend, boolean hide)
{
if (hide)
{
configManager.setConfiguration(FriendListConfig.GROUP, "hidenotification_" + friend, true);
}
else
{
configManager.unsetConfiguration(FriendListConfig.GROUP, "hidenotification_" + friend);
}
}
private boolean isHideNotification(String friend)
{
return configManager.getConfiguration(FriendListConfig.GROUP, "hidenotification_" + friend, Boolean.class) == Boolean.TRUE;
}
}
@@ -28,7 +28,6 @@
package net.runelite.client.plugins.friendnotes;
import com.google.common.base.Strings;
import com.google.common.collect.ObjectArrays;
import com.google.inject.Provides;
import java.awt.Color;
import java.awt.image.BufferedImage;
@@ -43,12 +42,10 @@ import net.runelite.api.GameState;
import net.runelite.api.Ignore;
import net.runelite.api.IndexedSprite;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.Nameable;
import net.runelite.api.ScriptID;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.NameableNameChanged;
import net.runelite.api.events.RemovedFriend;
import net.runelite.api.events.ScriptCallbackEvent;
@@ -235,7 +232,7 @@ public class FriendNotesPlugin extends Plugin
@Subscribe
public void onMenuEntryAdded(MenuEntryAdded event)
{
final int groupId = WidgetInfo.TO_GROUP(event.getParam1());
final int groupId = WidgetInfo.TO_GROUP(event.getActionParam1());
// Look for "Message" on friends list
if ((groupId == WidgetInfo.FRIENDS_LIST.getGroupId() && event.getOption().equals("Message")) ||
@@ -245,16 +242,31 @@ public class FriendNotesPlugin extends Plugin
setHoveredFriend(Text.toJagexName(Text.removeTags(event.getTarget())));
// Build "Add Note" or "Edit Note" menu entry
final MenuEntry addNote = new MenuEntry();
addNote.setOption(hoveredFriend == null || hoveredFriend.getNote() == null ? ADD_NOTE : EDIT_NOTE);
addNote.setType(MenuAction.RUNELITE.getId());
addNote.setTarget(event.getTarget()); //Preserve color codes here
addNote.setParam0(event.getActionParam0());
addNote.setParam1(event.getParam1());
client.createMenuEntry(-1)
.setOption(hoveredFriend == null || hoveredFriend.getNote() == null ? ADD_NOTE : EDIT_NOTE)
.setType(MenuAction.RUNELITE)
.setTarget(event.getTarget()) //Preserve color codes here
.onClick(e ->
{
//Friends have color tags
final String sanitizedTarget = Text.toJagexName(Text.removeTags(e.getTarget()));
final String note = getFriendNote(sanitizedTarget);
// Add menu entry
final MenuEntry[] menuEntries = ObjectArrays.concat(client.getMenuEntries(), addNote);
client.setMenuEntries(menuEntries);
// Open the new chatbox input dialog
chatboxPanelManager.openTextInput(String.format(NOTE_PROMPT_FORMAT, sanitizedTarget, CHARACTER_LIMIT))
.value(Strings.nullToEmpty(note))
.onDone((content) ->
{
if (content == null)
{
return;
}
content = Text.removeTags(content).trim();
log.debug("Set note for '{}': '{}'", sanitizedTarget, content);
setFriendNote(sanitizedTarget, content);
}).build();
});
}
else if (hoveredFriend != null)
{
@@ -262,46 +274,6 @@ public class FriendNotesPlugin extends Plugin
}
}
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event)
{
final int groupId = WidgetInfo.TO_GROUP(event.getParam1());
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.IGNORE_LIST.getGroupId())
{
if (Strings.isNullOrEmpty(event.getMenuTarget()))
{
return;
}
// Handle clicks on "Add Note" or "Edit Note"
if (event.getMenuOption().equals(ADD_NOTE) || event.getMenuOption().equals(EDIT_NOTE))
{
event.consume();
//Friends have color tags
final String sanitizedTarget = Text.toJagexName(Text.removeTags(event.getMenuTarget()));
final String note = getFriendNote(sanitizedTarget);
// Open the new chatbox input dialog
chatboxPanelManager.openTextInput(String.format(NOTE_PROMPT_FORMAT, sanitizedTarget, CHARACTER_LIMIT))
.value(Strings.nullToEmpty(note))
.onDone((content) ->
{
if (content == null)
{
return;
}
content = Text.removeTags(content).trim();
log.debug("Set note for '{}': '{}'", sanitizedTarget, content);
setFriendNote(sanitizedTarget, content);
}).build();
}
}
}
@Subscribe
public void onNameableNameChanged(NameableNameChanged event)
{
@@ -1608,7 +1608,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
modelY = y + client.getCameraY2();
modelZ = z + client.getCameraZ2();
modelOrientation = orientation;
int triangleCount = model.getTrianglesCount();
int triangleCount = model.getFaceCount();
vertexBuffer.ensureCapacity(12 * triangleCount);
uvBuffer.ensureCapacity(12 * triangleCount);
@@ -1632,7 +1632,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
model.calculateExtreme(orientation);
client.checkClickbox(model, orientation, pitchSin, pitchCos, yawSin, yawCos, x, y, z, hash);
int tc = Math.min(MAX_TRIANGLE, model.getTrianglesCount());
int tc = Math.min(MAX_TRIANGLE, model.getFaceCount());
int uvOffset = model.getUvBufferOffset();
GpuIntBuffer b = bufferForTriangles(tc);
@@ -379,7 +379,7 @@ class SceneUploader
public int pushModel(Model model, GpuIntBuffer vertexBuffer, GpuFloatBuffer uvBuffer)
{
final int triangleCount = Math.min(model.getTrianglesCount(), GpuPlugin.MAX_TRIANGLE);
final int triangleCount = Math.min(model.getFaceCount(), GpuPlugin.MAX_TRIANGLE);
vertexBuffer.ensureCapacity(triangleCount * 12);
uvBuffer.ensureCapacity(triangleCount * 12);
@@ -388,20 +388,25 @@ class SceneUploader
final int[] vertexY = model.getVerticesY();
final int[] vertexZ = model.getVerticesZ();
final int[] trianglesX = model.getTrianglesX();
final int[] trianglesY = model.getTrianglesY();
final int[] trianglesZ = model.getTrianglesZ();
final int[] indices1 = model.getFaceIndices1();
final int[] indices2 = model.getFaceIndices2();
final int[] indices3 = model.getFaceIndices3();
final int[] color1s = model.getFaceColors1();
final int[] color2s = model.getFaceColors2();
final int[] color3s = model.getFaceColors3();
final byte[] transparencies = model.getTriangleTransparencies();
final byte[] transparencies = model.getFaceTransparencies();
final short[] faceTextures = model.getFaceTextures();
final byte[] facePriorities = model.getFaceRenderPriorities();
float[] uv = model.getFaceTextureUVCoordinates();
final byte overrideAmount = model.getOverrideAmount();
final byte overrideHue = model.getOverrideHue();
final byte overrideSat = model.getOverrideSaturation();
final byte overrideLum = model.getOverrideLuminance();
int len = 0;
for (int face = 0; face < triangleCount; ++face)
{
@@ -429,12 +434,22 @@ class SceneUploader
len += 3;
continue;
}
// HSL override is not applied to flat shade faces or to textured faces
else if (faceTextures == null || faceTextures[face] == -1)
{
if (overrideAmount > 0)
{
color1 = interpolateHSL(color1, overrideHue, overrideSat, overrideLum, overrideAmount);
color2 = interpolateHSL(color2, overrideHue, overrideSat, overrideLum, overrideAmount);
color3 = interpolateHSL(color3, overrideHue, overrideSat, overrideLum, overrideAmount);
}
}
int packAlphaPriority = packAlphaPriority(faceTextures, transparencies, facePriorities, face);
int triangleA = trianglesX[face];
int triangleB = trianglesY[face];
int triangleC = trianglesZ[face];
int triangleA = indices1[face];
int triangleB = indices2[face];
int triangleC = indices3[face];
vertexBuffer.put(vertexX[triangleA], vertexY[triangleA], vertexZ[triangleA], packAlphaPriority | color1);
vertexBuffer.put(vertexX[triangleB], vertexY[triangleB], vertexZ[triangleB], packAlphaPriority | color2);
@@ -458,26 +473,31 @@ class SceneUploader
final int[] vertexY = model.getVerticesY();
final int[] vertexZ = model.getVerticesZ();
final int[] trianglesX = model.getTrianglesX();
final int[] trianglesY = model.getTrianglesY();
final int[] trianglesZ = model.getTrianglesZ();
final int[] indices1 = model.getFaceIndices1();
final int[] indices2 = model.getFaceIndices2();
final int[] indices3 = model.getFaceIndices3();
final int[] color1s = model.getFaceColors1();
final int[] color2s = model.getFaceColors2();
final int[] color3s = model.getFaceColors3();
final byte[] transparencies = model.getTriangleTransparencies();
final byte[] transparencies = model.getFaceTransparencies();
final short[] faceTextures = model.getFaceTextures();
final byte[] facePriorities = model.getFaceRenderPriorities();
int triangleA = trianglesX[face];
int triangleB = trianglesY[face];
int triangleC = trianglesZ[face];
final int triangleA = indices1[face];
final int triangleB = indices2[face];
final int triangleC = indices3[face];
int color1 = color1s[face];
int color2 = color2s[face];
int color3 = color3s[face];
final byte overrideAmount = model.getOverrideAmount();
final byte overrideHue = model.getOverrideHue();
final byte overrideSat = model.getOverrideSaturation();
final byte overrideLum = model.getOverrideLuminance();
int packedAlphaPriority = packAlphaPriority(faceTextures, transparencies, facePriorities, face);
int sin = 0, cos = 0;
@@ -505,6 +525,16 @@ class SceneUploader
}
return 3;
}
// HSL override is not applied to flat shade faces or to textured faces
else if (faceTextures == null || faceTextures[face] == -1)
{
if (overrideAmount > 0)
{
color1 = interpolateHSL(color1, overrideHue, overrideSat, overrideLum, overrideAmount);
color2 = interpolateHSL(color2, overrideHue, overrideSat, overrideLum, overrideAmount);
color3 = interpolateHSL(color3, overrideHue, overrideSat, overrideLum, overrideAmount);
}
}
int a, b, c;
@@ -605,4 +635,28 @@ class SceneUploader
uvBuffer.put(0, 0, 0, 0);
}
}
private static int interpolateHSL(int hsl, byte hue2, byte sat2, byte lum2, byte lerp)
{
int hue = hsl >> 10 & 63;
int sat = hsl >> 7 & 7;
int lum = hsl & 127;
int var9 = lerp & 255;
if (hue2 != -1)
{
hue += var9 * (hue2 - hue) >> 7;
}
if (sat2 != -1)
{
sat += var9 * (sat2 - sat) >> 7;
}
if (lum2 != -1)
{
lum += var9 * (lum2 - lum) >> 7;
}
return (hue << 10 | sat << 7 | lum) & 65535;
}
}
@@ -66,6 +66,7 @@ import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.ScriptID;
import net.runelite.api.VarClientStr;
import net.runelite.api.VarPlayer;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.GameStateChanged;
@@ -74,7 +75,6 @@ import net.runelite.api.events.GrandExchangeSearched;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.events.ScriptPostFired;
import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
@@ -103,7 +103,6 @@ import net.runelite.client.util.Text;
import net.runelite.http.api.ge.GrandExchangeClient;
import net.runelite.http.api.ge.GrandExchangeTrade;
import net.runelite.http.api.item.ItemStats;
import net.runelite.http.api.osbuddy.OSBGrandExchangeClient;
import net.runelite.http.api.worlds.WorldType;
import okhttp3.OkHttpClient;
import org.apache.commons.lang3.time.DurationFormatUtils;
@@ -120,10 +119,9 @@ public class GrandExchangePlugin extends Plugin
@VisibleForTesting
static final int GE_SLOTS = 8;
private static final int GE_LOGIN_BURST_WINDOW = 2; // ticks
private static final int OFFER_CONTAINER_ITEM = 21;
private static final int OFFER_DEFAULT_ITEM_ID = 6512;
private static final int GE_MAX_EXAMINE_LEN = 100;
private static final String BUY_LIMIT_GE_TEXT = "<br>Buy limit: ";
private static final String BUY_LIMIT_GE_TEXT = "Buy limit: ";
private static final String BUY_LIMIT_KEY = "buylimit";
private static final Duration BUY_LIMIT_RESET = Duration.ofHours(4);
@@ -182,9 +180,6 @@ public class GrandExchangePlugin extends Plugin
@Inject
private RuneLiteConfig runeLiteConfig;
private Widget grandExchangeText;
private String grandExchangeExamine;
@Inject
private GrandExchangeClient grandExchangeClient;
private int lastLoginTick;
@@ -264,12 +259,6 @@ public class GrandExchangePlugin extends Plugin
return configManager.getConfig(GrandExchangeConfig.class);
}
@Provides
OSBGrandExchangeClient provideOsbGrandExchangeClient(OkHttpClient okHttpClient)
{
return new OSBGrandExchangeClient(okHttpClient);
}
@Provides
GrandExchangeClient provideGrandExchangeClient(OkHttpClient okHttpClient)
{
@@ -317,7 +306,6 @@ public class GrandExchangePlugin extends Plugin
clientToolbar.removeNavigation(button);
mouseManager.unregisterMouseListener(inputListener);
keyManager.unregisterKeyListener(inputListener);
grandExchangeText = null;
lastUsername = machineUuid = null;
tradeSeq = 0;
}
@@ -574,8 +562,7 @@ public class GrandExchangePlugin extends Plugin
case WidgetID.GRAND_EXCHANGE_INVENTORY_GROUP_ID:
case WidgetID.SHOP_INVENTORY_GROUP_ID:
menuEntry.setOption(SEARCH_GRAND_EXCHANGE);
menuEntry.setType(MenuAction.RUNELITE.getId());
client.setMenuEntries(entries);
menuEntry.setType(MenuAction.RUNELITE);
}
}
@@ -588,31 +575,10 @@ public class GrandExchangePlugin extends Plugin
}
}
@Subscribe
public void onWidgetLoaded(WidgetLoaded event)
{
switch (event.getGroupId())
{
// Grand exchange was opened.
case WidgetID.GRAND_EXCHANGE_GROUP_ID:
grandExchangeText = client.getWidget(WidgetInfo.GRAND_EXCHANGE_OFFER_TEXT);
break;
// Grand exchange was closed (if it was open before).
case WidgetID.INVENTORY_GROUP_ID:
grandExchangeText = null;
break;
}
}
@Subscribe
public void onScriptPostFired(ScriptPostFired event)
{
// GE offers setup init
if (event.getScriptId() == ScriptID.GE_OFFERS_SETUP_BUILD)
{
rebuildGeText();
}
else if (event.getScriptId() == ScriptID.GE_ITEM_SEARCH && config.highlightSearchMatch())
if (event.getScriptId() == ScriptID.GE_ITEM_SEARCH && config.highlightSearchMatch())
{
highlightSearchMatches();
}
@@ -739,7 +705,30 @@ public class GrandExchangePlugin extends Plugin
@Subscribe
public void onScriptCallbackEvent(ScriptCallbackEvent event)
{
if (!event.getEventName().equals("setGETitle") || !config.showTotal())
switch (event.getEventName())
{
case "setGETitle":
setGeTitle();
break;
case "geExamineText":
{
String[] stack = client.getStringStack();
int sz = client.getStringStackSize();
String fee = stack[sz - 2];
String examine = stack[sz - 3];
String text = setExamineText(examine, fee);
if (text != null)
{
stack[sz - 1] = text;
}
break;
}
}
}
private void setGeTitle()
{
if (!config.showTotal())
{
return;
}
@@ -818,39 +807,10 @@ public class GrandExchangePlugin extends Plugin
}
}
private void rebuildGeText()
private String setExamineText(String examine, String fee)
{
if (grandExchangeText == null)
{
return;
}
Widget grandExchangeOffer = client.getWidget(WidgetInfo.GRAND_EXCHANGE_OFFER_CONTAINER);
if (grandExchangeOffer == null)
{
return;
}
Widget grandExchangeItem = grandExchangeOffer.getChild(OFFER_CONTAINER_ITEM);
if (grandExchangeItem == null || grandExchangeItem.isHidden())
{
return;
}
final Widget geText = grandExchangeText;
final int itemId = grandExchangeItem.getItemId();
if (itemId == OFFER_DEFAULT_ITEM_ID || itemId == -1)
{
// This item is invalid/nothing has been searched for
return;
}
if (geText.getText() == grandExchangeExamine)
{
// if we've already set the text, don't set it again
return;
}
String text = geText.getText();
final int itemId = client.getVar(VarPlayer.CURRENT_GE_ITEM);
StringBuilder sb = new StringBuilder();
if (config.enableGELimits())
{
@@ -859,7 +819,7 @@ public class GrandExchangePlugin extends Plugin
// If we have item buy limit, append it
if (itemStats != null && itemStats.getGeLimit() > 0)
{
text += BUY_LIMIT_GE_TEXT + QuantityFormatter.formatNumber(itemStats.getGeLimit());
sb.append(BUY_LIMIT_GE_TEXT).append(QuantityFormatter.formatNumber(itemStats.getGeLimit()));
}
}
@@ -869,7 +829,7 @@ public class GrandExchangePlugin extends Plugin
if (resetTime != null)
{
Duration remaining = Duration.between(Instant.now(), resetTime);
text += " (" + DurationFormatUtils.formatDuration(remaining.toMillis(), "H:mm") + ")";
sb.append(" (").append(DurationFormatUtils.formatDuration(remaining.toMillis(), "H:mm")).append(")");
}
}
@@ -878,12 +838,41 @@ public class GrandExchangePlugin extends Plugin
final int price = itemManager.getItemPriceWithSource(itemId, true);
if (price > 0)
{
text += "<br>Actively traded price: " + QuantityFormatter.formatNumber(price);
if (sb.length() > 0)
{
sb.append(" / ");
}
sb.append("Actively traded price: ").append(QuantityFormatter.formatNumber(price));
}
}
grandExchangeExamine = text;
geText.setText(text);
if (sb.length() == 0)
{
return null;
}
return shortenExamine(examine) + "<br>" + sb + "<br>" + fee;
}
private static String shortenExamine(String examine)
{
int from = 0;
int idx;
while (true)
{
idx = examine.indexOf(' ', from);
if (idx == -1)
{
return examine;
}
if (idx > GE_MAX_EXAMINE_LEN && from > 0)
{
break; // use from
}
from = idx + 1;
}
return examine.substring(0, from - 1) + "...";
}
void openGeLink(String name, int itemId)
@@ -115,14 +115,6 @@ public class GroundItemsPlugin extends Plugin
static final int MAX_QUANTITY = 65535;
// ItemID for coins
private static final int COINS = ItemID.COINS_995;
// Ground item menu options
private static final int FIRST_OPTION = MenuAction.GROUND_ITEM_FIRST_OPTION.getId();
private static final int SECOND_OPTION = MenuAction.GROUND_ITEM_SECOND_OPTION.getId();
private static final int THIRD_OPTION = MenuAction.GROUND_ITEM_THIRD_OPTION.getId(); // this is Take
private static final int FOURTH_OPTION = MenuAction.GROUND_ITEM_FOURTH_OPTION.getId();
private static final int FIFTH_OPTION = MenuAction.GROUND_ITEM_FIFTH_OPTION.getId();
private static final int EXAMINE_ITEM = MenuAction.EXAMINE_ITEM_GROUND.getId();
private static final int CAST_ON_ITEM = MenuAction.SPELL_CAST_ON_GROUND_ITEM.getId();
private static final String TELEGRAB_TEXT = ColorUtil.wrapWithColorTag("Telekinetic Grab", Color.GREEN) + ColorUtil.prependColorTag(" -> ", Color.WHITE);
@@ -344,9 +336,10 @@ public class GroundItemsPlugin extends Plugin
{
MenuEntry menuEntry = menuEntries[i];
int menuType = menuEntry.getType();
if (menuType == FIRST_OPTION || menuType == SECOND_OPTION || menuType == THIRD_OPTION
|| menuType == FOURTH_OPTION || menuType == FIFTH_OPTION || menuType == EXAMINE_ITEM)
MenuAction menuType = menuEntry.getType();
if (menuType == MenuAction.GROUND_ITEM_FIRST_OPTION || menuType == MenuAction.GROUND_ITEM_SECOND_OPTION
|| menuType == MenuAction.GROUND_ITEM_THIRD_OPTION || menuType == MenuAction.GROUND_ITEM_FOURTH_OPTION
|| menuType == MenuAction.GROUND_ITEM_FIFTH_OPTION || menuType == MenuAction.SPELL_CAST_ON_GROUND_ITEM)
{
for (MenuEntryWithCount entryWCount : newEntries)
{
@@ -490,15 +483,15 @@ public class GroundItemsPlugin extends Plugin
{
if (config.itemHighlightMode() == ItemHighlightMode.MENU || config.itemHighlightMode() == ItemHighlightMode.BOTH)
{
final boolean telegrabEntry = event.getOption().equals("Cast") && event.getTarget().startsWith(TELEGRAB_TEXT) && event.getType() == CAST_ON_ITEM;
if (!(event.getOption().equals("Take") && event.getType() == THIRD_OPTION) && !telegrabEntry)
final boolean telegrabEntry = event.getOption().equals("Cast") && event.getTarget().startsWith(TELEGRAB_TEXT) && event.getType() == MenuAction.SPELL_CAST_ON_GROUND_ITEM.getId();
if (!(event.getOption().equals("Take") && event.getType() == MenuAction.GROUND_ITEM_THIRD_OPTION.getId()) && !telegrabEntry)
{
return;
}
final int itemId = event.getIdentifier();
final int sceneX = event.getActionParam0();
final int sceneY = event.getParam1();
final int sceneY = event.getActionParam1();
MenuEntry[] menuEntries = client.getMenuEntries();
MenuEntry lastEntry = menuEntries[menuEntries.length - 1];
@@ -548,8 +541,6 @@ public class GroundItemsPlugin extends Plugin
{
lastEntry.setTarget(lastEntry.getTarget() + " (" + quantity + ")");
}
client.setMenuEntries(menuEntries);
}
}
@@ -30,7 +30,6 @@ import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.google.inject.Provides;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
@@ -44,13 +43,11 @@ import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.KeyCode;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.Tile;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
@@ -243,48 +240,34 @@ public class GroundMarkerPlugin extends Plugin
final GroundMarkerPoint point = new GroundMarkerPoint(regionId, worldPoint.getRegionX(), worldPoint.getRegionY(), client.getPlane(), null, null);
final boolean exists = getPoints(regionId).contains(point);
MenuEntry[] menuEntries = client.getMenuEntries();
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + (exists ? 2 : 1));
MenuEntry mark = menuEntries[menuEntries.length - 1] = new MenuEntry();
mark.setOption(exists ? UNMARK : MARK);
mark.setTarget(event.getTarget());
mark.setType(MenuAction.RUNELITE.getId());
client.createMenuEntry(-1)
.setOption(exists ? UNMARK : MARK)
.setTarget(event.getTarget())
.setType(MenuAction.RUNELITE)
.onClick(e ->
{
Tile target = client.getSelectedSceneTile();
if (target != null)
{
markTile(target.getLocalLocation());
}
});
if (exists)
{
MenuEntry label = menuEntries[menuEntries.length - 2] = new MenuEntry();
label.setOption(LABEL);
label.setTarget(event.getTarget());
label.setType(MenuAction.RUNELITE.getId());
client.createMenuEntry(-2)
.setOption(LABEL)
.setTarget(event.getTarget())
.setType(MenuAction.RUNELITE)
.onClick(e ->
{
Tile target = client.getSelectedSceneTile();
if (target != null)
{
labelTile(target);
}
});
}
client.setMenuEntries(menuEntries);
}
}
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event)
{
if (event.getMenuAction().getId() != MenuAction.RUNELITE.getId())
{
return;
}
Tile target = client.getSelectedSceneTile();
if (target == null)
{
return;
}
final String option = event.getMenuOption();
if (option.equals(MARK) || option.equals(UNMARK))
{
markTile(target.getLocalLocation());
}
else if (option.equals(LABEL))
{
labelTile(target);
}
}
@@ -45,11 +45,10 @@ import javax.inject.Inject;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.events.WidgetMenuOptionClicked;
import net.runelite.api.MenuEntry;
import static net.runelite.api.widgets.WidgetInfo.MINIMAP_WORLDMAP_OPTIONS;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.menus.MenuManager;
import net.runelite.client.menus.WidgetMenuOption;
@@ -82,13 +81,13 @@ class GroundMarkerSharingManager
void addImportExportMenuOptions()
{
menuManager.addManagedCustomMenu(EXPORT_MARKERS_OPTION);
menuManager.addManagedCustomMenu(IMPORT_MARKERS_OPTION);
menuManager.addManagedCustomMenu(EXPORT_MARKERS_OPTION, this::exportGroundMarkers);
menuManager.addManagedCustomMenu(IMPORT_MARKERS_OPTION, this::promptForImport);
}
void addClearMenuOption()
{
menuManager.addManagedCustomMenu(CLEAR_MARKERS_OPTION);
menuManager.addManagedCustomMenu(CLEAR_MARKERS_OPTION, this::promptForClear);
}
void removeMenuOptions()
@@ -98,36 +97,7 @@ class GroundMarkerSharingManager
menuManager.removeManagedCustomMenu(CLEAR_MARKERS_OPTION);
}
private boolean widgetMenuClickedEquals(final WidgetMenuOptionClicked event, final WidgetMenuOption target)
{
return event.getMenuTarget().equals(target.getMenuTarget()) &&
event.getMenuOption().equals(target.getMenuOption());
}
@Subscribe
public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{
// ensure that the option clicked is the export markers option
if (event.getWidget() != MINIMAP_WORLDMAP_OPTIONS)
{
return;
}
if (widgetMenuClickedEquals(event, EXPORT_MARKERS_OPTION))
{
exportGroundMarkers();
}
else if (widgetMenuClickedEquals(event, IMPORT_MARKERS_OPTION))
{
promptForImport();
}
else if (widgetMenuClickedEquals(event, CLEAR_MARKERS_OPTION))
{
promptForClear();
}
}
private void exportGroundMarkers()
private void exportGroundMarkers(MenuEntry menuEntry)
{
int[] regions = client.getMapRegions();
if (regions == null)
@@ -156,7 +126,7 @@ class GroundMarkerSharingManager
sendChatMessage(activePoints.size() + " ground markers were copied to your clipboard.");
}
private void promptForImport()
private void promptForImport(MenuEntry menuEntry)
{
final String clipboardText;
try
@@ -244,7 +214,7 @@ class GroundMarkerSharingManager
sendChatMessage(importPoints.size() + " ground markers were imported from the clipboard.");
}
private void promptForClear()
private void promptForClear(MenuEntry entry)
{
int[] regions = client.getMapRegions();
if (regions == null)
@@ -61,13 +61,13 @@ import net.runelite.client.ui.components.materialtabs.MaterialTab;
import net.runelite.client.ui.components.materialtabs.MaterialTabGroup;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.QuantityFormatter;
import net.runelite.http.api.hiscore.HiscoreClient;
import net.runelite.http.api.hiscore.HiscoreEndpoint;
import net.runelite.http.api.hiscore.HiscoreResult;
import net.runelite.http.api.hiscore.HiscoreSkill;
import static net.runelite.http.api.hiscore.HiscoreSkill.*;
import net.runelite.http.api.hiscore.HiscoreSkillType;
import net.runelite.http.api.hiscore.Skill;
import net.runelite.client.hiscore.HiscoreClient;
import net.runelite.client.hiscore.HiscoreEndpoint;
import net.runelite.client.hiscore.HiscoreResult;
import net.runelite.client.hiscore.HiscoreSkill;
import static net.runelite.client.hiscore.HiscoreSkill.*;
import net.runelite.client.hiscore.HiscoreSkillType;
import net.runelite.client.hiscore.Skill;
import okhttp3.OkHttpClient;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
@@ -105,13 +105,13 @@ public class HiscorePanel extends PluginPanel
GIANT_MOLE, GROTESQUE_GUARDIANS, HESPORI,
KALPHITE_QUEEN, KING_BLACK_DRAGON, KRAKEN,
KREEARRA, KRIL_TSUTSAROTH, MIMIC,
NIGHTMARE, PHOSANIS_NIGHTMARE, OBOR, SARACHNIS,
SCORPIA, SKOTIZO, TEMPOROSS,
THE_GAUNTLET, THE_CORRUPTED_GAUNTLET, THEATRE_OF_BLOOD,
THEATRE_OF_BLOOD_HARD_MODE, THERMONUCLEAR_SMOKE_DEVIL, TZKAL_ZUK,
TZTOK_JAD, VENENATIS, VETION,
VORKATH, WINTERTODT, ZALCANO,
ZULRAH
NEX, NIGHTMARE, PHOSANIS_NIGHTMARE,
OBOR, SARACHNIS, SCORPIA,
SKOTIZO, TEMPOROSS, THE_GAUNTLET,
THE_CORRUPTED_GAUNTLET, THEATRE_OF_BLOOD, THEATRE_OF_BLOOD_HARD_MODE,
THERMONUCLEAR_SMOKE_DEVIL, TZKAL_ZUK, TZTOK_JAD,
VENENATIS, VETION, VORKATH,
WINTERTODT, ZALCANO, ZULRAH
);
private static final HiscoreEndpoint[] ENDPOINTS = {
@@ -24,7 +24,6 @@
*/
package net.runelite.client.plugins.hiscore;
import com.google.common.collect.ObjectArrays;
import com.google.inject.Provides;
import java.awt.image.BufferedImage;
import java.util.EnumSet;
@@ -39,7 +38,6 @@ import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.IconID;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.Player;
import net.runelite.api.WorldType;
import net.runelite.api.events.ChatMessage;
@@ -58,8 +56,7 @@ import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.Text;
import net.runelite.http.api.hiscore.HiscoreEndpoint;
import org.apache.commons.lang3.ArrayUtils;
import net.runelite.client.hiscore.HiscoreEndpoint;
@PluginDescriptor(
name = "HiScore",
@@ -169,46 +166,37 @@ public class HiscorePlugin extends Plugin
|| groupId == WidgetID.GROUP_IRON_GROUP_ID && (option.equals("Add friend") || option.equals("Remove friend") || option.equals("Remove ignore"))
)
{
final MenuEntry lookup = new MenuEntry();
lookup.setOption(LOOKUP);
lookup.setTarget(event.getTarget());
lookup.setType(MenuAction.RUNELITE.getId());
lookup.setParam0(event.getActionParam0());
lookup.setParam1(event.getActionParam1());
lookup.setIdentifier(event.getIdentifier());
insertMenuEntry(lookup, client.getMenuEntries());
client.createMenuEntry(-2)
.setOption(LOOKUP)
.setTarget(event.getTarget())
.setType(MenuAction.RUNELITE)
.setIdentifier(event.getIdentifier())
.onClick(e ->
{
// Determine proper endpoint from player name.
// TODO: look at target's world and determine if tournament/dmm endpoint should be used instead.
HiscoreEndpoint endpoint = findHiscoreEndpointFromPlayerName(e.getTarget());
String target = Text.removeTags(e.getTarget());
lookupPlayer(target, endpoint);
});
}
}
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event)
{
if ((event.getMenuAction() == MenuAction.RUNELITE || event.getMenuAction() == MenuAction.RUNELITE_PLAYER)
&& event.getMenuOption().equals(LOOKUP))
if (event.getMenuAction() == MenuAction.RUNELITE_PLAYER && event.getMenuOption().equals(LOOKUP))
{
final String target;
HiscoreEndpoint endpoint;
if (event.getMenuAction() == MenuAction.RUNELITE_PLAYER)
// The player id is included in the event, so we can use that to get the player name,
// which avoids having to parse out the combat level and any icons preceding the name.
Player player = client.getCachedPlayers()[event.getId()];
if (player == null)
{
// The player id is included in the event, so we can use that to get the player name,
// which avoids having to parse out the combat level and any icons preceding the name.
Player player = client.getCachedPlayers()[event.getId()];
if (player == null)
{
return;
}
return;
}
endpoint = getWorldEndpoint();
target = player.getName();
}
else
{
// Determine proper endpoint from player name.
// TODO: look at target's world and determine if tournament/dmm endpoint should be used instead.
endpoint = findHiscoreEndpointFromPlayerName(event.getMenuTarget());
target = Text.removeTags(event.getMenuTarget());
}
String target = player.getName();
HiscoreEndpoint endpoint = getWorldEndpoint();
lookupPlayer(target, endpoint);
}
@@ -236,14 +224,6 @@ public class HiscorePlugin extends Plugin
localHiscoreEndpoint = findHiscoreEndpointFromLocalPlayer();
}
private void insertMenuEntry(MenuEntry newEntry, MenuEntry[] entries)
{
MenuEntry[] newMenu = ObjectArrays.concat(entries, newEntry);
int menuEntryCount = newMenu.length;
ArrayUtils.swap(newMenu, menuEntryCount - 1, menuEntryCount - 2);
client.setMenuEntries(newMenu);
}
private void lookupPlayer(String playerName, HiscoreEndpoint endpoint)
{
SwingUtilities.invokeLater(() ->
@@ -242,6 +242,7 @@ class NameAutocompleter implements KeyListener
autocompleteName = Arrays.stream(cachedPlayers)
.filter(Objects::nonNull)
.map(Player::getName)
.filter(Objects::nonNull)
.filter(n -> pattern.matcher(n).matches())
.findFirst();
}
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.instancemap;
import com.google.inject.Binder;
import javax.inject.Inject;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.WidgetMenuOptionClicked;
import static net.runelite.api.widgets.WidgetInfo.MINIMAP_WORLDMAP_OPTIONS;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.input.KeyManager;
@@ -72,7 +71,17 @@ public class InstanceMapPlugin extends Plugin
private void addCustomOptions()
{
menuManager.addManagedCustomMenu(openMapOption);
menuManager.addManagedCustomMenu(openMapOption, entry ->
{
if (overlay.isMapShown())
{
closeMap();
}
else
{
showMap();
}
});
}
private void removeCustomOptions()
@@ -107,32 +116,6 @@ public class InstanceMapPlugin extends Plugin
overlay.onGameStateChange(event);
}
private boolean clickedOptionEquals(WidgetMenuOptionClicked event, WidgetMenuOption widgetMenuOption)
{
return event.getMenuOption().equals(widgetMenuOption.getMenuOption()) && event.getMenuTarget().equals(widgetMenuOption.getMenuTarget());
}
@Subscribe
public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{
if (event.getWidget() != MINIMAP_WORLDMAP_OPTIONS)
{
return;
}
if (clickedOptionEquals(event, openMapOption))
{
if (overlay.isMapShown())
{
closeMap();
}
else
{
showMap();
}
}
}
public void showMap()
{
overlay.setShowMap(true);
@@ -79,7 +79,7 @@ class InteractHighlightOverlay extends Overlay
}
MenuEntry top = menuEntries[menuEntries.length - 1];
MenuAction menuAction = MenuAction.of(top.getType());
MenuAction menuAction = top.getType();
switch (menuAction)
{
@@ -28,14 +28,13 @@ import com.google.common.base.MoreObjects;
import com.google.common.collect.ImmutableList;
import com.google.inject.Provides;
import java.awt.Color;
import java.util.Arrays;
import java.util.List;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.MenuAction;
import net.runelite.api.MenuEntry;
import net.runelite.api.events.MenuOpened;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.WidgetMenuOptionClicked;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
@@ -46,7 +45,6 @@ import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.ColorUtil;
import net.runelite.client.util.Text;
@PluginDescriptor(
name = "Inventory Tags",
@@ -157,44 +155,11 @@ public class InventoryTagsPlugin extends Plugin
}
}
@Subscribe
public void onWidgetMenuOptionClicked(final WidgetMenuOptionClicked event)
{
if (event.getWidget() == WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB
|| event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB
|| event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB)
{
editorMode = event.getMenuOption().equals(CONFIGURE) && Text.removeTags(event.getMenuTarget()).equals(MENU_TARGET);
refreshInventoryMenuOptions();
}
}
@Subscribe
public void onMenuOptionClicked(final MenuOptionClicked event)
{
if (event.getMenuAction() != MenuAction.RUNELITE)
{
return;
}
final String selectedMenu = Text.removeTags(event.getMenuTarget());
if (event.getMenuOption().equals(MENU_SET))
{
setTag(event.getId(), selectedMenu);
}
else if (event.getMenuOption().equals(MENU_REMOVE))
{
unsetTag(event.getId());
}
}
@Subscribe
public void onMenuOpened(final MenuOpened event)
{
final MenuEntry firstEntry = event.getFirstEntry();
if (firstEntry == null)
if (firstEntry == null || !editorMode)
{
return;
}
@@ -202,7 +167,7 @@ public class InventoryTagsPlugin extends Plugin
final int widgetId = firstEntry.getParam1();
// Inventory item menu
if (widgetId == WidgetInfo.INVENTORY.getId() && editorMode)
if (widgetId == WidgetInfo.INVENTORY.getId())
{
int itemId = firstEntry.getIdentifier();
@@ -211,26 +176,30 @@ public class InventoryTagsPlugin extends Plugin
return;
}
MenuEntry[] menuList = new MenuEntry[GROUPS.size() + 1];
int num = 0;
// preserve the 'Cancel' option as the client will reuse the first entry for Cancel and only resets option/action
menuList[num++] = event.getMenuEntries()[0];
// Set menu to only be Cancel
client.setMenuEntries(Arrays.copyOf(client.getMenuEntries(), 1));
for (final String groupName : GROUPS)
{
final String group = getTag(itemId);
final MenuEntry newMenu = new MenuEntry();
final Color color = getGroupNameColor(groupName);
newMenu.setOption(groupName.equals(group) ? MENU_REMOVE : MENU_SET);
newMenu.setTarget(ColorUtil.prependColorTag(groupName, MoreObjects.firstNonNull(color, Color.WHITE)));
newMenu.setIdentifier(itemId);
newMenu.setParam1(widgetId);
newMenu.setType(MenuAction.RUNELITE.getId());
menuList[num++] = newMenu;
}
client.setMenuEntries(menuList);
client.createMenuEntry(-1)
.setOption(groupName.equals(group) ? MENU_REMOVE : MENU_SET)
.setTarget(ColorUtil.prependColorTag(groupName, MoreObjects.firstNonNull(color, Color.WHITE)))
.setType(MenuAction.RUNELITE)
.onClick(e ->
{
if (e.getOption().equals(MENU_SET))
{
setTag(itemId, groupName);
}
else
{
unsetTag(itemId);
}
});
}
}
}
@@ -270,15 +239,27 @@ public class InventoryTagsPlugin extends Plugin
removeInventoryMenuOptions();
if (editorMode)
{
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_SAVE);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_SAVE);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE);
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_SAVE, this::save);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_SAVE, this::save);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE, this::save);
}
else
{
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_CONFIGURE);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_CONFIGURE);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE);
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_CONFIGURE, this::configure);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_CONFIGURE, this::configure);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE, this::configure);
}
}
private void save(MenuEntry menuEntry)
{
editorMode = false;
refreshInventoryMenuOptions();
}
private void configure(MenuEntry menuEntry)
{
editorMode = true;
refreshInventoryMenuOptions();
}
}
@@ -90,7 +90,7 @@ class ItemPricesOverlay extends Overlay
}
final MenuEntry menuEntry = menuEntries[last];
final MenuAction action = MenuAction.of(menuEntry.getType());
final MenuAction action = menuEntry.getType();
final int widgetId = menuEntry.getParam1();
final int groupId = WidgetInfo.TO_GROUP(widgetId);
final boolean isAlching = menuEntry.getOption().equals("Cast") && menuEntry.getTarget().contains("High Level Alchemy");
@@ -56,7 +56,6 @@ import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOpened;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.PostItemComposition;
import net.runelite.api.events.WidgetMenuOptionClicked;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.callback.ClientThread;
@@ -75,7 +74,6 @@ import static net.runelite.client.plugins.menuentryswapper.MenuEntrySwapperConfi
import static net.runelite.client.plugins.menuentryswapper.MenuEntrySwapperConfig.MorytaniaLegsMode;
import static net.runelite.client.plugins.menuentryswapper.MenuEntrySwapperConfig.RadasBlessingMode;
import net.runelite.client.util.Text;
import org.apache.commons.lang3.ArrayUtils;
@PluginDescriptor(
name = "Menu Entry Swapper",
@@ -516,24 +514,6 @@ public class MenuEntrySwapperPlugin extends Plugin
clientThread.invoke(this::resetItemCompositionCache);
}
@Subscribe
public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
{
if (event.getWidget() == WidgetInfo.FIXED_VIEWPORT_INVENTORY_TAB
|| event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_TAB
|| event.getWidget() == WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_TAB)
{
String option = event.getMenuOption();
String target = Text.removeTags(event.getMenuTarget());
if ((option.equals(CONFIGURE) || option.equals(SAVE)) && (target.equals(LEFT_CLICK_MENU_TARGET) || target.equals(SHIFT_CLICK_MENU_TARGET)))
{
configuringShiftClick = option.equals(CONFIGURE) && target.equals(SHIFT_CLICK_MENU_TARGET);
configuringLeftClick = option.equals(CONFIGURE) && target.equals(LEFT_CLICK_MENU_TARGET);
rebuildCustomizationMenus();
}
}
}
@Subscribe
public void onMenuOpened(MenuOpened event)
{
@@ -601,11 +581,11 @@ public class MenuEntrySwapperPlugin extends Plugin
for (MenuEntry entry : entries)
{
final MenuAction menuAction = MenuAction.of(entry.getType());
final MenuAction menuAction = entry.getType();
if (ITEM_MENU_TYPES.contains(menuAction) && entry.getIdentifier() == itemId)
{
entry.setType(MenuAction.RUNELITE.getId());
entry.setType(MenuAction.RUNELITE);
if (activeAction == menuAction)
{
@@ -614,13 +594,11 @@ public class MenuEntrySwapperPlugin extends Plugin
}
}
final MenuEntry resetShiftClickEntry = new MenuEntry();
resetShiftClickEntry.setOption(RESET);
resetShiftClickEntry.setTarget(configuringShiftClick ? SHIFT_CLICK_MENU_TARGET : LEFT_CLICK_MENU_TARGET);
resetShiftClickEntry.setIdentifier(itemId);
resetShiftClickEntry.setParam1(widgetId);
resetShiftClickEntry.setType(MenuAction.RUNELITE.getId());
client.setMenuEntries(ArrayUtils.addAll(entries, resetShiftClickEntry));
client.createMenuEntry(-1)
.setOption(RESET)
.setTarget(configuringShiftClick ? SHIFT_CLICK_MENU_TARGET : LEFT_CLICK_MENU_TARGET)
.setType(MenuAction.RUNELITE)
.onClick(e -> unsetSwapConfig(configuringShiftClick, itemId));
}
@Subscribe
@@ -646,8 +624,8 @@ public class MenuEntrySwapperPlugin extends Plugin
final int opId = isDepositBoxPlayerInventory ? shiftDepositMode.getIdentifierDepositBox()
: isChambersOfXericStorageUnitPlayerInventory ? shiftDepositMode.getIdentifierChambersStorageUnit()
: shiftDepositMode.getIdentifier();
final int actionId = opId >= 6 ? MenuAction.CC_OP_LOW_PRIORITY.getId() : MenuAction.CC_OP.getId();
bankModeSwap(actionId, opId);
final MenuAction action = opId >= 6 ? MenuAction.CC_OP_LOW_PRIORITY : MenuAction.CC_OP;
bankModeSwap(action, opId);
}
// Swap to shift-click withdraw behavior
@@ -657,22 +635,23 @@ public class MenuEntrySwapperPlugin extends Plugin
&& menuEntryAdded.getOption().startsWith("Withdraw"))
{
ShiftWithdrawMode shiftWithdrawMode = config.bankWithdrawShiftClick();
final int actionId, opId;
final MenuAction action;
final int opId;
if (widgetGroupId == WidgetID.CHAMBERS_OF_XERIC_STORAGE_UNIT_PRIVATE_GROUP_ID || widgetGroupId == WidgetID.CHAMBERS_OF_XERIC_STORAGE_UNIT_SHARED_GROUP_ID)
{
actionId = MenuAction.CC_OP.getId();
action = MenuAction.CC_OP;
opId = shiftWithdrawMode.getIdentifierChambersStorageUnit();
}
else
{
actionId = shiftWithdrawMode.getMenuAction().getId();
action = shiftWithdrawMode.getMenuAction();
opId = shiftWithdrawMode.getIdentifier();
}
bankModeSwap(actionId, opId);
bankModeSwap(action, opId);
}
}
private void bankModeSwap(int entryTypeId, int entryIdentifier)
private void bankModeSwap(MenuAction entryType, int entryIdentifier)
{
MenuEntry[] menuEntries = client.getMenuEntries();
@@ -680,10 +659,10 @@ public class MenuEntrySwapperPlugin extends Plugin
{
MenuEntry entry = menuEntries[i];
if (entry.getType() == entryTypeId && entry.getIdentifier() == entryIdentifier)
if (entry.getType() == entryType && entry.getIdentifier() == entryIdentifier)
{
// Raise the priority of the op so it doesn't get sorted later
entry.setType(MenuAction.CC_OP.getId());
entry.setType(MenuAction.CC_OP);
menuEntries[i] = menuEntries[menuEntries.length - 1];
menuEntries[menuEntries.length - 1] = entry;
@@ -713,17 +692,6 @@ public class MenuEntrySwapperPlugin extends Plugin
String target = event.getMenuTarget();
ItemComposition itemComposition = itemManager.getItemComposition(itemId);
if (option.equals(RESET) && target.equals(SHIFT_CLICK_MENU_TARGET))
{
unsetSwapConfig(true, itemId);
return;
}
if (option.equals(RESET) && target.equals(LEFT_CLICK_MENU_TARGET))
{
unsetSwapConfig(false, itemId);
return;
}
if (!itemComposition.getName().equals(Text.removeTags(target)))
{
return;
@@ -751,7 +719,7 @@ public class MenuEntrySwapperPlugin extends Plugin
private void swapMenuEntry(MenuEntry[] menuEntries, int index, MenuEntry menuEntry)
{
final int eventId = menuEntry.getIdentifier();
final MenuAction menuAction = MenuAction.of(menuEntry.getType());
final MenuAction menuAction = menuEntry.getType();
final String option = Text.removeTags(menuEntry.getOption()).toLowerCase();
final String target = Text.removeTags(menuEntry.getTarget()).toLowerCase();
final NPC hintArrowNpc = client.getHintArrowNpc();
@@ -978,31 +946,31 @@ public class MenuEntrySwapperPlugin extends Plugin
removeCusomizationMenus();
if (configuringLeftClick)
{
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_SAVE_LC);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE_LC);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_SAVE_LC);
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_SAVE_LC, this::save);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE_LC, this::save);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_SAVE_LC, this::save);
}
else if (configuringShiftClick)
{
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_SAVE_SC);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE_SC);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_SAVE_SC);
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_SAVE_SC, this::save);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_SAVE_SC, this::save);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_SAVE_SC, this::save);
}
else
{
// Left click
if (config.leftClickCustomization())
{
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_CONFIGURE_LC);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE_LC);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_CONFIGURE_LC);
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_CONFIGURE_LC, this::configure);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE_LC, this::configure);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_CONFIGURE_LC, this::configure);
}
// Shift click
if (config.shiftClickCustomization())
{
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_CONFIGURE_SC);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE_SC);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_CONFIGURE_SC);
menuManager.addManagedCustomMenu(FIXED_INVENTORY_TAB_CONFIGURE_SC, this::configure);
menuManager.addManagedCustomMenu(RESIZABLE_BOTTOM_LINE_INVENTORY_TAB_CONFIGURE_SC, this::configure);
menuManager.addManagedCustomMenu(RESIZABLE_INVENTORY_TAB_CONFIGURE_SC, this::configure);
}
}
}
@@ -1011,4 +979,18 @@ public class MenuEntrySwapperPlugin extends Plugin
{
return client.isKeyPressed(KeyCode.KC_SHIFT);
}
private void save(MenuEntry menuEntry)
{
configuringLeftClick = configuringShiftClick = false;
rebuildCustomizationMenus();
}
private void configure(MenuEntry menuEntry)
{
String target = Text.removeTags(menuEntry.getTarget());
configuringShiftClick = target.equals(SHIFT_CLICK_MENU_TARGET);
configuringLeftClick = target.equals(LEFT_CLICK_MENU_TARGET);
rebuildCustomizationMenus();
}
}
@@ -108,7 +108,7 @@ class MouseHighlightOverlay extends Overlay
MenuEntry menuEntry = menuEntries[last];
String target = menuEntry.getTarget();
String option = menuEntry.getOption();
MenuAction type = MenuAction.of(menuEntry.getType());
MenuAction type = menuEntry.getType();
if (type == MenuAction.RUNELITE_OVERLAY || type == MenuAction.CC_OP_LOW_PRIORITY)
{
@@ -91,13 +91,6 @@ class NightmareZoneOverlay extends OverlayPanel
return null;
}
Widget nmzWidget = client.getWidget(WidgetInfo.NIGHTMARE_ZONE);
if (nmzWidget != null)
{
nmzWidget.setHidden(true);
}
renderAbsorptionCounter();
final int currentPoints = client.getVar(Varbits.NMZ_POINTS);
@@ -33,6 +33,7 @@ import lombok.Getter;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.Varbits;
import net.runelite.api.events.BeforeRender;
import net.runelite.api.events.ChatMessage;
import net.runelite.client.events.ConfigChanged;
import net.runelite.api.events.GameTick;
@@ -121,6 +122,21 @@ public class NightmareZonePlugin extends Plugin
return configManager.getConfig(NightmareZoneConfig.class);
}
@Subscribe
public void onBeforeRender(BeforeRender beforeRender)
{
if (!isInNightmareZone() || !config.moveOverlay())
{
return;
}
Widget nmzWidget = client.getWidget(WidgetInfo.NIGHTMARE_ZONE);
if (nmzWidget != null)
{
nmzWidget.setHidden(true);
}
}
@Subscribe
public void onGameTick(GameTick event)
{
@@ -31,7 +31,6 @@ import com.google.inject.Provides;
import java.awt.Color;
import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
@@ -57,7 +56,6 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.GraphicsObjectCreated;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.NpcChanged;
import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.NpcSpawned;
@@ -271,7 +269,6 @@ public class NpcIndicatorsPlugin extends Plugin
final MenuEntry menuEntry = menuEntries[menuEntries.length - 1];
final String target = ColorUtil.prependColorTag(Text.removeTags(event.getTarget()), color);
menuEntry.setTarget(target);
client.setMenuEntries(menuEntries);
}
}
else if (menuAction == MenuAction.EXAMINE_NPC && client.isKeyPressed(KeyCode.KC_SHIFT))
@@ -291,48 +288,29 @@ public class NpcIndicatorsPlugin extends Plugin
.filter(highlight -> !highlight.equalsIgnoreCase(npcName))
.anyMatch(highlight -> WildcardMatcher.matches(highlight, npcName));
MenuEntry[] menuEntries = client.getMenuEntries();
// Only add Untag-All option to npcs not highlighted by a wildcard entry, because untag-all will not remove wildcards
if (!matchesList)
{
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 2);
final MenuEntry tagAllEntry = menuEntries[menuEntries.length - 2] = new MenuEntry();
tagAllEntry.setOption(highlights.stream().anyMatch(npcName::equalsIgnoreCase) ? UNTAG_ALL : TAG_ALL);
tagAllEntry.setTarget(event.getTarget());
tagAllEntry.setParam0(event.getActionParam0());
tagAllEntry.setParam1(event.getParam1());
tagAllEntry.setIdentifier(event.getIdentifier());
tagAllEntry.setType(MenuAction.RUNELITE.getId());
}
else
{
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
client.createMenuEntry(-1)
.setOption(highlights.stream().anyMatch(npcName::equalsIgnoreCase) ? UNTAG_ALL : TAG_ALL)
.setTarget(event.getTarget())
.setIdentifier(event.getIdentifier())
.setType(MenuAction.RUNELITE)
.onClick(this::tag);
}
final MenuEntry tagEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
tagEntry.setOption(npcTags.contains(npc.getIndex()) ? UNTAG : TAG);
tagEntry.setTarget(event.getTarget());
tagEntry.setParam0(event.getActionParam0());
tagEntry.setParam1(event.getParam1());
tagEntry.setIdentifier(event.getIdentifier());
tagEntry.setType(MenuAction.RUNELITE.getId());
client.setMenuEntries(menuEntries);
MenuEntry i = client.createMenuEntry(-1)
.setOption(npcTags.contains(npc.getIndex()) ? UNTAG : TAG)
.setTarget(event.getTarget())
.setIdentifier(event.getIdentifier())
.setType(MenuAction.RUNELITE)
.onClick(this::tag);
}
}
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked click)
private void tag(MenuEntry entry)
{
if (click.getMenuAction() != MenuAction.RUNELITE ||
!(click.getMenuOption().equals(TAG) || click.getMenuOption().equals(UNTAG) ||
click.getMenuOption().equals(TAG_ALL) || click.getMenuOption().equals(UNTAG_ALL)))
{
return;
}
final int id = click.getId();
final int id = entry.getIdentifier();
final NPC[] cachedNPCs = client.getCachedNPCs();
final NPC npc = cachedNPCs[id];
@@ -341,7 +319,7 @@ public class NpcIndicatorsPlugin extends Plugin
return;
}
if (click.getMenuOption().equals(TAG) || click.getMenuOption().equals(UNTAG))
if (entry.getOption().equals(TAG) || entry.getOption().equals(UNTAG))
{
final boolean removed = npcTags.remove(id);
@@ -371,8 +349,6 @@ public class NpcIndicatorsPlugin extends Plugin
// this trips a config change which triggers the overlay rebuild
updateNpcsToHighlight(name);
}
click.consume();
}
@Subscribe
@@ -31,7 +31,6 @@ import com.google.gson.reflect.TypeToken;
import com.google.inject.Provides;
import java.awt.Color;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -65,7 +64,6 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GroundObjectDespawned;
import net.runelite.api.events.GroundObjectSpawned;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.WallObjectChanged;
import net.runelite.api.events.WallObjectDespawned;
import net.runelite.api.events.WallObjectSpawned;
@@ -222,7 +220,7 @@ public class ObjectIndicatorsPlugin extends Plugin
return;
}
final Tile tile = client.getScene().getTiles()[client.getPlane()][event.getActionParam0()][event.getParam1()];
final Tile tile = client.getScene().getTiles()[client.getPlane()][event.getActionParam0()][event.getActionParam1()];
final TileObject tileObject = findTileObject(tile, event.getIdentifier());
if (tileObject == null)
@@ -230,35 +228,26 @@ public class ObjectIndicatorsPlugin extends Plugin
return;
}
MenuEntry[] menuEntries = client.getMenuEntries();
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
menuEntry.setOption(objects.stream().anyMatch(o -> o.getTileObject() == tileObject) ? UNMARK : MARK);
menuEntry.setTarget(event.getTarget());
menuEntry.setParam0(event.getActionParam0());
menuEntry.setParam1(event.getParam1());
menuEntry.setIdentifier(event.getIdentifier());
menuEntry.setType(MenuAction.RUNELITE.getId());
client.setMenuEntries(menuEntries);
client.createMenuEntry(-1)
.setOption(objects.stream().anyMatch(o -> o.getTileObject() == tileObject) ? UNMARK : MARK)
.setTarget(event.getTarget())
.setParam0(event.getActionParam0())
.setParam1(event.getActionParam1())
.setIdentifier(event.getIdentifier())
.setType(MenuAction.RUNELITE)
.onClick(this::markObject);
}
@Subscribe
public void onMenuOptionClicked(MenuOptionClicked event)
private void markObject(MenuEntry entry)
{
if (event.getMenuAction() != MenuAction.RUNELITE
|| !(event.getMenuOption().equals(MARK) || event.getMenuOption().equals(UNMARK)))
{
return;
}
Scene scene = client.getScene();
Tile[][][] tiles = scene.getTiles();
final int x = event.getParam0();
final int y = event.getParam1();
final int x = entry.getParam0();
final int y = entry.getParam1();
final int z = client.getPlane();
final Tile tile = tiles[z][x][y];
TileObject object = findTileObject(tile, event.getId());
TileObject object = findTileObject(tile, entry.getIdentifier());
if (object == null)
{
return;
@@ -42,7 +42,7 @@ import net.runelite.api.ParamID;
import net.runelite.api.Player;
import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.client.game.HiscoreManager;
import net.runelite.client.hiscore.HiscoreManager;
import net.runelite.client.game.NPCManager;
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
import net.runelite.client.ui.overlay.OverlayMenuEntry;
@@ -53,7 +53,7 @@ import net.runelite.client.ui.overlay.components.ComponentConstants;
import net.runelite.client.ui.overlay.components.ProgressBarComponent;
import net.runelite.client.ui.overlay.components.TitleComponent;
import net.runelite.client.util.Text;
import net.runelite.http.api.hiscore.HiscoreResult;
import net.runelite.client.hiscore.HiscoreResult;
class OpponentInfoOverlay extends OverlayPanel
{
@@ -49,7 +49,7 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.http.api.hiscore.HiscoreEndpoint;
import net.runelite.client.hiscore.HiscoreEndpoint;
@PluginDescriptor(
name = "Opponent Information",
@@ -184,7 +184,6 @@ public class OpponentInfoPlugin extends Plugin
{
MenuEntry[] menuEntries = client.getMenuEntries();
menuEntries[menuEntries.length - 1].setTarget("*" + menuEntries[menuEntries.length - 1].getTarget());
client.setMenuEntries(menuEntries);
}
}
}
@@ -34,7 +34,7 @@ import net.runelite.api.Client;
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
import net.runelite.api.Player;
import net.runelite.api.Skill;
import net.runelite.client.game.HiscoreManager;
import net.runelite.client.hiscore.HiscoreManager;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
@@ -44,8 +44,8 @@ import net.runelite.client.ui.overlay.components.LineComponent;
import net.runelite.client.ui.overlay.components.PanelComponent;
import net.runelite.client.ui.overlay.components.TitleComponent;
import net.runelite.client.util.Text;
import net.runelite.http.api.hiscore.HiscoreResult;
import net.runelite.http.api.hiscore.HiscoreSkill;
import net.runelite.client.hiscore.HiscoreResult;
import net.runelite.client.hiscore.HiscoreSkill;
class PlayerComparisonOverlay extends Overlay
{
@@ -153,7 +153,7 @@ class PlayerComparisonOverlay extends Overlay
final HiscoreSkill hiscoreSkill = HISCORE_COMBAT_SKILLS[i];
final Skill skill = COMBAT_SKILLS[i];
final net.runelite.http.api.hiscore.Skill opponentSkill = opponentSkills.getSkill(hiscoreSkill);
final net.runelite.client.hiscore.Skill opponentSkill = opponentSkills.getSkill(hiscoreSkill);
if (opponentSkill == null || opponentSkill.getLevel() == -1)
{
@@ -99,4 +99,23 @@ public interface PartyConfig extends Config
{
return false;
}
@ConfigItem(
keyName = "previousPartyId",
name = "",
description = "",
hidden = true
)
default String previousPartyId()
{
return "";
}
@ConfigItem(
keyName = "previousPartyId",
name = "",
description = "",
hidden = true
)
void setPreviousPartyId(String id);
}
@@ -26,6 +26,12 @@ package net.runelite.client.plugins.party;
import com.google.inject.Inject;
import java.awt.BorderLayout;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@@ -55,6 +61,9 @@ class PartyPanel extends PluginPanel
private final Map<UUID, PartyMemberBox> memberBoxes = new HashMap<>();
private final JButton startButton = new JButton();
private final JButton joinPartyButton = new JButton();
private final JButton rejoinPartyButton = new JButton();
private final JButton copyPartyIdButton = new JButton();
private final PluginErrorPanel noPartyPanel = new PluginErrorPanel();
private final PluginErrorPanel partyEmptyPanel = new PluginErrorPanel();
@@ -79,10 +88,29 @@ class PartyPanel extends PluginPanel
final JPanel topPanel = new JPanel();
topPanel.setBorder(new EmptyBorder(0, 0, 10, 0));
topPanel.setLayout(new BorderLayout());
topPanel.setBorder(new EmptyBorder(0, 0, 4, 0));
topPanel.setLayout(new GridBagLayout());
topPanel.add(startButton, BorderLayout.CENTER);
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.HORIZONTAL;
c.insets = new Insets(0, 2, 4, 2);
c.gridx = 0;
c.gridy = 0;
topPanel.add(startButton, c);
c.gridx = 1;
c.gridy = 0;
topPanel.add(joinPartyButton, c);
c.gridx = 1;
c.gridy = 0;
topPanel.add(copyPartyIdButton, c);
c.gridx = 0;
c.gridy = 1;
c.gridwidth = 2;
topPanel.add(rejoinPartyButton, c);
layoutPanel.add(topPanel);
layoutPanel.add(requestBoxPanel);
@@ -91,7 +119,14 @@ class PartyPanel extends PluginPanel
startButton.setText(party.isInParty() ? BTN_LEAVE_TEXT : BTN_CREATE_TEXT);
startButton.setFocusable(false);
topPanel.add(startButton);
joinPartyButton.setText("Join party");
joinPartyButton.setFocusable(false);
rejoinPartyButton.setText("Join previous party");
rejoinPartyButton.setFocusable(false);
copyPartyIdButton.setText("Copy party id");
copyPartyIdButton.setFocusable(false);
startButton.addActionListener(e ->
{
@@ -115,6 +150,63 @@ class PartyPanel extends PluginPanel
}
});
joinPartyButton.addActionListener(e ->
{
if (!party.isInParty())
{
String s = (String) JOptionPane.showInputDialog(
joinPartyButton,
"Please enter the party id:",
"Party Id",
JOptionPane.PLAIN_MESSAGE,
null,
null,
"");
if (s == null)
{
return;
}
try
{
party.changeParty(UUID.fromString(s));
}
catch (IllegalArgumentException ex)
{
JOptionPane.showMessageDialog(joinPartyButton, "You have entered an invalid party id.", "Invalid Party Id",
JOptionPane.ERROR_MESSAGE);
}
}
});
rejoinPartyButton.addActionListener(e ->
{
if (!party.isInParty())
{
try
{
party.changeParty(UUID.fromString(config.previousPartyId()));
}
catch (IllegalArgumentException ex)
{
JOptionPane.showMessageDialog(rejoinPartyButton,
"Failed to join your previous party, create a new party or join a new one.",
"Failed to Join Party",
JOptionPane.ERROR_MESSAGE);
}
}
});
copyPartyIdButton.addActionListener(e ->
{
if (party.isInParty())
{
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
clipboard.setContents(new StringSelection(String.valueOf(party.getPartyId())), null);
}
});
noPartyPanel.setContent("Not in a party", "Create a party to begin.");
partyEmptyPanel.setContent("Party created", "You can now invite friends!");
@@ -127,6 +219,9 @@ class PartyPanel extends PluginPanel
remove(partyEmptyPanel);
startButton.setText(party.isInParty() ? BTN_LEAVE_TEXT : BTN_CREATE_TEXT);
joinPartyButton.setVisible(!party.isInParty());
rejoinPartyButton.setVisible(!party.isInParty());
copyPartyIdButton.setVisible(party.isInParty());
if (!party.isInParty())
{
@@ -66,8 +66,8 @@ import net.runelite.client.config.ConfigManager;
import net.runelite.client.discord.DiscordService;
import net.runelite.client.discord.events.DiscordJoinRequest;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.events.PartyChanged;
import net.runelite.client.events.PartyMemberAvatar;
import net.runelite.client.plugins.Plugin;
@@ -585,6 +585,11 @@ public class PartyPlugin extends Plugin
pendingTilePings.clear();
worldMapManager.removeIf(PartyWorldMapPoint.class::isInstance);
if (event.getPartyId() != null)
{
config.setPreviousPartyId(String.valueOf(event.getPartyId()));
}
SwingUtilities.invokeLater(() ->
{
panel.removeAllMembers();
@@ -31,8 +31,8 @@ import lombok.Value;
import net.runelite.api.Client;
import net.runelite.api.FriendsChatRank;
import static net.runelite.api.FriendsChatRank.UNRANKED;
import net.runelite.api.MenuAction;
import static net.runelite.api.MenuAction.ITEM_USE_ON_PLAYER;
import static net.runelite.api.MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET;
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;
@@ -118,29 +118,23 @@ public class PlayerIndicatorsPlugin extends Plugin
}
MenuEntry[] menuEntries = client.getMenuEntries();
boolean modified = false;
for (MenuEntry entry : menuEntries)
{
int type = entry.getType();
MenuAction type = entry.getType();
if (type >= MENU_ACTION_DEPRIORITIZE_OFFSET)
{
type -= MENU_ACTION_DEPRIORITIZE_OFFSET;
}
if (type == WALK.getId()
|| type == SPELL_CAST_ON_PLAYER.getId()
|| type == ITEM_USE_ON_PLAYER.getId()
|| type == PLAYER_FIRST_OPTION.getId()
|| type == PLAYER_SECOND_OPTION.getId()
|| type == PLAYER_THIRD_OPTION.getId()
|| type == PLAYER_FOURTH_OPTION.getId()
|| type == PLAYER_FIFTH_OPTION.getId()
|| type == PLAYER_SIXTH_OPTION.getId()
|| type == PLAYER_SEVENTH_OPTION.getId()
|| type == PLAYER_EIGTH_OPTION.getId()
|| type == RUNELITE_PLAYER.getId())
if (type == WALK
|| type == SPELL_CAST_ON_PLAYER
|| type == ITEM_USE_ON_PLAYER
|| type == PLAYER_FIRST_OPTION
|| type == PLAYER_SECOND_OPTION
|| type == PLAYER_THIRD_OPTION
|| type == PLAYER_FOURTH_OPTION
|| type == PLAYER_FIFTH_OPTION
|| type == PLAYER_SIXTH_OPTION
|| type == PLAYER_SEVENTH_OPTION
|| type == PLAYER_EIGTH_OPTION
|| type == RUNELITE_PLAYER)
{
Player[] players = client.getCachedPlayers();
Player player = null;
@@ -149,7 +143,7 @@ public class PlayerIndicatorsPlugin extends Plugin
// 'Walk here' identifiers are offset by 1 because the default
// identifier for this option is 0, which is also a player index.
if (type == WALK.getId())
if (type == WALK)
{
identifier--;
}
@@ -175,14 +169,8 @@ public class PlayerIndicatorsPlugin extends Plugin
String newTarget = decorateTarget(oldTarget, decorations);
entry.setTarget(newTarget);
modified = true;
}
}
if (modified)
{
client.setMenuEntries(menuEntries);
}
}
private Decorations getDecorations(Player player)
@@ -58,13 +58,13 @@ import net.runelite.api.events.GameStateChanged;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.HiscoreManager;
import net.runelite.client.hiscore.HiscoreManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.http.api.hiscore.HiscoreEndpoint;
import net.runelite.http.api.hiscore.HiscoreResult;
import net.runelite.http.api.hiscore.Skill;
import net.runelite.client.hiscore.HiscoreEndpoint;
import net.runelite.client.hiscore.HiscoreResult;
import net.runelite.client.hiscore.Skill;
@PluginDescriptor(
name = "Player-owned House",
@@ -70,7 +70,7 @@ import okhttp3.HttpUrl;
)
public class WikiPlugin extends Plugin
{
static final HttpUrl WIKI_BASE = HttpUrl.parse("https://oldschool.runescape.wiki");
static final HttpUrl WIKI_BASE = HttpUrl.get("https://oldschool.runescape.wiki");
static final HttpUrl WIKI_API = WIKI_BASE.newBuilder().addPathSegments("api.php").build();
static final String UTM_SORUCE_KEY = "utm_source";
static final String UTM_SORUCE_VALUE = "runelite";
@@ -335,20 +335,6 @@ public class WikiPlugin extends Plugin
LinkBrowser.browse(url.toString());
return;
}
if (ev.getMenuAction() == MenuAction.RUNELITE)
{
switch (ev.getMenuOption())
{
case MENUOP_WIKI:
LinkBrowser.browse(WIKI_BASE.newBuilder()
.addPathSegment("w")
.addPathSegment(Text.removeTags(ev.getMenuTarget()))
.addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE)
.build().toString());
}
}
}
private void openSearchInput()
@@ -371,18 +357,18 @@ public class WikiPlugin extends Plugin
public void onMenuEntryAdded(MenuEntryAdded event)
{
int widgetIndex = event.getActionParam0();
int widgetID = event.getParam1();
MenuEntry[] menuEntries = client.getMenuEntries();
int widgetID = event.getActionParam1();
if (wikiSelected && event.getType() == MenuAction.SPELL_CAST_ON_WIDGET.getId())
{
MenuEntry[] menuEntries = client.getMenuEntries();
Widget w = getWidget(widgetID, widgetIndex);
if (w.getType() == WidgetType.GRAPHIC && w.getItemId() != -1)
{
for (int ourEntry = menuEntries.length - 1;ourEntry >= 0; ourEntry--)
{
MenuEntry entry = menuEntries[ourEntry];
if (entry.getType() == MenuAction.SPELL_CAST_ON_WIDGET.getId())
if (entry.getType() == MenuAction.SPELL_CAST_ON_WIDGET)
{
int id = itemManager.canonicalize(w.getItemId());
String name = itemManager.getItemComposition(id).getName();
@@ -390,7 +376,6 @@ public class WikiPlugin extends Plugin
break;
}
}
client.setMenuEntries(menuEntries);
}
else
{
@@ -400,7 +385,7 @@ public class WikiPlugin extends Plugin
MenuEntry[] oldEntries = menuEntries;
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length - 1);
for (int ourEntry = oldEntries.length - 1;
ourEntry >= 2 && oldEntries[oldEntries.length - 1].getType() != MenuAction.SPELL_CAST_ON_WIDGET.getId();
ourEntry >= 2 && oldEntries[oldEntries.length - 1].getType() != MenuAction.SPELL_CAST_ON_WIDGET;
ourEntry--)
{
menuEntries[ourEntry - 1] = oldEntries[ourEntry];
@@ -425,16 +410,15 @@ public class WikiPlugin extends Plugin
return;
}
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
menuEntry.setTarget(action.replace("View ", "").replace(" guide", ""));
menuEntry.setOption(MENUOP_WIKI);
menuEntry.setParam0(widgetIndex);
menuEntry.setParam1(widgetID);
menuEntry.setType(MenuAction.RUNELITE.getId());
client.setMenuEntries(menuEntries);
client.createMenuEntry(-1)
.setTarget(action.replace("View ", "").replace(" guide", ""))
.setOption(MENUOP_WIKI)
.setType(MenuAction.RUNELITE)
.onClick(ev -> LinkBrowser.browse(WIKI_BASE.newBuilder()
.addPathSegment("w")
.addPathSegment(Text.removeTags(ev.getTarget()))
.addQueryParameter(UTM_SORUCE_KEY, UTM_SORUCE_VALUE)
.build().toString()));
}
}
}
@@ -53,26 +53,27 @@ import static net.runelite.api.ObjectID.WILLOW_10833;
import static net.runelite.api.ObjectID.YEW;
import static net.runelite.api.NullObjectID.NULL_10823;
import static net.runelite.api.ObjectID.YEW_36683;
import static net.runelite.client.util.RSTimeUnit.GAME_TICKS;
@Getter
enum Tree
{
REGULAR_TREE(null, TREE, TREE_1277, TREE_1278, TREE_1279, TREE_1280),
OAK_TREE(Duration.ofMillis(8500), OAK_TREE_4540, OAK_10820),
WILLOW_TREE(Duration.ofMillis(8500), WILLOW, WILLOW_10829, WILLOW_10831, WILLOW_10833),
MAPLE_TREE(Duration.ofSeconds(35), MAPLE_TREE_10832, MAPLE_TREE_36681)
OAK_TREE(Duration.of(14, GAME_TICKS), OAK_TREE_4540, OAK_10820),
WILLOW_TREE(Duration.of(14, GAME_TICKS), WILLOW, WILLOW_10829, WILLOW_10831, WILLOW_10833),
MAPLE_TREE(Duration.of(59, GAME_TICKS), MAPLE_TREE_10832, MAPLE_TREE_36681)
{
@Override
Duration getRespawnTime(int region)
{
return region == MISCELLANIA_REGION ? Duration.ofMillis(8500) : super.respawnTime;
return region == MISCELLANIA_REGION ? Duration.of(14, GAME_TICKS) : super.respawnTime;
}
},
TEAK_TREE(Duration.ofMillis(8500), TEAK, TEAK_36686),
MAHOGANY_TREE(Duration.ofMillis(8500), MAHOGANY, MAHOGANY_36688),
YEW_TREE(Duration.ofMinutes(1), YEW, NULL_10823, YEW_36683),
MAGIC_TREE(Duration.ofMinutes(2), MAGIC_TREE_10834, NULL_10835),
REDWOOD(Duration.ofMinutes(2), ObjectID.REDWOOD, REDWOOD_29670);
TEAK_TREE(Duration.of(15, GAME_TICKS), TEAK, TEAK_36686),
MAHOGANY_TREE(Duration.of(14, GAME_TICKS), MAHOGANY, MAHOGANY_36688),
YEW_TREE(Duration.of(99, GAME_TICKS), YEW, NULL_10823, YEW_36683),
MAGIC_TREE(Duration.of(199, GAME_TICKS), MAGIC_TREE_10834, NULL_10835),
REDWOOD(Duration.of(199, GAME_TICKS), ObjectID.REDWOOD, REDWOOD_29670);
@Nullable
private final Duration respawnTime;

Some files were not shown because too many files have changed in this diff Show More