Merge pull request #2 from open-osrs/runelite

Runelite
This commit is contained in:
Burak
2021-01-13 21:09:05 +01:00
committed by GitHub
300 changed files with 3578 additions and 3326 deletions
@@ -14,7 +14,6 @@ class BootstrapPlugin : Plugin<Project> {
bootstrapDependencies(project(":runelite-api"))
bootstrapDependencies(project(":runescape-api"))
bootstrapDependencies(project(":http-api"))
bootstrapDependencies(project(":injector"))
bootstrapDependencies(project(":runelite-client"))
}
@@ -31,7 +30,6 @@ class BootstrapPlugin : Plugin<Project> {
dependsOn(project(":runelite-api").tasks["publish"])
dependsOn(project(":runescape-api").tasks["publish"])
dependsOn(project(":http-api").tasks["publish"])
dependsOn(project(":injector").tasks["publish"])
doLast {
copy {
@@ -41,7 +39,6 @@ class BootstrapPlugin : Plugin<Project> {
copy {
from(
"${buildDir}/repo/.",
"${parent?.projectDir}/injector/build/repo/.",
"${parent?.projectDir}/runelite-api/build/repo/.",
"${parent?.projectDir}/http-api/build/repo/.",
"${parent?.projectDir}/runescape-api/build/repo/."
+17 -2
View File
@@ -6,6 +6,7 @@ import org.gradle.kotlin.dsl.get
import java.io.File
import java.security.MessageDigest
import javax.inject.Inject
import kotlin.system.exitProcess
open class BootstrapTask @Inject constructor(@Input val type: String) : DefaultTask() {
@@ -42,8 +43,7 @@ open class BootstrapTask @Inject constructor(@Input val type: String) : DefaultT
val version = splat[2]
lateinit var path: String
if (it.file.name.contains("injected-client") ||
it.file.name.contains("runelite-client") ||
if (it.file.name.contains("runelite-client") ||
it.file.name.contains("http-api") ||
it.file.name.contains("runescape-api") ||
it.file.name.contains("runelite-api")) {
@@ -63,6 +63,21 @@ open class BootstrapTask @Inject constructor(@Input val type: String) : DefaultT
}
path += "${name}/$version/${name}-$version.jar"
}
else if (it.file.name.contains("gluegen"))
{
path = "http://repo.runelite.net/net/runelite/gluegen/gluegen-rt/" + version + "/" + it.file.name
}
else if (it.file.name.contains("jogl"))
{
path = "http://repo.runelite.net/net/runelite/jogl/jogl-all/" + version + "/" + it.file.name
}
else
{
println("ERROR: " + it.file.name + " has no download path!")
exitProcess(-1)
}
val filePath = it.file.absolutePath
val artifactFile = File(filePath)
+1 -1
View File
@@ -25,7 +25,7 @@
object ProjectVersions {
const val launcherVersion = "2.2.0"
const val rlVersion = "1.6.35"
const val rlVersion = "1.6.36"
const val openosrsVersion = "3.5.4"
@@ -77,7 +77,7 @@ public class Deob
Stopwatch stopwatch = Stopwatch.createStarted();
ClassGroup group = JarUtil.loadJar(new File(args[0]));
ClassGroup group = JarUtil.load(new File(args[0]));
// remove except RuntimeException
run(group, new RuntimeExceptions());
@@ -137,7 +137,7 @@ public class Deob
//new MaxMemoryTransformer().transform(group);
//new RuneliteBufferTransformer().transform(group);
JarUtil.saveJar(group, new File(args[1]));
JarUtil.save(group, new File(args[1]));
stopwatch.stop();
logger.info("Done in {}", stopwatch);
@@ -82,7 +82,7 @@ public class UpdateMappings
public void save(File out) throws IOException
{
JarUtil.saveJar(group2, out);
JarUtil.save(group2, out);
}
public static void main(String[] args) throws IOException
@@ -93,8 +93,8 @@ public class UpdateMappings
}
UpdateMappings u = new UpdateMappings(
JarUtil.loadJar(new File(args[0])),
JarUtil.loadJar(new File(args[1]))
JarUtil.load(new File(args[0])),
JarUtil.load(new File(args[1]))
);
u.update();
u.save(new File(args[2]));
@@ -49,7 +49,7 @@ public class JarUtil
{
private static final Logger logger = LoggerFactory.getLogger(JarUtil.class);
public static ClassGroup loadJar(File jarfile) throws IOException
public static ClassGroup load(File jarfile)
{
ClassGroup group = new ClassGroup();
@@ -74,6 +74,10 @@ public class JarUtil
group.addClass(cv.getClassFile());
}
}
catch (IOException e)
{
e.printStackTrace();
}
group.initialize();
@@ -115,7 +119,7 @@ public class JarUtil
return group;
}
public static void saveJar(ClassGroup group, File jarfile) throws IOException
public static void save(ClassGroup group, File jarfile)
{
try (JarOutputStream jout = new JarOutputStream(new FileOutputStream(jarfile)))
{
@@ -131,6 +135,10 @@ public class JarUtil
jout.closeEntry();
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
public static byte[] writeClass(ClassGroup group, ClassFile cf)
@@ -39,7 +39,7 @@ public class ExecutionTest
@Test
public void test() throws Exception
{
ClassGroup group1 = JarUtil.loadJar(new File(properties.getVanillaClient()));
ClassGroup group1 = JarUtil.load(new File(properties.getVanillaClient()));
Execution e = new Execution(group1);
e.populateInitialMethods();
e.run();
@@ -45,9 +45,9 @@ public class ClassFileVisitorTest
@Test
public void test() throws Exception
{
ClassGroup group = JarUtil.loadJar(new File(properties.getVanillaClient()));
ClassGroup group = JarUtil.load(new File(properties.getVanillaClient()));
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
}
@@ -50,13 +50,13 @@ public class EnumDeobfuscatorTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -50,13 +50,13 @@ public class FieldInlinerTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -50,13 +50,13 @@ public class IllegalStateExceptionsTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -50,13 +50,13 @@ public class OrderTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -50,13 +50,13 @@ public class PacketHandlerOrderTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -58,13 +58,13 @@ public class RenameUniqueTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -50,13 +50,13 @@ public class RuntimeExceptionsTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -59,7 +59,7 @@ public class UnreachedCodeTest
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -75,7 +75,7 @@ public class UnusedClassTest
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -50,13 +50,13 @@ public class UnusedFieldsTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -50,13 +50,13 @@ public class UnusedMethodsTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -50,13 +50,13 @@ public class UnusedParametersTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -51,13 +51,13 @@ public class ModArithTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -51,13 +51,13 @@ public class MultiplyZeroDeobfuscatorTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -50,13 +50,13 @@ public class ControlFlowDeobfuscatorTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -50,13 +50,13 @@ public class ConstantParameterTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getVanillaClient()));
group = JarUtil.load(new File(properties.getVanillaClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -59,7 +59,7 @@ public class MappingDumper
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
}
@Test
@@ -72,7 +72,7 @@ public class MappingDumper
@Test
public void dump() throws IOException
{
ClassGroup group = JarUtil.loadJar(new File(properties.getRsClient()));
ClassGroup group = JarUtil.load(new File(properties.getRsClient()));
final String GAP = "%-40s";
int classes = 0, methods = 0, fields = 0;
@@ -321,7 +321,7 @@ public class MappingDumper
@Test
public void dumpTiny() throws IOException
{
ClassGroup group = JarUtil.loadJar(new File(properties.getRsClient()));
ClassGroup group = JarUtil.load(new File(properties.getRsClient()));
System.out.println("v1\tofficial\tintermediary");
for (ClassFile clazz : group.getClasses())
{
@@ -379,7 +379,7 @@ public class MappingDumper
@Test
public void dumpJson() throws IOException
{
ClassGroup group = JarUtil.loadJar(new File(properties.getRsClient()));
ClassGroup group = JarUtil.load(new File(properties.getRsClient()));
Gson gson = new GsonBuilder().setPrettyPrinting().create();
JsonObject jObject = new JsonObject();
@@ -50,13 +50,13 @@ public class MenuActionDeobfuscatorTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -49,7 +49,7 @@ public class PacketTypeFinderTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
}
@Test
@@ -51,14 +51,14 @@ public class PacketWriteDeobfuscatorTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
group.removeClass(group.findClass("net/runelite/rs/Reflection"));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, folder.newFile());
JarUtil.save(group, folder.newFile());
}
@Test
@@ -51,7 +51,7 @@ public class ClientErrorTransformerTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(GAMEPACK);
group = JarUtil.load(GAMEPACK);
}
@After
@@ -59,7 +59,7 @@ public class ClientErrorTransformerTest
{
File out = folder.newFile();
JarUtil.saveJar(group, out);
JarUtil.save(group, out);
logger.info("Wrote to {}", out);
}
@@ -49,7 +49,7 @@ public class BufferFinderTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
}
@Test
@@ -31,7 +31,7 @@ public class AnnotationCleaner
{
final List<String> missing = new ArrayList<>();
File client = new File(properties.getRsClient());
ClassGroup group = JarUtil.loadJar(client);
ClassGroup group = JarUtil.load(client);
for (ClassFile c : group.getClasses())
{
@@ -113,11 +113,11 @@ public class AnnotationCleaner
{
File client = new File(properties.getRsClient());
ClassGroup group = JarUtil.loadJar(client);
ClassGroup group = JarUtil.load(client);
new AnnotationAdder(group).run();
JarUtil.saveJar(group, new File("C:/Users/Lucas/Desktop/niec.jar"));
JarUtil.save(group, new File("C:/Users/Lucas/Desktop/niec.jar"));
}
private static class OhNoException extends Exception
@@ -47,14 +47,14 @@ public class AnnotationCopierTest
@Before
public void before() throws IOException
{
group1 = JarUtil.loadJar(new File(JAR1));
group2 = JarUtil.loadJar(new File(JAR2));
group1 = JarUtil.load(new File(JAR1));
group2 = JarUtil.load(new File(JAR2));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group2, new File(OUT));
JarUtil.save(group2, new File(OUT));
}
//@Test
@@ -42,13 +42,13 @@ public class AnnotationRenamerTest
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(JAR));
group = JarUtil.load(new File(JAR));
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, new File(OUT));
JarUtil.save(group, new File(OUT));
}
//@Test
@@ -62,12 +62,12 @@ public class UpdateMappingsTest
{
File client = new File(properties.getRsClient());
ClassGroup group1 = JarUtil.loadJar(client);
ClassGroup group2 = JarUtil.loadJar(new File(JAR));
ClassGroup group1 = JarUtil.load(client);
ClassGroup group2 = JarUtil.load(new File(JAR));
map(group1, group2);
JarUtil.saveJar(group2, new File(OUT));
JarUtil.save(group2, new File(OUT));
}
@Test
@@ -76,8 +76,8 @@ public class UpdateMappingsTest
{
File client = new File(properties.getRsClient());
ClassGroup group1 = JarUtil.loadJar(client);
ClassGroup group2 = JarUtil.loadJar(client);
ClassGroup group1 = JarUtil.load(client);
ClassGroup group2 = JarUtil.load(client);
// Remove existing annotations
unannotate(group2);
@@ -94,11 +94,11 @@ public class UpdateMappingsTest
{
File client = new File("C:\\Users\\Lucas\\IdeaProjects\\runelitexxx\\client.jar");
ClassGroup group = JarUtil.loadJar(client);
ClassGroup group = JarUtil.load(client);
new ScriptOpcodesTransformer().transform(group);
JarUtil.saveJar(group, new File("C:/Users/Lucas/Desktop/Apapapapapap.jar"));
JarUtil.save(group, new File("C:/Users/Lucas/Desktop/Apapapapapap.jar"));
}
private void unannotate(ClassGroup group)
@@ -72,13 +72,13 @@ public class HookImporter
java.lang.reflect.Type type = new TypeToken<Map<String, ClassHook>>() {}.getType();
hooks = gson.fromJson(new InputStreamReader(is), type);
group = JarUtil.loadJar(IN);
group = JarUtil.load(IN);
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, OUT);
JarUtil.save(group, OUT);
}
@Test
@@ -64,13 +64,13 @@ public class MappingImporter
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(IN);
group = JarUtil.load(IN);
}
@After
public void after() throws IOException
{
JarUtil.saveJar(group, OUT);
JarUtil.save(group, OUT);
}
private boolean hasObfuscatedName(Annotated an, String name)
@@ -75,7 +75,7 @@ public class HookImporter
@Before
public void before() throws IOException
{
group = JarUtil.loadJar(new File(properties.getRsClient()));
group = JarUtil.load(new File(properties.getRsClient()));
InputStream is = getClass().getResourceAsStream("hooks.json");
Gson gson = new Gson();
@@ -87,7 +87,7 @@ public class HookImporter
public void after() throws IOException
{
File out = folder.newFile("client.jar");
JarUtil.saveJar(group, out);
JarUtil.save(group, out);
logger.info("Wrote to {}", out);
}
@@ -45,4 +45,4 @@ public class GrandExchangeTrade
private WorldType worldType;
private int seq;
private Instant resetTime;
}
}
@@ -65,6 +65,7 @@ public class HiscoreResult
private Skill clueScrollElite;
private Skill clueScrollMaster;
private Skill lastManStanding;
private Skill soulWarsZeal;
private Skill abyssalSire;
private Skill alchemicalHydra;
private Skill barrowsChests;
@@ -184,6 +185,8 @@ public class HiscoreResult
return getClueScrollMaster();
case LAST_MAN_STANDING:
return getLastManStanding();
case SOUL_WARS_ZEAL:
return getSoulWarsZeal();
case ABYSSAL_SIRE:
return abyssalSire;
case ALCHEMICAL_HYDRA:
@@ -87,6 +87,7 @@ class HiscoreResultBuilder
hiscoreResult.setClueScrollElite(skills.get(index++));
hiscoreResult.setClueScrollMaster(skills.get(index++));
hiscoreResult.setLastManStanding(skills.get(index++));
hiscoreResult.setSoulWarsZeal(skills.get(index++));
// seasonal doesn't have boss hiscores
if (index < skills.size())
{
@@ -69,6 +69,7 @@ public enum HiscoreSkill
CLUE_SCROLL_ELITE("Clue Scrolls (elite)", ACTIVITY),
CLUE_SCROLL_MASTER("Clue Scrolls (master)", ACTIVITY),
LAST_MAN_STANDING("Last Man Standing", ACTIVITY),
SOUL_WARS_ZEAL("Soul Wars Zeal", ACTIVITY),
ABYSSAL_SIRE("Abyssal Sire", BOSS),
ALCHEMICAL_HYDRA("Alchemical Hydra", BOSS),
BARROWS_CHESTS("Barrows Chests", BOSS),
+3
View File
@@ -31,6 +31,9 @@ tasks.register<JavaExec>("inject") {
main = "com.openosrs.injector.Injector"
classpath = sourceSets["main"].runtimeClasspath
args(vanillaDep.singleFile, openosrsVersion)
outputs.upToDateWhen {
false
}
}
tasks {
@@ -24,49 +24,36 @@ import com.openosrs.injector.injectors.raw.ScriptVM;
import com.openosrs.injector.rsapi.RSApi;
import com.openosrs.injector.transformers.InjectTransformer;
import com.openosrs.injector.transformers.SourceChanger;
import static net.runelite.deob.util.JarUtil.load;
import static net.runelite.deob.util.JarUtil.save;
import java.io.File;
import java.io.IOException;
import net.runelite.deob.util.JarUtil;
import java.util.Objects;
import org.gradle.api.logging.Logger;
import org.gradle.api.logging.Logging;
public class Injector extends InjectData implements InjectTaskHandler
{
private static final Logger log = Logging.getLogger(Injector.class);
public Injector(File vanilla, File rsclient, File mixins, File[] rsapi) throws IOException
{
super(
JarUtil.loadJar(vanilla),
JarUtil.loadJar(rsclient),
JarUtil.loadJar(mixins),
new RSApi(rsapi)
);
inject();
save(new File("../runelite-client/src/main/resources/net/runelite/client/injected-client.oprs"));
}
static final Logger log = Logging.getLogger(Injector.class);
static Injector injector = new Injector();
static File injectedClient =
new File("../runelite-client/src/main/resources/net/runelite/client/injected-client.oprs");
public static void main(String[] args)
{
try
{
args = new String[]
{
args[0],
"../runescape-client/build/libs/runescape-client-" + args[1] + ".jar",
"../runelite-mixins/build/libs/runelite-mixins-" + args[1] + ".jar",
"../runescape-api/build/classes/java/main/net/runelite/rs/api/"
};
new Injector(new File(args[0]), new File(args[1]), new File(args[2]), new File(args[3]).listFiles());
}
catch (Exception e)
{
e.printStackTrace();
}
injector.vanilla = load(new File(args[0]));
injector.deobfuscated = load(
new File("../runescape-client/build/libs/runescape-client-" + args[1] + ".jar"));
injector.rsApi = new RSApi(Objects.requireNonNull(
new File("../runescape-api/build/classes/java/main/net/runelite/rs/api/")
.listFiles()));
injector.mixins = load(
new File("../runelite-mixins/build/libs/runelite-mixins-" + args[1] + ".jar"));
injector.initToVanilla();
injector.injectVanilla();
save(injector.getVanilla(), injectedClient);
}
public void inject()
public void injectVanilla()
{
log.debug("[DEBUG] Starting injection");
@@ -106,13 +93,6 @@ public class Injector extends InjectData implements InjectTaskHandler
transform(new SourceChanger(this));
}
public void save(File outputJar) throws IOException
{
log.info("[INFO] Saving jar to {}", outputJar.toString());
JarUtil.saveJar(this.getVanilla(), outputJar);
}
private void inject(com.openosrs.injector.injectors.Injector injector)
{
final String name = injector.getName();
@@ -31,21 +31,21 @@ public abstract class InjectData
public static final String CALLBACKS = "net/runelite/api/hooks/Callbacks";
@Getter
private final ClassGroup vanilla;
public ClassGroup vanilla;
@Getter
private final ClassGroup deobfuscated;
public ClassGroup deobfuscated;
@Getter
private final ClassGroup mixins;
public ClassGroup mixins;
@Getter
private final RSApi rsApi;
public RSApi rsApi;
/**
* Deobfuscated ClassFiles -> Vanilla ClassFiles
*/
private final Map<ClassFile, ClassFile> toVanilla;
public Map<ClassFile, ClassFile> toVanilla;
/**
* Strings -> Deobfuscated ClassFiles
@@ -55,18 +55,9 @@ public abstract class InjectData
*/
private final Map<String, ClassFile> toDeob = new HashMap<>();
public InjectData(ClassGroup vanilla, ClassGroup deobfuscated, ClassGroup mixins, RSApi rsApi)
{
this.vanilla = vanilla;
this.deobfuscated = deobfuscated;
this.rsApi = rsApi;
this.mixins = mixins;
this.toVanilla = initToVanilla();
}
public abstract void runChildInjector(Injector injector);
private Map<ClassFile, ClassFile> initToVanilla()
public void initToVanilla()
{
ImmutableMap.Builder<ClassFile, ClassFile> toVanillaB = ImmutableMap.builder();
@@ -88,7 +79,7 @@ public abstract class InjectData
}
}
return toVanillaB.build();
this.toVanilla = toVanillaB.build();
}
/**
@@ -7,9 +7,6 @@
*/
package com.openosrs.injector.injection;
import java.io.File;
import java.io.IOException;
/**
* Interface containing all the methods gradle needs to know about
*/
@@ -18,10 +15,5 @@ public interface InjectTaskHandler
/**
* The actual method that does all the work
*/
void inject();
/**
* Call this to save the injected jar to outputJar
*/
void save(File outputJar) throws IOException;
void injectVanilla();
}
@@ -118,9 +118,9 @@ public class RSApiInjector extends AbstractInjector
final Signature sig = apiMethod.getSignature();
if (sig.isVoid())
if (sig.size() == 1)
{
if (sig.size() == 1)
if (sig.isVoid() || sig.getReturnValue().equals(Type.fromAsmString(apiMethod.getClazz().getName())))
{
Type type = InjectUtil.apiToDeob(inject, sig.getTypeOfArg(0));
if (deobType.equals(type))
@@ -276,7 +276,7 @@ public class RSApiInjector extends AbstractInjector
final ClassFile targetClass = InjectUtil.vanillaFromApiMethod(inject, apiMethod);
apiMethod.setInjected(true);
if (apiMethod.getSignature().isVoid())
if (apiMethod.getSignature().getArguments().size() == 1)
{
++set;
log.debug("[DEBUG] Injecting setter {} for {} into {}", apiMethod.getMethod(), field.getPoolField(), targetClass.getPoolClass());
@@ -102,7 +102,15 @@ public class InjectSetter
ins.add(new PutField(instructions, field));
}
ins.add(new VReturn(instructions));
if (!apiMethod.getSignature().getReturnValue().equals(Type.VOID))
{
ins.add(new ALoad(instructions, 0));
ins.add(InjectUtil.createReturnForType(instructions, apiMethod.getSignature().getReturnValue()));
}
else
{
ins.add(new VReturn(instructions));
}
targetClass.addMethod(method);
}
@@ -526,6 +526,16 @@ public interface Client extends GameShell
@Nullable
Widget getWidget(int groupId, int childId);
/**
* Gets a widget by it's packed ID.
*
* <p>
* Note: Use {@link #getWidget(WidgetInfo)} or {@link #getWidget(int, int)} for
* a more readable version of this method.
*/
@Nullable
Widget getWidget(int packedID);
/**
* Gets an array containing the x-axis canvas positions
* of all widgets.
@@ -784,6 +794,15 @@ public interface Client extends GameShell
*/
void setVarbit(Varbits varbit, int value);
/**
* Gets the varbit composition for a given varbit id
*
* @param id
* @return
*/
@Nullable
VarbitComposition getVarbit(int id);
/**
* Gets the value of a given variable.
*
@@ -817,10 +836,11 @@ public interface Client extends GameShell
void setVarbitValue(int[] varps, int varbit, int value);
/**
* Gets the varbit composition for a given varbit id
* Mark the given varp as changed, causing var listeners to be
* triggered next tick
* @param varp
*/
@Nullable
VarbitComposition getVarbitDefinition(int id);
void queueChangedVarp(int varp);
/**
* Gets the widget flags table.
@@ -898,16 +918,6 @@ public interface Client extends GameShell
*/
IterableHashTable<MessageNode> getMessages();
/**
* Gets the viewport widget.
* <p>
* The viewport is the area of the game above the chatbox
* and to the left of the mini-map.
*
* @return the viewport widget
*/
Widget getViewportWidget();
/**
* Gets the object composition corresponding to an objects ID.
*
@@ -926,6 +936,18 @@ public interface Client extends GameShell
*/
NPCComposition getNpcDefinition(int npcId);
/**
* Gets the {@link StructComposition} for a given struct ID
*
* @see StructID
*/
StructComposition getStructComposition(int structID);
/**
* Gets the client's cache of in memory struct compositions
*/
NodeCache getStructCompositionCache();
/**
* Gets an array of all world areas
*
@@ -1017,6 +1039,18 @@ public interface Client extends GameShell
*/
List<GraphicsObject> getGraphicsObjects();
/**
* Gets the music volume
* @return volume 0-255 inclusive
*/
int getMusicVolume();
/**
* Sets the music volume
* @param volume 0-255 inclusive
*/
void setMusicVolume(int volume);
/**
* Play a sound effect at the player's current location. This is how UI,
* and player-generated (e.g. mining, woodcutting) sound effects are
@@ -1160,6 +1194,20 @@ public interface Client extends GameShell
*/
String[] getStringStack();
/**
* Gets the cs2 vm's active widget
*
* This is used for all {@code cc_*} operations with a {@code 0} operand
*/
Widget getScriptActiveWidget();
/**
* Gets the cs2 vm's "dot" widget
*
* This is used for all {@code .cc_*} operations with a {@code 1} operand
*/
Widget getScriptDotWidget();
/**
* Checks whether a player is on the friends list.
*
@@ -1329,11 +1377,21 @@ public interface Client extends GameShell
* <p>
* This method must be ran on the client thread and is not reentrant
*
* This method is shorthand for {@code client.createScriptEvent(args).run()}
*
* @param args the script id, then any additional arguments to execute the script with
* @see ScriptID
*/
void runScript(Object... args);
/**
* Creates a blank ScriptEvent for executing a ClientScript2 script
*
* @param args the script id, then any additional arguments to execute the script with
* @see ScriptID
*/
ScriptEvent createScriptEvent(Object ...args);
/**
* Checks whether or not there is any active hint arrow.
*
@@ -2063,15 +2121,4 @@ public interface Client extends GameShell
void setOutdatedScript(String outdatedScript);
List<String> getOutdatedScripts();
//TODO: Implement
void queueChangedVarp(int varp);
//TODO: Implement
VarbitComposition getVarbit(Integer id);
Widget getWidget(int param1);
//TODO: Implement
Widget getScriptActiveWidget();
}
@@ -5,7 +5,7 @@ import javax.annotation.Nullable;
/**
* Represents the template of a specific item type.
*/
public interface ItemComposition
public interface ItemComposition extends ParamHolder
{
/**
* Gets the items name.
@@ -624,7 +624,7 @@ public final class ItemID
public static final int SILK = 950;
public static final int SPADE = 952;
public static final int ROPE = 954;
public static final int FLIER = 956;
public static final int FLYER = 956;
public static final int GREY_WOLF_FUR = 958;
public static final int PLANK = 960;
public static final int CHRISTMAS_CRACKER = 962;
@@ -3330,7 +3330,6 @@ public final class ItemID
public static final int TILES = 5569;
public static final int TILES_5570 = 5570;
public static final int TILES_5571 = 5571;
public static final int DIAL = 5572;
public static final int DESERT_AMULET = 5573;
public static final int INITIATE_SALLET = 5574;
public static final int INITIATE_HAUBERK = 5575;
@@ -5008,7 +5007,7 @@ public final class ItemID
public static final int SARADOMIN_ICON = 8058;
public static final int ZAMORAK_ICON = 8059;
public static final int GUTHIX_ICON = 8060;
public static final int ICON_OF_BOB = 8061;
public static final int BOB_ICON = 8061;
public static final int OAK_ALTAR = 8062;
public static final int TEAK_ALTAR = 8063;
public static final int CLOTHCOVERED_ALTAR = 8064;
@@ -10754,7 +10753,7 @@ public final class ItemID
public static final int CRYSTAL_SAPLING = 23659;
public static final int CRYSTAL_ACORN = 23661;
public static final int DRAGONSTONE_ARMOUR_SET = 23667;
public static final int FLIER_23670 = 23670;
public static final int FLYER_23670 = 23670;
public static final int CRYSTAL_AXE = 23673;
public static final int CRYSTAL_AXE_INACTIVE = 23675;
public static final int DRAGON_PICKAXE_OR = 23677;
@@ -10946,9 +10945,7 @@ public final class ItemID
public static final int CRYSTAL_SHIELD = 23991;
public static final int CRYSTAL_SHIELD_INACTIVE = 23993;
public static final int BLADE_OF_SAELDOR = 23995;
public static final int BLADE_OF_SAELDOR_23996 = 23996;
public static final int BLADE_OF_SAELDOR_INACTIVE = 23997;
public static final int BLADE_OF_SAELDOR_INACTIVE_23999 = 23999;
public static final int CRYSTAL_GRAIL = 24000;
public static final int ELVEN_BOOTS = 24003;
public static final int ELVEN_GLOVES = 24006;
@@ -11494,19 +11491,18 @@ public final class ItemID
public static final int CABBAGE_24994 = 24994;
public static final int CABBAGE_24996 = 24996;
public static final int TRAILBLAZER_HOOD_T3 = 25001;
public static final int TRAILBLAZER_COAT_T3 = 25004;
public static final int TRAILBLAZER_TOP_T3 = 25004;
public static final int TRAILBLAZER_TROUSERS_T3 = 25007;
public static final int TRAILBLAZER_BOOTS_T3 = 25010;
public static final int TRAILBLAZER_CANE = 25013;
public static final int TRAILBLAZER_HOOD_T2 = 25016;
public static final int TRAILBLAZER_COAT_T2 = 25019;
public static final int TRAILBLAZER_TOP_T2 = 25019;
public static final int TRAILBLAZER_TROUSERS_T2 = 25022;
public static final int TRAILBLAZER_BOOTS_T2 = 25025;
public static final int TRAILBLAZER_HOOD_T1 = 25028;
public static final int TRAILBLAZER_COAT_T1 = 25031;
public static final int TRAILBLAZER_TOP_T1 = 25031;
public static final int TRAILBLAZER_TROUSERS_T1 = 25034;
public static final int TRAILBLAZER_BOOTS_T1 = 25037;
public static final int TRAILBLAZER_TROPHY = 25040;
public static final int TRAILBLAZER_DRAGON_TROPHY = 25042;
public static final int TRAILBLAZER_RUNE_TROPHY = 25044;
public static final int TRAILBLAZER_ADAMANT_TROPHY = 25046;
@@ -11515,9 +11511,9 @@ public final class ItemID
public static final int TRAILBLAZER_IRON_TROPHY = 25052;
public static final int TRAILBLAZER_BRONZE_TROPHY = 25054;
public static final int TRAILBLAZER_BANNER = 25056;
public static final int TRAILBLAZER_HARPOON = 25059;
public static final int TRAILBLAZER_PICKAXE = 25063;
public static final int TRAILBLAZER_AXE = 25066;
public static final int INFERNAL_HARPOON_OR = 25059;
public static final int INFERNAL_PICKAXE_OR = 25063;
public static final int INFERNAL_AXE_OR = 25066;
public static final int GRACEFUL_HOOD_25069 = 25069;
public static final int GRACEFUL_HOOD_25071 = 25071;
public static final int GRACEFUL_CAPE_25072 = 25072;
@@ -11539,9 +11535,9 @@ public final class ItemID
public static final int CRYSTAL_OF_MEMORIES = 25104;
public static final int EXTRADIMENSIONAL_BAG = 25106;
public static final int EXTRADIMENSIONAL_BAG_25108 = 25108;
public static final int TRAILBLAZER_AXE_25110 = 25110;
public static final int TRAILBLAZER_PICKAXE_25112 = 25112;
public static final int TRAILBLAZER_HARPOON_25114 = 25114;
public static final int TRAILBLAZER_AXE = 25110;
public static final int TRAILBLAZER_PICKAXE = 25112;
public static final int TRAILBLAZER_HARPOON = 25114;
public static final int LEAGUE_TOMATO = 25117;
public static final int BEEKEEPERS_HAT = 25129;
public static final int BEEKEEPERS_TOP = 25131;
@@ -11549,5 +11545,158 @@ public final class ItemID
public static final int BEEKEEPERS_GLOVES = 25135;
public static final int BEEKEEPERS_BOOTS = 25137;
public static final int BONE_FRAGMENTS = 25139;
public static final int CLAY_HEAD = 25145;
public static final int FUR_HEAD = 25146;
public static final int BLOODY_HEAD = 25147;
public static final int NEILANS_JOURNAL = 25152;
public static final int ORNATE_UNDEAD_COMBAT_DUMMY = 25154;
public static final int DECORATIVE_BOOTS_BROKEN = 25155;
public static final int DECORATIVE_FULL_HELM_BROKEN = 25157;
public static final int CASTLEWARS_BREW4 = 25159;
public static final int CASTLEWARS_BREW3 = 25160;
public static final int CASTLEWARS_BREW2 = 25161;
public static final int CASTLEWARS_BREW1 = 25162;
public static final int DECORATIVE_BOOTS = 25163;
public static final int DECORATIVE_FULL_HELM = 25165;
public static final int DECORATIVE_BOOTS_25167 = 25167;
public static final int DECORATIVE_FULL_HELM_25169 = 25169;
public static final int DECORATIVE_BOOTS_25171 = 25171;
public static final int DECORATIVE_BOOTS_L = 25173;
public static final int DECORATIVE_FULL_HELM_25174 = 25174;
public static final int DECORATIVE_FULL_HELM_L = 25176;
public static final int SLAYER_HELMET_I_25177 = 25177;
public static final int BLACK_SLAYER_HELMET_I_25179 = 25179;
public static final int GREEN_SLAYER_HELMET_I_25181 = 25181;
public static final int RED_SLAYER_HELMET_I_25183 = 25183;
public static final int PURPLE_SLAYER_HELMET_I_25185 = 25185;
public static final int TURQUOISE_SLAYER_HELMET_I_25187 = 25187;
public static final int HYDRA_SLAYER_HELMET_I_25189 = 25189;
public static final int TWISTED_SLAYER_HELMET_I_25191 = 25191;
public static final int GRANITE_RING_I_25193 = 25193;
public static final int BLUE_CAPE_25195 = 25195;
public static final int SOUL_FRAGMENT = 25196;
public static final int SOUL_WARS_GUIDE = 25197;
public static final int BONES_25199 = 25199;
public static final int SOUL_FRAGMENT_25201 = 25201;
public static final int BANDAGES_25202 = 25202;
public static final int POTION_OF_POWER4 = 25203;
public static final int POTION_OF_POWER3 = 25204;
public static final int POTION_OF_POWER2 = 25205;
public static final int POTION_OF_POWER1 = 25206;
public static final int RED_CAPE_25207 = 25207;
public static final int BLUE_CAPE_25208 = 25208;
public static final int BARRICADE_25209 = 25209;
public static final int BARRICADE_25210 = 25210;
public static final int EXPLOSIVE_POTION_25211 = 25211;
public static final int BLUE_ICON = 25212;
public static final int BLUE_ICON_25213 = 25213;
public static final int BLUE_ICON_25214 = 25214;
public static final int BLUE_ICON_25215 = 25215;
public static final int BLUE_ICON_25216 = 25216;
public static final int BLUE_ICON_25217 = 25217;
public static final int BLUE_ICON_25218 = 25218;
public static final int BLUE_ICON_25219 = 25219;
public static final int BLUE_ICON_25220 = 25220;
public static final int BLUE_ICON_25221 = 25221;
public static final int BLUE_ICON_25222 = 25222;
public static final int BLUE_ICON_25223 = 25223;
public static final int BLUE_ICON_25224 = 25224;
public static final int BLUE_ICON_25225 = 25225;
public static final int BLUE_ICON_25226 = 25226;
public static final int BLUE_ICON_25227 = 25227;
public static final int RED_ICON = 25228;
public static final int RED_ICON_25229 = 25229;
public static final int RED_ICON_25230 = 25230;
public static final int RED_ICON_25231 = 25231;
public static final int RED_ICON_25232 = 25232;
public static final int RED_ICON_25233 = 25233;
public static final int RED_ICON_25234 = 25234;
public static final int RED_ICON_25235 = 25235;
public static final int RED_ICON_25236 = 25236;
public static final int RED_ICON_25237 = 25237;
public static final int RED_ICON_25238 = 25238;
public static final int RED_ICON_25239 = 25239;
public static final int RED_ICON_25240 = 25240;
public static final int RED_ICON_25241 = 25241;
public static final int RED_ICON_25242 = 25242;
public static final int RED_ICON_25243 = 25243;
public static final int OLD_KEY_25244 = 25244;
public static final int RING_OF_SUFFERING_I_25246 = 25246;
public static final int RING_OF_SUFFERING_RI_25248 = 25248;
public static final int SALVE_AMULETI_25250 = 25250;
public static final int RING_OF_THE_GODS_I_25252 = 25252;
public static final int TYRANNICAL_RING_I_25254 = 25254;
public static final int TREASONOUS_RING_I_25256 = 25256;
public static final int SEERS_RING_I_25258 = 25258;
public static final int ARCHERS_RING_I_25260 = 25260;
public static final int WARRIOR_RING_I_25262 = 25262;
public static final int BERSERKER_RING_I_25264 = 25264;
public static final int BLACK_MASK_10_I_25266 = 25266;
public static final int BLACK_MASK_9_I_25267 = 25267;
public static final int BLACK_MASK_8_I_25268 = 25268;
public static final int BLACK_MASK_7_I_25269 = 25269;
public static final int BLACK_MASK_6_I_25270 = 25270;
public static final int BLACK_MASK_5_I_25271 = 25271;
public static final int BLACK_MASK_4_I_25272 = 25272;
public static final int BLACK_MASK_3_I_25273 = 25273;
public static final int BLACK_MASK_2_I_25274 = 25274;
public static final int BLACK_MASK_1_I_25275 = 25275;
public static final int BLACK_MASK_I_25276 = 25276;
public static final int SALVE_AMULETEI_25278 = 25278;
public static final int PURE_ESSENCE_PACK = 25280;
public static final int SLED_25282 = 25282;
public static final int RED_FIREFLIES = 25283;
public static final int GREEN_FIREFLIES = 25284;
public static final int STICK_25285 = 25285;
public static final int MOULDY_SAWDUST = 25286;
public static final int ROTTEN_MEAT = 25287;
public static final int STALE_BREAD = 25288;
public static final int GOBLIN_STEW = 25289;
public static final int GOBLIN_GIFTS = 25290;
public static final int GIANT_BOULDER = 25314;
public static final int GOBLIN_DECORATIONS = 25316;
public static final int GNOME_CHILD_ICON = 25319;
public static final int GNOME_CHILD = 25320;
public static final int GNOME_CHILD_25321 = 25321;
public static final int _20TH_ANNIVERSARY_HAT = 25322;
public static final int _20TH_ANNIVERSARY_TOP = 25324;
public static final int _20TH_ANNIVERSARY_BOTTOM = 25326;
public static final int _20TH_ANNIVERSARY_BOOTS = 25328;
public static final int _20TH_ANNIVERSARY_GLOVES = 25330;
public static final int _20TH_ANNIVERSARY_NECKLACE = 25332;
public static final int _20TH_ANNIVERSARY_CAPE = 25334;
public static final int GNOME_CHILD_MASK = 25336;
public static final int GNOME_CHILD_ICON_25338 = 25338;
public static final int ECTOPLASMATOR = 25340;
public static final int SPOILS_OF_WAR = 25342;
public static final int SOUL_CAPE = 25344;
public static final int SOUL_CAPE_25346 = 25346;
public static final int LIL_CREATOR = 25348;
public static final int LIL_DESTRUCTOR = 25350;
public static final int TROPHY_PEDESTAL = 25351;
public static final int ORNATE_TROPHY_PEDESTAL = 25352;
public static final int OAK_TROPHY_CASE = 25353;
public static final int MAHOGANY_TROPHY_CASE = 25354;
public static final int BANNER_STAND = 25355;
public static final int ORNATE_BANNER_STAND = 25356;
public static final int OAK_OUTFIT_STAND = 25357;
public static final int MAHOGANY_OUTFIT_STAND = 25358;
public static final int LEAGUE_STATUE = 25359;
public static final int ORNATE_LEAGUE_STATUE = 25360;
public static final int TRAILBLAZER_GLOBE_25361 = 25361;
public static final int RUG_25362 = 25362;
public static final int OPULENT_RUG_25363 = 25363;
public static final int TRAILBLAZER_RUG_25364 = 25364;
public static final int LEAGUE_ACCOMPLISHMENTS_SCROLL = 25365;
public static final int LEAGUE_HALL = 25366;
public static final int INFERNAL_HARPOON_UNCHARGED_25367 = 25367;
public static final int INFERNAL_PICKAXE_UNCHARGED_25369 = 25369;
public static final int INFERNAL_AXE_UNCHARGED_25371 = 25371;
public static final int DRAGON_HARPOON_OR = 25373;
public static final int DRAGON_PICKAXE_OR_25376 = 25376;
public static final int DRAGON_AXE_OR = 25378;
public static final int TRAILBLAZER_RELIC_HUNTER_T1_ARMOUR_SET = 25380;
public static final int TRAILBLAZER_RELIC_HUNTER_T2_ARMOUR_SET = 25383;
public static final int TRAILBLAZER_RELIC_HUNTER_T3_ARMOUR_SET = 25386;
/* This file is automatically generated. Do not edit. */
}
}
@@ -27,4 +27,5 @@ package net.runelite.api;
public interface IterableHashTable<T extends Node> extends Iterable<T>
{
T get(long hash);
void put(T node, long hash);
}
@@ -36,5 +36,5 @@ public interface MainBufferProvider extends BufferProvider
*
* @return the loaded image
*/
Image getImage(); //TODO
Image getImage();
}
@@ -27,7 +27,7 @@ package net.runelite.api;
/**
* Information about a specific {@link NpcID}
*/
public interface NPCComposition
public interface NPCComposition extends ParamHolder
{
/**
* Gets the name of the NPC.
@@ -27,7 +27,7 @@ package net.runelite.api;
/**
* Information about a specific {@link ObjectID}
*/
public interface ObjectComposition
public interface ObjectComposition extends ParamHolder
{
/**
* Gets ID for the object.
@@ -0,0 +1,57 @@
/*
* Copyright (c) 2020 Abex
* 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 composition that can hold `param` keys. This lets Jagex attach arbitrary constant
* data to certain items, objects, npcs, or structs for use in cs2
*
* @see ParamID
*/
public interface ParamHolder
{
IterableHashTable<Node> getParams();
void setParams(IterableHashTable<Node> params);
/**
* Gets the value of a given {@link ParamID}, or its default if it is unset
*/
int getIntValue(int paramID);
/**
* Sets the value of a given {@link ParamID}
*/
void setValue(int paramID, int value);
/**
* Gets the value of a given {@link ParamID}, or its default if it is unset
*/
String getStringValue(int paramID);
/**
* Sets the value of a given {@link ParamID}
*/
void setValue(int paramID, String value);
}
@@ -0,0 +1,48 @@
/*
* Copyright (c) 2020 Abex
* 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;
/**
* @see ParamHolder
*/
public class ParamID
{
/**
* @see SettingID
*/
public static final int SETTING_ID = 1077;
// defaults to 5
// 1 is continuous
public static final int SETTING_SLIDER_STEPS = 1101;
public static final int SETTING_CUSTOM_TRANSMIT = 1085;
// defaults to true
// track is foreground
public static final int SETTING_FOREGROUND_CLICKZONE = 1105;
public static final int SETTING_SLIDER_CUSTOM_ONOP = 1106;
public static final int SETTING_SLIDER_CUSTOM_SETPOS = 1107;
public static final int SETTING_SLIDER_IS_DRAGGABLE = 1108;
public static final int SETTING_SLIDER_DEADZONE = 1109;
public static final int SETTING_SLIDER_DEADTIME = 1110;
}
@@ -43,15 +43,27 @@ public interface Preferences
*/
void setRememberedUsername(String username);
/**
* Gets the sound effect volume
* @return volume 0-127 inclusive
*/
int getSoundEffectVolume();
void setSoundEffectVolume(int i);
/**
* Sets the sound effect volume
* @param volume 0-127 inclusive
*/
void setSoundEffectVolume(int volume);
/**
* Gets the area sound effect volume
* @return volume 0-127 inclusive
*/
int getAreaSoundEffectVolume();
void setAreaSoundEffectVolume(int i);
int getMusicVolume();
void setClientMusicVolume(int i);
/**
* Sets the area sound effect volume
* @param volume 0-127 inclusive
*/
void setAreaSoundEffectVolume(int volume);
}
@@ -40,13 +40,19 @@ public interface ScriptEvent
String NAME = "event_opbase";
/**
* Gets the widget of the event.
*
* @return the widget
* @see Widget
* Gets the widget the {@link #WIDGET_ID} and {@link #WIDGET_INDEX} args
* are substituted with
*/
Widget getSource();
/**
* Sets the widget the {@link #WIDGET_ID} and {@link #WIDGET_INDEX} args
* are substituted with. This is useful for running widget listeners
*
* @see Widget#getOnLoadListener()
*/
ScriptEvent setSource(Widget widget);
/**
* Gets the menu index of the event
*
@@ -80,4 +86,11 @@ public interface ScriptEvent
* @return
*/
int getTypedKeyChar();
}
/**
* Executes a cs2 script specified by this event
*
* This method must be ran on the client thread and is not reentrant
*/
void run();
}
@@ -348,6 +348,20 @@ public final class ScriptID
@ScriptArguments()
public static final int BANKMAIN_SEARCHING = 514;
/**
* Chooses the click handler for a {@link ParamID#SETTING_SLIDER_CUSTOM_ONOP} = 1 settings slider
*
* The active widget is set to the track created by {@link ParamID#SETTING_FOREGROUND_CLICKZONE}
* <ul>
* <li>int {@link ParamID#SETTING_ID}</li>
* <li>int (WidgetID) Slider handle ID</li>
* <li>int (widget index) Slider handle index</li>
* <li>int track width</li>
* <li>int y offset</li>
* <li>int x offset</li>
* <li>int (WidgetID) drag parent</li>
* </ul>
*/
@ScriptArguments(integer = 7)
public static final int SETTINGS_SLIDER_CHOOSE_ONOP = 3885;
@@ -1596,4 +1596,8 @@ public final class SpriteID
public static final int FRIENDS_CHAT_RANK_TRIPLE_CHEVRON_SERGEANT = 2831;
public static final int FRIENDS_CHAT_RANK_DOUBLE_CHEVRON_CORPORAL = 2832;
public static final int FRIENDS_CHAT_RANK_SINGLE_CHEVRON_RECRUIT = 2833;
public static final int SETTINGS_SLIDER_HANDLE_BLUE = 2858;
public static final int SETTINGS_SLIDER_HANDLE_RED = 2859;
public static final int SETTINGS_SLIDER_HANDLE_GREEN = 2860;
}
@@ -56,6 +56,62 @@ public interface SpritePixels
*/
int getHeight();
/**
* Gets the max width of the sprite image in pixels.
*
* @return the width
*/
int getMaxWidth();
/**
* Gets the max height of the sprite image in pixels.
*
* @return the height
*/
int getMaxHeight();
/**
* Gets the x offset of the sprite image in pixels.
*
* @return the offset
*/
int getOffsetX();
/**
* Gets the y offset of the sprite image in pixels.
*
* @return the offset
*/
int getOffsetY();
/**
* Sets the max width of the sprite image in pixels.
*
* @param maxWidth the width
*/
void setMaxWidth(int maxWidth);
/**
* Sets the max height of the sprite image in pixels.
*
* @param maxHeight the height
*/
void setMaxHeight(int maxHeight);
/**
* Sets the x offset of the sprite image in pixels.
*
* @param offsetX the offset
*/
void setOffsetX(int offsetX);
/**
* Sets the y offset of the sprite image in pixels.
*
* @param offsetY the offset
*/
void setOffsetY(int offsetY);
/**
* Gets an array of all pixels data in the sprite.
*
@@ -92,20 +148,4 @@ public interface SpritePixels
* @param color target color
*/
void toBufferedOutline(BufferedImage img, int color);
int getMaxWidth();
void setMaxWidth(int maxWidth);
int getMaxHeight();
void setMaxHeight(int maxHeight);
int getOffsetX();
void setOffsetX(int offsetX);
int getOffsetY();
void setOffsetY(int offsetY);
}
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2020 Abex
* 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 config type dedicated to holding params.
*
* Historically items were often used for this before structs were made
* available, and there are many of these still around.
*
* @see ParamHolder
*/
public interface StructComposition extends ParamHolder
{
int getId();
}
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2020 Abex
* 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;
/**
* @see StructComposition
* @see Client#getStructComposition(int)
*/
public class StructID
{
public static final int SETTINGS_MUSIC_VOLUME = 2753;
public static final int SETTINGS_EFFECT_VOLUME = 2754;
public static final int SETTINGS_AREA_VOLUME = 2755;
}
@@ -197,104 +197,15 @@ public enum VarPlayer
SOUND_EFFECT_VOLUME(169),
AREA_EFFECT_VOLUME(872),
/**
* f2p Quest varbits, these don't hold the completion value.
*/
QUEST_BLACK_KNIGHTS_FORTRESS(130),
QUEST_COOKS_ASSISTANT(29),
QUEST_DORICS_QUEST(31),
QUEST_DRAGON_SLAYER(176),
QUEST_ERNEST_THE_CHICKEN(32),
QUEST_IMP_CATCHER(160),
QUEST_THE_KNIGHTS_SWORD(122),
QUEST_PIRATES_TREASURE(71),
QUEST_PRINCE_ALI_RESCUE(273),
QUEST_THE_RESTLESS_GHOST(107),
QUEST_ROMEO_AND_JULIET(144),
QUEST_RUNE_MYSTERIES(63),
QUEST_SHEEP_SHEARER(179),
QUEST_SHIELD_OF_ARRAV(145),
QUEST_SHIELD_OF_ARRAV_STATE_146(146),
QUEST_VAMPIRE_SLAYER(178),
QUEST_WITCHS_POTION(67),
/**
* member Quest varbits, these don't hold the completion value.
*/
QUEST_BIG_CHOMPY_BIRD_HUNTING(293),
QUEST_BIOHAZARD(68),
QUEST_CABIN_FEVER(655),
QUEST_CLOCK_TOWER(10),
QUEST_CREATURE_OF_FENKENSTRAIN(399),
QUEST_DEATH_PLATEAU(314),
QUEST_THE_DIG_SITE(131),
QUEST_DRUIDIC_RITUAL(80),
QUEST_DWARF_CANNON(0),
QUEST_EADGARS_RUSE(335),
QUEST_ELEMENTAL_WORKSHOP_I(299),
QUEST_FAMILY_CREST(148),
QUEST_FIGHT_ARENA(17),
QUEST_FISHING_CONTEST(11),
QUEST_THE_FREMENNIK_TRIALS(347),
QUEST_WATERFALL_QUEST(65),
QUEST_GERTRUDES_CAT(180),
QUEST_THE_GRAND_TREE(150),
QUEST_HAUNTED_MINE(382),
QUEST_HAZEEL_CULT(223),
QUEST_HEROES_QUEST(188),
QUEST_HOLY_GRAIL(5),
QUEST_IN_SEARCH_OF_THE_MYREQUE(387),
QUEST_JUNGLE_POTION(175),
QUEST_LEGENDS_QUEST(139),
QUEST_LOST_CITY(147),
QUEST_MERLINS_CRYSTAL(14),
QUEST_MONKEY_MADNESS_I(365),
QUEST_MONKS_FRIEND(30),
QUEST_MOURNINGS_END_PART_I(517),
QUEST_MURDER_MYSTERY(192),
QUEST_NATURE_SPIRIT(307),
QUEST_OBSERVATORY_QUEST(112),
QUEST_ONE_SMALL_FAVOUR(416),
QUEST_PLAGUE_CITY(165),
QUEST_PRIEST_IN_PERIL(302),
QUEST_RAG_AND_BONE_MAN(714),
QUEST_REGICIDE(328),
QUEST_ROVING_ELVES(402),
QUEST_RUM_DEAL(600),
QUEST_SCORPION_CATCHER(76),
QUEST_SEA_SLUG(159),
QUEST_SHADES_OF_MORTTON(339),
QUEST_SHEEP_HERDER(60),
QUEST_SHILO_VILLAGE(116),
QUEST_TAI_BWO_WANNAI_TRIO(320),
QUEST_TEMPLE_OF_IKOV(26),
QUEST_THRONE_OF_MISCELLANIA(359),
QUEST_THE_TOURIST_TRAP(197),
QUEST_WITCHS_HOUSE(226),
QUEST_TREE_GNOME_VILLAGE(111),
QUEST_TRIBAL_TOTEM(200),
QUEST_TROLL_ROMANCE(385),
QUEST_TROLL_STRONGHOLD(317),
QUEST_UNDERGROUND_PASS(161),
QUEST_UNDERGROUND_PASS_STATE_162(162),
QUEST_WATCHTOWER(212),
QUEST_THE_GREAT_BRAIN_ROBBERY(980),
QUEST_RAG_AND_BONE_MAN_II(714),
/**
* mini-quest varbits, these don't hold the completion value.
*/
QUEST_ENTER_THE_ABYSS(492),
QUEST_ALFRED_GRIMHANDS_BARCRAWL(77),
QUEST_ALFRED_GRIMHANDS_BARCRAWL_STATE_76(76),
QUEST_THE_MAGE_ARENA(267),
/**
* 0 = 2 buttons, 1 = 1 button
*/
MOUSE_BUTTONS(170),
ZALCANO_FORM(1683);
/**
* {@link NpcID} for the HP HUD
*/
HP_HUD_NPC_ID(1683);
public final int id;
}
private final int id;
}
@@ -784,6 +784,13 @@ public enum Varbits
LEAGUE_RELIC_5(10053),
LEAGUE_RELIC_6(11696),
/**
* Muted volume restore values
*/
MUTED_MUSIC_VOLUME(9666),
MUTED_SOUND_EFFECT_VOLUME(9674),
MUTED_AREA_EFFECT_VOLUME(9675),
/**
* Whether the Special Attack orb is disabled due to being in a PvP area
*
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* Copyright (c) 2020 Abex
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -24,21 +24,18 @@
*/
package net.runelite.api.events;
import net.runelite.api.widgets.Widget;
import lombok.Data;
import net.runelite.api.StructComposition;
/**
* An event where the hidden state of a {@link Widget} has been modified.
* An event called after a new {@link StructComposition} is created and
* its data is initialized.
*/
@Data
public class WidgetHiddenChanged implements Event
public class PostStructComposition
{
/**
* The affected widget.
* The newly created struct.
*/
private Widget widget;
/**
* The new hidden state of the widget.
*/
private boolean hidden;
}
private StructComposition structComposition;
}
@@ -25,15 +25,16 @@
package net.runelite.api.events;
import lombok.Value;
import net.runelite.api.Nameable;
/**
* An event where a request to remove a friend is sent to the server.
* An event trigger when a player is removed from the friend or ignore list.
*/
@Value
public class RemovedFriend implements Event
public class RemovedFriend
{
/**
* The name of the removed friend.
* The removed friend or ignore entry
*/
String name;
}
private final Nameable nameable;
}
@@ -0,0 +1,39 @@
/*
* Copyright (c) 2020 Abex
* 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.events;
import net.runelite.api.Client;
/**
* Posted when the game world the client wants to connect to has changed
* This is posted after the world ID and type have updated, but before a new
* connection is established
*
* @see Client#getWorld()
* @see Client#getWorldType()
*/
public class WorldChanged
{
}
@@ -72,9 +72,6 @@ public interface Callbacks
*/
void drawAboveOverheads();
void drawLayer(Widget layer, List<WidgetItem> widgetItems);
void drawInterface(int interfaceId, List<WidgetItem> widgetItems);
/**
* Client top-most draw method, rendering over top of most of game interfaces.
*
@@ -85,6 +82,20 @@ public interface Callbacks
*/
void draw(MainBufferProvider mainBufferProvider, Graphics graphics, int x, int y);
/**
* Called after an interface has been drawn
* @param interfaceId the interface id
* @param widgetItems Widget items within the interface
*/
void drawInterface(int interfaceId, List<WidgetItem> widgetItems);
/**
* Called after a widget layer has been drawn
* @param layer The layer
* @param widgetItems Widget items within the layer
*/
void drawLayer(Widget layer, List<WidgetItem> widgetItems);
/**
* Mouse pressed event. If this event will be consumed it will not be propagated further to client.
*
@@ -43,11 +43,30 @@ public interface DrawCallbacks
SceneTileModel model, int tileZ, int tileX, int tileY,
int zoom, int centerX, int centerY);
void draw();
/**
* Called when a frame should be drawn.
*
* @param overlayColor Color of full-viewport overlays, if any
*/
void draw(int overlayColor);
boolean drawFace(Model model, int face);
/**
* Called before the scene is drawn
* @param cameraX
* @param cameraY
* @param cameraZ
* @param cameraPitch
* @param cameraYaw
* @param plane
*/
void drawScene(int cameraX, int cameraY, int cameraZ, int cameraPitch, int cameraYaw, int plane);
/**
* Called after the scene has been drawn
*/
void postDrawScene();
void animate(Texture texture, int diff);
}
@@ -70,6 +70,10 @@ public interface Widget
int getButtonType();
boolean isWidgetItemDragged(int index);
Point getWidgetItemDragOffsets();
/**
* Gets the type of content displayed by the widget.
*/
@@ -1017,13 +1021,34 @@ public interface Widget
*/
void setOnReleaseListener(Object ...args);
boolean isWidgetItemDragged(int index);
/**
* Sets a script to be ran when a drag operation is finished on this widget
*
* @param args A ScriptID, then the args for the script
*/
void setOnDragCompleteListener(Object ...args);
Point getWidgetItemDragOffsets();
/**
* Sets a script to be ran when this widget moves due to a drag
*
* @param args A ScriptID, then the args for the script
*/
void setOnDragListener(Object ...args);
static boolean getDragParent(Widget widget)
{
System.out.println("ERROR: IMPLEMENT"); //Would throw but that breaks widget inspector
return false;
}
/**
* Container this can be dragged in
*/
Widget getDragParent();
/**
* Container this can be dragged in
*/
void setDragParent(Widget dragParent);
/**
* Sets a script to be ran when a varplayer changes
*
* @param args A ScriptID, then the args for the script
*/
void setOnVarTransmitListener(Object ...args);
}
@@ -141,7 +141,7 @@ public class WidgetID
public static final int LOOTING_BAG_GROUP_ID = 81;
public static final int SKOTIZO_GROUP_ID = 308;
public static final int ENTERING_HOUSE_GROUP_ID = 71;
public static final int FULLSCREEN_MAP_GROUP_ID = 165;
public static final int FULLSCREEN_CONTAINER_TLI = 165;
public static final int QUESTLIST_GROUP_ID = 399;
public static final int SKILLS_GROUP_ID = 320;
public static final int DIALOG_SPRITE2_ID = 11;
@@ -827,7 +827,7 @@ public enum WidgetInfo
MULTICOMBAT_FIXED(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.MULTICOMBAT_INDICATOR),
MULTICOMBAT_RESIZEABLE(WidgetID.RESIZABLE_VIEWPORT_BOTTOM_LINE_GROUP_ID, WidgetID.ResizableViewport.MULTICOMBAT_INDICATOR),
FULLSCREEN_MAP_ROOT(WidgetID.FULLSCREEN_MAP_GROUP_ID, WidgetID.FullScreenMap.ROOT),
FULLSCREEN_MAP_ROOT(WidgetID.FULLSCREEN_CONTAINER_TLI, WidgetID.FullScreenMap.ROOT),
QUESTLIST_BOX(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.BOX),
QUESTLIST_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.CONTAINER),
@@ -888,6 +888,12 @@ public enum WidgetInfo
SEED_VAULT_ITEM_CONTAINER(WidgetID.SEED_VAULT_GROUP_ID, WidgetID.SeedVault.ITEM_CONTAINER),
SEED_VAULT_ITEM_TEXT(WidgetID.SEED_VAULT_GROUP_ID, WidgetID.SeedVault.ITEM_TEXT),
SEED_VAULT_INVENTORY_ITEMS_CONTAINER(WidgetID.SEED_VAULT_INVENTORY_GROUP_ID, WidgetID.SeedVault.INVENTORY_ITEM_CONTAINER),
SETTINGS_SIDE_CAMERA_ZOOM_SLIDER_TRACK(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.CAMERA_ZOOM_SLIDER_TRACK),
SETTINGS_SIDE_MUSIC_SLIDER(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.MUSIC_SLIDER),
SETTINGS_SIDE_SOUND_EFFECT_SLIDER(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.SOUND_EFFECT_SLIDER),
SETTINGS_SIDE_AREA_SOUND_SLIDER(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.AREA_SOUND_SLIDER),
JEWELLERY_BOX_DUEL_RING(WidgetID.JEWELLERY_BOX_GROUP_ID, WidgetID.JewelBox.DUEL_RING),
JEWELLERY_BOX_GAME_NECK(WidgetID.JEWELLERY_BOX_GROUP_ID, WidgetID.JewelBox.GAME_NECK),
JEWELLERY_BOX_COMB_BRAC(WidgetID.JEWELLERY_BOX_GROUP_ID, WidgetID.JewelBox.COMB_BRAC),
@@ -921,7 +927,6 @@ public enum WidgetInfo
HEALTH_OVERLAY_BAR(WidgetID.HEALTH_OVERLAY_BAR_GROUP_ID, WidgetID.EncounterHealthBar.CONTAINER),
SETTINGS_INIT(WidgetID.SETTINGS_GROUP_ID, WidgetID.Settings.INIT),
SETTINGS_SIDE_CAMERA_ZOOM_SLIDER_TRACK(WidgetID.SETTINGS_SIDE_GROUP_ID, WidgetID.SettingsSide.CAMERA_ZOOM_SLIDER_TRACK),
TRAILBLAZER_AREA_TELEPORT(WidgetID.TRAILBLAZER_AREAS_GROUP_ID, WidgetID.TrailblazerAreas.TELEPORT),
;
@@ -1,29 +0,0 @@
package com.openosrs.client.plugins;
import com.openosrs.client.plugins.openosrs.OpenOSRSPlugin;
import java.util.ArrayList;
import java.util.List;
import net.runelite.client.externalplugins.ExternalPluginManager;
import net.runelite.client.plugins.PluginInstantiationException;
public class BuiltInPluginManager
{
public static List<Class<?>> oprsPlugins = new ArrayList<>();
public static void loadPlugins()
{
try
{
ExternalPluginManager.pluginManager.loadPlugins(oprsPlugins, null);
}
catch (PluginInstantiationException e)
{
e.printStackTrace();
}
}
static
{
oprsPlugins.add(OpenOSRSPlugin.class);
}
}
@@ -33,6 +33,15 @@ import com.google.inject.CreationException;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Module;
import static com.openosrs.client.OpenOSRS.EXTERNALPLUGIN_DIR;
import static com.openosrs.client.OpenOSRS.SYSTEM_VERSION;
import com.openosrs.client.config.OpenOSRSConfig;
import com.openosrs.client.events.ExternalPluginChanged;
import com.openosrs.client.events.ExternalRepositoryChanged;
import com.openosrs.client.ui.OpenOSRSSplashScreen;
import com.openosrs.client.util.Groups;
import com.openosrs.client.util.MiscUtils;
import com.openosrs.client.util.SwingUtil;
import java.lang.reflect.InvocationTargetException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -61,24 +70,15 @@ import lombok.AccessLevel;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.RuneLite;
import static com.openosrs.client.OpenOSRS.EXTERNALPLUGIN_DIR;
import static com.openosrs.client.OpenOSRS.SYSTEM_VERSION;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigManager;
import com.openosrs.client.config.OpenOSRSConfig;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.events.ConfigChanged;
import com.openosrs.client.events.ExternalPluginChanged;
import com.openosrs.client.events.ExternalRepositoryChanged;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginInstantiationException;
import net.runelite.client.plugins.PluginManager;
import net.runelite.client.ui.ClientUI;
import com.openosrs.client.ui.OpenOSRSSplashScreen;
import com.openosrs.client.util.Groups;
import com.openosrs.client.util.MiscUtils;
import com.openosrs.client.util.SwingUtil;
import org.jgroups.Message;
import org.pf4j.DefaultPluginManager;
import org.pf4j.DependencyResolver;
@@ -117,7 +117,7 @@ public class ExternalPluginManager
@Inject
public ExternalPluginManager(
@Named("safeMode") final boolean safeMode,
net.runelite.client.plugins.PluginManager pluginManager,
PluginManager pluginManager,
OpenOSRSConfig openOSRSConfig,
EventBus eventBus,
ExecutorService executorService,
@@ -27,6 +27,8 @@
package com.openosrs.client.plugins.openosrs;
import ch.qos.logback.classic.Logger;
import com.openosrs.client.plugins.openosrs.externals.ExternalPluginManagerPanel;
import com.openosrs.client.config.OpenOSRSConfig;
import java.awt.event.KeyEvent;
import java.awt.image.BufferedImage;
import javax.inject.Inject;
@@ -55,14 +57,12 @@ import static net.runelite.api.widgets.WidgetInfo.BANK_PIN_SECOND_ENTERED;
import static net.runelite.api.widgets.WidgetInfo.BANK_PIN_THIRD_ENTERED;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.Keybind;
import com.openosrs.client.config.OpenOSRSConfig;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.input.KeyListener;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import com.openosrs.client.plugins.openosrs.externals.ExternalPluginManagerPanel;
import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.util.HotkeyListener;
@@ -1,5 +1,6 @@
package com.openosrs.client.plugins.openosrs.externals;
import com.openosrs.client.plugins.ExternalPluginManager;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
@@ -21,7 +22,6 @@ import javax.swing.JTabbedPane;
import javax.swing.JTextField;
import javax.swing.border.EmptyBorder;
import net.runelite.client.eventbus.EventBus;
import com.openosrs.client.plugins.ExternalPluginManager;
import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.PluginPanel;
@@ -1,6 +1,12 @@
package com.openosrs.client.plugins.openosrs.externals;
import com.openosrs.client.plugins.ExternalPluginManager;
import com.google.gson.JsonSyntaxException;
import com.openosrs.client.events.ExternalPluginChanged;
import com.openosrs.client.events.ExternalRepositoryChanged;
import com.openosrs.client.util.DeferredDocumentChangedListener;
import com.openosrs.client.util.ImageUtil;
import com.openosrs.client.util.SwingUtil;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
@@ -32,10 +38,6 @@ import javax.swing.border.EmptyBorder;
import lombok.extern.slf4j.Slf4j;
import static net.runelite.api.util.Text.DISTANCE;
import net.runelite.client.eventbus.EventBus;
import com.openosrs.client.events.ExternalPluginChanged;
import com.openosrs.client.events.ExternalRepositoryChanged;
import com.openosrs.client.plugins.ExternalPluginManager;
import static com.openosrs.client.plugins.openosrs.externals.ExternalPluginManagerPanel.wrapContainer;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.ColorScheme;
@@ -43,9 +45,6 @@ import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.PluginPanel;
import net.runelite.client.ui.components.IconTextField;
import net.runelite.client.ui.components.shadowlabel.JShadowedLabel;
import com.openosrs.client.util.DeferredDocumentChangedListener;
import com.openosrs.client.util.ImageUtil;
import com.openosrs.client.util.SwingUtil;
import org.pf4j.update.PluginInfo;
import org.pf4j.update.UpdateManager;
import org.pf4j.update.UpdateRepository;
@@ -112,8 +111,8 @@ public class PluginsPanel extends JPanel
JTabbedPane mainTabPane = new JTabbedPane();
mainTabPane.add("Installed", wrapContainer(installedPluginsPanel()));
mainTabPane.add("Available", wrapContainer(availablePluginsPanel()));
mainTabPane.add("Installed", ExternalPluginManagerPanel.wrapContainer(installedPluginsPanel()));
mainTabPane.add("Available", ExternalPluginManagerPanel.wrapContainer(availablePluginsPanel()));
add(filterwrapper, BorderLayout.NORTH);
add(mainTabPane, BorderLayout.CENTER);
@@ -1,5 +1,8 @@
package com.openosrs.client.plugins.openosrs.externals;
import com.openosrs.client.plugins.ExternalPluginManager;
import com.openosrs.client.ui.JMultilineLabel;
import com.openosrs.client.util.ImageUtil;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
@@ -14,11 +17,8 @@ import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.CompoundBorder;
import javax.swing.border.EmptyBorder;
import com.openosrs.client.plugins.ExternalPluginManager;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.FontManager;
import com.openosrs.client.ui.JMultilineLabel;
import com.openosrs.client.util.ImageUtil;
import net.runelite.client.util.LinkBrowser;
import org.pf4j.update.PluginInfo;
import org.pf4j.update.UpdateRepository;
@@ -1,5 +1,7 @@
package com.openosrs.client.plugins.openosrs.externals;
import com.openosrs.client.plugins.ExternalPluginManager;
import com.openosrs.client.events.ExternalRepositoryChanged;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
@@ -7,8 +9,6 @@ import javax.inject.Inject;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import net.runelite.client.eventbus.EventBus;
import com.openosrs.client.events.ExternalRepositoryChanged;
import com.openosrs.client.plugins.ExternalPluginManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.ui.ColorScheme;
import org.pf4j.update.UpdateRepository;
@@ -46,7 +46,7 @@ import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.FontManager;
import com.openosrs.client.ui.OpenOSRSSplashScreen;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.LinkBrowser;
import com.openosrs.client.util.LinkBrowser;
@Slf4j
public class InfoPanel extends JPanel
@@ -0,0 +1,83 @@
package com.openosrs.client.util;
import java.awt.Desktop;
import java.awt.Toolkit;
import java.awt.datatransfer.StringSelection;
import java.io.File;
import java.io.IOException;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class LinkBrowser extends net.runelite.client.util.LinkBrowser
{
/**
* Tries to open the specified {@code File} with the systems default text editor. If operation fails
* an error message is displayed with the option to copy the absolute file path to clipboard.
*
* @param file the File instance of the log file
* @return did the file open successfully?
*/
public static boolean openLocalFile(final File file)
{
if (file == null || !file.exists())
{
return false;
}
if (attemptOpenLocalFile(file))
{
log.debug("Opened log file through Desktop#edit to {}", file);
return true;
}
showMessageBox("Unable to open log file. Press 'OK' and the file path will be copied to your clipboard", file.getAbsolutePath());
return false;
}
private static boolean attemptOpenLocalFile(final File file)
{
if (!Desktop.isDesktopSupported())
{
return false;
}
final Desktop desktop = Desktop.getDesktop();
if (!desktop.isSupported(Desktop.Action.OPEN))
{
return false;
}
try
{
desktop.open(file);
return true;
}
catch (IOException ex)
{
log.warn("Failed to open Desktop#edit {}", file, ex);
return false;
}
}
/**
* Open swing message box with specified message and copy data to clipboard
* @param message message to show
*/
private static void showMessageBox(final String message, final String data)
{
SwingUtilities.invokeLater(() ->
{
final int result = JOptionPane.showConfirmDialog(null, message, "Message",
JOptionPane.OK_CANCEL_OPTION);
if (result == JOptionPane.OK_OPTION)
{
final StringSelection stringSelection = new StringSelection(data);
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(stringSelection, null);
}
});
}
}
@@ -45,6 +45,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.sound.sampled.AudioInputStream;
import javax.sound.sampled.AudioSystem;
@@ -101,8 +102,6 @@ public class Notifier
private static final int MINIMUM_FLASH_DURATION_MILLIS = 2000;
private static final int MINIMUM_FLASH_DURATION_TICKS = MINIMUM_FLASH_DURATION_MILLIS / Constants.CLIENT_TICK_LENGTH;
private static final String appName = RuneLiteProperties.getTitle();
private static final File NOTIFICATION_FILE = new File(RuneLite.RUNELITE_DIR, "notification.wav");
private static final long CLIP_MTIME_UNLOADED = -2;
private static final long CLIP_MTIME_BUILTIN = -1;
@@ -113,6 +112,7 @@ public class Notifier
private final ScheduledExecutorService executorService;
private final ChatMessageManager chatMessageManager;
private final EventBus eventBus;
private final String appName;
private final Path notifyIconPath;
private boolean terminalNotifierAvailable;
private Instant flashStart;
@@ -127,7 +127,9 @@ public class Notifier
final RuneLiteConfig runeliteConfig,
final ScheduledExecutorService executorService,
final ChatMessageManager chatMessageManager,
final EventBus eventBus)
final EventBus eventBus,
@Named("runelite.title") final String appName
)
{
this.client = client;
this.clientUI = clientUI;
@@ -135,6 +137,7 @@ public class Notifier
this.executorService = executorService;
this.chatMessageManager = chatMessageManager;
this.eventBus = eventBus;
this.appName = appName;
this.notifyIconPath = RuneLite.RUNELITE_DIR.toPath().resolve("icon.png");
// First check if we are running in launcher
@@ -377,7 +380,7 @@ public class Notifier
{
if (OSType.getOSType() == OSType.Linux && !Files.exists(notifyIconPath))
{
try (InputStream stream = Notifier.class.getResourceAsStream("/runelite.png"))
try (InputStream stream = Notifier.class.getResourceAsStream("/openosrs.png"))
{
Files.copy(stream, notifyIconPath);
}
@@ -30,7 +30,6 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.inject.Guice;
import com.google.inject.Inject;
import com.google.inject.Injector;
import com.openosrs.client.plugins.BuiltInPluginManager;
import java.io.File;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
@@ -390,9 +389,6 @@ public class RuneLite
overlayManager.add(tooltipOverlay.get());
}
//Load built-in OPRS plugins
BuiltInPluginManager.loadPlugins();
// Start plugins
pluginManager.startPlugins();
@@ -32,6 +32,7 @@ import com.openosrs.client.config.OpenOSRSConfig;
import com.openosrs.client.util.NonScheduledExecutorServiceExceptionLogger;
import java.applet.Applet;
import java.io.File;
import java.util.Properties;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.LinkedBlockingQueue;
@@ -75,6 +76,12 @@ public class RuneLiteModule extends AbstractModule
@Override
protected void configure()
{
Properties properties = RuneLiteProperties.getProperties();
for (String key : properties.stringPropertyNames())
{
String value = properties.getProperty(key);
bindConstant().annotatedWith(Names.named(key)).to(value);
}
bindConstant().annotatedWith(Names.named("developerMode")).to(developerMode);
bindConstant().annotatedWith(Names.named("safeMode")).to(safeMode);
bind(File.class).annotatedWith(Names.named("sessionfile")).toInstance(sessionfile);
@@ -28,18 +28,14 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.annotation.Nullable;
import lombok.AccessLevel;
import lombok.Getter;
import okhttp3.HttpUrl;
public class RuneLiteProperties
{
private static final String RUNELITE_TITLE = "runelite.title";
private static final String RUNELITE_VERSION = "runelite.version";
private static final String RUNESCAPE_VERSION = "runescape.version";
private static final String DISCORD_APP_ID = "runelite.discord.appid";
private static final String DISCORD_INVITE = "runelite.discord.invite";
private static final String GITHUB_LINK = "runelite.github.link";
private static final String WIKI_LINK = "runelite.wiki.link";
private static final String PATREON_LINK = "runelite.patreon.link";
private static final String LAUNCHER_VERSION_PROPERTY = "runelite.launcher.version";
private static final String INSECURE_SKIP_TLS_VERIFICATION_PROPERTY = "runelite.insecure-skip-tls-verification";
private static final String TROUBLESHOOTING_LINK = "runelite.wiki.troubleshooting.link";
@@ -49,8 +45,8 @@ public class RuneLiteProperties
private static final String JAV_CONFIG_BACKUP = "runelite.jav_config_backup";
private static final String PLUGINHUB_BASE = "runelite.pluginhub.url";
private static final String PLUGINHUB_VERSION = "runelite.pluginhub.version";
private static final String IMGUR_CLIENT_ID = "runelite.imgur.client.id";
@Getter(AccessLevel.PACKAGE)
private static final Properties properties = new Properties();
static
@@ -65,46 +61,16 @@ public class RuneLiteProperties
}
}
public static String getTitle()
{
return properties.getProperty(RUNELITE_TITLE);
}
public static String getVersion()
{
return properties.getProperty(RUNELITE_VERSION);
}
public static String getRunescapeVersion()
{
return properties.getProperty(RUNESCAPE_VERSION);
}
public static String getDiscordAppId()
{
return properties.getProperty(DISCORD_APP_ID);
}
public static String getDiscordInvite()
{
return properties.getProperty(DISCORD_INVITE);
}
public static String getGithubLink()
{
return properties.getProperty(GITHUB_LINK);
}
public static String getWikiLink()
{
return properties.getProperty(WIKI_LINK);
}
public static String getPatreonLink()
{
return properties.getProperty(PATREON_LINK);
}
@Nullable
public static String getLauncherVersion()
{
@@ -146,9 +112,4 @@ public class RuneLiteProperties
String version = System.getProperty(PLUGINHUB_VERSION, properties.getProperty(PLUGINHUB_VERSION));
return HttpUrl.parse(properties.get(PLUGINHUB_BASE) + "/" + version);
}
public static String getImgurClientId()
{
return properties.getProperty(IMGUR_CLIENT_ID);
}
}
@@ -85,6 +85,7 @@ import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.PlayerChanged;
import net.runelite.api.events.UsernameChanged;
import net.runelite.api.events.WorldChanged;
import net.runelite.client.RuneLite;
import net.runelite.client.account.AccountSession;
import net.runelite.client.eventbus.EventBus;
@@ -1041,7 +1042,13 @@ public class ConfigManager
{
updateRSProfile();
}
@Subscribe
private void onWorldChanged(WorldChanged ev)
{
updateRSProfile();
}
@Subscribe
private void onPlayerChanged(PlayerChanged ev)
{
@@ -28,10 +28,10 @@ import com.google.common.base.Strings;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.RuneLiteProperties;
import net.runelite.client.discord.events.DiscordDisconnected;
import net.runelite.client.discord.events.DiscordErrored;
import net.runelite.client.discord.events.DiscordJoinGame;
@@ -50,6 +50,7 @@ public class DiscordService implements AutoCloseable
{
private final EventBus eventBus;
private final ScheduledExecutorService executorService;
private final String discordAppId;
private final DiscordRPC discordRPC;
// Hold a reference to the event handlers to prevent the garbage collector from deleting them
@@ -61,11 +62,14 @@ public class DiscordService implements AutoCloseable
@Inject
private DiscordService(
final EventBus eventBus,
final ScheduledExecutorService executorService)
final ScheduledExecutorService executorService,
@Named("runelite.discord.appid") final String discordAppId
)
{
this.eventBus = eventBus;
this.executorService = executorService;
this.discordAppId = discordAppId;
DiscordRPC discordRPC = null;
DiscordEventHandlers discordEventHandlers = null;
@@ -103,7 +107,7 @@ public class DiscordService implements AutoCloseable
discordEventHandlers.joinGame = this::joinGame;
discordEventHandlers.spectateGame = this::spectateGame;
discordEventHandlers.joinRequest = this::joinRequest;
discordRPC.Discord_Initialize(RuneLiteProperties.getDiscordAppId(), discordEventHandlers, true, null);
discordRPC.Discord_Initialize(discordAppId, discordEventHandlers, true, null);
executorService.scheduleAtFixedRate(discordRPC::Discord_RunCallbacks, 0, 2, TimeUnit.SECONDS);
}
@@ -49,7 +49,7 @@ public class SkillIconManager
String skillIconPath = (small ? "/skill_icons_small/" : "/skill_icons/")
+ skill.getName().toLowerCase() + ".png";
log.debug("Loading skill icon from {}", skillIconPath);
BufferedImage skillImage = ImageUtil.getResourceStreamFromClass(getClass(), skillIconPath);
BufferedImage skillImage = ImageUtil.loadImageResource(getClass(), skillIconPath);
imgCache[skillIdx] = skillImage;
return skillImage;
@@ -162,7 +162,7 @@ public class SpriteManager
Class<?> owner = add[0].getClass();
for (SpriteOverride o : add)
{
BufferedImage image = ImageUtil.getResourceStreamFromClass(owner, o.getFileName());
BufferedImage image = ImageUtil.loadImageResource(owner, o.getFileName());
SpritePixels sp = ImageUtil.getImageSpritePixels(image, client);
overrides.put(o.getSpriteId(), sp);
}
@@ -87,6 +87,7 @@ public class PluginManager
* Base package where the core plugins are
*/
private static final String PLUGIN_PACKAGE = "net.runelite.client.plugins";
private static final String OPENOSRS_PACKAGE = "com.openosrs.client.plugins";
private final boolean developerMode;
private final boolean safeMode;
@@ -290,6 +291,10 @@ public class PluginManager
.map(ClassInfo::load)
.collect(Collectors.toList());
plugins.addAll(classPath.getTopLevelClassesRecursive(OPENOSRS_PACKAGE).stream()
.map(ClassInfo::load)
.collect(Collectors.toList()));
loadPlugins(plugins, (loaded, total) ->
SplashScreen.stage(.60, .70, null, "Loading Plugins", loaded, total, false));
}
@@ -65,8 +65,8 @@ public class AccountPlugin extends Plugin
static
{
LOGIN_IMAGE = ImageUtil.getResourceStreamFromClass(AccountPlugin.class, "login_icon.png");
LOGOUT_IMAGE = ImageUtil.getResourceStreamFromClass(AccountPlugin.class, "logout_icon.png");
LOGIN_IMAGE = ImageUtil.loadImageResource(AccountPlugin.class, "login_icon.png");
LOGOUT_IMAGE = ImageUtil.loadImageResource(AccountPlugin.class, "logout_icon.png");
}
@Override
@@ -100,7 +100,7 @@ public class BarbarianAssaultPlugin extends Plugin
overlayManager.add(timerOverlay);
overlayManager.add(healerOverlay);
clockImage = ImageUtil.getResourceStreamFromClass(getClass(), "clock.png");
clockImage = ImageUtil.loadImageResource(getClass(), "clock.png");
}
@Override
@@ -27,6 +27,7 @@ package net.runelite.client.plugins.barrows;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.text.DecimalFormat;
import javax.inject.Inject;
import net.runelite.api.Client;
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
@@ -42,6 +43,8 @@ import net.runelite.client.ui.overlay.components.LineComponent;
public class BarrowsBrotherSlainOverlay extends OverlayPanel
{
private static final DecimalFormat REWARD_POTENTIAL_FORMATTER = new DecimalFormat("##0.00%");
private final Client client;
@Inject
@@ -84,10 +87,9 @@ public class BarrowsBrotherSlainOverlay extends OverlayPanel
}
final int rewardPotential = rewardPotential();
float rewardPercent = rewardPotential / 10.12f;
panelComponent.getChildren().add(LineComponent.builder()
.left("Potential")
.right(rewardPercent != 0 ? rewardPercent + "%" : "0%")
.right(REWARD_POTENTIAL_FORMATTER.format(rewardPotential / 1012f))
.rightColor(rewardPotential >= 756 && rewardPotential < 881 ? Color.GREEN : rewardPotential < 631 ? Color.WHITE : Color.YELLOW)
.build());
@@ -119,8 +119,8 @@ public class BoostsPlugin extends Plugin
Arrays.fill(lastSkillLevels, -1);
// Add infoboxes for everything at startup and then determine inside if it will be rendered
infoBoxManager.addInfoBox(new StatChangeIndicator(true, ImageUtil.getResourceStreamFromClass(getClass(), "debuffed.png"), this, config));
infoBoxManager.addInfoBox(new StatChangeIndicator(false, ImageUtil.getResourceStreamFromClass(getClass(), "buffed.png"), this, config));
infoBoxManager.addInfoBox(new StatChangeIndicator(true, ImageUtil.loadImageResource(getClass(), "debuffed.png"), this, config));
infoBoxManager.addInfoBox(new StatChangeIndicator(false, ImageUtil.loadImageResource(getClass(), "buffed.png"), this, config));
for (final Skill skill : Skill.values())
{
@@ -132,6 +132,14 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
{
addZoomTooltip(sideSlider);
}
Widget settingsInit = client.getWidget(WidgetInfo.SETTINGS_INIT);
if (settingsInit != null)
{
client.createScriptEvent(settingsInit.getOnLoadListener())
.setSource(settingsInit)
.run();
}
});
}
@@ -152,6 +160,14 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
{
sideSlider.setOnMouseRepeatListener((Object[]) null);
}
Widget settingsInit = client.getWidget(WidgetInfo.SETTINGS_INIT);
if (settingsInit != null)
{
client.createScriptEvent(settingsInit.getOnLoadListener())
.setSource(settingsInit)
.run();
}
});
}
@@ -34,13 +34,13 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Named;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.MessageNode;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.GameStateChanged;
import net.runelite.client.Notifier;
import net.runelite.client.RuneLiteProperties;
import net.runelite.client.chat.ChatColorType;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.config.ConfigManager;
@@ -70,6 +70,10 @@ public class ChatNotificationsPlugin extends Plugin
@Inject
private Notifier notifier;
@Inject
@Named("runelite.title")
private String runeliteTitle;
//Custom Highlights
private Pattern usernameMatcher = null;
private String usernameReplacer = "";
@@ -163,7 +167,7 @@ public class ChatNotificationsPlugin extends Plugin
break;
case CONSOLE:
// Don't notify for notification messages
if (chatMessage.getName().equals(RuneLiteProperties.getTitle()))
if (chatMessage.getName().equals(runeliteTitle))
{
return;
}
@@ -625,7 +625,7 @@ public class ClueScrollPlugin extends Plugin
return emoteImage;
}
emoteImage = ImageUtil.getResourceStreamFromClass(getClass(), "emote.png");
emoteImage = ImageUtil.loadImageResource(getClass(), "emote.png");
return emoteImage;
}
@@ -642,7 +642,7 @@ public class ClueScrollPlugin extends Plugin
return mapArrow;
}
mapArrow = ImageUtil.getResourceStreamFromClass(getClass(), "/util/clue_arrow.png");
mapArrow = ImageUtil.loadImageResource(getClass(), "/util/clue_arrow.png");
return mapArrow;
}
@@ -52,7 +52,7 @@ public class CipherClue extends ClueScroll implements TextClueScroll, NpcClueScr
new CipherClue("OVEXON", "Eluned", new WorldPoint(2289, 3144, 0), "Outside Lletya or in Prifddinas after Song of the Elves", "A question on elven crystal math. I have 5 and 3 crystals, large and small respectively. A large crystal is worth 10,000 coins and a small is worth but 1,000. How much are all my crystals worth?", "53,000"),
new CipherClue("VTYR APCNTGLW", "King Percival", new WorldPoint(2634, 4682, 1), "Fisher Realm, first floor. Fairy ring BJR", "How many cannons are on this here castle?", "5"),
new CipherClue("UZZU MUJHRKYYKJ", "Otto Godblessed", new WorldPoint(2501, 3487, 0), "Otto's Grotto", "How many pyre sites are found around this lake?", "3"),
new CipherClue("USBJCPSO", "Traiborn", new WorldPoint(3112, 3162, 0), "First floor of Wizards Tower", "How many air runes would I need to cast 630 wind waves?", "3150"),
new CipherClue("USBJCPSO", "Traiborn", new WorldPoint(3112, 3162, 0), "First floor of Wizards Tower. Fairy ring DIS", "How many air runes would I need to cast 630 wind waves?", "3150"),
new CipherClue("HCKTA IQFHCVJGT", "Fairy Godfather", new WorldPoint(2446, 4428, 0), "Zanaris throne room", "There are 3 inputs and 4 letters on each ring How many total individual fairy ring codes are possible?", "64"),
new CipherClue("ZSBKDO ZODO", "Pirate Pete", new WorldPoint(3680, 3537, 0), "Dock northeast of the Ectofunctus"),
new CipherClue("GBJSZ RVFFO", "Fairy Queen", new WorldPoint(2347, 4435, 0), "Fairy Resistance Hideout"),
@@ -134,11 +134,11 @@ class ConfigPanel extends PluginPanel
static
{
final BufferedImage backIcon = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "config_back_icon.png");
final BufferedImage backIcon = ImageUtil.loadImageResource(ConfigPanel.class, "config_back_icon.png");
BACK_ICON = new ImageIcon(backIcon);
BACK_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(backIcon, -100));
BufferedImage sectionRetractIcon = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "/util/arrow_right.png");
BufferedImage sectionRetractIcon = ImageUtil.loadImageResource(ConfigPanel.class, "/util/arrow_right.png");
sectionRetractIcon = ImageUtil.luminanceOffset(sectionRetractIcon, -121);
SECTION_EXPAND_ICON = new ImageIcon(sectionRetractIcon);
SECTION_EXPAND_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(sectionRetractIcon, -100));

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