Merge branch 'master' into spawn

This commit is contained in:
James
2019-10-28 12:04:28 -07:00
committed by GitHub
79 changed files with 2634 additions and 1045 deletions

View File

@@ -54,7 +54,7 @@ Before you submit your pull request consider the following guidelines:
* After cloning, set a new remote [upstream](https://help.github.com/articles/configuring-a-remote-for-a-fork/) (this helps to keep your fork up to date) * After cloning, set a new remote [upstream](https://help.github.com/articles/configuring-a-remote-for-a-fork/) (this helps to keep your fork up to date)
```shell ```shell
git remote add upstream https://github.com/runelite-extended/runelite.git git remote add upstream https://github.com/open-osrs/runelite.git
``` ```
* Make your changes in a new git branch: * Make your changes in a new git branch:

View File

@@ -1,207 +0,0 @@
import org.ajoberstar.grgit.Grgit
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "org.ajoberstar.grgit:grgit-gradle:3.1.1"
}
}
plugins {
id 'com.adarshr.test-logger' version '1.7.0' apply false
id "com.github.ben-manes.versions" version "0.22.0"
id "com.gradle.build-scan" version "2.4"
id 'se.patrikerdes.use-latest-versions' version '0.2.8'
}
apply plugin: 'application'
ext {
grgit = Grgit.open(dir: "${rootProject.projectDir}")
localGitCommit = grgit.head().id
localGitCommitShort = grgit.head().getAbbreviatedId(7)
localGitDirty = !grgit.status().clean
// sets the minimum launcher version that is output for the bootstrapper
launcherVersion = '2.0.3'
// Dependencies versions
annotations = '17.0.0'
antlr = '4.7.2'
apacheCommonsCompress = '1.19'
apacheCommonsCsv = '1.7'
apacheCommonsText = '1.8'
asm = '7.2'
commonsCli = '1.4'
discord = '1.1'
fernflower = '07082019'
findbugs = '3.0.2'
gson = '2.8.6'
guava = '28.1-jre'
guice = '4.2.2'
h2 = '1.4.200'
hamcrest = '2.2'
httpcore = '4.4.12'
httpmime = '4.5.10'
javassist = '3.26.0-GA'
javax = '1.3.2'
javaxInject = '1'
jbsdiff = '1.0'
jclCore = '2.8'
jedis = '3.1.0'
jfoenix = '9.0.9'
jna = '5.4.0'
jogamp = '2.3.2'
jopt = '5.0.4'
jooq = '3.12.2'
junit = '4.12'
jupiter = '5.6.0-M1'
logback = '1.2.3'
lombok = '1.18.10'
mapstruct = '1.3.1.Final'
mariadbJdbc = '2.5.1'
mavenPluginAnnotations = '3.6.0'
mavenPluginApi = '3.6.2'
minio = '6.0.11'
mockito = '3.1.0'
mongodbDriverSync = '3.11.1'
mysqlConnectorJava = '8.0.18'
netty = '4.1.42.Final'
okhttp3 = '4.2.2'
orangeExtensions = '1.0'
petitparser = '2.2.0'
plexus = '3.3.0'
rxjava = '2.2.13'
rxrelay = '2.1.1'
scribejava = '6.9.0'
sisu = '0.3.3'
slf4j = '1.7.28'
springJdbc = '5.2.0.RELEASE'
springboot = '2.2.0.RELEASE'
sql2o = '1.6.0'
substance = '8.0.02'
trident = '1.5.00'
}
allprojects {
apply plugin: 'maven'
if (this.name != 'rs-client') apply plugin: 'checkstyle'
group = 'com.openosrs'
version = '1.5.37-SNAPSHOT'
ext {
rsversion = 184
cacheversion = 165
plusVersion = '2.1.8.0'
gitCommit = localGitCommit
gitCommitShort = localGitCommitShort
gitDirty = localGitDirty
rootPath = rootDir.toString().replace('\\', '/')
injectedClassesPath = rootPath + "/injector-plugin/out/injected-client/"
}
}
subprojects {
apply plugin: 'com.adarshr.test-logger'
apply plugin: 'java-library'
apply plugin: 'maven'
apply plugin: 'fernflower'
apply plugin: 'maven-publish'
sourceCompatibility = 1.8
targetCompatibility = 1.8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
tasks.withType(GroovyCompile).configureEach {
options.incremental = true
}
publishing {
repositories {
maven {
name = "runelite"
url = uri("https://maven.pkg.github.com/open-osrs/runelite")
credentials {
username = System.getProperty("gpr_user")
password = System.getProperty("gpr_key")
}
}
}
publications {
gpr(MavenPublication) {
from(components.java)
}
}
}
repositories {
mavenLocal()
maven { url "http://repo1.maven.org/maven2" }
maven { url "http://repo.runelite.net" }
maven { url "http://repo.maven.apache.org/maven2" }
maven { url "https://raw.githubusercontent.com/open-osrs/hosting/master" }
if (System.getenv("NEXUS-URL") != null) {
maven { url System.getenv("NEXUS-URL") }
}
}
checkstyle {
toolVersion = '6.4.1'
sourceSets = [sourceSets.main]
configFile = file("${rootDir}/checkstyle/checkstyle.xml")
configProperties = [ "suppressionFile" : file("${rootDir}/checkstyle/suppressions.xml")]
showViolations = true
ignoreFailures = false
maxWarnings = 0
}
}
wrapper {
gradleVersion = '5.6.2'
doLast {
def optsEnvVar = "DEFAULT_JVM_OPTS"
scriptFile.write scriptFile.text.replace("$optsEnvVar='\"-Xmx64m\" \"-Xms64m\"'", "$optsEnvVar='\"-Xmx4g\" \"-Xms2g\" \"-Dfile.encoding=UTF-8\"'")
batchScript.write batchScript.text.replace("set $optsEnvVar=\"-Xmx64m\" \"-Xms64m\"", "set $optsEnvVar=\"-Xmx4g\" \"-Xms2g\" \"-Dfile.encoding=UTF-8\"")
}
}
run {
classpath = childProjects.client.sourceSets.main.runtimeClasspath
mainClassName = "net.runelite.client.RuneLite"
}
def isNonStable = { String version ->
def unstableKeyword = ['ALPHA', 'BETA', 'RC'].any { it -> version.toUpperCase().contains(it) }
return unstableKeyword
}
dependencyUpdates {
checkForGradleUpdate = false
resolutionStrategy {
componentSelection {
all {
if (isNonStable(candidate.version)) {
reject()
}
}
}
}
}

156
build.gradle.kts Normal file
View File

@@ -0,0 +1,156 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
import org.ajoberstar.grgit.Grgit
buildscript {
repositories {
maven(url = "https://plugins.gradle.org/m2/")
}
dependencies {
classpath(Plugins.grgitPlugin)
classpath(Plugins.versionsPlugin)
}
}
plugins {
id(Plugins.testLogger.first) version Plugins.testLogger.second apply false
id(Plugins.versions.first) version Plugins.versions.second
id(Plugins.buildScan.first) version Plugins.buildScan.second
id(Plugins.latestVersion.first) version Plugins.latestVersion.second
id(Plugins.grgit.first) version Plugins.grgit.second
application
}
val grgit = Grgit.open(mapOf("dir" to rootProject.projectDir.absolutePath))
val localGitCommit = grgit.head().id
val localGitCommitShort = grgit.head().getAbbreviatedId(7)
fun isNonStable(version: String): Boolean {
return listOf("ALPHA", "BETA", "RC").any {
version.toUpperCase().contains(it)
}
}
allprojects {
apply<MavenPlugin>()
group = "com.openosrs"
version = ProjectVersions.rlVersion
project.extra["gitCommit"] = localGitCommit
project.extra["gitCommitShort"] = localGitCommitShort
project.extra["rootPath"] = rootDir.toString().replace("\\", "/")
project.extra["injectedClassesPath"] = "${rootDir}/injector-plugin/out/injected-client/"
}
subprojects {
apply<JavaLibraryPlugin>()
apply<MavenPlugin>()
apply<MavenPublishPlugin>()
apply(plugin = Plugins.testLogger.first)
apply<FernflowerPlugin>()
if (this.name != "rs-client") apply(plugin = "checkstyle")
repositories {
mavenLocal()
maven(url = "http://repo1.maven.org/maven2")
maven(url = "http://repo.runelite.net")
maven(url = "http://repo.maven.apache.org/maven2")
maven(url = "https://raw.githubusercontent.com/open-osrs/hosting/master")
if (System.getenv("NEXUS-URL") != null) {
maven(url = System.getenv("NEXUS-URL"))
}
}
configure<CheckstyleExtension> {
sourceSets = setOf(project.sourceSets.main.get())
configFile = file("${rootDir}/checkstyle/checkstyle.xml")
configProperties = mapOf("suppressionFile" to file("${rootDir}/checkstyle/suppressions.xml"))
maxWarnings = 0
toolVersion = "6.4.1"
isShowViolations = true
isIgnoreFailures = false
}
configure<PublishingExtension> {
repositories {
maven {
name = "runelite"
url = uri("https://maven.pkg.github.com/open-osrs/runelite")
credentials {
username = System.getProperty("gpr_user")
password = System.getProperty("gpr_key")
}
}
}
publications {
register("gpr", MavenPublication::class) {
from(components["java"])
}
}
}
tasks {
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
withType<JavaCompile> {
options.encoding = "UTF-8"
}
}
}
application {
mainClassName = "net.runelite.client.RuneLite"
}
tasks {
named<JavaExec>("run") {
classpath = project(":runelite-client").sourceSets.main.get().runtimeClasspath
}
named<DependencyUpdatesTask>("dependencyUpdates") {
checkForGradleUpdate = false
resolutionStrategy {
componentSelection {
all {
if (candidate.displayName.contains("fernflower") || isNonStable(candidate.version)) {
reject("Non stable")
}
}
}
}
}
}

View File

@@ -1,7 +0,0 @@
repositories {
maven { url "https://raw.githubusercontent.com/open-osrs/hosting/master" }
}
dependencies {
compile localGroovy()
implementation group: 'net.runelite', name: 'fernflower', version: '07082019'
}

44
buildSrc/build.gradle.kts Normal file
View File

@@ -0,0 +1,44 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
plugins {
`kotlin-dsl`
groovy
}
repositories {
mavenCentral()
maven(url = "https://raw.githubusercontent.com/open-osrs/hosting/master")
}
dependencies {
implementation(gradleApi())
implementation(localGroovy())
implementation(group = "net.runelite", name = "fernflower", version = "07082019")
}
kotlinDslPluginOptions {
experimentalWarning.set(false)
}

View File

@@ -1,16 +0,0 @@
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.StopExecutionException
class FernflowerPlugin implements Plugin<Project> {
void apply(Project project) {
project.task('decompile', type: FernflowerTask) {
it.dependsOn(project.tasks.jar)
it.doFirst {
if (!project.tasks.jar.didWork) {
throw new StopExecutionException()
}
}
}
}
}

View File

@@ -1,32 +0,0 @@
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.InputFile
import org.gradle.api.tasks.OutputDirectory
import org.gradle.api.tasks.TaskAction
import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler
class FernflowerTask extends DefaultTask {
List<String> extraArgs
String inputJar
String outputDir
@InputFile
File getInputJar() {
project.file(inputJar ?: project.buildDir.toString() + '/libs/' + project.getName() + '-' + project.version + '.jar')
}
@OutputDirectory
File getOutputDir() {
project.file(outputDir ?: project.buildDir.toString() + '/decompiled-sources')
}
@TaskAction
void decompile() {
getOutputDir().mkdirs()
def args = [getInputJar().toString(), getOutputDir().toString()]
if (extraArgs) {
args.addAll(extraArgs)
}
ConsoleDecompiler.main(args as String[])
}
}

View File

@@ -0,0 +1,193 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
const val kotlinVersion = "1.3.50"
object ProjectVersions {
const val launcherVersion = "2.0.3"
const val rlVersion = "1.5.37-SNAPSHOT"
const val openosrsVersion = "2.1.8.0"
const val rsversion = 184
const val cacheversion = 165
}
object Plugins {
val grgitPlugin = "org.ajoberstar:grgit:2.3.0"
val versionsPlugin = "com.github.ben-manes:gradle-versions-plugin:0.27.0"
val testLogger = Pair("com.adarshr.test-logger", "2.0.0")
val versions = Pair("com.github.ben-manes.versions", "0.27.0")
val buildScan = Pair("com.gradle.build-scan", "3.0")
val latestVersion = Pair("se.patrikerdes.use-latest-versions", "0.2.12")
val grgit = Pair("org.ajoberstar.grgit", "4.0.0-rc.1")
val jarTest = Pair("com.github.hauner.jarTest", "1.0.1")
val shadow = Pair("com.github.johnrengelman.shadow", "5.1.0")
}
object Libraries {
private object Versions {
const val annotations = "17.0.0"
const val antlr = "4.7.2"
const val apacheCommonsCompress = "1.19"
const val apacheCommonsCsv = "1.7"
const val apacheCommonsText = "1.8"
const val asm = "7.2"
const val commonsCli = "1.4"
const val discord = "1.1"
const val fernflower = "07082019"
const val findbugs = "3.0.2"
const val gson = "2.8.6"
const val guava = "28.1-jre"
const val guice = "4.2.2"
const val h2 = "1.4.200"
const val hamcrest = "2.2"
const val httpcore = "4.4.12"
const val httpmime = "4.5.10"
const val javassist = "3.26.0-GA"
const val javax = "1.3.2"
const val javaxInject = "1"
const val jbsdiff = "1.0"
const val jclCore = "2.8"
const val jedis = "3.1.0"
const val jna = "5.4.0"
const val jogamp = "2.3.2"
const val jopt = "5.0.4"
const val jooq = "3.12.2"
const val junit = "4.12"
const val jupiter = "5.6.0-M1"
const val logback = "1.2.3"
const val lombok = "1.18.10"
const val mapstruct = "1.3.1.Final"
const val mariadbJdbc = "2.5.1"
const val mavenPluginAnnotations = "3.6.0"
const val mavenPluginApi = "3.6.2"
const val minio = "6.0.11"
const val mockito = "3.1.0"
const val mongodbDriverSync = "3.11.1"
const val mysqlConnectorJava = "8.0.18"
const val naturalMouse = "2.0.2"
const val netty = "4.1.42.Final"
const val okhttp3 = "4.2.2"
const val orangeExtensions = "1.0"
const val petitparser = "2.2.0"
const val plexus = "3.3.0"
const val rxjava = "2.2.13"
const val rxrelay = "2.1.1"
const val scribejava = "6.9.0"
const val sisu = "0.3.3"
const val slf4j = "1.7.28"
const val springJdbc = "5.2.0.RELEASE"
const val springboot = "2.2.0.RELEASE"
const val sql2o = "1.6.0"
const val substance = "8.0.02"
const val trident = "1.5.00"
}
const val annotations = "org.jetbrains:annotations:${Versions.annotations}"
const val antlr = "org.antlr:antlr4-runtime:${Versions.antlr}"
const val apacheCommonsCompress = "org.apache.commons:commons-compress:${Versions.apacheCommonsCompress}"
const val apacheCommonsCsv = "org.apache.commons:commons-csv:${Versions.apacheCommonsCsv}"
const val apacheCommonsText = "org.apache.commons:commons-text:${Versions.apacheCommonsText}"
const val asmAll = "org.ow2.asm:asm:${Versions.asm}"
const val asmUtil = "org.ow2.asm:asm-util:${Versions.asm}"
const val asmTree = "org.ow2.asm:asm-tree:${Versions.asm}"
const val commonsCli = "commons-cli:commons-cli:${Versions.commonsCli}"
const val discord = "net.runelite:discord:${Versions.discord}"
const val fernflower = "net.runelite:fernflower:${Versions.fernflower}"
const val findbugs = "com.google.code.findbugs:jsr305:${Versions.findbugs}"
const val gson = "com.google.code.gson:gson:${Versions.gson}"
const val guava = "com.google.guava:guava:${Versions.guava}"
const val guice = "com.google.inject:guice:${Versions.guice}:no_aop"
const val guiceGrapher = "com.google.inject.extensions:guice-grapher:${Versions.guice}"
const val guiceTestlib = "com.google.inject.extensions:guice-testlib:${Versions.guice}"
const val h2 = "com.h2database:h2:${Versions.h2}"
const val hamcrest = "org.hamcrest:hamcrest-library:${Versions.hamcrest}"
const val httpcore = "org.apache.httpcomponents:httpcore:${Versions.httpcore}"
const val httpmime = "org.apache.httpcomponents:httpmime:${Versions.httpmime}"
const val javassist = "org.javassist:javassist:${Versions.javassist}"
const val javax = "javax.annotation:javax.annotation-api:${Versions.javax}"
const val javaxInject = "javax.inject:javax.inject:${Versions.javaxInject}"
const val jbsdiff = "io.sigpipe:jbsdiff:${Versions.jbsdiff}"
const val jclCore = "org.xeustechnologies:jcl-core:${Versions.jclCore}"
const val jedis = "redis.clients:jedis:${Versions.jedis}"
const val jna = "net.java.dev.jna:jna:${Versions.jna}"
const val jnaPlatform = "net.java.dev.jna:jna-platform:${Versions.jna}"
const val jogampJogl = "org.jogamp.jogl:jogl-all:${Versions.jogamp}"
const val jogampGluegen = "org.jogamp.gluegen:gluegen-rt:${Versions.jogamp}"
const val jogampGluegenLinuxAmd64 = "org.jogamp.gluegen:gluegen-rt:${Versions.jogamp}:natives-linux-amd64"
const val jogampGluegenLinuxI586 = "org.jogamp.gluegen:gluegen-rt:${Versions.jogamp}:natives-linux-i586"
const val jogampGluegenWindowsAmd64 = "org.jogamp.gluegen:gluegen-rt:${Versions.jogamp}:natives-windows-amd64"
const val jogampGluegenWindowsI586 = "org.jogamp.gluegen:gluegen-rt:${Versions.jogamp}:natives-windows-i586"
const val jogampJoglLinuxAmd64 = "org.jogamp.jogl:jogl-all:${Versions.jogamp}:natives-linux-amd64"
const val jogampJoglLinuxI586 = "org.jogamp.jogl:jogl-all:${Versions.jogamp}:natives-linux-i586"
const val jogampJoglWindowsAmd64 = "org.jogamp.jogl:jogl-all:${Versions.jogamp}:natives-windows-amd64"
const val jogampJoglWindowsI586 = "org.jogamp.jogl:jogl-all:${Versions.jogamp}:natives-windows-i586"
const val jopt = "net.sf.jopt-simple:jopt-simple:${Versions.jopt}"
const val jooq = "org.jooq:jooq:${Versions.jooq}"
const val jooqCodegen = "org.jooq:jooq-codegen:${Versions.jooq}"
const val jooqMeta = "org.jooq:jooq-meta:${Versions.jooq}"
const val junit = "junit:junit:${Versions.junit}"
const val jupiter = "org.junit.jupiter:junit-jupiter-api:${Versions.jupiter}"
const val logback = "ch.qos.logback:logback-classic:${Versions.logback}"
const val lombok = "org.projectlombok:lombok:${Versions.lombok}"
const val mapstruct = "org.mapstruct:mapstruct-jdk8:${Versions.mapstruct}"
const val mapstructProcessor = "org.mapstruct:mapstruct-processor:${Versions.mapstruct}"
const val mariadbJdbc = "org.mariadb.jdbc:mariadb-java-client:${Versions.mariadbJdbc}"
const val mavenPluginAnnotations = "org.apache.maven.plugin-tools:maven-plugin-annotations:${Versions.mavenPluginAnnotations}"
const val mavenPluginApi = "org.apache.maven:maven-plugin-api:${Versions.mavenPluginApi}"
const val minio = "io.minio:minio:${Versions.minio}"
const val mockitoCore = "org.mockito:mockito-core:${Versions.mockito}"
const val mockitoInline = "org.mockito:mockito-inline:${Versions.mockito}"
const val mongodbDriverSync = "org.mongodb:mongodb-driver-sync:${Versions.mongodbDriverSync}"
const val mysqlConnectorJava = "mysql:mysql-connector-java:${Versions.mysqlConnectorJava}"
const val naturalMouse = "com.github.joonasvali.naturalmouse:naturalmouse:${Versions.naturalMouse}"
const val nettyAll = "io.netty:netty-all:${Versions.netty}"
const val nettyBuffer = "io.netty:netty-buffer:${Versions.netty}"
const val okhttp3 = "com.squareup.okhttp3:okhttp:${Versions.okhttp3}"
const val okhttp3Webserver = "com.squareup.okhttp3:mockwebserver:${Versions.okhttp3}"
const val orangeExtensions = "net.runelite:orange-extensions:${Versions.orangeExtensions}"
const val petitparser = "com.github.petitparser:java-petitparser:${Versions.petitparser}"
const val plexus = "org.codehaus.plexus:plexus-utils:${Versions.plexus}"
const val rxjava = "io.reactivex.rxjava2:rxjava:${Versions.rxjava}"
const val rxrelay = "com.jakewharton.rxrelay2:rxrelay:${Versions.rxrelay}"
const val scribejava = "com.github.scribejava:scribejava-apis:${Versions.scribejava}"
const val sisu = "org.eclipse.sisu:org.eclipse.sisu.inject:${Versions.sisu}"
const val slf4jApi = "org.slf4j:slf4j-api:${Versions.slf4j}"
const val slf4jNop = "org.slf4j:slf4j-nop:${Versions.slf4j}"
const val slf4jSimple = "org.slf4j:slf4j-simple:${Versions.slf4j}"
const val springbootDevtools = "org.springframework.boot:spring-boot-devtools:${Versions.springboot}"
const val springbootStarter = "org.springframework.boot:spring-boot-starter:${Versions.springboot}"
const val springbootStarterWeb = "org.springframework.boot:spring-boot-starter-web:${Versions.springboot}"
const val springbootStarterJdbc = "org.springframework.boot:spring-boot-starter-jdbc:${Versions.springboot}"
const val springbootStarterTest = "org.springframework.boot:spring-boot-starter-test:${Versions.springboot}"
const val springbootStarterTomcat = "org.springframework.boot:spring-boot-starter-tomcat:${Versions.springboot}"
const val springbootJdbc = "org.springframework:spring-jdbc:${Versions.springJdbc}"
const val sql2o = "org.sql2o:sql2o:${Versions.sql2o}"
const val substance = "net.runelite.pushingpixels:substance:${Versions.substance}"
const val trident = "net.runelite.pushingpixels:trident:${Versions.trident}"
const val vanilla = "net.runelite.rs:vanilla:${ProjectVersions.rsversion}"
}

View File

@@ -0,0 +1,17 @@
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.tasks.StopExecutionException
class FernflowerPlugin : Plugin<Project> {
override fun apply(project: Project) {
project.tasks.create("decompile", FernflowerTask::class.java).run {
dependsOn(project.tasks.getByName("jar"))
doFirst {
if (!project.tasks.getByName("jar").didWork) {
throw StopExecutionException()
}
}
}
}
}

View File

@@ -0,0 +1,30 @@
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.TaskAction
import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler
import java.io.File
open class FernflowerTask: DefaultTask() {
var extraArgs: List<String>? = null
var inputJar: String? = null
var outputDir: String? = null
fun getInputJar(): File {
return project.file(inputJar ?: project.buildDir.toString() + "/libs/" + project.name + '-' + project.version + ".jar")
}
fun getOutputDir(): File {
return project.file(outputDir ?: project.buildDir.toString() + "/decompiled-sources")
}
@TaskAction
fun decompile() {
getOutputDir().mkdirs()
val args = mutableListOf(getInputJar().toString(), getOutputDir().toString())
if (extraArgs != null) {
args.addAll(extraArgs!!)
}
ConsoleDecompiler.main(args.toTypedArray())
}
}

View File

@@ -1 +1 @@
implementation-class=FernflowerPlugin implementation-class=kt

View File

@@ -1,28 +0,0 @@
description = 'Cache Client'
dependencies {
api project(':cache')
api project(':protocol')
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'io.netty', name: 'netty-all', version: netty
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
testImplementation group: 'junit', name: 'junit', version: junit
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: slf4j
testImplementation project(path: ':cache', configuration: 'testArchives')
}
task update {
dependsOn ":cache-client:build"
doLast {
def path = sourceSets.main.runtimeClasspath
def loader = new URLClassLoader(path.collect { f -> f.toURI().toURL() } as URL[])
def cacheClient = loader.loadClass('net.runelite.cache.client.CacheClient')
cacheClient.getCache(rsversion);
loader.close()
}
}

View File

@@ -0,0 +1,49 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
description = "Cache Client"
dependencies {
api(project(":cache"))
api(project(":protocol"))
implementation(Libraries.guava)
implementation(Libraries.nettyAll)
implementation(Libraries.slf4jApi)
testImplementation(Libraries.junit)
testImplementation(Libraries.slf4jSimple)
testImplementation(project(path = ":cache", configuration = "testArchives"))
}
tasks {
register<JavaExec>("download") {
dependsOn("copyVanilla")
classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.cache.client.CacheClient"
args(listOf(ProjectVersions.rsversion))
}
}

View File

@@ -85,7 +85,7 @@ public class CacheClient implements AutoCloseable
private CompletableFuture<HandshakeResponseType> handshakeFuture; private CompletableFuture<HandshakeResponseType> handshakeFuture;
private final Queue<PendingFileRequest> requests = new ArrayDeque<>(); private final Queue<PendingFileRequest> requests = new ArrayDeque<>();
public static void getCache(int clientRevision) public static void main(String[] args)
{ {
Path path = Paths.get(System.getProperty("user.home"), "jagexcache" + File.separator + "oldschool" + File.separator + "LIVE"); Path path = Paths.get(System.getProperty("user.home"), "jagexcache" + File.separator + "oldschool" + File.separator + "LIVE");
final File jagexcache = new File(String.valueOf(path)); final File jagexcache = new File(String.valueOf(path));
@@ -95,7 +95,7 @@ public class CacheClient implements AutoCloseable
try (Store store = new Store(jagexcache)) try (Store store = new Store(jagexcache))
{ {
store.load(); store.load();
CacheClient c = new CacheClient(store, clientRevision); CacheClient c = new CacheClient(store, Integer.parseInt(args[0]));
c.connect(); c.connect();
CompletableFuture<HandshakeResponseType> handshake = c.handshake(); CompletableFuture<HandshakeResponseType> handshake = c.handshake();
handshake.get(); handshake.get();

View File

@@ -1,15 +0,0 @@
description = 'Cache Updater'
dependencies {
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
compileOnly group: 'org.projectlombok', name: 'lombok', version: lombok
implementation group: 'io.minio', name: 'minio', version: minio
implementation group: 'mysql', name: 'mysql-connector-java', version: mysqlConnectorJava
implementation group: 'org.springframework.boot', name: 'spring-boot-devtools', version: springboot
implementation group: 'org.springframework.boot', name: 'spring-boot-starter', version: springboot
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-jdbc', version: springboot
implementation group: 'org.sql2o', name: 'sql2o', version: sql2o
implementation project(':cache-client')
}

View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
description = "Cache Updater"
dependencies {
annotationProcessor(Libraries.lombok)
compileOnly(Libraries.lombok)
implementation(Libraries.minio)
implementation(Libraries.mysqlConnectorJava)
implementation(Libraries.springbootDevtools)
implementation(Libraries.springbootStarter)
implementation(Libraries.springbootStarterJdbc)
implementation(Libraries.sql2o)
implementation(project(":cache-client"))
}

36
cache/build.gradle vendored
View File

@@ -1,36 +0,0 @@
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id "com.github.hauner.jarTest" version "1.0.1"
}
description = 'Cache'
dependencies {
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
api project(':http-api')
compileOnly group: 'org.projectlombok', name: 'lombok', version: lombok
implementation group: 'com.google.code.gson', name: 'gson', version: gson
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'commons-cli', name: 'commons-cli', version: commonsCli
implementation group: 'io.netty', name: 'netty-buffer', version: netty
implementation group: 'org.antlr', name: 'antlr4-runtime', version: antlr
implementation group: 'org.apache.commons', name: 'commons-compress', version: apacheCommonsCompress
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
testImplementation group: 'junit', name: 'junit', version: junit
testImplementation group: 'net.runelite.rs', name: 'cache', version: cacheversion
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: slf4j
}
processTestResources {
from file("src/test/resources/cache.properties"), {
filter(ReplaceTokens, tokens: [
"rs.version": rsversion.toString(),
"cache.version": cacheversion.toString()
])
}
}

69
cache/cache.gradle.kts vendored Normal file
View File

@@ -0,0 +1,69 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id(Plugins.jarTest.first) version Plugins.jarTest.second
}
description = "Cache"
dependencies {
annotationProcessor(Libraries.lombok)
api(project(":http-api"))
compileOnly(Libraries.lombok)
implementation(Libraries.gson)
implementation(Libraries.guava)
implementation(Libraries.commonsCli)
implementation(Libraries.nettyBuffer)
implementation(Libraries.antlr)
implementation(Libraries.apacheCommonsCompress)
implementation(Libraries.slf4jApi)
testImplementation(Libraries.junit)
testImplementation(group = "net.runelite.rs", name = "cache", version = "${ProjectVersions.cacheversion}")
testImplementation(Libraries.slf4jSimple)
}
tasks {
"processTestResources"(ProcessResources::class) {
val tokens = mapOf(
"rs.version" to ProjectVersions.rsversion.toString(),
"cache.version" to ProjectVersions.cacheversion.toString()
)
inputs.properties(tokens)
from("src/test/resources") {
include("cache.properties")
filter<ReplaceTokens>("tokens" to tokens)
}
}
}

View File

@@ -1,117 +0,0 @@
import org.apache.tools.ant.filters.ReplaceTokens
import org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler
import java.nio.file.Files
import java.nio.file.Paths
import java.util.zip.ZipFile
plugins {
id "com.github.hauner.jarTest" version "1.0.1"
}
description = 'Deobfuscator'
def deobfuscatedJar = "${rootPath}/runescape-client/build/libs/rs-client-${project.version}.jar"
def unzipFile(String file, String dest)
{
def zipFile = new ZipFile(file)
zipFile.entries().each { it ->
def path = Paths.get(dest + File.separator + it.name)
if (it.directory)
{
Files.createDirectories(path)
}
else
{
def parentDir = path.getParent()
if (!Files.exists(parentDir))
{
Files.createDirectories(parentDir)
}
Files.copy(zipFile.getInputStream(it), path)
}
}
}
configurations {
deobjars
}
dependencies {
deobjars group: 'net.runelite.rs', name: 'vanilla', version: rsversion
deobjars project(':rs-client')
implementation group: 'com.google.code.gson', name: 'gson', version: gson
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'net.runelite', name: 'fernflower', version: fernflower
implementation group: 'org.ow2.asm', name: 'asm', version: asm
implementation group: 'org.ow2.asm', name: 'asm-util', version: asm
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
implementation project(':runelite-api')
implementation project(':runescape-api')
runtime group: 'org.slf4j', name: 'slf4j-simple', version: slf4j
testImplementation configurations.deobjars.dependencies
testImplementation group: 'junit', name: 'junit', version: junit
testImplementation group: 'org.mockito', name: 'mockito-core', version: mockito
}
processResources {
from file("src/main/resources/deob.properties"), {
filter(ReplaceTokens, tokens: [
"rs.version": rsversion.toString(),
"vanilla.jar": configurations.deobjars.find {it.name.startsWith("vanilla")}.toString().replace('\\', "/"),
"rs.client": configurations.deobjars.find {it.name.startsWith("rs-client")}.toString().replace('\\', "/")
])
}
}
processTestResources {
from file("src/test/resources/deob-test.properties"), {
filter(ReplaceTokens, tokens: [
"rs.client": configurations.deobjars.find {it.name.startsWith("rs-client")}.toString().replace('\\', "/"),
"rs.version": rsversion.toString(),
"vanilla.jar": configurations.deobjars.find {it.name.startsWith("vanilla")}.toString().replace('\\', "/")
])
}
}
task gamepackUpdate {
dependsOn ":deobfuscator:build"
dependsOn ":rs-client:build"
doLast {
def path = sourceSets.main.runtimeClasspath
def loader = new URLClassLoader(path.collect { f -> f.toURI().toURL() } as URL[])
def downloader = loader.loadClass('net.runelite.gamepack.Downloader')
def clientVersion = loader.loadClass('net.runelite.deob.clientver.ClientVersionMain')
def deob = loader.loadClass('net.runelite.deob.Deob')
def mappings = loader.loadClass('net.runelite.deob.updater.UpdateMappings')
String gamepack = downloader.gamepack()
int version = clientVersion.version(gamepack)
String gamepackVersion = gamepack.replace("gamepack.jar", "gamepack-" + version + ".jar")
String gamepackDeob = gamepack.replace("gamepack.jar", "gamepack-" + version + "-deob.jar")
String gamepackMappings = gamepack.replace("gamepack.jar", "gamepack-" + version + "-updated-mappings.jar")
String gamepackMappingsDecomp = gamepackMappings.replace(".jar", "-decomp")
String gamepackMappingsFern = gamepackMappingsDecomp + File.separator + gamepackMappings.split("/gamepack/")[1]
if (version == -1 || version == rsversion)
{
return
}
deob.main(gamepackVersion, gamepackDeob)
mappings.main(deobfuscatedJar, gamepackDeob, gamepackMappings)
new File(gamepackMappingsDecomp).mkdirs()
ConsoleDecompiler.main(gamepackMappings, gamepackMappingsDecomp)
unzipFile(gamepackMappingsFern, gamepackMappingsDecomp)
new File(gamepackMappingsFern).delete()
loader.close()
}
}

View File

@@ -0,0 +1,80 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
import org.apache.tools.ant.filters.ReplaceTokens
plugins {
id(Plugins.jarTest.first) version Plugins.jarTest.second
}
val deobjars = configurations.create("deobjars")
dependencies {
deobjars(group = "net.runelite.rs", name = "vanilla", version = ProjectVersions.rsversion.toString())
deobjars(project(":runescape-client"))
implementation(Libraries.gson)
implementation(Libraries.guava)
implementation(Libraries.fernflower)
implementation(Libraries.asmAll)
implementation(Libraries.asmUtil)
implementation(Libraries.slf4jApi)
implementation(project(":runelite-api"))
implementation(project(":runescape-api"))
runtime(Libraries.slf4jSimple)
testImplementation(deobjars)
testImplementation(Libraries.junit)
testImplementation(Libraries.mockitoCore)
}
tasks {
val tokens = mapOf(
"rs.version" to ProjectVersions.rsversion.toString(),
"vanilla.jar" to deobjars.find { it.name.startsWith("vanilla") }.toString().replace("\\", "/"),
"rs.client" to deobjars.find { it.name.startsWith("runescape-client") }.toString().replace("\\", "/")
)
"processResources"(ProcessResources::class) {
inputs.properties(tokens)
from("src/main/resources") {
include("deob.properties")
filter<ReplaceTokens>("tokens" to tokens)
}
}
"processTestResources"(ProcessResources::class) {
inputs.properties(tokens)
from("src/test/resources") {
include("deob-test.properties")
filter<ReplaceTokens>("tokens" to tokens)
}
}
}

2
gradlew vendored
View File

@@ -44,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"` APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx4g" "-Xms2g" "-Dfile.encoding=UTF-8"' DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value. # Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum" MAX_FD="maximum"

2
gradlew.bat vendored
View File

@@ -30,7 +30,7 @@ set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME% set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx4g" "-Xms2g" "-Dfile.encoding=UTF-8" set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe @rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome if defined JAVA_HOME goto findJavaFromJavaHome

View File

@@ -1,33 +0,0 @@
import org.apache.tools.ant.filters.ReplaceTokens
description = 'Web API'
dependencies {
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
compileOnly group: 'javax.inject', name: 'javax.inject', version: javaxInject
compileOnly group: 'org.projectlombok', name: 'lombok', version: lombok
implementation group: 'com.google.code.gson', name: 'gson', version: gson
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: okhttp3
implementation group: 'io.reactivex.rxjava2', name: 'rxjava', version: rxjava
implementation group: 'org.apache.commons', name: 'commons-csv', version: apacheCommonsCsv
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
implementation project(':runelite-api')
testImplementation group: 'com.squareup.okhttp3', name: 'mockwebserver', version: okhttp3
testImplementation group: 'junit', name: 'junit', version: junit
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: slf4j
}
processResources {
from file("src/main/resources/runelite.properties"), {
filter(ReplaceTokens, tokens: [
"projectver": project.version,
"rsver": rsversion.toString(),
"gitcommit": gitCommitShort,
"gitdirty": gitDirty.toString()
])
}
}

View File

@@ -0,0 +1,65 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
import org.apache.tools.ant.filters.ReplaceTokens
description = "Web API"
dependencies {
annotationProcessor(Libraries.lombok)
compileOnly(Libraries.javaxInject)
compileOnly(Libraries.lombok)
implementation(Libraries.gson)
implementation(Libraries.guava)
implementation(Libraries.okhttp3)
implementation(Libraries.rxjava)
implementation(Libraries.apacheCommonsCsv)
implementation(Libraries.slf4jApi)
implementation(project(":runelite-api"))
testImplementation(Libraries.okhttp3Webserver)
testImplementation(Libraries.junit)
testImplementation(Libraries.slf4jSimple)
}
tasks {
"processResources"(ProcessResources::class) {
val tokens = mapOf(
"projectver" to ProjectVersions.rlVersion,
"rsver" to ProjectVersions.rsversion.toString(),
"gitcommit" to project.extra["gitCommit"]
)
inputs.properties(tokens)
from("src/main/resources") {
include("runelite.properties")
filter<ReplaceTokens>("tokens" to tokens)
}
}
}

View File

@@ -1,4 +1,3 @@
runelite.version=@projectver@ runelite.version=@projectver@
rs.version=@rsver@ rs.version=@rsver@
runelite.commit=@gitcommit@ runelite.commit=@gitcommit@
runelite.dirty=@gitdirty@

View File

@@ -1,26 +0,0 @@
apply plugin: 'war'
description = 'Web Service OpenOSRS'
dependencies {
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
api project(':cache')
api project(':http-api')
api project(':http-service')
implementation group: 'com.google.code.gson', name: 'gson', version: gson
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: okhttp3
implementation group: 'org.springframework', name: 'spring-jdbc', version: springJdbc
implementation group: 'org.springframework.boot', name: 'spring-boot-devtools', version: springboot
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springboot
implementation group: 'org.sql2o', name: 'sql2o', version: sql2o
implementation(group: 'redis.clients', name: 'jedis', version: jedis) {
exclude(module: 'commons-pool2')
}
providedCompile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: mariadbJdbc
providedCompile group: 'org.projectlombok', name: 'lombok', version: lombok
providedCompile group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat', version: springboot
}

View File

@@ -0,0 +1,53 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
plugins {
war
}
description = "Web Service OpenOSRS"
dependencies {
annotationProcessor(Libraries.lombok)
api(project(":cache"))
api(project(":http-api"))
api(project(":http-service"))
implementation(Libraries.gson)
implementation(Libraries.guava)
implementation(Libraries.okhttp3)
implementation(Libraries.springbootJdbc)
implementation(Libraries.springbootDevtools)
implementation(Libraries.springbootStarterWeb)
implementation(Libraries.sql2o)
implementation(Libraries.jedis) {
exclude(module = "commons-pool2")
}
providedCompile(Libraries.mariadbJdbc)
providedCompile(Libraries.lombok)
providedCompile(Libraries.springbootStarterTomcat)
}

View File

@@ -1,37 +0,0 @@
apply plugin: 'war'
description = 'Web Service'
dependencies {
annotationProcessor group: 'org.mapstruct', name: 'mapstruct-processor', version: mapstruct
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
api project(':cache')
api project(':http-api')
api project(':runelite-api')
implementation group: 'com.github.scribejava', name: 'scribejava-apis', version: scribejava
implementation group: 'com.google.code.gson', name: 'gson', version: gson
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'io.minio', name: 'minio', version: minio
implementation group: 'org.mapstruct', name: 'mapstruct-jdk8', version: mapstruct
implementation group: 'org.mongodb', name: 'mongodb-driver-sync', version: mongodbDriverSync
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
implementation group: 'org.springframework', name: 'spring-jdbc', version: springJdbc
implementation group: 'org.springframework.boot', name: 'spring-boot-devtools', version: springboot
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: springboot
implementation group: 'org.sql2o', name: 'sql2o', version: sql2o
implementation(group: 'redis.clients', name: 'jedis', version: jedis) {
exclude(module: 'commons-pool2')
}
providedCompile group: 'org.mariadb.jdbc', name: 'mariadb-java-client', version: mariadbJdbc
providedCompile group: 'org.projectlombok', name: 'lombok', version: lombok
providedCompile group: 'org.springframework.boot', name: 'spring-boot-starter-tomcat', version: springboot
testImplementation group: 'com.h2database', name: 'h2', version: '1.4.200'
testImplementation group: 'com.squareup.okhttp3', name: 'mockwebserver', version: okhttp3
testImplementation(group: 'org.springframework.boot', name: 'spring-boot-starter-test', version: springboot) {
exclude(module: 'commons-logging')
}
}

View File

@@ -0,0 +1,64 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
plugins {
war
}
description = "Web Service"
dependencies {
annotationProcessor(Libraries.mapstructProcessor)
annotationProcessor(Libraries.lombok)
api(project(":cache"))
api(project(":http-api"))
api(project(":runelite-api"))
implementation(Libraries.scribejava)
implementation(Libraries.gson)
implementation(Libraries.guava)
implementation(Libraries.minio)
implementation(Libraries.mapstruct)
implementation(Libraries.mongodbDriverSync)
implementation(Libraries.slf4jApi)
implementation(Libraries.springbootJdbc)
implementation(Libraries.springbootDevtools)
implementation(Libraries.springbootStarterWeb)
implementation(Libraries.sql2o)
implementation(Libraries.jedis) {
exclude(module = "commons-pool2")
}
providedCompile(Libraries.mariadbJdbc)
providedCompile(Libraries.lombok)
providedCompile(Libraries.springbootStarterTomcat)
testImplementation(Libraries.h2)
testImplementation(Libraries.okhttp3Webserver)
testImplementation(Libraries.springbootStarterTest) {
exclude(module = "commons-logging")
}
}

View File

@@ -0,0 +1,55 @@
/*
* Copyright (c) 2019 ThatGamerBlue
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
description = "Injected Client"
tasks {
compileJava {
dependsOn(":injector-plugin:assemble")
outputs.upToDateWhen { false }
doLast {
copy {
val f = file ("build/classes/java/main")
f.deleteRecursively()
f.mkdirs()
from(project.extra["injectedClassesPath"])
into("build/classes/java/main")
}
}
}
classes {
val f = file("build/classes/java/main/Placeholder.class")
f.delete()
}
// this is just here to show how the fernflower plugin could be used
//build {
// dependsOn(project.tasks.getByName("decompile"))
//}
}

View File

@@ -1,63 +0,0 @@
group = 'us.runelitepl.rs'
description = 'Injector'
def buildPath = buildDir.toString().replace('\\', '/') // this doesnt work in an ext block for some reason
def deobfuscatedJar = "${rootPath}/runescape-client/build/libs/rs-client-${project.version}.jar"
def vanillaJar = "${buildPath}/vanilla-${rsversion}.jar"
configurations {
vanilla
}
dependencies {
annotationProcessor group: 'org.eclipse.sisu', name: 'org.eclipse.sisu.inject', version: sisu
compileOnly group: 'org.apache.maven.plugin-tools', name: 'maven-plugin-annotations', version: mavenPluginAnnotations
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'org.apache.maven', name: 'maven-plugin-api', version: mavenPluginApi
implementation group: 'org.ow2.asm', name: 'asm', version: asm
implementation group: 'org.ow2.asm', name: 'asm-util', version: asm
implementation project(':deobfuscator')
implementation project(':mixins')
implementation project(':runelite-api')
implementation project(':runescape-api')
testImplementation group: 'junit', name: 'junit', version: junit
testImplementation group: 'org.mockito', name: 'mockito-core', version: mockito
testImplementation project(':deobfuscator')
testImplementation project(path: ':deobfuscator', configuration: 'testArchives')
vanilla "net.runelite.rs:vanilla:${rsversion}"
}
compileJava {
dependsOn ":rs-client:build"
inputs.dir("${project.rootDir}/runescape-client/")
inputs.dir("${project.rootDir}/runescape-api/")
inputs.dir("${project.rootDir}/runelite-mixins/")
}
compileJava.doLast() {
copy {
from configurations.vanilla
into "$buildDir"
}
def path = sourceSets.main.runtimeClasspath
def loader
try {
loader = new URLClassLoader(path.collect { f -> f.toURI().toURL() } as URL[])
def inject = loader.loadClass('net.runelite.injector.Injector')
String[] jarPaths = [
deobfuscatedJar.toString(),
vanillaJar.toString(),
injectedClassesPath.toString()
]
inject.main(jarPaths)
} finally {
if (loader) {
loader.close()
}
}
}

View File

@@ -0,0 +1,83 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
group = "com.openosrs.rs"
description = "Injector"
val deobfuscatedJar = "${project.extra["rootPath"]}/runescape-client/build/libs/runescape-client-${ProjectVersions.rlVersion}.jar"
val vanillaJar = "${buildDir}/vanilla-${ProjectVersions.rsversion}.jar"
val vanilla = configurations.create("vanilla")
dependencies {
annotationProcessor(Libraries.sisu)
compileOnly(Libraries.mavenPluginAnnotations)
implementation(Libraries.guava)
implementation(Libraries.mavenPluginApi)
implementation(Libraries.asmAll)
implementation(Libraries.asmUtil)
implementation(project(":deobfuscator"))
implementation(project(":runelite-mixins"))
implementation(project(":runelite-api"))
implementation(project(":runescape-api"))
testImplementation(Libraries.junit)
testImplementation(Libraries.mockitoCore)
testImplementation(project(":deobfuscator"))
testImplementation(project(path = ":deobfuscator", configuration = "testArchives"))
vanilla(Libraries.vanilla)
}
tasks {
register<Copy>("copyVanilla") {
copy {
from(configurations.get("vanilla"))
into("$buildDir")
}
}
register<JavaExec>("inject") {
dependsOn("copyVanilla")
classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.injector.Injector"
args(listOf(deobfuscatedJar, vanillaJar, project.extra["injectedClassesPath"]))
}
compileJava {
dependsOn(":runescape-client:build")
inputs.dir(project(":runescape-client").projectDir.absolutePath)
inputs.dir(project(":runescape-api").projectDir.absolutePath)
inputs.dir(project(":runelite-mixins").projectDir.absolutePath)
}
jar {
dependsOn("inject")
}
}

View File

@@ -1,13 +0,0 @@
description = 'Protocol API'
dependencies {
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
compileOnly group: 'org.projectlombok', name: 'lombok', version: lombok
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
implementation project(':runelite-api')
testImplementation group: 'junit', name: 'junit', version: junit
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
description = "Protocol API"
dependencies {
annotationProcessor(Libraries.lombok)
compileOnly(Libraries.lombok)
implementation(Libraries.guava)
implementation(Libraries.slf4jApi)
implementation(project(":runelite-api"))
testImplementation(Libraries.junit)
}

View File

@@ -1,16 +0,0 @@
description = 'Protocol'
dependencies {
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
api project(':protocol-api')
compileOnly group: 'org.projectlombok', name: 'lombok', version: lombok
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'io.netty', name: 'netty-all', version: netty
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
implementation project(':cache')
testImplementation group: 'junit', name: 'junit', version: junit
}

View File

@@ -0,0 +1,41 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
description = "Protocol"
dependencies {
annotationProcessor(Libraries.lombok)
api(project(":protocol-api"))
compileOnly(Libraries.lombok)
implementation(Libraries.guava)
implementation(Libraries.nettyAll)
implementation(Libraries.slf4jApi)
implementation(project(":cache"))
testImplementation(Libraries.junit)
}

View File

@@ -1,14 +0,0 @@
description = 'RuneLite API'
dependencies {
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
compileOnly group: 'org.projectlombok', name: 'lombok', version: lombok
implementation group: 'com.google.code.findbugs', name: 'jsr305', version: findbugs
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'org.apache.commons', name: 'commons-text', version: apacheCommonsText
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
testImplementation group: 'junit', name: 'junit', version: junit
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
description = "RuneLite API"
dependencies {
annotationProcessor(Libraries.lombok)
compileOnly(Libraries.lombok)
implementation(Libraries.findbugs)
implementation(Libraries.guava)
implementation(Libraries.apacheCommonsText)
implementation(Libraries.slf4jApi)
testImplementation(Libraries.junit)
}

View File

@@ -98,6 +98,15 @@ public final class AnimationID
public static final int FISHING_DRAGON_HARPOON = 7401; public static final int FISHING_DRAGON_HARPOON = 7401;
public static final int FISHING_INFERNAL_HARPOON = 7402; public static final int FISHING_INFERNAL_HARPOON = 7402;
public static final int FISHING_CRYSTAL_HARPOON = 8336; public static final int FISHING_CRYSTAL_HARPOON = 8336;
public static final int CRYSTALLINE_RAT_DEATH = 8334;
public static final int CRYSTALLINE_BAT_DEATH = 4917;
public static final int CRYSTALLINE_WOLF_DEATH = 8335;
public static final int CRYSTALLINE_SPIDER_DEATH = 8338;
public static final int CRYSTALLINE_UNICORN_DEATH = 6377;
public static final int CRYSTALLINE_DRAGON_DEATH = 92;
public static final int CRYSTALLINE_BEAR_DEATH = 4929;
public static final int CRYSTALLINE_DARK_BEAST_DEATH = 2733;
public static final int CORRUPTED_SCORPION_DEATH = 6256;
public static final int FISHING_OILY_ROD = 622; public static final int FISHING_OILY_ROD = 622;
public static final int FISHING_KARAMBWAN = 1193; public static final int FISHING_KARAMBWAN = 1193;
public static final int FISHING_CRUSHING_INFERNAL_EELS = 7553; public static final int FISHING_CRUSHING_INFERNAL_EELS = 7553;

View File

@@ -12,6 +12,11 @@ public interface ItemDefinition
*/ */
String getName(); String getName();
/**
* Sets the items name.
*/
void setName(String name);
/** /**
* Gets the items ID. * Gets the items ID.
* *
@@ -86,6 +91,7 @@ public interface ItemDefinition
* Returns whether or not the item can be sold on the grand exchange. * Returns whether or not the item can be sold on the grand exchange.
*/ */
boolean isTradeable(); boolean isTradeable();
void setTradeable(boolean yes);
/** /**
* Gets an array of possible right-click menu actions the item * Gets an array of possible right-click menu actions the item
@@ -114,4 +120,11 @@ public interface ItemDefinition
* default value. * default value.
*/ */
void resetShiftClickActionIndex(); void resetShiftClickActionIndex();
/**
* With this you can make certain (ground) items look like different ones.
*
* @param id The itemID of the item with desired model
*/
void setModelOverride(int id);
} }

View File

@@ -24,6 +24,8 @@
*/ */
package net.runelite.api; package net.runelite.api;
import net.runelite.api.coords.WorldPoint;
/** /**
* Represents the entire 3D scene * Represents the entire 3D scene
*/ */
@@ -36,6 +38,16 @@ public interface Scene
*/ */
Tile[][][] getTiles(); Tile[][][] getTiles();
/**
* Adds an item to the scene
*/
void addItem(int id, int quantity, WorldPoint point);
/**
* Removes an item from the scene
*/
void removeItem(int id, int quantity, WorldPoint point);
int getDrawDistance(); int getDrawDistance();
void setDrawDistance(int drawDistance); void setDrawDistance(int drawDistance);
} }

View File

@@ -24,6 +24,7 @@
*/ */
package net.runelite.api.events; package net.runelite.api.events;
import java.util.Iterator;
import lombok.AccessLevel; import lombok.AccessLevel;
import lombok.Setter; import lombok.Setter;
import net.runelite.api.MenuEntry; import net.runelite.api.MenuEntry;
@@ -33,7 +34,7 @@ import lombok.Data;
* An event where a menu has been opened. * An event where a menu has been opened.
*/ */
@Data @Data
public class MenuOpened implements Event public class MenuOpened implements Event, Iterable<MenuEntry>
{ {
/** /**
* This should be set to true if anything about the menu * This should be set to true if anything about the menu
@@ -70,4 +71,25 @@ public class MenuOpened implements Event
{ {
this.modified = true; this.modified = true;
} }
@Override
public Iterator<MenuEntry> iterator()
{
return new Iterator<MenuEntry>()
{
int index = 0;
@Override
public boolean hasNext()
{
return index < menuEntries.length;
}
@Override
public MenuEntry next()
{
return menuEntries[index++];
}
};
}
} }

View File

@@ -1,118 +0,0 @@
import org.apache.tools.ant.filters.ReplaceTokens
import java.text.SimpleDateFormat
plugins {
id 'com.github.johnrengelman.shadow' version '5.1.0'
id 'java'
}
description = 'RuneLite Client'
dependencies {
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
compileOnly group: 'javax.annotation', name: 'javax.annotation-api', version: javax
compileOnly group: 'net.runelite', name: 'orange-extensions', version: orangeExtensions
compileOnly group: 'org.projectlombok', name: 'lombok', version: lombok
implementation group: 'ch.qos.logback', name: 'logback-classic', version: logback
implementation group: 'com.google.code.gson', name: 'gson', version: gson
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'com.google.inject', name: 'guice', version: guice, classifier: 'no_aop'
implementation group: 'com.h2database', name: 'h2', version: h2
implementation group: 'com.jakewharton.rxrelay2', name: 'rxrelay', version: rxrelay
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: okhttp3
implementation group: 'io.reactivex.rxjava2', name: 'rxjava', version: rxjava
implementation group: 'net.java.dev.jna', name: 'jna', version: jna
implementation group: 'net.java.dev.jna', name: 'jna-platform', version: jna
implementation group: 'net.runelite', name: 'discord', version: discord
implementation group: 'net.runelite.pushingpixels', name: 'substance', version: substance
implementation group: 'net.sf.jopt-simple', name: 'jopt-simple', version: jopt
implementation group: 'org.apache.commons', name: 'commons-text', version: apacheCommonsText
implementation group: 'org.apache.httpcomponents', name: 'httpcore', version: httpcore
implementation group: 'org.apache.httpcomponents', name: 'httpmime', version: httpmime
implementation group: 'org.codehaus.plexus', name: 'plexus-utils', version: plexus
implementation group: 'org.javassist', name: 'javassist', version: javassist
implementation group: 'org.jetbrains', name: 'annotations', version: annotations
implementation group: 'org.jogamp.gluegen', name: 'gluegen-rt', version: jogamp
implementation group: 'org.jogamp.jogl', name: 'jogl-all', version: jogamp
implementation group: 'org.jooq', name: 'jooq', version: jooq
implementation group: 'org.jooq', name: 'jooq-codegen', version: jooq
implementation group: 'org.jooq', name: 'jooq-meta', version: jooq
implementation group: 'org.ow2.asm', name: 'asm-tree', version: asm
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
implementation group: 'org.xeustechnologies', name: 'jcl-core', version: jclCore
implementation project(':http-api')
implementation project(':runelite-api')
implementation(group: 'io.sigpipe', name: 'jbsdiff', version: jbsdiff) {
exclude(module: 'xz')
}
implementation group: 'com.github.joonasvali.naturalmouse', name: 'naturalmouse', version: '2.0.2'
runtime group: 'net.runelite.pushingpixels', name: 'trident', version: trident
runtime group: 'org.jogamp.gluegen', name: 'gluegen-rt', version: jogamp, classifier: 'natives-linux-amd64'
runtime group: 'org.jogamp.gluegen', name: 'gluegen-rt', version: jogamp, classifier: 'natives-linux-i586'
runtime group: 'org.jogamp.gluegen', name: 'gluegen-rt', version: jogamp, classifier: 'natives-windows-amd64'
runtime group: 'org.jogamp.gluegen', name: 'gluegen-rt', version: jogamp, classifier: 'natives-windows-i586'
runtime group: 'org.jogamp.jogl', name: 'jogl-all', version: jogamp, classifier: 'natives-linux-amd64'
runtime group: 'org.jogamp.jogl', name: 'jogl-all', version: jogamp, classifier: 'natives-linux-i586'
runtime group: 'org.jogamp.jogl', name: 'jogl-all', version: jogamp, classifier: 'natives-windows-amd64'
runtime group: 'org.jogamp.jogl', name: 'jogl-all', version: jogamp, classifier: 'natives-windows-i586'
runtime project(':injected-client')
runtime project(':runescape-api')
testAnnotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
testCompileOnly group: 'org.projectlombok', name: 'lombok', version: lombok
testImplementation group: 'com.google.inject.extensions', name: 'guice-grapher', version: guice
testImplementation group: 'com.google.inject.extensions', name: 'guice-testlib', version: guice
testImplementation group: 'junit', name: 'junit', version: junit
testImplementation group: 'org.hamcrest', name: 'hamcrest-library', version: hamcrest
testImplementation group: 'org.mockito', name: 'mockito-core', version: mockito
testImplementation group: 'org.mockito', name: 'mockito-inline', version: mockito
testImplementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
}
static def getDate() {
return new SimpleDateFormat("MM-dd-yyyy", Locale.forLanguageTag("en-US")).format(new Date())
}
def buildDate = getDate()
processResources {
from file("src/main/resources/open.osrs.properties"), {
filter(ReplaceTokens, tokens: [
"project.version": project.version,
"rs.version": rsversion.toString(),
"open.osrs.version": plusVersion.toString(),
"open.osrs.builddate": buildDate.toString(),
"launcher.version": launcherVersion.toString()
])
}
}
tasks.withType(AbstractArchiveTask) {
preserveFileTimestamps = false
reproducibleFileOrder = true
}
jar {
manifest {
attributes 'Main-Class': 'net.runelite.client.RuneLite'
}
}
shadowJar {
archiveClassifier.set("shaded")
exclude("net/runelite/injector/**")
}
task dependencyReportFile(type: DependencyReportTask) {
outputFile = file('dependencies.txt')
Set configs = [project.configurations.runtimeClasspath]
setConfigurations(configs)
}
tasks.build.dependsOn tasks.shadowJar
tasks.shadowJar.dependsOn tasks.dependencyReportFile

View File

@@ -0,0 +1,153 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
import org.apache.tools.ant.filters.ReplaceTokens
import java.util.Date
import java.text.SimpleDateFormat
buildscript {
dependencies {
classpath(gradleApi())
}
}
plugins {
id(Plugins.shadow.first) version Plugins.shadow.second
java
}
description = "RuneLite Client"
dependencies {
annotationProcessor(Libraries.lombok)
compileOnly(Libraries.javax)
compileOnly(Libraries.orangeExtensions)
compileOnly(Libraries.lombok)
implementation(Libraries.logback)
implementation(Libraries.gson)
implementation(Libraries.guava)
implementation(Libraries.guice)
implementation(Libraries.h2)
implementation(Libraries.rxrelay)
implementation(Libraries.okhttp3)
implementation(Libraries.rxjava)
implementation(Libraries.jna)
implementation(Libraries.jnaPlatform)
implementation(Libraries.discord)
implementation(Libraries.substance)
implementation(Libraries.jopt)
implementation(Libraries.apacheCommonsText)
implementation(Libraries.httpcore)
implementation(Libraries.httpmime)
implementation(Libraries.plexus)
implementation(Libraries.javassist)
implementation(Libraries.annotations)
implementation(Libraries.jogampGluegen)
implementation(Libraries.jogampJogl)
implementation(Libraries.jooq)
implementation(Libraries.jooqCodegen)
implementation(Libraries.jooqMeta)
implementation(Libraries.asmTree)
implementation(Libraries.slf4jApi)
implementation(Libraries.jclCore)
implementation(project(":http-api"))
implementation(project(":runelite-api"))
implementation(Libraries.jbsdiff) {
exclude(module = "xz")
}
implementation(Libraries.naturalMouse)
runtime(Libraries.trident)
runtime(Libraries.jogampGluegenLinuxAmd64)
runtime(Libraries.jogampGluegenLinuxI586)
runtime(Libraries.jogampGluegenWindowsAmd64)
runtime(Libraries.jogampGluegenWindowsI586)
runtime(Libraries.jogampJoglLinuxAmd64)
runtime(Libraries.jogampJoglLinuxI586)
runtime(Libraries.jogampJoglWindowsAmd64)
runtime(Libraries.jogampJoglWindowsI586)
runtime(project(":injected-client"))
runtime(project(":runescape-api"))
testAnnotationProcessor(Libraries.lombok)
testCompileOnly(Libraries.lombok)
testImplementation(Libraries.guiceGrapher)
testImplementation(Libraries.guiceTestlib)
testImplementation(Libraries.junit)
testImplementation(Libraries.hamcrest)
testImplementation(Libraries.mockitoCore)
testImplementation(Libraries.mockitoInline)
testImplementation(Libraries.slf4jApi)
}
fun formatDate(date: Date?) = with(date ?: Date()) {
SimpleDateFormat("MM-dd-yyyy").format(this)
}
tasks {
register<DependencyReportTask>("dependencyReportFile") {
outputFile = file("dependencies.txt")
setConfiguration("runtimeClasspath")
}
build {
finalizedBy("shadowJar")
}
"processResources"(ProcessResources::class) {
val tokens = mapOf(
"project.version" to ProjectVersions.rlVersion,
"rs.version" to ProjectVersions.rsversion.toString(),
"open.osrs.version" to ProjectVersions.openosrsVersion,
"open.osrs.builddate" to formatDate(Date()),
"launcher.version" to ProjectVersions.launcherVersion
)
inputs.properties(tokens)
from("src/main/resources") {
include("open.osrs.properties")
filter<ReplaceTokens>("tokens" to tokens)
}
}
jar {
manifest {
attributes(mutableMapOf("Main-Class" to "net.runelite.client.RuneLite"))
}
}
shadowJar {
dependsOn("dependencyReportFile")
archiveClassifier.set("shaded")
exclude("net/runelite/injector/**")
}
}

View File

@@ -59,6 +59,7 @@ import net.runelite.client.eventbus.EventBus;
import net.runelite.client.game.ClanManager; import net.runelite.client.game.ClanManager;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
import net.runelite.client.game.LootManager; import net.runelite.client.game.LootManager;
import net.runelite.client.game.XpDropManager;
import net.runelite.client.game.chatbox.ChatboxPanelManager; import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.graphics.ModelOutlineRenderer; import net.runelite.client.graphics.ModelOutlineRenderer;
import net.runelite.client.menus.MenuManager; import net.runelite.client.menus.MenuManager;
@@ -151,6 +152,9 @@ public class RuneLite
@Inject @Inject
private Provider<LootManager> lootManager; private Provider<LootManager> lootManager;
@Inject
private Provider<XpDropManager> xpDropManager;
@Inject @Inject
private Provider<ChatboxPanelManager> chatboxPanelManager; private Provider<ChatboxPanelManager> chatboxPanelManager;
@@ -368,6 +372,7 @@ public class RuneLite
chatMessageManager.get(); chatMessageManager.get();
commandManager.get(); commandManager.get();
lootManager.get(); lootManager.get();
xpDropManager.get();
chatboxPanelManager.get(); chatboxPanelManager.get();
eventBus.subscribe(GameStateChanged.class, this, hooks::onGameStateChanged); eventBus.subscribe(GameStateChanged.class, this, hooks::onGameStateChanged);

View File

@@ -61,9 +61,27 @@ import net.runelite.client.events.PlayerLootReceived;
@Slf4j @Slf4j
public class LootManager public class LootManager
{ {
private static final Map<Integer, Integer> NPC_DEATH_ANIMATIONS = ImmutableMap.of( private static final Map<Integer, Integer> NPC_DEATH_ANIMATIONS = ImmutableMap.<Integer, Integer>builder()
NpcID.CAVE_KRAKEN, AnimationID.CAVE_KRAKEN_DEATH .put(NpcID.CAVE_KRAKEN, AnimationID.CAVE_KRAKEN_DEATH)
); .put(NpcID.CRYSTALLINE_BAT, AnimationID.CRYSTALLINE_BAT_DEATH)
.put(NpcID.CRYSTALLINE_RAT, AnimationID.CRYSTALLINE_RAT_DEATH)
.put(NpcID.CRYSTALLINE_SPIDER, AnimationID.CRYSTALLINE_SPIDER_DEATH)
.put(NpcID.CRYSTALLINE_WOLF, AnimationID.CRYSTALLINE_WOLF_DEATH)
.put(NpcID.CRYSTALLINE_UNICORN, AnimationID.CRYSTALLINE_UNICORN_DEATH)
.put(NpcID.CRYSTALLINE_SCORPION, AnimationID.CORRUPTED_SCORPION_DEATH)
.put(NpcID.CRYSTALLINE_DRAGON, AnimationID.CRYSTALLINE_DRAGON_DEATH)
.put(NpcID.CRYSTALLINE_DARK_BEAST, AnimationID.CRYSTALLINE_DARK_BEAST_DEATH)
.put(NpcID.CRYSTALLINE_BEAR, AnimationID.CRYSTALLINE_BEAR_DEATH)
.put(NpcID.CORRUPTED_BAT, AnimationID.CRYSTALLINE_BAT_DEATH)
.put(NpcID.CORRUPTED_RAT, AnimationID.CRYSTALLINE_RAT_DEATH)
.put(NpcID.CORRUPTED_SPIDER, AnimationID.CRYSTALLINE_SPIDER_DEATH)
.put(NpcID.CORRUPTED_WOLF, AnimationID.CRYSTALLINE_WOLF_DEATH)
.put(NpcID.CORRUPTED_UNICORN, AnimationID.CRYSTALLINE_UNICORN_DEATH)
.put(NpcID.CORRUPTED_SCORPION, AnimationID.CORRUPTED_SCORPION_DEATH)
.put(NpcID.CORRUPTED_DRAGON, AnimationID.CRYSTALLINE_DRAGON_DEATH)
.put(NpcID.CORRUPTED_DARK_BEAST, AnimationID.CRYSTALLINE_DARK_BEAST_DEATH)
.put(NpcID.CORRUPTED_BEAR, AnimationID.CRYSTALLINE_BEAR_DEATH)
.build();
private final EventBus eventBus; private final EventBus eventBus;
private final Client client; private final Client client;
@@ -167,6 +185,7 @@ public class LootManager
final Tile tile = itemSpawned.getTile(); final Tile tile = itemSpawned.getTile();
final LocalPoint location = tile.getLocalLocation(); final LocalPoint location = tile.getLocalLocation();
final int packed = location.getSceneX() << 8 | location.getSceneY(); final int packed = location.getSceneX() << 8 | location.getSceneY();
log.debug("storing items in {}", packed);
itemSpawns.put(packed, new ItemStack(item.getId(), item.getQuantity(), location)); itemSpawns.put(packed, new ItemStack(item.getId(), item.getQuantity(), location));
log.debug("Item spawn {} ({}) location {}", item.getId(), item.getQuantity(), location); log.debug("Item spawn {} ({}) location {}", item.getId(), item.getQuantity(), location);
} }

View File

@@ -0,0 +1,12 @@
package net.runelite.client.game;
import lombok.Data;
import net.runelite.api.Skill;
import net.runelite.api.events.Event;
@Data
public class XpDropEvent implements Event
{
private Skill skill;
private int exp;
}

View File

@@ -0,0 +1,60 @@
package net.runelite.client.game;
import java.util.EnumMap;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.Skill;
import net.runelite.api.events.ExperienceChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.client.eventbus.EventBus;
@Singleton
public class XpDropManager
{
private final Map<Skill, Integer> previousSkillExpTable = new EnumMap<>(Skill.class);
@Getter(AccessLevel.PACKAGE)
private int damage = 0;
@Getter(AccessLevel.PACKAGE)
private int tickShow = 0;
private int previousExpGained;
private Client client;
private EventBus eventBus;
@Inject
private XpDropManager(
final EventBus eventBus,
final Client client
)
{
this.client = client;
this.eventBus = eventBus;
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(ExperienceChanged.class, this, this::onExperienceChanged);
}
private void onGameStateChanged(GameStateChanged event)
{
damage = 0;
tickShow = 0;
}
private void onExperienceChanged(ExperienceChanged event)
{
final Skill skill = event.getSkill();
final int xp = client.getSkillExperience(skill);
Integer previous = previousSkillExpTable.put(skill, xp);
if (previous != null)
{
previousExpGained = xp - previous;
XpDropEvent xpDropEvent = new XpDropEvent();
xpDropEvent.setExp(previousExpGained);
xpDropEvent.setSkill(skill);
eventBus.post(XpDropEvent.class, xpDropEvent);
}
}
}

View File

@@ -223,7 +223,7 @@ public class CoxPlugin extends Plugin
{ {
final String fixedPlayerName = Text.sanitize(rawPlayerName); final String fixedPlayerName = Text.sanitize(rawPlayerName);
if (fixedPlayerName.equals(tpMatcher.group(1))) if (fixedPlayerName.equals(Text.sanitize(tpMatcher.group(1))))
{ {
victims.add(new Victim(player, Victim.Type.TELEPORT)); victims.add(new Victim(player, Victim.Type.TELEPORT));
} }

View File

@@ -0,0 +1,42 @@
package net.runelite.client.plugins.deathindicator;
import java.time.Duration;
import java.time.Instant;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import net.runelite.api.Scene;
import net.runelite.api.coords.WorldPoint;
import static net.runelite.client.plugins.deathindicator.DeathIndicatorPlugin.HIJACKED_ITEMID;
import net.runelite.client.util.ColorUtil;
import net.runelite.client.util.MiscUtils;
@EqualsAndHashCode
@Getter
@Setter
class Bone
{
private String name;
private WorldPoint loc;
private Instant time;
void addToScene(Scene scene)
{
scene.addItem(HIJACKED_ITEMID, 1, loc);
}
void removeFromScene(Scene scene)
{
scene.removeItem(HIJACKED_ITEMID, 1, loc);
}
String getName()
{
return ColorUtil.colorStartTag(0xff9040) + "Bones (" + name + ")";
}
String getExamine()
{
return name + " died here " + MiscUtils.formatTimeAgo(Duration.between(time, Instant.now()));
}
}

View File

@@ -0,0 +1,200 @@
package net.runelite.client.plugins.deathindicator;
import com.google.common.collect.ImmutableMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.Scene;
import net.runelite.api.coords.WorldPoint;
import net.runelite.client.config.ConfigManager;
import static net.runelite.http.api.RuneLiteAPI.GSON;
@Slf4j
public class Bones
{
private static final String CONFIG_GROUP = "deathIndicator";
private static final String BONES_PREFIX = "bones_";
private ImmutableMap<Integer, Map<WorldPoint, List<Bone>>> map;
private boolean changed = false;
void init(Client client, ConfigManager configManager)
{
// Clone is important here as the normal array changes
int[] regions = client.getMapRegions().clone();
Bone[][] bones = getBones(configManager, regions);
if (log.isDebugEnabled())
{
log.debug("Regions are now {}", Arrays.toString(regions));
int n = 0;
for (Bone[] ar : bones)
{
n += ar.length;
}
log.debug("Loaded {} Bones", n);
}
initMap(regions, bones);
showBones(client.getScene());
}
private Bone[][] getBones(ConfigManager configManager, int[] regions)
{
Bone[][] bones = new Bone[regions.length][];
for (int i = 0; i < regions.length; i++)
{
int region = regions[i];
bones[i] = getBones(configManager, region);
}
return bones;
}
private Bone[] getBones(ConfigManager configManager, int regionId)
{
String json = configManager.getConfiguration(CONFIG_GROUP, BONES_PREFIX + regionId);
if (json == null)
{
return new Bone[0];
}
return GSON.fromJson(json, Bone[].class);
}
@SuppressWarnings("unchecked")
private void initMap(int[] regions, Bone[][] bones)
{
ImmutableMap.Builder<Integer, Map<WorldPoint, List<Bone>>> builder = ImmutableMap.builder();
for (int i = 0; i < regions.length; i++)
{
int region = regions[i];
Bone[] boneA = bones[i];
if (boneA.length == 0)
{
builder.put(region, Collections.EMPTY_MAP);
continue;
}
Map<WorldPoint, List<Bone>> map = new HashMap(boneA.length);
for (Bone b : boneA)
{
List<Bone> list = map.computeIfAbsent(b.getLoc(), wp -> new ArrayList<>());
list.add(b);
}
builder.put(region, map);
}
this.map = builder.build();
}
private void showBones(Scene scene)
{
this.forEach(bone -> bone.addToScene(scene));
}
void save(ConfigManager configManager)
{
if (this.map == null || !changed)
{
this.changed = false;
return;
}
for (Map.Entry<Integer, Map<WorldPoint, List<Bone>>> entry : this.map.entrySet())
{
final String key = BONES_PREFIX + entry.getKey();
final Map<WorldPoint, List<Bone>> map = entry.getValue();
if (map.size() == 0)
{
configManager.unsetConfiguration(CONFIG_GROUP, key);
continue;
}
List<Bone> list = new ArrayList<>(map.values().size());
for (List<Bone> lb : map.values())
{
list.addAll(lb);
}
String val = GSON.toJson(list.toArray(new Bone[0]));
configManager.setConfiguration(CONFIG_GROUP, key, val);
}
this.changed = false;
}
public boolean add(Bone bone)
{
if (this.map == null)
{
return false;
}
this.changed = true;
final int region = bone.getLoc().getRegionID();
final Map<WorldPoint, List<Bone>> map = this.map.get(region);
final List<Bone> list = map.computeIfAbsent(bone.getLoc(), wp -> new ArrayList<>());
list.add(bone);
return true;
}
public void remove(Bone bone)
{
this.changed = true;
final int region = bone.getLoc().getRegionID();
final Map<WorldPoint, List<Bone>> map = this.map.get(region);
final List<Bone> list = map.get(bone.getLoc());
list.remove(bone);
}
public void clear(Scene scene)
{
if (map == null)
{
return;
}
this.forEach(bone -> bone.removeFromScene(scene));
}
public Bone get(WorldPoint point, int i)
{
return get(point).get(i);
}
public List<Bone> get(WorldPoint point)
{
final int reg = point.getRegionID();
final Map<WorldPoint, List<Bone>> map = this.map.get(reg);
if (map == null)
{
return null;
}
return map.get(point);
}
private void forEach(Consumer<Bone> consumer)
{
for (Map<WorldPoint, List<Bone>> map : this.map.values())
{
for (Map.Entry<WorldPoint, List<Bone>> entry : map.entrySet())
{
for (Bone bone : entry.getValue())
{
consumer.accept(bone);
}
}
}
}
}

View File

@@ -152,4 +152,14 @@ public interface DeathIndicatorConfig extends Config
description = "" description = ""
) )
void timeOfDeath(Instant timeOfDeath); void timeOfDeath(Instant timeOfDeath);
@ConfigItem(
keyName = "permaBones",
name = "Permanent bones",
description = "Show right clickable bones with the name of who died permanently, after seeing someone die"
)
default boolean permaBones()
{
return false;
}
} }

View File

@@ -30,18 +30,32 @@ import java.awt.image.BufferedImage;
import java.time.Duration; import java.time.Duration;
import java.time.Instant; import java.time.Instant;
import java.time.temporal.ChronoUnit; import java.time.temporal.ChronoUnit;
import java.util.List;
import java.util.Set; import java.util.Set;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.GameState; import net.runelite.api.GameState;
import net.runelite.api.ItemDefinition;
import net.runelite.api.ItemID; import net.runelite.api.ItemID;
import net.runelite.api.MenuEntry;
import net.runelite.api.MenuOpcode;
import net.runelite.api.Player;
import net.runelite.api.coords.WorldPoint; import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemDespawned;
import net.runelite.api.events.LocalPlayerDeath; import net.runelite.api.events.LocalPlayerDeath;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.MenuOpened;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.PlayerDeath;
import net.runelite.api.events.PostItemDefinition;
import net.runelite.api.util.Text;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.game.ItemManager; import net.runelite.client.game.ItemManager;
@@ -61,6 +75,10 @@ import net.runelite.client.util.ImageUtil;
@Slf4j @Slf4j
public class DeathIndicatorPlugin extends Plugin public class DeathIndicatorPlugin extends Plugin
{ {
private static final Object BONES = new Object();
// A random number, that jagex probably won't actually use in the near future
static final int HIJACKED_ITEMID = 0x69696969;
private static final Set<Integer> RESPAWN_REGIONS = ImmutableSet.of( private static final Set<Integer> RESPAWN_REGIONS = ImmutableSet.of(
12850, // Lumbridge 12850, // Lumbridge
11828, // Falador 11828, // Falador
@@ -88,6 +106,14 @@ public class DeathIndicatorPlugin extends Plugin
@Inject @Inject
private EventBus eventBus; private EventBus eventBus;
@Inject
private ConfigManager configManager;
@Inject
private ClientThread clientThread;
private final Bones bones = new Bones();
private BufferedImage mapArrow; private BufferedImage mapArrow;
private Timer deathTimer; private Timer deathTimer;
@@ -95,7 +121,7 @@ public class DeathIndicatorPlugin extends Plugin
private WorldPoint lastDeath; private WorldPoint lastDeath;
private Instant lastDeathTime; private Instant lastDeathTime;
private int lastDeathWorld; private int lastDeathWorld;
private int despawnIdx = 0;
@Provides @Provides
DeathIndicatorConfig deathIndicatorConfig(ConfigManager configManager) DeathIndicatorConfig deathIndicatorConfig(ConfigManager configManager)
{ {
@@ -129,12 +155,18 @@ public class DeathIndicatorPlugin extends Plugin
worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance); worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance);
worldMapPointManager.add(new DeathWorldMapPoint(new WorldPoint(config.deathLocationX(), config.deathLocationY(), config.deathLocationPlane()), this)); worldMapPointManager.add(new DeathWorldMapPoint(new WorldPoint(config.deathLocationX(), config.deathLocationY(), config.deathLocationPlane()), this));
} }
if (config.permaBones() && client.getGameState() == GameState.LOGGED_IN)
{
clientThread.invokeLater(this::initBones);
}
} }
@Override @Override
protected void shutDown() protected void shutDown()
{ {
eventBus.unregister(this); eventBus.unregister(this);
eventBus.unregister(BONES);
if (client.hasHintArrow()) if (client.hasHintArrow())
{ {
@@ -148,6 +180,24 @@ public class DeathIndicatorPlugin extends Plugin
} }
worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance); worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance);
clientThread.invokeLater(this::clearBones);
saveBones();
}
private void initBones()
{
bones.init(client, configManager);
}
private void saveBones()
{
bones.save(configManager);
}
private void clearBones()
{
bones.clear(client.getScene());
} }
private void addSubscriptions() private void addSubscriptions()
@@ -156,6 +206,100 @@ public class DeathIndicatorPlugin extends Plugin
eventBus.subscribe(LocalPlayerDeath.class, this, this::onLocalPlayerDeath); eventBus.subscribe(LocalPlayerDeath.class, this, this::onLocalPlayerDeath);
eventBus.subscribe(GameTick.class, this, this::onGameTick); eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
if (config.permaBones())
{
addBoneSubs();
}
}
private void addBoneSubs()
{
eventBus.subscribe(ItemDespawned.class, BONES, this::onItemDespawn);
eventBus.subscribe(PlayerDeath.class, BONES, this::onPlayerDeath);
eventBus.subscribe(MenuEntryAdded.class, BONES, this::onMenuEntryAdded);
eventBus.subscribe(MenuOptionClicked.class, BONES, this::onMenuOptionClicked);
eventBus.subscribe(MenuOpened.class, BONES, this::onMenuOpened);
eventBus.subscribe(PostItemDefinition.class, BONES, this::onPostItemDefinition);
}
private void onPostItemDefinition(PostItemDefinition def)
{
ItemDefinition itemDef = def.getItemDefinition();
if (itemDef.getId() == HIJACKED_ITEMID)
{
itemDef.setModelOverride(ItemID.BONES);
itemDef.setName("Bones");
// This is so never hide untradeables doesn't not hide it
itemDef.setTradeable(true);
}
}
private void onPlayerDeath(PlayerDeath death)
{
Player p = death.getPlayer();
Bone b = new Bone();
b.setName(Text.sanitize(p.getName()));
b.setTime(Instant.now());
b.setLoc(p.getWorldLocation());
while (!bones.add(b))
{
initBones();
}
b.addToScene(client.getScene());
}
private void onMenuEntryAdded(MenuEntryAdded event)
{
if (event.getIdentifier() == HIJACKED_ITEMID)
{
if (event.getOpcode() == MenuOpcode.GROUND_ITEM_THIRD_OPTION.getId())
{
client.setMenuOptionCount(client.getMenuOptionCount() - 1);
}
}
}
private void onMenuOpened(MenuOpened event)
{
int idx = 0;
for (MenuEntry entry : event)
{
if (entry.getIdentifier() != HIJACKED_ITEMID)
{
continue;
}
// Only entries with appropriate identifier here will be examine so that's easy
// Add idx to id field, so we can find that back from clicked event
entry.setIdentifier(HIJACKED_ITEMID + idx);
Bone bone = bones.get(
WorldPoint.fromScene(client, entry.getParam0(), entry.getParam1(), client.getPlane()),
idx++
);
entry.setTarget(bone.getName());
event.setModified();
}
}
private void onMenuOptionClicked(MenuOptionClicked event)
{
if (event.getIdentifier() >= HIJACKED_ITEMID
&& event.getOpcode() == MenuOpcode.EXAMINE_ITEM_GROUND.getId())
{
Bone b = bones.get(
WorldPoint.fromScene(client, event.getParam0(), event.getParam1(), client.getPlane()),
event.getIdentifier() - HIJACKED_ITEMID
);
client.addChatMessage(ChatMessageType.ITEM_EXAMINE, "", b.getExamine(), "");
event.consume();
}
} }
private void onLocalPlayerDeath(LocalPlayerDeath death) private void onLocalPlayerDeath(LocalPlayerDeath death)
@@ -238,6 +382,29 @@ public class DeathIndicatorPlugin extends Plugin
{ {
if (event.getGroup().equals("deathIndicator")) if (event.getGroup().equals("deathIndicator"))
{ {
if ("permaBones".equals(event.getKey()))
{
if (config.permaBones())
{
addBoneSubs();
if (client.getGameState() == GameState.LOGGED_IN)
{
clientThread.invokeLater(this::initBones);
}
}
else
{
eventBus.unregister(BONES);
if (client.getGameState() == GameState.LOGGED_IN)
{
clientThread.invokeLater(this::clearBones);
saveBones();
}
}
return;
}
if (!config.showDeathHintArrow() && hasDied()) if (!config.showDeathHintArrow() && hasDied())
{ {
client.clearHintArrow(); client.clearHintArrow();
@@ -267,32 +434,62 @@ public class DeathIndicatorPlugin extends Plugin
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
if (!hasDied()) switch (event.getGameState())
{ {
return; case LOADING:
} clearBones();
saveBones();
if (event.getGameState() == GameState.LOGGED_IN) break;
{ case LOGGED_IN:
if (client.getWorld() == config.deathWorld()) if (config.permaBones())
{
WorldPoint deathPoint = new WorldPoint(config.deathLocationX(), config.deathLocationY(), config.deathLocationPlane());
if (config.showDeathHintArrow())
{ {
client.setHintArrow(deathPoint); initBones();
} }
if (config.showDeathOnWorldMap()) if (!hasDied())
{
return;
}
if (client.getWorld() == config.deathWorld())
{
WorldPoint deathPoint = new WorldPoint(config.deathLocationX(), config.deathLocationY(), config.deathLocationPlane());
if (config.showDeathHintArrow())
{
client.setHintArrow(deathPoint);
}
if (config.showDeathOnWorldMap())
{
worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance);
worldMapPointManager.add(new DeathWorldMapPoint(deathPoint, this));
}
}
else
{ {
worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance); worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance);
worldMapPointManager.add(new DeathWorldMapPoint(deathPoint, this));
} }
} break;
else }
}
private void onItemDespawn(ItemDespawned event)
{
if (event.getItem().getId() == HIJACKED_ITEMID)
{
List<Bone> list = bones.get(event.getTile().getWorldLocation());
if (list == null)
{ {
worldMapPointManager.removeIf(DeathWorldMapPoint.class::isInstance); return;
} }
if (list.size() <= despawnIdx)
{
despawnIdx = 0;
}
Bone bone = list.get(despawnIdx++);
bone.addToScene(client.getScene());
} }
} }

View File

@@ -29,8 +29,6 @@ package net.runelite.client.plugins.experiencedrop;
import com.google.inject.Provides; import com.google.inject.Provides;
import java.awt.Color; import java.awt.Color;
import java.util.Arrays; import java.util.Arrays;
import java.util.EnumMap;
import java.util.Map;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
@@ -46,7 +44,6 @@ import net.runelite.api.SpriteID;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.WorldType; import net.runelite.api.WorldType;
import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.ExperienceChanged;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.ScriptCallbackEvent; import net.runelite.api.events.ScriptCallbackEvent;
@@ -57,6 +54,7 @@ import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.game.NPCManager; import net.runelite.client.game.NPCManager;
import net.runelite.client.game.XpDropEvent;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
@@ -65,30 +63,23 @@ import net.runelite.client.util.ColorUtil;
@PluginDescriptor( @PluginDescriptor(
name = "XP Drop", name = "XP Drop",
description = "Enable customization of the way XP drops are displayed", description = "Enable customization of the way XP drops are displayed",
tags = {"experience", "levels", "tick"} tags = {"experience", "levels", "tick"})
)
@Singleton @Singleton
public class XpDropPlugin extends Plugin public class XpDropPlugin extends Plugin
{ {
private static final int XPDROP_PADDING = 2; // space between xp drop icons private static final int XPDROP_PADDING = 2; // space between xp drop icons
private static final double HITPOINT_RATIO = 1.33; // Base rate of hp xp per point damage private static final double HITPOINT_RATIO = 1.33; // Base rate of hp xp per point damage
private static final double DMM_MULTIPLIER_RATIO = 10; private static final double DMM_MULTIPLIER_RATIO = 10;
@Inject @Inject
private Client client; private Client client;
@Inject @Inject
private XpDropConfig config; private XpDropConfig config;
@Inject @Inject
private NPCManager npcManager; private NPCManager npcManager;
@Inject @Inject
private OverlayManager overlayManager; private OverlayManager overlayManager;
@Inject @Inject
private XpDropOverlay overlay; private XpDropOverlay overlay;
@Inject @Inject
private EventBus eventBus; private EventBus eventBus;
@@ -106,16 +97,15 @@ public class XpDropPlugin extends Plugin
private boolean hasDropped = false; private boolean hasDropped = false;
private boolean correctPrayer; private boolean correctPrayer;
private Skill lastSkill = null; private Skill lastSkill = null;
private final Map<Skill, Integer> previousSkillExpTable = new EnumMap<>(Skill.class);
private PrayerType currentTickPrayer; private PrayerType currentTickPrayer;
private XpDropConfig.DamageMode damageMode; private XpDropConfig.DamageMode damageMode;
private boolean hideSkillIcons; private boolean hideSkillIcons;
private Color getMeleePrayerColor; private Color getMeleePrayerColor;
private Color getRangePrayerColor; private Color getRangePrayerColor;
private Color getMagePrayerColor; private Color getMagePrayerColor;
private int fakeXpDropDelay; private int fakeXpDropDelay;
private XpDropConfig.DamageMode showdamagedrops; private XpDropConfig.DamageMode showdamagedrops;
@Getter(AccessLevel.PACKAGE) @Getter(AccessLevel.PACKAGE)
private Color damageColor; private Color damageColor;
@@ -153,10 +143,17 @@ public class XpDropPlugin extends Plugin
eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged); eventBus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventBus.subscribe(WidgetHiddenChanged.class, this, this::onWidgetHiddenChanged); eventBus.subscribe(WidgetHiddenChanged.class, this, this::onWidgetHiddenChanged);
eventBus.subscribe(GameTick.class, this, this::onGameTick); eventBus.subscribe(GameTick.class, this, this::onGameTick);
eventBus.subscribe(ExperienceChanged.class, this, this::onExperienceChanged); eventBus.subscribe(XpDropEvent.class, this, this::onXpDropEvent);
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent); eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
} }
private void onXpDropEvent(XpDropEvent event)
{
previousExpGained = event.getExp();
lastSkill = event.getSkill();
hasDropped = true;
}
private void onConfigChanged(ConfigChanged event) private void onConfigChanged(ConfigChanged event)
{ {
if (!event.getGroup().equals("xpdrop")) if (!event.getGroup().equals("xpdrop"))
@@ -188,8 +185,8 @@ public class XpDropPlugin extends Plugin
private void onGameStateChanged(GameStateChanged event) private void onGameStateChanged(GameStateChanged event)
{ {
damage = 0;
tickShow = 0; tickShow = 0;
damage = 0;
} }
private void onWidgetHiddenChanged(WidgetHiddenChanged event) private void onWidgetHiddenChanged(WidgetHiddenChanged event)
@@ -269,9 +266,12 @@ public class XpDropPlugin extends Plugin
switch (prayer) switch (prayer)
{ {
case MELEE: case MELEE:
if (spriteIDs.anyMatch(id -> if (spriteIDs.anyMatch(
id == SpriteID.SKILL_ATTACK || id == SpriteID.SKILL_STRENGTH || id == SpriteID.SKILL_DEFENCE id ->
|| correctPrayer)) id == SpriteID.SKILL_ATTACK
|| id == SpriteID.SKILL_STRENGTH
|| id == SpriteID.SKILL_DEFENCE
|| correctPrayer))
{ {
color = this.getMeleePrayerColor.getRGB(); color = this.getMeleePrayerColor.getRGB();
correctPrayer = true; correctPrayer = true;
@@ -351,21 +351,6 @@ public class XpDropPlugin extends Plugin
client.runScript(XPDROP_DISABLED, lastSkill.ordinal(), previousExpGained); client.runScript(XPDROP_DISABLED, lastSkill.ordinal(), previousExpGained);
} }
private void onExperienceChanged(ExperienceChanged event)
{
final Skill skill = event.getSkill();
final int xp = client.getSkillExperience(skill);
lastSkill = skill;
Integer previous = previousSkillExpTable.put(skill, xp);
if (previous != null)
{
previousExpGained = xp - previous;
hasDropped = true;
}
}
private void onScriptCallbackEvent(ScriptCallbackEvent e) private void onScriptCallbackEvent(ScriptCallbackEvent e)
{ {
if (this.showdamagedrops == XpDropConfig.DamageMode.NONE) if (this.showdamagedrops == XpDropConfig.DamageMode.NONE)
@@ -404,16 +389,19 @@ public class XpDropPlugin extends Plugin
final int exp = intStack[intStackSize - 1]; final int exp = intStack[intStackSize - 1];
calculateDamageDealt(exp); calculateDamageDealt(exp);
} }
else if (eventName.equals("xpDropAddDamage") && else if (eventName.equals("xpDropAddDamage")
damageMode == XpDropConfig.DamageMode.IN_XP_DROP && && damageMode == XpDropConfig.DamageMode.IN_XP_DROP
damage > 0) && damage > 0)
{ {
final String[] stringStack = client.getStringStack(); final String[] stringStack = client.getStringStack();
final int stringStackSize = client.getStringStackSize(); final int stringStackSize = client.getStringStackSize();
String builder = stringStack[stringStackSize - 1] + String builder =
ColorUtil.colorTag(this.damageColor) + stringStack[stringStackSize - 1]
" (" + damage + ")"; + ColorUtil.colorTag(this.damageColor)
+ " ("
+ damage
+ ")";
stringStack[stringStackSize - 1] = builder; stringStack[stringStackSize - 1] = builder;
} }
} }
@@ -431,7 +419,8 @@ public class XpDropPlugin extends Plugin
Actor a = client.getLocalPlayer().getInteracting(); Actor a = client.getLocalPlayer().getInteracting();
if (!(a instanceof NPC) && !(a instanceof Player)) if (!(a instanceof NPC) && !(a instanceof Player))
{ {
// If we are interacting with nothing we may have clicked away at the perfect time fall back to last tick // If we are interacting with nothing we may have clicked away at the perfect time fall back
// to last tick
if (!(lastOpponent instanceof NPC) && !(lastOpponent instanceof Player)) if (!(lastOpponent instanceof NPC) && !(lastOpponent instanceof Player))
{ {
damage = (int) Math.rint(damageDealt); damage = (int) Math.rint(damageDealt);

View File

@@ -321,4 +321,16 @@ public interface GauntletConfig extends Config
{ {
return false; return false;
} }
@ConfigItem(
position = 21,
keyName = "displayResources",
name = "Show raw resources gathered",
description = "Displays how much of each resource you have gathered.",
titleSection = "resources"
)
default boolean displayGatheredResources()
{
return false;
}
} }

View File

@@ -43,6 +43,7 @@ import net.runelite.api.Client;
import net.runelite.api.GameObject; import net.runelite.api.GameObject;
import net.runelite.api.GameState; import net.runelite.api.GameState;
import net.runelite.api.HeadIcon; import net.runelite.api.HeadIcon;
import net.runelite.api.ItemID;
import net.runelite.api.NPC; import net.runelite.api.NPC;
import net.runelite.api.NPCDefinition; import net.runelite.api.NPCDefinition;
import net.runelite.api.NpcID; import net.runelite.api.NpcID;
@@ -50,6 +51,7 @@ import net.runelite.api.ObjectID;
import net.runelite.api.Player; import net.runelite.api.Player;
import net.runelite.api.Projectile; import net.runelite.api.Projectile;
import net.runelite.api.ProjectileID; import net.runelite.api.ProjectileID;
import net.runelite.api.Skill;
import net.runelite.api.SoundEffectID; import net.runelite.api.SoundEffectID;
import net.runelite.api.Varbits; import net.runelite.api.Varbits;
import net.runelite.api.events.AnimationChanged; import net.runelite.api.events.AnimationChanged;
@@ -58,6 +60,7 @@ import net.runelite.api.events.GameObjectDespawned;
import net.runelite.api.events.GameObjectSpawned; import net.runelite.api.events.GameObjectSpawned;
import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick; import net.runelite.api.events.GameTick;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcDespawned;
import net.runelite.api.events.NpcSpawned; import net.runelite.api.events.NpcSpawned;
import net.runelite.api.events.ProjectileSpawned; import net.runelite.api.events.ProjectileSpawned;
@@ -65,6 +68,8 @@ import net.runelite.api.events.VarbitChanged;
import net.runelite.client.callback.ClientThread; import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus; import net.runelite.client.eventbus.EventBus;
import net.runelite.client.events.NpcLootReceived;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.SkillIconManager; import net.runelite.client.game.SkillIconManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
@@ -73,7 +78,10 @@ import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.LIGHTNING;
import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.MAGIC; import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.MAGIC;
import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.PRAYER; import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.PRAYER;
import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.RANGE; import static net.runelite.client.plugins.gauntlet.Hunllef.BossAttack.RANGE;
import net.runelite.client.game.XpDropEvent;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.Counter;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@PluginDescriptor( @PluginDescriptor(
name = "Gauntlet", name = "Gauntlet",
@@ -104,7 +112,8 @@ public class GauntletPlugin extends Plugin
ObjectID.PHREN_ROOTS_36066, ObjectID.FISHING_SPOT_36068, ObjectID.FISHING_SPOT_35971, ObjectID.GRYM_ROOT, ObjectID.GRYM_ROOT_36070, ObjectID.PHREN_ROOTS_36066, ObjectID.FISHING_SPOT_36068, ObjectID.FISHING_SPOT_35971, ObjectID.GRYM_ROOT, ObjectID.GRYM_ROOT_36070,
ObjectID.LINUM_TIRINUM, ObjectID.LINUM_TIRINUM_36072 ObjectID.LINUM_TIRINUM, ObjectID.LINUM_TIRINUM_36072
); );
private static final int GATHERING_HERB = 0;
private static final int GATHERING_CLOTH = 1;
@Inject @Inject
@Getter(AccessLevel.NONE) @Getter(AccessLevel.NONE)
private Client client; private Client client;
@@ -138,6 +147,10 @@ public class GauntletPlugin extends Plugin
@Setter(AccessLevel.PACKAGE) @Setter(AccessLevel.PACKAGE)
@Nullable @Nullable
private Hunllef hunllef; private Hunllef hunllef;
@Inject
private InfoBoxManager infoBoxManager;
@Inject
private ItemManager itemManager;
private boolean attackVisualOutline; private boolean attackVisualOutline;
private boolean completeStartup = false; private boolean completeStartup = false;
private boolean displayTimerChat; private boolean displayTimerChat;
@@ -160,11 +173,24 @@ public class GauntletPlugin extends Plugin
private final Map<String, Integer> items = new HashMap<>(); private final Map<String, Integer> items = new HashMap<>();
private final Set<Missiles> projectiles = new HashSet<>(); private final Set<Missiles> projectiles = new HashSet<>();
private final Set<Resources> resources = new HashSet<>(); private final Set<Resources> resources = new HashSet<>();
private GauntletConfig.CounterDisplay countAttacks; private GauntletConfig.CounterDisplay countAttacks;
private int resourceIconSize; private int resourceIconSize;
private Set<Tornado> tornadoes = new HashSet<>(); private Set<Tornado> tornadoes = new HashSet<>();
private int projectileIconSize; private int projectileIconSize;
private boolean displayResources;
private Counter oreCounter;
private Counter woodCounter;
private Counter clothCounter;
private Counter fishCounter;
private Counter herbCounter;
private int oresGathered;
private int woodGathered;
private int clothGathered;
private int fishGathered;
private int herbGathered;
private int currentFarmingAction = -1;
private boolean countersVisible = false;
@Provides @Provides
GauntletConfig getConfig(ConfigManager configManager) GauntletConfig getConfig(ConfigManager configManager)
@@ -177,6 +203,7 @@ public class GauntletPlugin extends Plugin
{ {
addSubscriptions(); addSubscriptions();
updateConfig(); updateConfig();
initializeCounters();
overlayManager.add(overlay); overlayManager.add(overlay);
overlayManager.add(infoboxoverlay); overlayManager.add(infoboxoverlay);
overlayManager.add(GauntletCounter); overlayManager.add(GauntletCounter);
@@ -200,6 +227,47 @@ public class GauntletPlugin extends Plugin
} }
} }
private void addCounters()
{
if (!countersVisible)
{
infoBoxManager.addInfoBox(oreCounter);
infoBoxManager.addInfoBox(woodCounter);
infoBoxManager.addInfoBox(clothCounter);
infoBoxManager.addInfoBox(fishCounter);
infoBoxManager.addInfoBox(herbCounter);
countersVisible = true;
}
}
private void initializeCounters()
{
resetGatheringCounters();
oreCounter = new Counter(itemManager.getImage(ItemID.CORRUPTED_ORE), this, 0);
woodCounter = new Counter(itemManager.getImage(ItemID.PHREN_BARK_23878), this, 0);
clothCounter = new Counter(itemManager.getImage(ItemID.LINUM_TIRINUM_23876), this, 0);
fishCounter = new Counter(itemManager.getImage(ItemID.RAW_PADDLEFISH), this, 0);
herbCounter = new Counter(itemManager.getImage(ItemID.GRYM_LEAF_23875), this, 0);
}
private void resetGatheringCounters()
{
oresGathered = 0;
fishGathered = 0;
woodGathered = 0;
clothGathered = 0;
herbGathered = 0;
}
private void updateCounters()
{
oreCounter.setCount(oresGathered);
woodCounter.setCount(woodGathered);
clothCounter.setCount(clothGathered);
fishCounter.setCount(fishGathered);
herbCounter.setCount(herbGathered);
}
@Override @Override
protected void shutDown() protected void shutDown()
{ {
@@ -213,12 +281,24 @@ public class GauntletPlugin extends Plugin
overlayManager.remove(overlay); overlayManager.remove(overlay);
overlayManager.remove(infoboxoverlay); overlayManager.remove(infoboxoverlay);
overlayManager.remove(GauntletCounter); overlayManager.remove(GauntletCounter);
removeCounters();
resetGatheringCounters();
resources.clear(); resources.clear();
projectiles.clear(); projectiles.clear();
tornadoes.clear(); tornadoes.clear();
setHunllef(null); setHunllef(null);
} }
private void removeCounters()
{
infoBoxManager.removeInfoBox(oreCounter);
infoBoxManager.removeInfoBox(woodCounter);
infoBoxManager.removeInfoBox(clothCounter);
infoBoxManager.removeInfoBox(fishCounter);
infoBoxManager.removeInfoBox(herbCounter);
countersVisible = false;
}
private void addSubscriptions() private void addSubscriptions()
{ {
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged); eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
@@ -231,6 +311,56 @@ public class GauntletPlugin extends Plugin
eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned); eventBus.subscribe(NpcSpawned.class, this, this::onNpcSpawned);
eventBus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned); eventBus.subscribe(ProjectileSpawned.class, this, this::onProjectileSpawned);
eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged); eventBus.subscribe(VarbitChanged.class, this, this::onVarbitChanged);
eventBus.subscribe(XpDropEvent.class, this, this::onXpDropEvent);
eventBus.subscribe(NpcLootReceived.class, this, this::onNpcLootReceived);
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
}
private void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
{
if (menuOptionClicked.getTarget().toUpperCase().contains("LINUM"))
{
currentFarmingAction = GATHERING_CLOTH;
}
if (menuOptionClicked.getTarget().toUpperCase().contains("GRYM"))
{
currentFarmingAction = GATHERING_HERB;
}
}
private void onNpcLootReceived(NpcLootReceived npcLootReceived)
{
fishGathered += (int) npcLootReceived.getItems().stream().filter(item -> item.getId() == ItemID.RAW_PADDLEFISH).count();
herbGathered += (int) npcLootReceived.getItems().stream().filter(item -> item.getId() == ItemID.GRYM_LEAF || item.getId() == ItemID.GRYM_LEAF_23875).count();
updateCounters();
}
private void onXpDropEvent(XpDropEvent experienceChanged)
{
if (experienceChanged.getSkill().compareTo(Skill.MINING) == 0)
{
oresGathered++;
}
if (experienceChanged.getSkill().compareTo(Skill.WOODCUTTING) == 0)
{
woodGathered++;
}
if (experienceChanged.getSkill().compareTo(Skill.FARMING) == 0)
{
if (currentFarmingAction == GATHERING_HERB)
{
herbGathered++;
}
else if (currentFarmingAction == GATHERING_CLOTH)
{
clothGathered++;
}
}
if (experienceChanged.getSkill().compareTo(Skill.FISHING) == 0)
{
fishGathered++;
}
updateCounters();
} }
private void onAnimationChanged(AnimationChanged event) private void onAnimationChanged(AnimationChanged event)
@@ -325,6 +455,18 @@ public class GauntletPlugin extends Plugin
timerVisible = false; timerVisible = false;
} }
} }
if (event.getKey().equals("displayResources"))
{
if (this.displayResources && this.startedGauntlet())
{
addCounters();
}
else
{
removeCounters();
}
}
} }
private void onGameObjectDespawned(GameObjectDespawned event) private void onGameObjectDespawned(GameObjectDespawned event)
@@ -379,6 +521,7 @@ public class GauntletPlugin extends Plugin
if (HUNLLEF_NPC_IDS.contains(npc.getId())) if (HUNLLEF_NPC_IDS.contains(npc.getId()))
{ {
setHunllef(null); setHunllef(null);
resetGatheringCounters();
} }
else if (TORNADO_NPC_IDS.contains(npc.getId())) else if (TORNADO_NPC_IDS.contains(npc.getId()))
{ {
@@ -436,6 +579,14 @@ public class GauntletPlugin extends Plugin
{ {
timer.checkStates(true); timer.checkStates(true);
} }
if (startedGauntlet() && displayResources)
{
addCounters();
}
else
{
removeCounters();
}
} }
boolean fightingBoss() boolean fightingBoss()
@@ -468,5 +619,6 @@ public class GauntletPlugin extends Plugin
this.displayTimerChat = config.displayTimerChat(); this.displayTimerChat = config.displayTimerChat();
this.attackVisualOutline = config.attackVisualOutline(); this.attackVisualOutline = config.attackVisualOutline();
this.highlightPrayerInfobox = config.highlightPrayerInfobox(); this.highlightPrayerInfobox = config.highlightPrayerInfobox();
this.displayResources = config.displayGatheredResources();
} }
} }

View File

@@ -1,6 +1,8 @@
package net.runelite.client.util; package net.runelite.client.util;
import java.awt.Polygon; import java.awt.Polygon;
import java.time.Duration;
import java.time.temporal.ChronoUnit;
import net.runelite.api.Client; import net.runelite.api.Client;
import net.runelite.api.Player; import net.runelite.api.Player;
import net.runelite.api.WorldType; import net.runelite.api.WorldType;
@@ -16,6 +18,17 @@ public class MiscUtils
private static final Polygon abovePoly = new Polygon(abovePointsX, abovePointsY, abovePointsX.length); private static final Polygon abovePoly = new Polygon(abovePointsX, abovePointsY, abovePointsX.length);
private static final Polygon belowPoly = new Polygon(belowPointsX, belowPointsY, belowPointsX.length); private static final Polygon belowPoly = new Polygon(belowPointsX, belowPointsY, belowPointsX.length);
private static final ChronoUnit[] ORDERED_CHRONOS = new ChronoUnit[]
{
ChronoUnit.YEARS,
ChronoUnit.MONTHS,
ChronoUnit.WEEKS,
ChronoUnit.DAYS,
ChronoUnit.HOURS,
ChronoUnit.MINUTES,
ChronoUnit.SECONDS
};
//test replacement so private for now //test replacement so private for now
private static boolean inWildy(WorldPoint point) private static boolean inWildy(WorldPoint point)
{ {
@@ -86,4 +99,75 @@ public class MiscUtils
//return getWildernessLevelFrom(client, localPlayer.getWorldLocation()) > 0; //return getWildernessLevelFrom(client, localPlayer.getWorldLocation()) > 0;
} }
public static String formatTimeAgo(Duration dur)
{
long dA = 0, dB = 0, rm;
ChronoUnit cA = null, cB = null;
for (int i = 0; i < ORDERED_CHRONOS.length; i++)
{
cA = ORDERED_CHRONOS[i];
dA = dur.getSeconds() / cA.getDuration().getSeconds();
rm = dur.getSeconds() % cA.getDuration().getSeconds();
if (dA <= 0)
{
cA = null;
continue;
}
if (i + 1 < ORDERED_CHRONOS.length)
{
cB = ORDERED_CHRONOS[i + 1];
dB = rm / cB.getDuration().getSeconds();
if (dB <= 0)
{
cB = null;
}
}
break;
}
if (cA == null)
{
return "just now.";
}
String str = formatUnit(cA, dA);
if (cB != null)
{
str += " and " + formatUnit(cB, dB);
}
return str + " ago.";
}
private static String formatUnit(ChronoUnit chrono, long val)
{
boolean multiple = val != 1;
String str;
if (multiple)
{
str = val + " ";
}
else
{
str = "a" + (chrono == ChronoUnit.HOURS ? "n " : " ");
}
str += chrono.name().toLowerCase();
if (!multiple)
{
if (str.charAt(str.length() - 1) == 's')
{
str = str.substring(0, str.length() - 1);
}
}
else if (str.charAt(str.length() - 1) != 's')
{
str += "s";
}
return str;
}
} }

File diff suppressed because one or more lines are too long

View File

@@ -1,13 +0,0 @@
description = 'RuneLite Mixins'
dependencies {
compileOnly group: 'com.google.guava', name: 'guava', version: guava
compileOnly group: 'javax.inject', name: 'javax.inject', version: javaxInject
compileOnly group: 'org.slf4j', name: 'slf4j-api', version: slf4j
implementation project(':runescape-api')
}
tasks.withType(JavaCompile){
options.compilerArgs.addAll('-source', '7', '-Xlint:-unchecked')
}

View File

@@ -0,0 +1,38 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
description = "RuneLite Mixins"
dependencies {
compileOnly(Libraries.guava)
compileOnly(Libraries.javaxInject)
compileOnly(Libraries.slf4jApi)
implementation(project(":runescape-api"))
}
tasks.withType<JavaCompile> {
options.compilerArgs.addAll(arrayOf("-source", "7", "-Xlint:-unchecked"))
}

View File

@@ -9,6 +9,7 @@ import net.runelite.api.mixins.Replace;
import net.runelite.api.mixins.Shadow; import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSClient; import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSItemDefinition; import net.runelite.rs.api.RSItemDefinition;
import net.runelite.rs.api.RSModel;
@Mixin(RSItemDefinition.class) @Mixin(RSItemDefinition.class)
public abstract class RSItemDefinitionMixin implements RSItemDefinition public abstract class RSItemDefinitionMixin implements RSItemDefinition
@@ -21,6 +22,16 @@ public abstract class RSItemDefinitionMixin implements RSItemDefinition
@Inject @Inject
private int shiftClickActionIndex = DEFAULT_CUSTOM_SHIFT_CLICK_INDEX; private int shiftClickActionIndex = DEFAULT_CUSTOM_SHIFT_CLICK_INDEX;
@Inject
private int modelOverride = -1;
@Override
@Inject
public void setModelOverride(int id)
{
modelOverride = id;
}
@Inject @Inject
RSItemDefinitionMixin() RSItemDefinitionMixin()
{ {
@@ -64,4 +75,18 @@ public abstract class RSItemDefinitionMixin implements RSItemDefinition
event.setItemDefinition(this); event.setItemDefinition(this);
client.getCallbacks().post(PostItemDefinition.class, event); client.getCallbacks().post(PostItemDefinition.class, event);
} }
@Copy("getModel")
public abstract RSModel rs$getModel(int quantity);
@Replace("getModel")
public RSModel getModel(int quantity)
{
if (modelOverride == -1)
{
return rs$getModel(quantity);
}
return client.getItemDefinition(modelOverride).getModel(quantity);
}
} }

View File

@@ -29,6 +29,7 @@ import net.runelite.api.Perspective;
import net.runelite.api.TileModel; import net.runelite.api.TileModel;
import net.runelite.api.TilePaint; import net.runelite.api.TilePaint;
import net.runelite.api.Tile; import net.runelite.api.Tile;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.hooks.DrawCallbacks; import net.runelite.api.hooks.DrawCallbacks;
import net.runelite.api.mixins.Copy; import net.runelite.api.mixins.Copy;
import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.Inject;
@@ -38,6 +39,8 @@ import net.runelite.api.mixins.Shadow;
import net.runelite.rs.api.RSBoundaryObject; import net.runelite.rs.api.RSBoundaryObject;
import net.runelite.rs.api.RSClient; import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSFloorDecoration; import net.runelite.rs.api.RSFloorDecoration;
import net.runelite.rs.api.RSNodeDeque;
import net.runelite.rs.api.RSTileItem;
import net.runelite.rs.api.RSTileItemPile; import net.runelite.rs.api.RSTileItemPile;
import net.runelite.rs.api.RSScene; import net.runelite.rs.api.RSScene;
import net.runelite.rs.api.RSTile; import net.runelite.rs.api.RSTile;
@@ -716,4 +719,72 @@ public abstract class RSSceneMixin implements RSScene
client.setSelectedSceneTileX(targetX); client.setSelectedSceneTileX(targetX);
client.setSelectedSceneTileY(targetY); client.setSelectedSceneTileY(targetY);
} }
@Override
@Inject
public void addItem(int id, int quantity, WorldPoint point)
{
final int sceneX = point.getX() - client.getBaseX();
final int sceneY = point.getY() - client.getBaseY();
final int plane = point.getPlane();
if (sceneX < 0 || sceneY < 0 || sceneX >= 104 || sceneY >= 104)
{
return;
}
RSTileItem item = client.newTileItem();
item.setId(id);
item.setQuantity(quantity);
RSNodeDeque[][][] groundItems = client.getGroundItemDeque();
if (groundItems[plane][sceneX][sceneY] == null)
{
groundItems[plane][sceneX][sceneY] = client.newNodeDeque();
}
groundItems[plane][sceneX][sceneY].addFirst(item);
if (plane == client.getPlane())
{
client.updateItemPile(sceneX, sceneY);
}
}
@Override
@Inject
public void removeItem(int id, int quantity, WorldPoint point)
{
final int sceneX = point.getX() - client.getBaseX();
final int sceneY = point.getY() - client.getBaseY();
final int plane = point.getPlane();
if (sceneX < 0 || sceneY < 0 || sceneX >= 104 || sceneY >= 104)
{
return;
}
RSNodeDeque items = client.getGroundItemDeque()[plane][sceneX][sceneY];
if (items == null)
{
return;
}
for (RSTileItem item = (RSTileItem) items.last(); item != null; item = (RSTileItem) items.previous())
{
if (item.getId() == id && quantity == 1)
{
item.unlink();
break;
}
}
if (items.last() == null)
{
client.getGroundItemDeque()[plane][sceneX][sceneY] = null;
}
client.updateItemPile(sceneX, sceneY);
}
} }

View File

@@ -1 +0,0 @@
description = 'RuneLite Plugin Archetype'

View File

@@ -0,0 +1,26 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
description = "RuneLite Plugin Archetype"

View File

@@ -1,35 +0,0 @@
description = 'Script Assembler Plugin'
dependencies {
annotationProcessor group: 'org.eclipse.sisu', name: 'org.eclipse.sisu.inject', version: sisu
compileOnly group: 'org.apache.maven.plugin-tools', name: 'maven-plugin-annotations', version: mavenPluginAnnotations
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'org.apache.maven', name: 'maven-plugin-api', version: mavenPluginApi
implementation group: 'org.slf4j', name: 'slf4j-nop', version: slf4j
implementation project(':cache')
implementation project(':runelite-api')
}
compileJava.outputs.upToDateWhen {false}
compileJava.doLast {
def path = sourceSets.main.runtimeClasspath
def loader = new URLClassLoader(path.collect { f -> f.toURI().toURL() } as URL[])
def assemble = loader.loadClass('net.runelite.script.AssembleMojo')
String[] assembleArgs = [
"${project.rootDir}/runelite-client/src/main/scripts",
"${project.rootDir}/runelite-client/src/main/resources/runelite"
]
assemble.main(assembleArgs)
def index = loader.loadClass('net.runelite.script.IndexMojo')
String[] indexArgs = [
"${project.rootDir}/runelite-client/src/main/resources/runelite",
"${project.rootDir}/runelite-client/src/main/resources/runelite/index"
]
index.main(indexArgs)
loader.close()
}

View File

@@ -0,0 +1,66 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
description = "Script Assembler Plugin"
dependencies {
annotationProcessor(Libraries.sisu)
compileOnly(Libraries.mavenPluginAnnotations)
implementation(Libraries.guava)
implementation(Libraries.mavenPluginApi)
implementation(Libraries.slf4jNop)
implementation(project(":cache"))
implementation(project(":runelite-api"))
}
tasks {
register<JavaExec>("assembleMojo") {
classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.script.AssembleMojo"
args(listOf(
"${project.extra["rootPath"]}/runelite-client/src/main/scripts",
"${project.extra["rootPath"]}/runelite-client/src/main/resources/runelite"
))
}
register<JavaExec>("indexMojo") {
dependsOn("assembleMojo")
classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.script.IndexMojo"
args(listOf(
"${project.extra["rootPath"]}/runelite-client/src/main/resources/runelite",
"${project.extra["rootPath"]}/runelite-client/src/main/resources/runelite/index"
))
}
compileJava {
outputs.upToDateWhen {false}
finalizedBy("indexMojo")
}
}

View File

@@ -1,6 +0,0 @@
group = 'us.runelitepl.rs'
description = 'RuneScape API'
dependencies {
api project(':runelite-api')
}

View File

@@ -0,0 +1,31 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
group = "us.runelitepl.rs"
description = "RuneScape API"
dependencies {
api(project(":runelite-api"))
}

View File

@@ -1100,4 +1100,13 @@ public interface RSClient extends RSGameShell, Client
*/ */
@Import("Login_promptCredentials") @Import("Login_promptCredentials")
void promptCredentials(boolean clearPass); void promptCredentials(boolean clearPass);
}
@Construct
RSTileItem newTileItem();
@Construct
RSNodeDeque newNodeDeque();
@Import("updateItemPile")
void updateItemPile(int localX, int localY);
}

View File

@@ -9,6 +9,10 @@ public interface RSItemDefinition extends ItemDefinition
@Override @Override
String getName(); String getName();
@Import("name")
@Override
void setName(String name);
@Import("id") @Import("id")
@Override @Override
int getId(); int getId();
@@ -41,6 +45,10 @@ public interface RSItemDefinition extends ItemDefinition
@Override @Override
boolean isTradeable(); boolean isTradeable();
@Import("isTradable")
@Override
void setTradeable(boolean yes);
/** /**
* You probably want {@link #isStackable} * You probably want {@link #isStackable}
* <p> * <p>
@@ -60,4 +68,7 @@ public interface RSItemDefinition extends ItemDefinition
@Import("getShiftClickIndex") @Import("getShiftClickIndex")
@Override @Override
int getShiftClickActionIndex(); int getShiftClickActionIndex();
@Import("getModel")
RSModel getModel(int quantity);
} }

View File

@@ -9,4 +9,13 @@ public interface RSNodeDeque
@Import("sentinel") @Import("sentinel")
RSNode getHead(); RSNode getHead();
@Import("last")
RSNode last();
@Import("previous")
RSNode previous();
@Import("addFirst")
void addFirst(RSNode val);
} }

View File

@@ -36,4 +36,7 @@ public interface RSScene extends Scene
@Import("minPlane") @Import("minPlane")
int getMinLevel(); int getMinLevel();
@Import("newGroundItemPile")
void newGroundItemPile(int plane, int x, int y, int hash, RSEntity var5, long var6, RSEntity var7, RSEntity var8);
} }

View File

@@ -1,14 +0,0 @@
group = 'us.runelitepl.rs'
description = 'RuneScape Client'
dependencies {
implementation project(':runescape-api')
testImplementation group: 'junit', name: 'junit', version: junit
testImplementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
testImplementation group: 'org.slf4j', name: 'slf4j-simple', version: slf4j
}
tasks.withType(JavaCompile) {
options.compilerArgs.addAll('-g:source,vars,lines', '-Xlint:-unchecked')
}

View File

@@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2019 ThatGamerBlue * Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -22,28 +22,20 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
description = 'Injected Client'
compileJava { group = "com.openosrs.rs"
dependsOn ':injector-plugin:assemble' description = "RuneScape Client"
dependencies {
implementation(project(":runescape-api"))
testImplementation(Libraries.junit)
testImplementation(Libraries.slf4jApi)
testImplementation(Libraries.slf4jSimple)
} }
compileJava.outputs.upToDateWhen { false } tasks {
withType<JavaCompile> {
compileJava.doLast() { options.compilerArgs.addAll(arrayOf("-g:source,vars,lines", "-Xlint:-unchecked"))
copy {
File f = file("build/classes/java/main")
f.deleteDir()
f.mkdirs()
from ("${injectedClassesPath}")
into ("build/classes/java/main")
} }
} }
classes.doLast() {
File f = file("build/classes/java/main/Placeholder.class")
f.delete()
}
// tasks.build.dependsOn(tasks.decompile)
// this is just here to show how this could be used

View File

@@ -1,41 +0,0 @@
rootProject.name = 'runelite-parent'
include ':http-api'
include ':cache'
include ':runelite-api'
include ':protocol-api'
include ':protocol'
include ':cache-client'
include ':cache-updater'
include ':runescape-api'
include ':rs-client'
include ':deobfuscator'
include ':script-assembler-plugin'
include ':client'
include ':mixins'
include ':injector-plugin'
include ':injected-client'
include ':runelite-plugin-archetype'
include ':http-service'
include ':http-service-openosrs'
include ':wiki-scraper'
project(':http-api').projectDir = "$rootDir/http-api" as File
project(':cache').projectDir = "$rootDir/cache" as File
project(':runelite-api').projectDir = "$rootDir/runelite-api" as File
project(':protocol-api').projectDir = "$rootDir/protocol-api" as File
project(':protocol').projectDir = "$rootDir/protocol" as File
project(':cache-client').projectDir = "$rootDir/cache-client" as File
project(':cache-updater').projectDir = "$rootDir/cache-updater" as File
project(':runescape-api').projectDir = "$rootDir/runescape-api" as File
project(':rs-client').projectDir = "$rootDir/runescape-client" as File
project(':deobfuscator').projectDir = "$rootDir/deobfuscator" as File
project(':script-assembler-plugin').projectDir = "$rootDir/runelite-script-assembler-plugin" as File
project(':client').projectDir = "$rootDir/runelite-client" as File
project(':mixins').projectDir = "$rootDir/runelite-mixins" as File
project(':injector-plugin').projectDir = "$rootDir/injector-plugin" as File
project(':injected-client').projectDir = "$rootDir/injected-client" as File
project(':runelite-plugin-archetype').projectDir = "$rootDir/runelite-plugin-archetype" as File
project(':http-service').projectDir = "$rootDir/http-service" as File
project(':http-service-openosrs').projectDir = "$rootDir/http-service-openosrs" as File
project(':wiki-scraper').projectDir = "$rootDir/wiki-scraper" as File

57
settings.gradle.kts Normal file
View File

@@ -0,0 +1,57 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
rootProject.name = "OpenOSRS"
include(":http-api")
include(":cache")
include(":runelite-api")
include(":protocol-api")
include(":protocol")
include(":cache-client")
include(":cache-updater")
include(":runescape-api")
include(":runescape-client")
include(":deobfuscator")
include(":runelite-script-assembler-plugin")
include(":runelite-client")
include(":runelite-mixins")
include(":injector-plugin")
include(":injected-client")
include(":runelite-plugin-archetype")
include(":http-service")
include(":http-service-openosrs")
include(":wiki-scraper")
for (project in rootProject.children) {
project.apply {
projectDir = file("$name")
buildFileName = "$name.gradle.kts"
require(projectDir.isDirectory) { "Project '${project.path} must have a $projectDir directory" }
require(buildFile.isFile) { "Project '${project.path} must have a $buildFile build script" }
}
}

View File

@@ -1,57 +0,0 @@
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
description = 'RuneLite Wiki scraper'
dependencies {
api project(':cache')
api project(':runelite-api')
annotationProcessor group: 'org.projectlombok', name: 'lombok', version: lombok
compileOnly group: 'org.projectlombok', name: 'lombok', version: lombok
implementation group: 'com.google.code.gson', name: 'gson', version: gson
implementation group: 'com.google.guava', name: 'guava', version: guava
implementation group: 'com.github.petitparser', name: 'java-petitparser', version: '2.2.0'
implementation group: 'com.squareup.okhttp3', name: 'okhttp', version: okhttp3
implementation group: 'org.slf4j', name: 'slf4j-api', version: slf4j
implementation group: 'org.slf4j', name: 'slf4j-simple', version: slf4j
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: jupiter
}
task npcStatsScrape {
doLast {
def path = sourceSets.main.runtimeClasspath
def loader = new URLClassLoader(path.collect { f -> f.toURI().toURL() } as URL[])
def scrape = loader.loadClass('net.runelite.data.App')
scrape.npcStats(rootProject.file("./runelite-client/src/main/resources/"));
loader.close()
}
}
task itemStatsScrape {
doLast {
def path = sourceSets.main.runtimeClasspath
def loader = new URLClassLoader(path.collect { f -> f.toURI().toURL() } as URL[])
def scrape = loader.loadClass('net.runelite.data.App')
scrape.itemStats(rootProject.file("./runelite-client/src/main/resources/"));
loader.close()
}
}
task itemLimitsScrape {
doLast {
def path = sourceSets.main.runtimeClasspath
def loader = new URLClassLoader(path.collect { f -> f.toURI().toURL() } as URL[])
def scrape = loader.loadClass('net.runelite.data.App')
scrape.itemLimits(rootProject.file("./runelite-client/src/main/resources/net/runelite/client/plugins/grandexchange/"));
loader.close()
}
}

View File

@@ -45,7 +45,28 @@ public class App
private final static MediaWiki wiki = new MediaWiki("https://oldschool.runescape.wiki"); private final static MediaWiki wiki = new MediaWiki("https://oldschool.runescape.wiki");
public static Store cacheStore() throws IOException public static void main(String[] args) throws IOException
{
if (args.length < 2)
{
System.exit(-1);
}
switch (args[0])
{
case "npcStats":
npcStats(new File(args[1]));
break;
case "itemStats":
itemStats(new File(args[1]));
break;
case "itemLimits":
itemLimits(new File(args[1]));
break;
}
}
private static Store cacheStore() throws IOException
{ {
Path path = Paths.get(System.getProperty("user.home"), "jagexcache" + File.separator + "oldschool" + File.separator + "LIVE"); Path path = Paths.get(System.getProperty("user.home"), "jagexcache" + File.separator + "oldschool" + File.separator + "LIVE");
final File jagexcache = new File(String.valueOf(path)); final File jagexcache = new File(String.valueOf(path));
@@ -65,17 +86,17 @@ public class App
return cacheStore; return cacheStore;
} }
public static void npcStats(File path) throws IOException private static void npcStats(File path) throws IOException
{ {
NpcStatsDumper.dump(cacheStore(), wiki, path); NpcStatsDumper.dump(cacheStore(), wiki, path);
} }
public static void itemStats(File path) throws IOException private static void itemStats(File path) throws IOException
{ {
ItemStatsDumper.dump(cacheStore(), wiki, path); ItemStatsDumper.dump(cacheStore(), wiki, path);
} }
public static void itemLimits(File path) throws IOException private static void itemLimits(File path) throws IOException
{ {
ItemLimitsDumper.dump(cacheStore(), wiki, path); ItemLimitsDumper.dump(cacheStore(), wiki, path);
} }

View File

@@ -0,0 +1,69 @@
/*
* Copyright (c) 2019 Owain van Brakel <https://github.com/Owain94>
* 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.
*/
repositories {
mavenCentral()
maven(url = "https://jitpack.io")
}
description = "RuneLite Wiki scraper"
dependencies {
api(project(":cache"))
api(project(":runelite-api"))
annotationProcessor(Libraries.lombok)
compileOnly(Libraries.lombok)
implementation(Libraries.gson)
implementation(Libraries.guava)
implementation(Libraries.petitparser)
implementation(Libraries.okhttp3)
implementation(Libraries.slf4jApi)
implementation(Libraries.slf4jSimple)
testImplementation(Libraries.jupiter)
}
tasks {
register<JavaExec>("npcStatsScrape") {
classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.data.App"
args(listOf("npcStats", rootProject.file("./runelite-client/src/main/resources/").absolutePath))
}
register<JavaExec>("itemStatsScrape") {
classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.data.App"
args(listOf("itemStats", rootProject.file("./runelite-client/src/main/resources/").absolutePath))
}
register<JavaExec>("itemLimitsScrape") {
classpath = project.sourceSets.main.get().runtimeClasspath
main = "net.runelite.data.App"
args(listOf("itemLimits", rootProject.file("./runelite-client/src/main/resources/").absolutePath))
}
}