Compare commits
6 Commits
ce480a1185
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 0c5eca3636 | |||
| 138d7abe24 | |||
| 6faff7a032 | |||
| e555d5a114 | |||
| e3e7de9108 | |||
| 128173339e |
5
.gitignore
vendored
@@ -6,4 +6,7 @@ build
|
||||
.classpath
|
||||
nbactions.xml
|
||||
nb-configuration.xml
|
||||
nbproject/
|
||||
nbproject/
|
||||
bin/
|
||||
|
||||
examples/
|
||||
|
||||
BIN
banner_black.png
|
Before Width: | Height: | Size: 109 KiB |
BIN
banner_white.png
|
Before Width: | Height: | Size: 112 KiB |
@@ -18,6 +18,8 @@ def runeLiteVersion = 'latest.release'
|
||||
dependencies {
|
||||
compileOnly group: 'net.runelite', name: 'client', version: runeLiteVersion
|
||||
|
||||
implementation 'org.roaringbitmap:RoaringBitmap:0.9.44'
|
||||
|
||||
compileOnly 'org.projectlombok:lombok:1.18.20'
|
||||
annotationProcessor 'org.projectlombok:lombok:1.18.20'
|
||||
|
||||
@@ -26,7 +28,7 @@ dependencies {
|
||||
testImplementation group: 'net.runelite', name: 'jshell', version: runeLiteVersion
|
||||
}
|
||||
|
||||
group = 'com.toofifty'
|
||||
group = 'ee.futur'
|
||||
version = '1.0.11'
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
@@ -38,7 +40,7 @@ tasks.register('shadowJar', Jar) {
|
||||
dependsOn configurations.testRuntimeClasspath
|
||||
manifest {
|
||||
attributes('Main-Class':
|
||||
'com.toofifty.easygiantsfoundry.EasyGiantsFoundryPluginTest',
|
||||
'ee.futur.K4rliPluginsTest',
|
||||
'Multi-Release': true)
|
||||
}
|
||||
|
||||
@@ -67,6 +69,7 @@ task runClient(type: JavaExec) {
|
||||
group = 'application'
|
||||
description = 'Run the PluginTester main class to launch RuneLite with plugins'
|
||||
classpath = sourceSets.test.runtimeClasspath
|
||||
mainClass = 'com.toofifty.easygiantsfoundry.EasyGiantsFoundryPluginTest'
|
||||
mainClass = 'ee.futur.K4rliPluginsTest'
|
||||
jvmArgs '-ea'
|
||||
args '--developer-mode', '--debug'
|
||||
}
|
||||
|
||||
581
gotr-max-points-guide-youtube-transcription.txt
Normal file
@@ -0,0 +1,581 @@
|
||||
|
||||
Intro
|
||||
0:00
|
||||
what's going on guys it's jwell coming
|
||||
0:01
|
||||
to you with an updated 2023 Guardians of
|
||||
0:04
|
||||
the rift Max points guide now I'm going
|
||||
0:08
|
||||
to run through this as quick as I
|
||||
0:10
|
||||
possibly can and as clear as I possibly
|
||||
0:12
|
||||
can so hopefully you guys can start
|
||||
0:14
|
||||
utilizing this and taking advantage of
|
||||
0:17
|
||||
uh the method that like I said I
|
||||
0:19
|
||||
recently discovered I don't know if this
|
||||
0:20
|
||||
is common knowledge it certainly wasn't
|
||||
0:22
|
||||
to me so my goal is to help at least a
|
||||
0:24
|
||||
few of you out there that are looking to
|
||||
0:27
|
||||
uh maximize the amount of uh points
|
||||
0:29
|
||||
you're getting per game
|
||||
0:31
|
||||
now copy my inventory as best as you can
|
||||
Inventory and Gear
|
||||
0:34
|
||||
if you don't have the Colossal pouch
|
||||
0:35
|
||||
bring the best pouches that you have
|
||||
0:37
|
||||
available to you bring as many fire
|
||||
0:40
|
||||
runes as you have as many water runes as
|
||||
0:42
|
||||
you have and um obviously bring as many
|
||||
0:47
|
||||
pieces of the remnants of the eye that
|
||||
0:48
|
||||
you have um if you don't just kind of
|
||||
0:52
|
||||
substitute that with graceful not super
|
||||
0:54
|
||||
important but um the verac armor if you
|
||||
0:56
|
||||
don't have the top will help you when
|
||||
0:58
|
||||
you're mining fragments it'll double the
|
||||
1:00
|
||||
amount of fragments you get so I
|
||||
1:01
|
||||
recommend that bring a full binding
|
||||
1:04
|
||||
necklace this is extremely important um
|
||||
1:06
|
||||
you can pick them up on the GE I think
|
||||
1:08
|
||||
they're 800 a piece I picked up like a
|
||||
1:11
|
||||
100 for this grind um and we're going to
|
||||
1:14
|
||||
use one per game uh which is going to
|
||||
1:17
|
||||
allow us to craft combination runes
|
||||
1:18
|
||||
which is kind of the secret to this
|
||||
1:20
|
||||
method um last thing make sure you have
|
||||
1:23
|
||||
your Rune pouch with air Cosmic and
|
||||
1:26
|
||||
Astra runes on the lunar spell book
|
||||
1:29
|
||||
we're going to want NPC contact to fix
|
||||
1:31
|
||||
our pouches in between games as well as
|
||||
1:34
|
||||
magic and view which you must have in
|
||||
1:37
|
||||
order to do this
|
||||
1:38
|
||||
method now go ahead and equip everything
|
||||
1:41
|
||||
you have your best and Slot pickaxe
|
||||
1:43
|
||||
binding necklace and um make sure you
|
||||
RuneLite Plugins
|
||||
1:47
|
||||
have three crucial plugins menu menu
|
||||
1:49
|
||||
entry swapper make sure all your pouches
|
||||
1:52
|
||||
are set to
|
||||
1:53
|
||||
empty next thing you want to do if you
|
||||
1:55
|
||||
don't already have it um and this helps
|
||||
1:57
|
||||
out a lot which um you're going to going
|
||||
1:59
|
||||
to have to to follow along is going to
|
||||
2:01
|
||||
be the Guardians of the rift plugin you
|
||||
2:03
|
||||
can access that through the plug-in Hub
|
||||
2:05
|
||||
highly recommend you download that
|
||||
2:07
|
||||
because we're going to pay attention to
|
||||
2:08
|
||||
this countdown time sense portal um to
|
||||
2:13
|
||||
allow us to not make sure we don't miss
|
||||
2:15
|
||||
any of the portals and that'll make
|
||||
2:16
|
||||
sense once we get into the game and the
|
||||
2:18
|
||||
last thing is entity Hider you don't
|
||||
2:20
|
||||
have to have it but I highly recommend
|
||||
2:22
|
||||
it um I have hide others hide others 2D
|
||||
2:25
|
||||
don't have to hide your friends um I am
|
||||
2:28
|
||||
for this uh
|
||||
2:30
|
||||
setting but um and then hide other
|
||||
2:32
|
||||
players pets just because they're kind
|
||||
2:33
|
||||
of annoying a lot of people run around
|
||||
2:35
|
||||
with their pets in the game and um not a
|
||||
2:37
|
||||
huge fan of it uh the last thing and you
|
||||
2:40
|
||||
don't have to do this but if you have a
|
||||
2:42
|
||||
mouse where you can key bind the sides
|
||||
2:45
|
||||
of them I would highly recommend binding
|
||||
2:48
|
||||
the number four to uh one of your thumb
|
||||
2:51
|
||||
buttons and again this will make sense
|
||||
2:53
|
||||
once we get into the video but I I
|
||||
2:56
|
||||
highly recommend that you guys um bind
|
||||
2:58
|
||||
that because it's going to allow you to
|
||||
2:59
|
||||
deposit your runes quicker and like I
|
||||
3:02
|
||||
said just overall makes makes things
|
||||
3:04
|
||||
easier so um while we're waiting if you
|
||||
Getting There Options
|
||||
3:08
|
||||
don't know how to get here already
|
||||
3:10
|
||||
quickest way is going to be the
|
||||
3:12
|
||||
Guardians of the rift miname teleport
|
||||
3:15
|
||||
another way is the necklace of Passage
|
||||
3:17
|
||||
you can use that to the Wizards Tower
|
||||
3:20
|
||||
run in down into the basement um and
|
||||
3:23
|
||||
then there should be a blue portal right
|
||||
3:25
|
||||
there that you can enter which will
|
||||
3:26
|
||||
bring you to the mini game so without
|
||||
3:29
|
||||
further Ado I will go ahead and jump in
|
||||
3:32
|
||||
as soon as we're entering the mini
|
||||
Starting Off
|
||||
3:35
|
||||
game now that we're in the mini game go
|
||||
3:37
|
||||
ahead and run
|
||||
3:40
|
||||
north don't worry about picking up the
|
||||
3:42
|
||||
uh uncharged cells um you're not really
|
||||
3:46
|
||||
missing out on much experience and
|
||||
3:47
|
||||
honestly this method isn't as efficient
|
||||
3:49
|
||||
if you go that
|
||||
3:52
|
||||
route we'll wait right
|
||||
3:54
|
||||
here until the game
|
||||
3:58
|
||||
starts special attack if you want
|
||||
4:05
|
||||
to and go ahead and start
|
||||
4:08
|
||||
mining now pay attention to the time
|
||||
4:11
|
||||
since portal this is a good time you can
|
||||
4:13
|
||||
kind of hang out chill check your phone
|
||||
4:15
|
||||
whatever you want to do um and we're
|
||||
4:17
|
||||
going to leave as soon as
|
||||
4:19
|
||||
this gets to about 140 maybe 145 on the
|
||||
4:28
|
||||
portal
|
||||
4:31
|
||||
all right now that the portal is at 140
|
||||
4:34
|
||||
we're going to leave this area and run
|
||||
The Minigame
|
||||
4:37
|
||||
towards the center over here and wait
|
||||
4:41
|
||||
until a portal opens
|
||||
4:47
|
||||
up here we are got
|
||||
4:51
|
||||
lucky go ahead and run over
|
||||
4:54
|
||||
here fill up your
|
||||
4:58
|
||||
pouches
|
||||
5:20
|
||||
and then exit the
|
||||
5:22
|
||||
portal now we're going to go ahead enter
|
||||
5:25
|
||||
the uh whatever Elemental portal you
|
||||
5:28
|
||||
possibly can go ahead and enter into
|
||||
5:29
|
||||
there run up here cast magic and bu use
|
||||
5:34
|
||||
the fire on there empty the pouch use
|
||||
5:37
|
||||
the fire and
|
||||
5:39
|
||||
repeat and then go ahead and run out now
|
||||
5:42
|
||||
you can see here we have poly
|
||||
5:44
|
||||
Elemental Guardian Stones instead of the
|
||||
5:47
|
||||
regular and that's going to go ahead and
|
||||
5:49
|
||||
give us way more points than we normally
|
||||
5:51
|
||||
would have after you deposit that you
|
||||
5:54
|
||||
can go ahead and start working at the
|
||||
5:56
|
||||
workbench now this is where that key
|
||||
5:58
|
||||
bind number four makes things easier and
|
||||
6:00
|
||||
you'll see why when I deposit my steam
|
||||
6:02
|
||||
runes in here all I have to do is hold
|
||||
6:04
|
||||
four on the side of my uh Mouse and it
|
||||
6:08
|
||||
instant deposits them now if you don't
|
||||
6:11
|
||||
want to go that method that's okay you
|
||||
6:13
|
||||
can always just hit four on your
|
||||
6:15
|
||||
keyboard but like I said I mean the goal
|
||||
6:16
|
||||
here is to make things as easy as
|
||||
6:18
|
||||
possible
|
||||
6:21
|
||||
so
|
||||
6:23
|
||||
now we are going to continue to fill up
|
||||
6:26
|
||||
the
|
||||
6:28
|
||||
pouch
|
||||
6:39
|
||||
once our pouch is full let's go ahead
|
||||
6:41
|
||||
again we'll run back to the uh Elemental
|
||||
6:43
|
||||
alter and rinse in
|
||||
6:47
|
||||
repeat cast our magic and view use our
|
||||
6:50
|
||||
fire runes on the altar empty the pouch
|
||||
6:53
|
||||
use them again use them a third time and
|
||||
6:56
|
||||
run back
|
||||
6:58
|
||||
out
|
||||
7:01
|
||||
we will
|
||||
7:06
|
||||
deposit go ahead and deposit our runes
|
||||
7:09
|
||||
into the deposit
|
||||
7:12
|
||||
pool and make sure you deposit
|
||||
7:15
|
||||
all now one mistake that I've made a
|
||||
7:18
|
||||
couple of times is do not click deposit
|
||||
7:20
|
||||
runes because it will deposit your fire
|
||||
7:23
|
||||
and water runes and um well you'll be
|
||||
7:26
|
||||
screwed until the next round in terms of
|
||||
7:29
|
||||
making a combination R so make sure to
|
||||
7:32
|
||||
kind of use the method that I'm using um
|
||||
7:35
|
||||
just to avoid
|
||||
7:49
|
||||
that fill up your
|
||||
7:51
|
||||
pouch run back in looks like we have
|
||||
7:55
|
||||
Earth Rune Elemental alter let's run
|
||||
7:58
|
||||
back in there run up to the top cast our
|
||||
8:02
|
||||
magic and view use the runes on the
|
||||
8:05
|
||||
alter empty them use them again and run
|
||||
8:16
|
||||
out power up the guardian run back over
|
||||
8:20
|
||||
here use the lava runes on the deposit
|
||||
8:23
|
||||
pool hold
|
||||
8:25
|
||||
four and go back to
|
||||
8:28
|
||||
crafting pretty simple method you're
|
||||
8:31
|
||||
just alternating in between and that's
|
||||
8:34
|
||||
why I like to kind of time things the
|
||||
8:36
|
||||
way that I have it because you're going
|
||||
8:38
|
||||
to maximize your points as you can see
|
||||
8:39
|
||||
I'm already at
|
||||
8:40
|
||||
564 Elemental energy points typically if
|
||||
8:45
|
||||
I were to be finishing up crafting this
|
||||
8:47
|
||||
inventory I'd be looking at the the
|
||||
8:49
|
||||
blood Rune um in order to at least get
|
||||
8:52
|
||||
one catalytic energy Point per game and
|
||||
8:55
|
||||
the reason being is you can only get a
|
||||
8:58
|
||||
Max of a th000 Elemental energy points
|
||||
9:01
|
||||
um we're going to hit that easily in
|
||||
9:03
|
||||
this
|
||||
9:05
|
||||
game so we're all
|
||||
9:08
|
||||
full we will run back over to the water
|
||||
9:11
|
||||
alter it just opened up run up to the
|
||||
9:15
|
||||
top cast our magic and view use our fire
|
||||
9:19
|
||||
runes empty our pouch use our fire runes
|
||||
9:23
|
||||
and run
|
||||
9:27
|
||||
out power up the
|
||||
9:31
|
||||
Guardian run back over deposit our steam
|
||||
9:34
|
||||
room steam runes into the pool click
|
||||
9:37
|
||||
number four and then run into the
|
||||
9:58
|
||||
portal
|
||||
10:11
|
||||
all righty I'm going to go ahead and
|
||||
10:12
|
||||
just hop into the death alter to go
|
||||
10:15
|
||||
ahead and gain myself a point here you
|
||||
10:18
|
||||
don't have to cast The Magic and
|
||||
10:23
|
||||
bu because you will not be making
|
||||
10:26
|
||||
combination runes let's power up the
|
||||
10:28
|
||||
guardian
|
||||
10:31
|
||||
run back over here deposit our death
|
||||
10:36
|
||||
runes and get back to
|
||||
10:58
|
||||
crafting
|
||||
11:20
|
||||
now that we're done crafting we'll run
|
||||
11:21
|
||||
over to the
|
||||
11:23
|
||||
elemental alter run up to the top on the
|
||||
11:26
|
||||
way up let's cast our magic and view use
|
||||
11:29
|
||||
our runes on the alter rinse and
|
||||
11:33
|
||||
repeat and then run
|
||||
11:38
|
||||
out we'll power up the
|
||||
11:42
|
||||
guardian run back down
|
||||
11:45
|
||||
here deposit our lava
|
||||
11:48
|
||||
runes and enter the
|
||||
11:57
|
||||
portal
|
||||
12:05
|
||||
now as you can see I'm already at 945
|
||||
12:07
|
||||
points I'm going to go ahead and cat um
|
||||
12:10
|
||||
I'm going to go ahead and do catalytic
|
||||
12:13
|
||||
for the rest of the time and the reason
|
||||
12:15
|
||||
being is I have a 45% chance of rolling
|
||||
12:19
|
||||
that last point I'm going to take the uh
|
||||
12:23
|
||||
the chance that I go ahead and roll that
|
||||
12:26
|
||||
looks like we're not going to get that
|
||||
12:27
|
||||
alter so we'll run into the
|
||||
12:31
|
||||
nature alter but just to max out your
|
||||
12:34
|
||||
points again like the closest you the
|
||||
12:36
|
||||
closer you can get to a th000 the better
|
||||
12:40
|
||||
you may not even get there if you're um
|
||||
12:43
|
||||
if you don't have the Colossal pouch but
|
||||
12:47
|
||||
nonetheless like I
|
||||
12:57
|
||||
said now now we're at 92% I don't think
|
||||
13:00
|
||||
we're going to be able to craft an
|
||||
13:01
|
||||
entire
|
||||
13:04
|
||||
inventory before uh the time goes up so
|
||||
13:07
|
||||
I'm just going to go ahead and see if I
|
||||
13:08
|
||||
can maybe get half an inventory um in
|
||||
13:11
|
||||
this in this game just so I can make
|
||||
13:13
|
||||
sure to deposit them uh and get the
|
||||
13:17
|
||||
points out of it that's probably good
|
||||
13:20
|
||||
let's run into the Earth
|
||||
13:26
|
||||
alter you want to try to get all those
|
||||
13:28
|
||||
deposit Ed within about 5 Seconds of the
|
||||
13:31
|
||||
game hitting
|
||||
13:33
|
||||
100% so we got 38 that should guarantee
|
||||
13:36
|
||||
us that third
|
||||
13:38
|
||||
point for uh catalytic energy run up
|
||||
13:42
|
||||
power up the
|
||||
13:46
|
||||
guardian deposit our runes into this
|
||||
13:48
|
||||
pool
|
||||
13:54
|
||||
here and get ready to hit the next game
|
||||
13:58
|
||||
now do not exit this until the game is
|
||||
14:01
|
||||
completed and you see an experience drop
|
||||
14:03
|
||||
do not do it or you will not get any
|
||||
14:07
|
||||
points all righty we got the experience
|
||||
14:09
|
||||
drop let's go ahead and quick pass
|
||||
14:11
|
||||
through the barrier run over to our
|
||||
Reset the Minigame
|
||||
14:14
|
||||
bank grab a binding necklace as you can
|
||||
14:18
|
||||
see we only have one charge left on the
|
||||
14:20
|
||||
one we're wearing so go ahead and
|
||||
14:22
|
||||
destroy
|
||||
14:25
|
||||
it and you see we have a fresh one ready
|
||||
14:28
|
||||
to go for the next game
|
||||
14:31
|
||||
now the barrier becomes able to enter at
|
||||
14:35
|
||||
30 so go ahead and spam click at
|
||||
14:38
|
||||
30 and we get let
|
||||
14:41
|
||||
in run over
|
||||
14:44
|
||||
here back down into where we're going to
|
||||
14:47
|
||||
start our next
|
||||
14:50
|
||||
match cast NPC contact to the dark
|
||||
14:57
|
||||
mage yes I would like to repair my
|
||||
15:01
|
||||
pouches awesome super fun good
|
||||
15:04
|
||||
stuff and we're going to go ahead and
|
||||
Outro
|
||||
15:06
|
||||
start the next game if you guys found
|
||||
15:08
|
||||
this helpful at all please let me know
|
||||
15:10
|
||||
down in the comments section um I really
|
||||
15:12
|
||||
appreciate you guys tuning in and I hope
|
||||
15:14
|
||||
this help see you next time
|
||||
108
gotr-wiki-gameplay.txt
Normal file
@@ -0,0 +1,108 @@
|
||||
Guardians of the Rift is a non-combat minigame that takes place within the Temple of the Eye. The main goal of the game is to assist The Great Guardian in closing an abyssal rift to the Scar, the most dangerous part of Abyssal Space, by supplying it with guardian stones while protecting it from the abyssal creatures that come through the rift.
|
||||
|
||||
Gameplay
|
||||
Main article: Guardians of the Rift/Strategies
|
||||
|
||||
The objective of the minigame is to allow the Great Guardian to charge up enough power to close the rift where Abyssal creatures are coming through.
|
||||
An overview of the Temple of the Eye, where the minigame takes place.
|
||||
|
||||
Players will need to do the following throughout the battle:
|
||||
|
||||
Imbue essence acquired during the minigame at runic altars to power up the Great Guardian
|
||||
Create elemental and catalytic guardians to do battle with the incoming Abyssal creatures
|
||||
Create/repair barriers to protect the Great Guardian from Abyssal creatures
|
||||
|
||||
To imbue essence, players must obtain guardian fragments from guardian remains of varying sizes in the Temple. There are three nodes that can be mined off of: guardian parts, guardian remains, and large guardian remains. Parts and normal remains can be found in the edges of the temple area, while the larger remains are past some rubble in the mid-east of the Temple area, requiring level 56 Agility (not boostable) to access.
|
||||
|
||||
The huge guardian remains, which give guardian essence when mined, are found at the mid-western area of the temple. Though normally inaccessible, portals will occasionally appear that take players there, spawning approximately every 2 minutes. Portals remain active for around 25 seconds.
|
||||
|
||||
The doubling effect of certain mining enhancers—such as Varrock armour (all tiers) and charged celestial rings—will apply when mining for guardian fragments and essence.
|
||||
|
||||
Imbuing essence
|
||||
The UI showing the time remaining for the active earth and blood Portal Guardians and the portal to the huge guardian remains, among other things.
|
||||
Creating guardian essence on the workbench. Crafted runes can be deposited into a bank via the Deposit Pool next to it.
|
||||
|
||||
Guardian fragments are converted into guardian essence, which are storable in essence pouches. They are brought to runic altars to be imbued via entering Portal Guardians surrounding the centre of the Temple. Only two portals are active at a time: one elemental and one catalytic. Imbuing guardian essence requires the same Runecraft level as crafting them regularly in the corresponding altar. Note that imbuing on runic altars during the minigame will not give players the rift guardian pet.[1]
|
||||
|
||||
In addition, for every guardian essence imbued, there is a 1/250 chance that players will receive a portal talisman,[2][3] which can be used on the Portal Guardians to take them back to the runic altar they previously used, even if the portal is closed for that altar. These cannot be kept after the game ends, so players should use them whenever possible. Players can right-click "Toggle-talisman" on a Portal Guardian to stop receiving portal talismans of the selected type.
|
||||
|
||||
Once players imbue their essence into either an elemental or catalytic guardian stone, they can return to the Temple and power up the Great Guardian. Each guardian stone will give two energy of the respective type; if crafting combination runes, players will instead receive polyelemental guardian stones, which give three elemental energy when used on the Great Guardian.
|
||||
|
||||
The number of guardian stones required to fully charge up the Great Guardian scales with player count: the Great Guardian must be powered up with 250 guardian stones for each player inside the temple in order to reach 100%.[4] If there are over 20 players, every player beyond the 20th grants a 20% scaling penalty on the charge required to power up the Great Guardian, meaning 200 essence is required for each player after the 20th rather than 250.
|
||||
|
||||
When powering up the Great Guardian, the player's run energy will be restored by 1% for each guardian stone granted to the Guardian. In addition, a small bonus amount is restored based on the player's current special attack energy, ranging from 1% extra with a totally depleted special energy bar up to 11% additional run energy when the special bar is completely full.[5]
|
||||
|
||||
Be aware that players need to have completed certain quests to be able to enter some Portal Guardians:
|
||||
|
||||
Guardian of Cosmic - Lost City
|
||||
Guardian of Law - Troll Stronghold
|
||||
Guardian of Death - Mourning's End Part II
|
||||
Guardian of Blood - Sins of the Father
|
||||
|
||||
Charging cells
|
||||
|
||||
Charged cells are used to create rift guardians and erect barriers. Uncharged cells are obtained from a container near the entry barrier, and are charged in the same way guardian essence is. Players can hold up to ten uncharged cells and have only one charged cell at a time.
|
||||
Barriers and rift guardians protecting the Great Guardian from Abyssal creatures.
|
||||
|
||||
Rift guardians are created with a chisel via the essence piles near the tables at the south, and can either be elemental (east) or catalytic (west). These will follow the elemental/catalytic guides in the outer ring. Only ten rift guardians can be active at any time.
|
||||
|
||||
Barriers are created by using charged cells on the cell tiles at the front-centre. Using increasingly higher tiers of cells in order (ex. medium to strong cells) will also strengthen them. Using lesser charged cells (ex. a strong cell on an overcharged barrier) will instead recharge the barriers by "healing" them. Should a barrier break, the cell tile will need to be repaired, which requires 12 guardian fragments.
|
||||
|
||||
The strength of the cell corresponds to the Runecraft level of the runic altar it is charged in:
|
||||
Standard runes
|
||||
Runecraft Level Type Tier Alignment
|
||||
1 Air Weak Elemental
|
||||
5 Water Medium Elemental
|
||||
9 Earth Strong Elemental
|
||||
14 Fire Overcharged Elemental
|
||||
2 Mind Weak Catalytic
|
||||
20 Body Weak Catalytic
|
||||
27 Cosmic Medium Catalytic
|
||||
35 Chaos Medium Catalytic
|
||||
44 Nature Strong Catalytic
|
||||
54 Law Strong Catalytic
|
||||
65 Death Overcharged Catalytic
|
||||
77 Blood Overcharged Catalytic
|
||||
Combination runes
|
||||
|
||||
Since each combination rune can be made on either of two altars, the cell tier is determined by the elemental altar that's used.
|
||||
Runecraft Level Type Alignment
|
||||
6 Mist Polyelemental
|
||||
10 Dust Polyelemental
|
||||
13 Mud Polyelemental
|
||||
15 Smoke Polyelemental
|
||||
19 Steam Polyelemental
|
||||
23 Lava Polyelemental
|
||||
90 Aether Polycatalytic
|
||||
Gaining energy
|
||||
|
||||
Players can gain energy by either using cells, by using guardian stones on the Great Guardian, or by repairing a barrier. For each stone used, players will get 5 Runecraft experience and two energy in elemental or catalytic depending on the type of essence used; if crafting combination runes, players will get a polyelemental guardian stone instead, which gives three elemental energy. If players use twelve fragments on repairing a cell tile they will gain 25 energy in both types.
|
||||
|
||||
Each cell can be used in one of four ways: to build a barrier, to recharge a barrier, to strengthen a barrier (one tier at a time), or to create a guardian. Higher level cells give more energy, except for when building barriers, which always gives 2 energy in both types. Using cells on barriers gives equal energy in elemental and catalytic, whereas creating a guardian gives energy only in the energy type matching the guardian they created. Creating a guardian awards 2x+1 energy, where x is the energy that would be awarded for strengthening a barrier with the same cell.
|
||||
Tier Barrier Guardian
|
||||
Placing Strengthening Recharging Health restored XP Creating[n 1] XP
|
||||
Weak 17 N/A 2 10 Runecraft 30 6 Runecraft 30
|
||||
Crafting 80
|
||||
Medium 20 7 5 25 Runecraft 100 15 Runecraft 100
|
||||
Crafting 80
|
||||
Strong 24 13 9 50 Runecraft 180 27 Runecraft 180
|
||||
Crafting 80
|
||||
Overcharged 30 22 15 100 Runecraft 250 45 Runecraft 250
|
||||
Crafting 80
|
||||
|
||||
Creating rift guardians only yields energy in either elemental or catalytic, while other uses of cells yield equal energy in both.
|
||||
|
||||
Phases of the battle
|
||||
Charged with enough power, the Great Guardian closes the rift.
|
||||
|
||||
The battle is split into three phases:
|
||||
|
||||
The first phase is short, giving players two minutes to prepare by obtaining guardian essence and uncharged cells to create and power up guardians. Initially, there are some weak cells used in the beginning stages of the battle that should be used to erect barriers.
|
||||
|
||||
After the two minutes pass, abyssal creatures will begin spawning from the rift, consisting of mostly abyssal leeches and guardians. There will be a few walkers among them. The monsters will attempt to attack the Great Guardian, with their attacks draining its energy. They will also attack barriers and rift guardians, although they only retaliate back for the latter, not actively targeting them. Should the Great Guardian's energy level reach 0%, the encounter will fail.
|
||||
|
||||
When the guardian reaches 60% charge, the temple will rumble as the rift glows more intensely, damaging all active barriers by 50 health (in a mass) and spewing out more guardians and walkers compared to leeches. Players should heal the barriers and create more rift guardians if necessary.
|
||||
|
||||
When the guardian reaches 100% charge, it will seal the rift. All abyssal creatures and rift guardians will automatically die once this occurs and there is a brief period of respite for players inside to leave or reposition themselves.
|
||||
|
||||
At the beginning of a new game, all guardian fragments, essence, and portal talismans acquired during the game will be removed from the player's possession. This also applies when leaving the minigame area.
|
||||
|
Before Width: | Height: | Size: 3.6 MiB |
|
Before Width: | Height: | Size: 265 KiB |
|
Before Width: | Height: | Size: 1.8 MiB |
|
Before Width: | Height: | Size: 6.4 MiB |
|
Before Width: | Height: | Size: 733 KiB |
|
Before Width: | Height: | Size: 710 KiB |
@@ -1,6 +1,6 @@
|
||||
displayName=Easy Giants' Foundry
|
||||
author=Toofifty
|
||||
support=https://github.com/Toofifty/easy-giantsfoundry
|
||||
description=Helpful overlays for the Giants' Foundry minigame
|
||||
tags=smithing,giant,foundry,giantsfoundry,minigame,ez,easy,smith
|
||||
plugins=com.toofifty.easygiantsfoundry.EasyGiantsFoundryPlugin
|
||||
displayName=Example
|
||||
author=Nobody
|
||||
support=
|
||||
description=An example greeter plugin
|
||||
tags=
|
||||
plugins=com.example.ExamplePlugin
|
||||
|
||||
@@ -1 +1 @@
|
||||
rootProject.name = 'easy-giantsfoundry'
|
||||
rootProject.name = 'k4rli-plugins'
|
||||
|
||||
1179
src/main/java/ee/futur/baseapi/BaseApiPlugin.java
Normal file
82
src/main/java/ee/futur/baseapi/collections/Bank.java
Normal file
@@ -0,0 +1,82 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
|
||||
import ee.futur.baseapi.collections.query.ItemQuery;
|
||||
import ee.futur.baseapi.BaseApiPlugin;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Bank {
|
||||
private static final int WITHDRAW_MODE = 3958;
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
static List<Widget> bankItems = new ArrayList<>();
|
||||
boolean bankUpdate = true;
|
||||
static int lastUpdateTick = 0;
|
||||
|
||||
public static ItemQuery search() {
|
||||
if (lastUpdateTick < client.getTickCount()) {
|
||||
Bank.bankItems.clear();
|
||||
int i = 0;
|
||||
if (client.getItemContainer(InventoryID.BANK) == null) {
|
||||
return new ItemQuery(new ArrayList<>());
|
||||
}
|
||||
for (Item item : client.getItemContainer(InventoryID.BANK).getItems()) {
|
||||
try {
|
||||
if (item == null) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
if (BaseApiPlugin.itemDefs.get(item.getId()).getPlaceholderTemplateId() == 14401) {
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
Bank.bankItems.add(new BankItemWidget(BaseApiPlugin.itemDefs.get(item.getId()).getName(), item.getId(), item.getQuantity(), i));
|
||||
} catch (NullPointerException | ExecutionException ex) {
|
||||
//todo fix this
|
||||
}
|
||||
i++;
|
||||
}
|
||||
lastUpdateTick = client.getTickCount();
|
||||
}
|
||||
return new ItemQuery(bankItems.stream().filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
public static boolean isOpen() {
|
||||
return client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER) != null && !client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER).isHidden();
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged) {
|
||||
if (gameStateChanged.getGameState() == GameState.HOPPING || gameStateChanged.getGameState() == GameState.LOGIN_SCREEN || gameStateChanged.getGameState() == GameState.CONNECTION_LOST) {
|
||||
Bank.bankItems.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isNotedMode() {
|
||||
return client.getVarbitValue(WITHDRAW_MODE) == 1;
|
||||
}
|
||||
|
||||
public static void setWithdrawMode(boolean noted) {
|
||||
if (noted && !isNotedMode()) {
|
||||
//MousePackets.queueClickPacket();
|
||||
//WidgetPackets.queueWidgetActionPacket(1, 786458, -1, -1);
|
||||
} else if (!noted && isNotedMode()) {
|
||||
//MousePackets.queueClickPacket();
|
||||
//WidgetPackets.queueWidgetActionPacket(1, 786456, -1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.collections.query.ItemQuery;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class BankInventory {
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
static List<Widget> bankInventoryItems = new ArrayList<>();
|
||||
static int lastUpdateTick = 0;
|
||||
|
||||
public static ItemQuery search() {
|
||||
if (lastUpdateTick < client.getTickCount()) {
|
||||
if (client.getWidget(WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER) == null) {
|
||||
return new ItemQuery(new ArrayList<>());
|
||||
}
|
||||
BankInventory.bankInventoryItems =
|
||||
Arrays.stream(client.getWidget(WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER).getDynamicChildren()).filter(Objects::nonNull).filter(x -> x.getItemId() != 6512 && x.getItemId() != -1).collect(Collectors.toList());
|
||||
lastUpdateTick = client.getTickCount();
|
||||
}
|
||||
return new ItemQuery(bankInventoryItems.stream().filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged) {
|
||||
if (gameStateChanged.getGameState() == GameState.HOPPING || gameStateChanged.getGameState() == GameState.LOGIN_SCREEN || gameStateChanged.getGameState() == GameState.CONNECTION_LOST) {
|
||||
BankInventory.bankInventoryItems.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
902
src/main/java/ee/futur/baseapi/collections/BankItemWidget.java
Normal file
@@ -0,0 +1,902 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.BaseApiPlugin;
|
||||
import net.runelite.api.FontTypeFace;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.gameval.VarbitID;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.*;
|
||||
|
||||
public class BankItemWidget implements Widget {
|
||||
|
||||
int index;
|
||||
String name;
|
||||
int itemid;
|
||||
int quantity;
|
||||
|
||||
BankItemWidget(String name, int itemid, int quantity, int index) {
|
||||
this.name = name;
|
||||
this.itemid = itemid;
|
||||
this.quantity = quantity;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return WidgetInfo.BANK_ITEM_CONTAINER.getPackedId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(int type) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearActions() {
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
public int getContentType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setContentType(int contentType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClickMask() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setClickMask(int mask) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getParent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getParentId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getChild(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Widget[] getChildren() {
|
||||
return new Widget[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChildren(Widget[] children) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget[] getDynamicChildren() {
|
||||
return new Widget[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget[] getStaticChildren() {
|
||||
return new Widget[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget[] getNestedChildren() {
|
||||
return new Widget[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRelativeX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRelativeX(int x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRelativeY() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRelativeY(int y) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setForcedPosition(int x, int y) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setText(String text) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextColor() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setTextColor(int textColor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setOpacity(int transparency) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setName(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getModelId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setModelId(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getModelType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setModelType(int type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnimationId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setAnimationId(int animationId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRotationX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setRotationX(int modelX) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRotationY() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setRotationY(int modelY) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRotationZ() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setRotationZ(int modelZ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getModelZoom() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setModelZoom(int modelZoom) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpriteId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getSpriteTiling() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setSpriteTiling(boolean tiling) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setSpriteId(int spriteId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHidden() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfHidden() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setHidden(boolean hidden) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getCanvasLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWidth(int width) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(int height) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle getBounds() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemId() {
|
||||
return itemid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setItemId(int itemId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setItemQuantity(int quantity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Point point) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScrollX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setScrollX(int scrollX) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScrollY() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setScrollY(int scrollY) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScrollWidth() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setScrollWidth(int width) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScrollHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setScrollHeight(int height) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOriginalX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setOriginalX(int originalX) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOriginalY() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setOriginalY(int originalY) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setPos(int x, int y) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setPos(int x, int y, int xMode, int yMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOriginalHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setOriginalHeight(int originalHeight) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOriginalWidth() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setOriginalWidth(int originalWidth) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setSize(int width, int height) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setSize(int width, int height, int widthMode, int heightMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String[] getActions() {
|
||||
int xQuantity = BaseApiPlugin.getClient().getVarbitValue(VarbitID.BANK_REQUESTEDQUANTITY);
|
||||
String[] actions = new String[10];
|
||||
switch (BaseApiPlugin.getClient().getVarbitValue(VarbitID.BANK_QUANTITY_TYPE)) {
|
||||
default:
|
||||
case 0:
|
||||
actions[0] = "Withdraw-1";
|
||||
actions[1] = "Withdraw-5";
|
||||
actions[2] = "Withdraw-10";
|
||||
if (xQuantity > 0) {
|
||||
actions[3] = "Withdraw-" + xQuantity;
|
||||
actions[4] = "Withdraw-X";
|
||||
actions[5] = "Withdraw-All";
|
||||
actions[6] = "Withdraw-All-but-1";
|
||||
} else {
|
||||
actions[3] = "Withdraw-X";
|
||||
actions[4] = "Withdraw-All";
|
||||
actions[5] = "Withdraw-All-but-1";
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
actions[0] = "Withdraw-5";
|
||||
actions[1] = "Withdraw-1";
|
||||
actions[2] = "Withdraw-10";
|
||||
if (xQuantity > 0) {
|
||||
actions[3] = "Withdraw-" + xQuantity;
|
||||
actions[4] = "Withdraw-X";
|
||||
actions[5] = "Withdraw-All";
|
||||
actions[6] = "Withdraw-All-but-1";
|
||||
} else {
|
||||
actions[3] = "Withdraw-X";
|
||||
actions[4] = "Withdraw-All";
|
||||
actions[5] = "Withdraw-All-but-1";
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
actions[0] = "Withdraw-10";
|
||||
actions[1] = "Withdraw-1";
|
||||
actions[2] = "Withdraw-5";
|
||||
if (xQuantity > 0) {
|
||||
actions[3] = "Withdraw-" + xQuantity;
|
||||
actions[4] = "Withdraw-X";
|
||||
actions[5] = "Withdraw-All";
|
||||
actions[6] = "Withdraw-All-but-1";
|
||||
} else {
|
||||
actions[3] = "Withdraw-X";
|
||||
actions[4] = "Withdraw-All";
|
||||
actions[5] = "Withdraw-All-but-1";
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
// this can't ever be a thing while this is set to 0
|
||||
actions[0] = "Withdraw-" + xQuantity;
|
||||
actions[1] = "Withdraw-1";
|
||||
actions[2] = "Withdraw-5";
|
||||
actions[3] = "Withdraw-10";
|
||||
actions[4] = "Withdraw-X";
|
||||
actions[5] = "Withdraw-All";
|
||||
actions[6] = "Withdraw-All-but-1";
|
||||
break;
|
||||
case 4:
|
||||
actions[0] = "Withdraw-All";
|
||||
actions[1] = "Withdraw-1";
|
||||
actions[2] = "Withdraw-5";
|
||||
actions[3] = "Withdraw-10";
|
||||
if (xQuantity > 0) {
|
||||
actions[4] = "Withdraw-" + xQuantity;
|
||||
actions[5] = "Withdraw-X";
|
||||
actions[6] = "Withdraw-All-but-1";
|
||||
} else {
|
||||
actions[4] = "Withdraw-X";
|
||||
actions[5] = "Withdraw-All-but-1";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (BaseApiPlugin.getClient().getVarbitValue(VarbitID.BANK_LEAVEPLACEHOLDERS) == 0) {
|
||||
actions[7] = "Placeholder";
|
||||
}
|
||||
// these are null normally, 7 can be placeholder
|
||||
// actions[7] = null;
|
||||
// actions[8] = null;
|
||||
|
||||
actions[9] = "Examine";
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget createChild(int index, int type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget createChild(int type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllChildren() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAction(int index, String action) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnOpListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnDialogAbortListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnKeyListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMouseOverListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMouseRepeatListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMouseLeaveListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnTimerListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnTargetEnterListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnTargetLeaveListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setHasListener(boolean hasListener) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIf3() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revalidate() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revalidateScroll() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getOnOpListener() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getOnKeyListener() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getOnLoadListener() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getOnInvTransmitListener() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFontId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setFontId(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBorderType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBorderType(int thickness) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlippedVertically() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlippedVertically(boolean b) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlippedHorizontally() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlippedHorizontally(boolean b) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTextShadowed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setTextShadowed(boolean shadowed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDragDeadZone() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDragDeadZone(int deadZone) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDragDeadTime() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDragDeadTime(int deadTime) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemQuantityMode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setItemQuantityMode(int itemQuantityMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXPositionMode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setXPositionMode(int xpm) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYPositionMode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setYPositionMode(int ypm) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLineHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setLineHeight(int lineHeight) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXTextAlignment() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setXTextAlignment(int xta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYTextAlignment() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setYTextAlignment(int yta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidthMode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setWidthMode(int widthMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeightMode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setHeightMode(int heightMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FontTypeFace getFont() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFilled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setFilled(boolean filled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTargetVerb() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTargetVerb(String targetVerb) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTargetPriority() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTargetPriority(int priority) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getNoClickThrough() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNoClickThrough(boolean noClickThrough) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getNoScrollThrough() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNoScrollThrough(boolean noScrollThrough) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getVarTransmitTrigger() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVarTransmitTrigger(int... trigger) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnClickListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnHoldListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnReleaseListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnDragCompleteListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnDragListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnScrollWheelListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getDragParent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setDragParent(Widget dragParent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getOnVarTransmitListener() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnVarTransmitListener(Object... args) {
|
||||
|
||||
}
|
||||
}
|
||||
68
src/main/java/ee/futur/baseapi/collections/DepositBox.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.collections.query.ItemQuery;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class DepositBox {
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
static List<Widget> depositBoxItems = new ArrayList<>();
|
||||
static int lastUpdateTick = 0;
|
||||
|
||||
public static ItemQuery search() {
|
||||
if (lastUpdateTick < client.getTickCount()) {
|
||||
DepositBox.depositBoxItems =
|
||||
Arrays.stream(client.getWidget(WidgetInfo.DEPOSIT_BOX_INVENTORY_ITEMS_CONTAINER).getDynamicChildren()).filter(Objects::nonNull).filter(x -> x.getItemId() != 6512 && x.getItemId() != -1).collect(Collectors.toList());
|
||||
lastUpdateTick = client.getTickCount();
|
||||
}
|
||||
return new ItemQuery(depositBoxItems);
|
||||
}
|
||||
|
||||
// @Subscribe
|
||||
// public void onWidgetLoaded(WidgetLoaded e) {
|
||||
// if (e.getGroupId() == WidgetID.DEPOSIT_BOX_GROUP_ID) {
|
||||
// try {
|
||||
// DepositBox.depositBoxItems =
|
||||
// Arrays.stream(client.getWidget(WidgetInfo.DEPOSIT_BOX_INVENTORY_ITEMS_CONTAINER).getDynamicChildren()).filter(Objects::nonNull).filter(x -> x.getItemId() != 6512 && x.getItemId() != -1).collect(Collectors.toList());
|
||||
// } catch (NullPointerException err) {
|
||||
// DepositBox.depositBoxItems.clear();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// @Subscribe
|
||||
// public void onItemContainerChanged(ItemContainerChanged e) {
|
||||
// if (e.getContainerId() == 93) {
|
||||
// if (client.getWidget(WidgetInfo.DEPOSIT_BOX_INVENTORY_ITEMS_CONTAINER) == null) {
|
||||
// DepositBox.depositBoxItems.clear();
|
||||
// return;
|
||||
// }
|
||||
// try {
|
||||
// DepositBox.depositBoxItems =
|
||||
// Arrays.stream(client.getWidget(WidgetInfo.DEPOSIT_BOX_INVENTORY_ITEMS_CONTAINER).getDynamicChildren()).filter(Objects::nonNull).filter(x -> x.getItemId() != 6512 && x.getItemId() != -1).collect(Collectors.toList());
|
||||
// return;
|
||||
// } catch (NullPointerException err) {
|
||||
// DepositBox.depositBoxItems.clear();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged) {
|
||||
if (gameStateChanged.getGameState() == GameState.HOPPING || gameStateChanged.getGameState() == GameState.LOGIN_SCREEN || gameStateChanged.getGameState() == GameState.CONNECTION_LOST) {
|
||||
DepositBox.depositBoxItems.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
34
src/main/java/ee/futur/baseapi/collections/ETileItem.java
Normal file
@@ -0,0 +1,34 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import net.runelite.api.TileItem;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
import static net.runelite.api.TileItem.OWNERSHIP_GROUP;
|
||||
import static net.runelite.api.TileItem.OWNERSHIP_SELF;
|
||||
|
||||
public class ETileItem {
|
||||
public WorldPoint location;
|
||||
public TileItem tileItem;
|
||||
|
||||
public ETileItem(WorldPoint worldLocation, TileItem tileItem) {
|
||||
this.location = worldLocation;
|
||||
this.tileItem = tileItem;
|
||||
}
|
||||
|
||||
public WorldPoint getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public TileItem getTileItem() {
|
||||
return tileItem;
|
||||
}
|
||||
|
||||
public boolean isMine() {
|
||||
return tileItem.getOwnership() == OWNERSHIP_SELF || tileItem.getOwnership() == OWNERSHIP_GROUP;
|
||||
}
|
||||
|
||||
public void interact(boolean ctrlDown) {
|
||||
//MousePackets.queueClickPacket();
|
||||
//TileItemPackets.queueTileItemAction(this, ctrlDown);
|
||||
}
|
||||
}
|
||||
105
src/main/java/ee/futur/baseapi/collections/Equipment.java
Normal file
@@ -0,0 +1,105 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.collections.query.EquipmentItemQuery;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLite;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class Equipment {
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
static List<EquipmentItemWidget> equipment = new ArrayList<>();
|
||||
static HashMap<Integer, Integer> equipmentSlotWidgetMapping = new HashMap<>();
|
||||
static HashMap<Integer, Integer> mappingToIterableIntegers = new HashMap<>();
|
||||
static int lastUpdateTick = 0;
|
||||
|
||||
static {
|
||||
equipmentSlotWidgetMapping.put(0, 15);
|
||||
equipmentSlotWidgetMapping.put(1, 16);
|
||||
equipmentSlotWidgetMapping.put(2, 17);
|
||||
equipmentSlotWidgetMapping.put(3, 18);
|
||||
equipmentSlotWidgetMapping.put(4, 19);
|
||||
equipmentSlotWidgetMapping.put(5, 20);
|
||||
equipmentSlotWidgetMapping.put(7, 21);
|
||||
equipmentSlotWidgetMapping.put(9, 22);
|
||||
equipmentSlotWidgetMapping.put(10, 23);
|
||||
equipmentSlotWidgetMapping.put(12, 24);
|
||||
equipmentSlotWidgetMapping.put(13, 25);
|
||||
|
||||
|
||||
mappingToIterableIntegers.put(0, 0);
|
||||
mappingToIterableIntegers.put(1, 1);
|
||||
mappingToIterableIntegers.put(2, 2);
|
||||
mappingToIterableIntegers.put(3, 3);
|
||||
mappingToIterableIntegers.put(4, 4);
|
||||
mappingToIterableIntegers.put(5, 5);
|
||||
mappingToIterableIntegers.put(6, 7);
|
||||
mappingToIterableIntegers.put(7, 9);
|
||||
mappingToIterableIntegers.put(8, 10);
|
||||
mappingToIterableIntegers.put(9, 12);
|
||||
mappingToIterableIntegers.put(10, 13);
|
||||
}
|
||||
|
||||
public static EquipmentItemQuery search() {
|
||||
if (lastUpdateTick < client.getTickCount()) {
|
||||
int x = 25362447;
|
||||
for (int i = 0; i < 11; i++) {
|
||||
client.runScript(545, (x + i), mappingToIterableIntegers.get(i), 1, 1, 2);
|
||||
}
|
||||
equipment.clear();
|
||||
int i = -1;
|
||||
if (client.getItemContainer(InventoryID.EQUIPMENT.getId()) == null) {
|
||||
return new EquipmentItemQuery(equipment);
|
||||
}
|
||||
for (Item item : client.getItemContainer(InventoryID.EQUIPMENT.getId()).getItems()) {
|
||||
i++;
|
||||
if (item == null) {
|
||||
continue;
|
||||
}
|
||||
if (item.getId() == 6512 || item.getId() == -1) {
|
||||
continue;
|
||||
}
|
||||
Widget w = client.getWidget(WidgetInfo.EQUIPMENT.getGroupId(), equipmentSlotWidgetMapping.get(i));
|
||||
if (w == null || w.getActions() == null) {
|
||||
continue;
|
||||
}
|
||||
equipment.add(new EquipmentItemWidget(w.getName(), item.getId(), w.getId(), -1, w.getActions()));
|
||||
}
|
||||
lastUpdateTick = client.getTickCount();
|
||||
}
|
||||
return new EquipmentItemQuery(equipment);
|
||||
}
|
||||
|
||||
// @SneakyThrows
|
||||
// @Subscribe
|
||||
// public void onItemContainerChanged(ItemContainerChanged e) {
|
||||
// if (e.getContainerId() == InventoryID.EQUIPMENT.getId()) {
|
||||
// int x = 25362447;
|
||||
// for (int i = 0; i < 11; i++) {
|
||||
// client.runScript(545, (x + i), mappingToIterableIntegers.get(i), 1, 1, 2);
|
||||
// }
|
||||
// equipment.clear();
|
||||
// int i = -1;
|
||||
// for (Item item : e.getItemContainer().getItems()) {
|
||||
// i++;
|
||||
// if (item == null) {
|
||||
// continue;
|
||||
// }
|
||||
// if (item.getId() == 6512 || item.getId() == -1) {
|
||||
// continue;
|
||||
// }
|
||||
// Widget w = client.getWidget(WidgetInfo.EQUIPMENT.getGroupId(), equipmentSlotWidgetMapping.get(i));
|
||||
// if (w == null || w.getActions() == null) {
|
||||
// continue;
|
||||
// }
|
||||
// equipment.add(new EquipmentItemWidget(w.getName(), item.getId(), w.getId(), i, w.getActions()));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,832 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import net.runelite.api.FontTypeFace;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.awt.*;
|
||||
|
||||
public class EquipmentItemWidget implements Widget {
|
||||
String name;
|
||||
String[] actions;
|
||||
int packedId;
|
||||
static final int EQUIPMENT_INVENTORY_ITEMS_CONTAINER = 25362449;
|
||||
int equipmentItemId;
|
||||
int index;
|
||||
|
||||
EquipmentItemWidget(String name, int itemId, int packedId, int index, String[] actions) {
|
||||
this.equipmentItemId = itemId;
|
||||
this.name = name;
|
||||
this.actions = actions;
|
||||
this.packedId = packedId;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
|
||||
public void interact(String... actions) {
|
||||
//MousePackets.queueClickPacket();
|
||||
//WidgetPackets.queueWidgetAction(BaseApiPlugin.getClient().getWidget(packedId), actions);
|
||||
}
|
||||
|
||||
public int getEquipmentItemId() {
|
||||
return equipmentItemId;
|
||||
}
|
||||
|
||||
public int getEquipmentIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getId() {
|
||||
return packedId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(int type) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearActions() {
|
||||
}
|
||||
|
||||
;
|
||||
|
||||
@Override
|
||||
public int getContentType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setContentType(int contentType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getClickMask() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setClickMask(int mask) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getParent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getParentId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getChild(int index) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Widget[] getChildren() {
|
||||
return new Widget[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setChildren(Widget[] children) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget[] getDynamicChildren() {
|
||||
return new Widget[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget[] getStaticChildren() {
|
||||
return new Widget[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget[] getNestedChildren() {
|
||||
return new Widget[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRelativeX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRelativeX(int x) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRelativeY() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRelativeY(int y) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setForcedPosition(int x, int y) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setText(String text) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTextColor() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setTextColor(int textColor) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOpacity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setOpacity(int transparency) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setName(String name) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getModelId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setModelId(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getModelType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setModelType(int type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAnimationId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setAnimationId(int animationId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRotationX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setRotationX(int modelX) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRotationY() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setRotationY(int modelY) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRotationZ() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setRotationZ(int modelZ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getModelZoom() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setModelZoom(int modelZoom) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSpriteId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getSpriteTiling() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setSpriteTiling(boolean tiling) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setSpriteId(int spriteId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isHidden() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSelfHidden() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setHidden(boolean hidden) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getCanvasLocation() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWidth(int width) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setHeight(int height) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Rectangle getBounds() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemId() {
|
||||
return equipmentItemId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setItemId(int itemId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemQuantity() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setItemQuantity(int quantity) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean contains(Point point) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScrollX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setScrollX(int scrollX) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScrollY() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setScrollY(int scrollY) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScrollWidth() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setScrollWidth(int width) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getScrollHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setScrollHeight(int height) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOriginalX() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setOriginalX(int originalX) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOriginalY() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setOriginalY(int originalY) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setPos(int x, int y) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setPos(int x, int y, int xMode, int yMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOriginalHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setOriginalHeight(int originalHeight) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOriginalWidth() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setOriginalWidth(int originalWidth) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setSize(int width, int height) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setSize(int width, int height, int widthMode, int heightMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public String[] getActions() {
|
||||
return actions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget createChild(int index, int type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget createChild(int type) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteAllChildren() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAction(int index, String action) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnOpListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnDialogAbortListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnKeyListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMouseOverListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMouseRepeatListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnMouseLeaveListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnTimerListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnTargetEnterListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnTargetLeaveListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasListener() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setHasListener(boolean hasListener) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIf3() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revalidate() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void revalidateScroll() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getOnOpListener() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getOnKeyListener() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getOnLoadListener() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getOnInvTransmitListener() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFontId() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setFontId(int id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBorderType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBorderType(int thickness) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlippedVertically() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlippedVertically(boolean b) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFlippedHorizontally() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFlippedHorizontally(boolean b) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTextShadowed() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setTextShadowed(boolean shadowed) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDragDeadZone() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDragDeadZone(int deadZone) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getDragDeadTime() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDragDeadTime(int deadTime) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemQuantityMode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setItemQuantityMode(int itemQuantityMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXPositionMode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setXPositionMode(int xpm) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYPositionMode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setYPositionMode(int ypm) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLineHeight() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setLineHeight(int lineHeight) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getXTextAlignment() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setXTextAlignment(int xta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getYTextAlignment() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setYTextAlignment(int yta) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidthMode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setWidthMode(int widthMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeightMode() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setHeightMode(int heightMode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FontTypeFace getFont() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFilled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setFilled(boolean filled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTargetVerb() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTargetVerb(String targetVerb) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTargetPriority() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTargetPriority(int priority) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getNoClickThrough() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNoClickThrough(boolean noClickThrough) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getNoScrollThrough() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setNoScrollThrough(boolean noScrollThrough) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getVarTransmitTrigger() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVarTransmitTrigger(int... trigger) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnClickListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnHoldListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnReleaseListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnDragCompleteListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnDragListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnScrollWheelListener(Object... args) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget getDragParent() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Widget setDragParent(Widget dragParent) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object[] getOnVarTransmitListener() {
|
||||
return new Object[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnVarTransmitListener(Object... args) {
|
||||
|
||||
}
|
||||
}
|
||||
55
src/main/java/ee/futur/baseapi/collections/Inventory.java
Normal file
@@ -0,0 +1,55 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.collections.query.ItemQuery;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Inventory {
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
static List<Widget> inventoryItems = new ArrayList<>();
|
||||
static int lastUpdateTick = 0;
|
||||
|
||||
public static ItemQuery search() {
|
||||
if (lastUpdateTick < client.getTickCount()) {
|
||||
client.runScript(6009, 9764864, 28, 1, -1);
|
||||
Inventory.inventoryItems =
|
||||
Arrays.stream(client.getWidget(WidgetInfo.INVENTORY).getDynamicChildren()).filter(Objects::nonNull).filter(x -> x.getItemId() != 6512 && x.getItemId() != -1).collect(Collectors.toList());
|
||||
lastUpdateTick = client.getTickCount();
|
||||
}
|
||||
return new ItemQuery(inventoryItems);
|
||||
}
|
||||
|
||||
public static int getEmptySlots() {
|
||||
return 28 - search().result().size();
|
||||
}
|
||||
|
||||
public static boolean full() {
|
||||
return getEmptySlots() == 0;
|
||||
}
|
||||
|
||||
public static int getItemAmount(int itemId) {
|
||||
return search().withId(itemId).result().size();
|
||||
}
|
||||
|
||||
public static int getItemAmount(String itemName) {
|
||||
return search().withName(itemName).result().size();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged) {
|
||||
if (gameStateChanged.getGameState() == GameState.HOPPING || gameStateChanged.getGameState() == GameState.LOGIN_SCREEN || gameStateChanged.getGameState() == GameState.CONNECTION_LOST) {
|
||||
Inventory.inventoryItems.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
32
src/main/java/ee/futur/baseapi/collections/NPCs.java
Normal file
@@ -0,0 +1,32 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.collections.query.NPCQuery;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class NPCs {
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
private static final List<NPC> npcList = new ArrayList<>();
|
||||
|
||||
public static NPCQuery search() {
|
||||
return new NPCQuery(npcList);
|
||||
}
|
||||
|
||||
@Subscribe(priority = 10000)
|
||||
public void onGameTick(GameTick e) {
|
||||
npcList.clear();
|
||||
for (NPC npc : client.getNpcs()) {
|
||||
if (npc == null)
|
||||
continue;
|
||||
if (npc.getId() == -1)
|
||||
continue;
|
||||
npcList.add(npc);
|
||||
}
|
||||
}
|
||||
}
|
||||
30
src/main/java/ee/futur/baseapi/collections/Players.java
Normal file
@@ -0,0 +1,30 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.collections.query.PlayerQuery;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Players {
|
||||
static List<Player> players = new ArrayList<>();
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
|
||||
public static PlayerQuery search() {
|
||||
return new PlayerQuery(players);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick e) {
|
||||
players.clear();
|
||||
for (Player player : client.getPlayers()) {
|
||||
if (player == null)
|
||||
continue;
|
||||
players.add(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
64
src/main/java/ee/futur/baseapi/collections/Shop.java
Normal file
@@ -0,0 +1,64 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.collections.query.ItemQuery;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.RuneLite;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class Shop {
|
||||
private static final int SHOP_ITEM_CONTAINER_PACKED_ID = 19660816;
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
static List<Widget> shopItems = new ArrayList<>();
|
||||
static int lastUpdateTick = 0;
|
||||
|
||||
public static ItemQuery search() {
|
||||
if (lastUpdateTick < client.getTickCount()) {
|
||||
shopItems =
|
||||
Arrays.stream(client.getWidget(SHOP_ITEM_CONTAINER_PACKED_ID).getDynamicChildren()).filter(Objects::nonNull).filter(x -> x.getItemId() != 6512 && x.getItemId() != -1).collect(Collectors.toList());
|
||||
lastUpdateTick = client.getTickCount();
|
||||
}
|
||||
return new ItemQuery(shopItems.stream().filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
// @Subscribe
|
||||
// public void onWidgetLoaded(WidgetLoaded e)
|
||||
// {
|
||||
// if (e.getGroupId() == WidgetID.SHOP_GROUP_ID)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// shopItems =
|
||||
// Arrays.stream(client.getWidget(SHOP_ITEM_CONTAINER_PACKED_ID).getDynamicChildren()).filter(Objects::nonNull).filter(x -> x.getItemId() != 6512 && x.getItemId() != -1).collect(Collectors.toList());
|
||||
// }
|
||||
// catch (NullPointerException err)
|
||||
// {
|
||||
// shopItems.clear();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Subscribe
|
||||
// public void onItemContainerChanged(ItemContainerChanged e)
|
||||
// {
|
||||
// if (client.getWidget(SHOP_ITEM_CONTAINER_PACKED_ID) == null)
|
||||
// {
|
||||
// shopItems.clear();
|
||||
// return;
|
||||
// }
|
||||
// try
|
||||
// {
|
||||
// shopItems =
|
||||
// Arrays.stream(client.getWidget(SHOP_ITEM_CONTAINER_PACKED_ID).getDynamicChildren()).filter(Objects::nonNull).filter(x -> x.getItemId() != 6512 && x.getItemId() != -1).collect(Collectors.toList());
|
||||
// }
|
||||
// catch (NullPointerException err)
|
||||
// {
|
||||
// shopItems.clear();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.collections.query.ItemQuery;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ShopInventory {
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
static List<Widget> shopInventoryItems = new ArrayList<>();
|
||||
static int lastUpdateTick = 0;
|
||||
|
||||
public static ItemQuery search() {
|
||||
if (lastUpdateTick < client.getTickCount()) {
|
||||
shopInventoryItems =
|
||||
Arrays.stream(client.getWidget(WidgetInfo.SHOP_INVENTORY_ITEMS_CONTAINER).getDynamicChildren()).filter(Objects::nonNull).filter(x -> x.getItemId() != 6512 && x.getItemId() != -1).collect(Collectors.toList());
|
||||
lastUpdateTick = client.getTickCount();
|
||||
}
|
||||
return new ItemQuery(shopInventoryItems.stream().filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
// @Subscribe
|
||||
// public void onWidgetLoaded(WidgetLoaded e)
|
||||
// {
|
||||
// if (e.getGroupId() == WidgetID.SHOP_INVENTORY_GROUP_ID)
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// ShopInventory.shopInventoryItems =
|
||||
// Arrays.stream(client.getWidget(WidgetInfo.SHOP_INVENTORY_ITEMS_CONTAINER).getDynamicChildren()).filter(Objects::nonNull).filter(x -> x.getItemId() != 6512 && x.getItemId() != -1).collect(Collectors.toList());
|
||||
// }
|
||||
// catch (NullPointerException err)
|
||||
// {
|
||||
// ShopInventory.shopInventoryItems.clear();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Subscribe
|
||||
// public void onItemContainerChanged(ItemContainerChanged e)
|
||||
// {
|
||||
// if (e.getContainerId() == 256)
|
||||
// {
|
||||
// if (client.getWidget(WidgetInfo.SHOP_INVENTORY_ITEMS_CONTAINER) == null)
|
||||
// {
|
||||
// ShopInventory.shopInventoryItems.clear();
|
||||
// return;
|
||||
// }
|
||||
// try
|
||||
// {
|
||||
// ShopInventory.shopInventoryItems =
|
||||
// Arrays.stream(client.getWidget(WidgetInfo.SHOP_INVENTORY_ITEMS_CONTAINER).getDynamicChildren()).filter(Objects::nonNull).filter(x -> x.getItemId() != 6512 && x.getItemId() != -1).collect(Collectors.toList());
|
||||
// return;
|
||||
// }
|
||||
// catch (NullPointerException err)
|
||||
// {
|
||||
// ShopInventory.shopInventoryItems.clear();
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged) {
|
||||
if (gameStateChanged.getGameState() == GameState.HOPPING || gameStateChanged.getGameState() == GameState.LOGIN_SCREEN || gameStateChanged.getGameState() == GameState.CONNECTION_LOST) {
|
||||
ShopInventory.shopInventoryItems.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
14
src/main/java/ee/futur/baseapi/collections/TileItems.java
Normal file
@@ -0,0 +1,14 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.collections.query.TileItemQuery;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class TileItems {
|
||||
public static List<ETileItem> tileItems = new ArrayList<>();
|
||||
|
||||
public static TileItemQuery search() {
|
||||
return new TileItemQuery(tileItems);
|
||||
}
|
||||
}
|
||||
77
src/main/java/ee/futur/baseapi/collections/TileObjects.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.collections.query.TileObjectQuery;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
public class TileObjects {
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
static List<TileObject> tileObjects = new ArrayList<>();
|
||||
|
||||
public static TileObjectQuery search() {
|
||||
return new TileObjectQuery(tileObjects);
|
||||
}
|
||||
|
||||
@Subscribe(priority = 10000)
|
||||
public void onGameTick(GameTick e) {
|
||||
HashSet<TileObject> tileObjectHashSet = new HashSet<>();
|
||||
tileObjects.clear();
|
||||
TileItems.tileItems.clear();
|
||||
for (Tile[] tiles : client.getScene().getTiles()[client.getPlane()]) {
|
||||
if (tiles == null) {
|
||||
continue;
|
||||
}
|
||||
for (Tile tile : tiles) {
|
||||
if (tile == null) {
|
||||
continue;
|
||||
}
|
||||
if (tile.getGroundItems() != null) {
|
||||
for (TileItem groundItem : tile.getGroundItems()) {
|
||||
if (groundItem == null) {
|
||||
continue;
|
||||
}
|
||||
TileItems.tileItems.add(new ETileItem(tile.getWorldLocation(), groundItem));
|
||||
}
|
||||
}
|
||||
for (GameObject gameObject : tile.getGameObjects()) {
|
||||
if (gameObject == null) {
|
||||
continue;
|
||||
}
|
||||
if (gameObject.getId() == -1) {
|
||||
continue;
|
||||
}
|
||||
tileObjectHashSet.add(gameObject);
|
||||
//tileObjects.add(gameObject);
|
||||
}
|
||||
if (tile.getGroundObject() != null) {
|
||||
if (tile.getGroundObject().getId() == -1) {
|
||||
continue;
|
||||
}
|
||||
tileObjectHashSet.add(tile.getGroundObject());
|
||||
//tileObjects.add(tile.getGroundObject());
|
||||
}
|
||||
if (tile.getWallObject() != null) {
|
||||
if (tile.getWallObject().getId() == -1) {
|
||||
continue;
|
||||
}
|
||||
tileObjectHashSet.add(tile.getWallObject());
|
||||
//tileObjects.add(tile.getWallObject());
|
||||
}
|
||||
if (tile.getDecorativeObject() != null) {
|
||||
if (tile.getDecorativeObject().getId() == -1) {
|
||||
continue;
|
||||
}
|
||||
tileObjectHashSet.add(tile.getDecorativeObject());
|
||||
//tileObjects.add(tile.getDecorativeObject());
|
||||
}
|
||||
}
|
||||
}
|
||||
tileObjects.addAll(tileObjectHashSet);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.collections.query.ItemQuery;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TradeInventory {
|
||||
private static final int TRADE_INVENTORY_PACKED_ID = 22020096;
|
||||
|
||||
static int lastUpdateTick = 0;
|
||||
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
static List<Widget> tradeInventoryItems = new ArrayList<>();
|
||||
|
||||
public static ItemQuery search() {
|
||||
if (lastUpdateTick < client.getTickCount()) {
|
||||
client.runScript(6009, 9764864, 28, 1, -1);
|
||||
tradeInventoryItems =
|
||||
Arrays.stream(client.getWidget(TRADE_INVENTORY_PACKED_ID).getDynamicChildren()).filter(Objects::nonNull).filter(x -> x.getItemId() != 6512 && x.getItemId() != -1).collect(Collectors.toList());
|
||||
lastUpdateTick = client.getTickCount();
|
||||
}
|
||||
return new ItemQuery(tradeInventoryItems);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged) {
|
||||
if (gameStateChanged.getGameState() == GameState.HOPPING || gameStateChanged.getGameState() == GameState.LOGIN_SCREEN || gameStateChanged.getGameState() == GameState.CONNECTION_LOST) {
|
||||
tradeInventoryItems.clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
76
src/main/java/ee/futur/baseapi/collections/Widgets.java
Normal file
@@ -0,0 +1,76 @@
|
||||
package ee.futur.baseapi.collections;
|
||||
|
||||
import ee.futur.baseapi.collections.query.WidgetQuery;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.RuneLite;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
|
||||
public class Widgets {
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
static int lastSearchIdleTicks = -10;
|
||||
static HashSet<Widget> cachedWidgets = new HashSet<>();
|
||||
|
||||
//It is important to note that this method will return all widgets, including hidden ones.
|
||||
//Some widgets are not updated while hidden so there is a chance that the widgets returned contain outdated
|
||||
// information.
|
||||
//for update critical information make sure the widget is not hidden or use the other query types like inventory,
|
||||
// equipment ect as they will only return up-to-date information.
|
||||
public static WidgetQuery search() {
|
||||
if (lastSearchIdleTicks == client.getKeyboardIdleTicks()) {
|
||||
return new WidgetQuery(cachedWidgets);
|
||||
}
|
||||
HashSet<Widget> returnList = new HashSet<>();
|
||||
Widget[] currentQueue;
|
||||
ArrayList<Widget> buffer = new ArrayList<>();
|
||||
currentQueue = client.getWidgetRoots();
|
||||
while (currentQueue.length != 0) {
|
||||
for (Widget widget : currentQueue) {
|
||||
if (widget == null) {
|
||||
continue;
|
||||
}
|
||||
returnList.add(widget);
|
||||
if (widget.getDynamicChildren() != null) {
|
||||
for (Widget dynamicChild : widget.getDynamicChildren()) {
|
||||
if (dynamicChild == null) {
|
||||
continue;
|
||||
}
|
||||
buffer.add(dynamicChild);
|
||||
returnList.add(dynamicChild);
|
||||
}
|
||||
}
|
||||
if (widget.getNestedChildren() != null) {
|
||||
for (Widget nestedChild : widget.getNestedChildren()) {
|
||||
if (nestedChild == null) {
|
||||
continue;
|
||||
}
|
||||
buffer.add(nestedChild);
|
||||
returnList.add(nestedChild);
|
||||
}
|
||||
}
|
||||
Widget[] staticChildren;
|
||||
try {
|
||||
staticChildren = widget.getStaticChildren();
|
||||
} catch (NullPointerException e) {
|
||||
continue;
|
||||
}
|
||||
if (staticChildren != null) {
|
||||
for (Widget staticChild : staticChildren) {
|
||||
if (staticChild == null) {
|
||||
continue;
|
||||
}
|
||||
buffer.add(staticChild);
|
||||
returnList.add(staticChild);
|
||||
}
|
||||
}
|
||||
}
|
||||
currentQueue = buffer.toArray(new Widget[]{});
|
||||
buffer.clear();
|
||||
}
|
||||
lastSearchIdleTicks = client.getKeyboardIdleTicks();
|
||||
cachedWidgets = returnList;
|
||||
return new WidgetQuery(returnList);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package ee.futur.baseapi.collections.query;
|
||||
|
||||
import ee.futur.baseapi.collections.EquipmentItemWidget;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.util.Text;
|
||||
import net.runelite.client.util.WildcardMatcher;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class EquipmentItemQuery {
|
||||
private List<EquipmentItemWidget> items;
|
||||
|
||||
public EquipmentItemQuery(List<EquipmentItemWidget> items) {
|
||||
this.items = new ArrayList(items);
|
||||
}
|
||||
|
||||
public EquipmentItemQuery filter(Predicate<? super Widget> predicate) {
|
||||
items = items.stream().filter(predicate).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public EquipmentItemQuery withAction(String action) {
|
||||
items = items.stream().filter(item -> Arrays.asList(item.getActions()).contains(action)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public EquipmentItemQuery withId(int id) {
|
||||
items = items.stream().filter(item -> item.getEquipmentItemId() == id).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public EquipmentItemQuery withName(String name) {
|
||||
items = items.stream().filter(item -> item.getName().equals(name)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public EquipmentItemQuery nameContains(String name) {
|
||||
items = items.stream().filter(item -> item.getName().contains(name)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public EquipmentItemQuery nameContainsNoCase(String name) {
|
||||
items =
|
||||
items.stream().filter(item -> item.getName().toLowerCase().contains(name.toLowerCase())).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public EquipmentItemQuery idInList(List<Integer> ids) {
|
||||
items = items.stream().filter(item -> ids.contains(item.getEquipmentItemId())).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public EquipmentItemQuery indexIs(int index) {
|
||||
items = items.stream().filter(item -> item.getIndex() == index).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public EquipmentItemQuery matchesWildCardNoCase(String input) {
|
||||
items =
|
||||
items.stream().
|
||||
filter(item -> WildcardMatcher.matches(input.toLowerCase(), Text.removeTags(item.getName().toLowerCase()))).
|
||||
collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean empty() {
|
||||
return items.size() == 0;
|
||||
}
|
||||
|
||||
public EquipmentItemQuery filterUnique() {
|
||||
items = items.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparingInt(Widget::getItemId))), ArrayList::new));
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<EquipmentItemWidget> result() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public Optional<EquipmentItemWidget> first() {
|
||||
Widget returnWidget = null;
|
||||
if (items.size() == 0) {
|
||||
return Optional.ofNullable(null);
|
||||
}
|
||||
return Optional.ofNullable(items.get(0));
|
||||
}
|
||||
}
|
||||
157
src/main/java/ee/futur/baseapi/collections/query/ItemQuery.java
Normal file
@@ -0,0 +1,157 @@
|
||||
package ee.futur.baseapi.collections.query;
|
||||
|
||||
import ee.futur.baseapi.BaseApiPlugin;
|
||||
import lombok.SneakyThrows;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.util.Text;
|
||||
import net.runelite.client.util.WildcardMatcher;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ItemQuery {
|
||||
private List<Widget> items;
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
static ItemManager itemManager = RuneLite.getInjector().getInstance(ItemManager.class);
|
||||
|
||||
public ItemQuery(List<Widget> items) {
|
||||
this.items = new ArrayList(items);
|
||||
}
|
||||
|
||||
public ItemQuery filter(Predicate<? super Widget> predicate) {
|
||||
items = items.stream().filter(predicate).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery withAction(String action) {
|
||||
items = items.stream().filter(item -> Arrays.asList(item.getActions()).contains(action)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery tradeAble() {
|
||||
items = items.stream().filter(item -> itemManager.getItemComposition(item.getItemId()).isTradeable()).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery differenceInValueLessThan(int difference) {
|
||||
items = items.stream().filter(item -> Math.abs(itemManager.getItemComposition(item.getItemId()).getHaPrice() - itemManager.getItemPriceWithSource(item.getItemId(), true)) < difference).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery priceOver(int price) {
|
||||
items = items.stream().filter(item -> itemManager.getItemComposition(item.getItemId()).getHaPrice() >= price).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery withSet(Set<Integer> ids) {
|
||||
items = items.stream()
|
||||
.filter(item -> ids.contains(item.getItemId()))
|
||||
.collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery withId(int id) {
|
||||
items = items.stream().filter(item -> item.getItemId() == id).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery withName(String name) {
|
||||
items = items.stream().filter(item -> Text.removeTags(item.getName()).equals(Text.removeTags(name))).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery quantityGreaterThan(int quanity) {
|
||||
items = items.stream().filter(item -> item.getItemQuantity() > quanity).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery nameContains(String name) {
|
||||
items = items.stream().filter(item -> item.getName().contains(name)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery nonPlaceHolder() {
|
||||
return quantityGreaterThan(0);
|
||||
}
|
||||
|
||||
public ItemQuery idInList(List<Integer> ids) {
|
||||
items = items.stream().filter(item -> ids.contains(item.getItemId())).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery nameInList(List<String> names) {
|
||||
items = items.stream()
|
||||
.filter(item -> names.stream()
|
||||
.map(String::toLowerCase)
|
||||
.anyMatch(name -> Text.removeTags(item.getName()).equalsIgnoreCase(name)))
|
||||
.collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery indexIs(int index) {
|
||||
items = items.stream().filter(item -> item.getIndex() == index).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery matchesWildCardNoCase(String input) {
|
||||
items =
|
||||
items.stream().
|
||||
filter(item -> WildcardMatcher.matches(input.toLowerCase(), Text.removeTags(item.getName().toLowerCase()))).
|
||||
collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery onlyNoted() {
|
||||
items = items.stream().filter(this::isNoted).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemQuery onlyStackable() {
|
||||
items = items.stream().filter(this::isStackable).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public ItemQuery onlyUnnoted() {
|
||||
items = items.stream().filter(item -> !isNoted(item)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean empty() {
|
||||
return items.size() == 0;
|
||||
}
|
||||
|
||||
public ItemQuery filterUnique() {
|
||||
items = items.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparingInt(Widget::getItemId))), ArrayList::new));
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<Widget> result() {
|
||||
return items;
|
||||
}
|
||||
|
||||
public Optional<Widget> first() {
|
||||
Widget returnWidget = null;
|
||||
if (items.size() == 0) {
|
||||
return Optional.ofNullable(null);
|
||||
}
|
||||
return Optional.ofNullable(items.get(0));
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public boolean isNoted(Widget item) {
|
||||
ItemComposition itemComposition = BaseApiPlugin.itemDefs.get(item.getItemId());
|
||||
return itemComposition.getNote() != -1;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public boolean isStackable(Widget item) {
|
||||
ItemComposition itemComposition = BaseApiPlugin.itemDefs.get(item.getItemId());
|
||||
return itemComposition.isStackable();
|
||||
}
|
||||
}
|
||||
232
src/main/java/ee/futur/baseapi/collections/query/NPCQuery.java
Normal file
@@ -0,0 +1,232 @@
|
||||
package ee.futur.baseapi.collections.query;
|
||||
|
||||
import ee.futur.baseapi.collections.Players;
|
||||
import ee.futur.baseapi.BaseApiPlugin;
|
||||
import ee.futur.baseapi.utils.WorldAreaUtility;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.api.coords.WorldArea;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.RuneLite;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class NPCQuery {
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
private List<NPC> npcs;
|
||||
|
||||
public NPCQuery(List<NPC> npcs) {
|
||||
this.npcs = new ArrayList(npcs.stream().filter(Objects::nonNull).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
public NPCQuery filter(Predicate<? super NPC> predicate) {
|
||||
npcs = npcs.stream().filter(predicate).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery atLocation(WorldPoint wp) {
|
||||
npcs = npcs.stream().filter(npc -> npc.getWorldLocation().equals(wp)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery withAction(String action) {
|
||||
npcs = npcs.stream().filter(npc -> {
|
||||
NPCComposition npcComposition = getNPCComposition(npc);
|
||||
if (npcComposition == null)
|
||||
return false;
|
||||
String[] actions = getNPCComposition(npc).getActions();
|
||||
return Arrays.stream(actions).filter(Objects::nonNull).anyMatch(a -> a.equalsIgnoreCase(action));
|
||||
}).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery withId(int id) {
|
||||
npcs = npcs.stream().filter(npc -> npc.getId() == id).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery withName(String name) {
|
||||
npcs = npcs.stream().filter(npcs -> npcs.getName() != null && npcs.getName().equals(name)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery nameContains(String name) {
|
||||
npcs = npcs.stream().filter(npcs -> npcs.getName() != null && npcs.getName().contains(name)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery interactingWithLocal() {
|
||||
List<NPC> filteredNPCs = new ArrayList<>();
|
||||
for (NPC npc : npcs) {
|
||||
if (!npc.isInteracting())
|
||||
continue;
|
||||
if (npc.getInteracting() == client.getLocalPlayer())
|
||||
filteredNPCs.add(npc);
|
||||
}
|
||||
npcs = filteredNPCs;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery interactingWith(Actor actor) {
|
||||
List<NPC> filteredNPCs = new ArrayList<>();
|
||||
for (NPC npc : npcs) {
|
||||
if (!npc.isInteracting())
|
||||
continue;
|
||||
if (npc.getInteracting() == actor)
|
||||
filteredNPCs.add(npc);
|
||||
}
|
||||
npcs = filteredNPCs;
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery idInList(List<Integer> ids) {
|
||||
npcs = npcs.stream().filter(npcs -> ids.contains(npcs.getId())).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery withinWorldArea(WorldArea area) {
|
||||
npcs = npcs.stream().filter(npcs -> area.contains(npcs.getWorldLocation())).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery withinBounds(WorldPoint min, WorldPoint max) {
|
||||
int x1 = min.getX();
|
||||
int x2 = max.getX();
|
||||
int y1 = min.getY();
|
||||
int y2 = max.getY();
|
||||
|
||||
npcs = npcs.stream().filter(npc -> {
|
||||
int x3 = npc.getWorldLocation().getX();
|
||||
int y3 = npc.getWorldLocation().getY();
|
||||
|
||||
if (x3 > Math.max(x1, x2) || x3 < Math.min(x1, x2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return y3 <= Math.max(y1, y2) && y3 >= Math.min(y1, y2);
|
||||
}).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery indexIs(int index) {
|
||||
npcs = npcs.stream().filter(npcs -> npcs.getIndex() == index).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean empty() {
|
||||
return npcs.size() == 0;
|
||||
}
|
||||
|
||||
public NPCQuery filterUnique() {
|
||||
npcs =
|
||||
npcs.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparingInt(NPC::getId))), ArrayList::new));
|
||||
return this;
|
||||
}
|
||||
|
||||
public List<NPC> result() {
|
||||
return npcs;
|
||||
}
|
||||
|
||||
public NPCQuery walkable() {
|
||||
npcs = npcs.stream().filter(npc -> BaseApiPlugin.canPathToTile(npc.getWorldLocation()).isReachable()).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery interacting() {
|
||||
npcs = npcs.stream().filter(Actor::isInteracting).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery notInteracting() {
|
||||
npcs = npcs.stream().filter(npc -> !npc.isInteracting()).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery noOneInteractingWith() {
|
||||
npcs = npcs.stream().filter(npc -> Players.search().interactingWith(npc).isEmpty()).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery playerInteractingWith() {
|
||||
npcs = npcs.stream().filter(npc -> client.getLocalPlayer().isInteracting() && client.getLocalPlayer().getInteracting() == npc).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery playerNotInteractingWith() {
|
||||
npcs = npcs.stream().filter(npc -> !client.getLocalPlayer().isInteracting() || client.getLocalPlayer().getInteracting() != npc).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery meleeable() {
|
||||
List<WorldPoint> meleeTiles = new ArrayList<>();
|
||||
meleeTiles.add(client.getLocalPlayer().getWorldLocation().dx(1));
|
||||
meleeTiles.add(client.getLocalPlayer().getWorldLocation().dx(-1));
|
||||
meleeTiles.add(client.getLocalPlayer().getWorldLocation().dy(1));
|
||||
meleeTiles.add(client.getLocalPlayer().getWorldLocation().dy(-1));
|
||||
npcs =
|
||||
npcs.stream().filter(npc -> !Collections.disjoint(meleeTiles, npc.getWorldArea().toWorldPointList()) && npc.getWorldArea().distanceTo(client.getLocalPlayer().getWorldLocation()) == 1).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public NPCQuery alive() {
|
||||
npcs = npcs.stream().filter(npc -> !npc.isDead() && npc.getHealthRatio() != 0).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public Optional<NPC> nearestToPlayer() {
|
||||
if (npcs.size() == 0) {
|
||||
return Optional.ofNullable(null);
|
||||
}
|
||||
return npcs.stream().min(Comparator.comparingInt(npc -> npc.getWorldLocation().distanceTo(client.getLocalPlayer().getWorldLocation())));
|
||||
}
|
||||
|
||||
public Optional<NPC> nearestToPoint(WorldPoint point) {
|
||||
if (npcs.size() == 0) {
|
||||
return Optional.ofNullable(null);
|
||||
}
|
||||
return npcs.stream().min(Comparator.comparingInt(npc -> npc.getWorldLocation().distanceTo(point)));
|
||||
}
|
||||
|
||||
public Optional<NPC> first() {
|
||||
if (npcs.size() == 0) {
|
||||
return Optional.ofNullable(null);
|
||||
}
|
||||
return Optional.ofNullable(npcs.get(0));
|
||||
}
|
||||
|
||||
public static NPCComposition getNPCComposition(NPC npc) {
|
||||
if (npc.getComposition().getConfigs() == null || npc.getTransformedComposition() == null) {
|
||||
return npc.getComposition();
|
||||
}
|
||||
return npc.getTransformedComposition();
|
||||
}
|
||||
|
||||
public Optional<NPC> nearestByPath() {
|
||||
HashMap<WorldPoint, NPC> npcMap = new HashMap<>();
|
||||
for (NPC npc : npcs) {
|
||||
for (WorldPoint wp : npc.getWorldArea().toWorldPointList()) {
|
||||
npcMap.put(wp, npc);
|
||||
}
|
||||
|
||||
for (WorldPoint wp : WorldAreaUtility.objectInteractableTiles(npc)) {
|
||||
npcMap.put(wp, npc);
|
||||
}
|
||||
}
|
||||
List<WorldPoint> path = BaseApiPlugin.pathToGoalSetFromPlayerNoCustomTiles(new HashSet<>(npcMap.keySet()));
|
||||
if (path == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
if (path.isEmpty()) {
|
||||
if (npcMap.containsKey(client.getLocalPlayer().getWorldLocation())) {
|
||||
return Optional.ofNullable(npcMap.get(client.getLocalPlayer().getWorldLocation()));
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
return Optional.ofNullable(npcMap.get(path.get(path.size() - 1)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package ee.futur.baseapi.collections.query;
|
||||
|
||||
import ee.futur.baseapi.BaseApiPlugin;
|
||||
import ee.futur.baseapi.utils.WorldAreaUtility;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.coords.WorldArea;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.RuneLite;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PlayerQuery {
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
private List<Player> players;
|
||||
|
||||
public PlayerQuery(List<Player> players) {
|
||||
this.players = new ArrayList<>(players);
|
||||
}
|
||||
|
||||
public PlayerQuery withName(String name) {
|
||||
List<Player> filteredPlayers = new ArrayList<>();
|
||||
for (Player player : players) {
|
||||
if (player.getName().equals(name))
|
||||
filteredPlayers.add(player);
|
||||
}
|
||||
players = filteredPlayers;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlayerQuery withinWorldArea(WorldArea area) {
|
||||
players = players.stream().filter(player -> area.contains(player.getWorldLocation())).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlayerQuery filter(Predicate<? super Player> predicate) {
|
||||
players = players.stream().filter(predicate).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlayerQuery interactingWithLocal() {
|
||||
List<Player> filteredPlayers = new ArrayList<>();
|
||||
for (Player player : players) {
|
||||
if (!player.isInteracting())
|
||||
continue;
|
||||
if (player.getInteracting() == client.getLocalPlayer())
|
||||
filteredPlayers.add(player);
|
||||
}
|
||||
players = filteredPlayers;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlayerQuery interactingWith(Actor actor) {
|
||||
List<Player> filteredPlayers = new ArrayList<>();
|
||||
for (Player player : players) {
|
||||
if (!player.isInteracting())
|
||||
continue;
|
||||
if (player.getInteracting() == actor)
|
||||
filteredPlayers.add(player);
|
||||
}
|
||||
players = filteredPlayers;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlayerQuery nameContains(String name) {
|
||||
List<Player> filteredPlayers = new ArrayList<>();
|
||||
for (Player player : players) {
|
||||
if (player.getName().contains(name))
|
||||
filteredPlayers.add(player);
|
||||
}
|
||||
players = filteredPlayers;
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlayerQuery notLocalPlayer() {
|
||||
players.remove(client.getLocalPlayer());
|
||||
return this;
|
||||
}
|
||||
|
||||
public PlayerQuery withinLevel(int low, int high) {
|
||||
List<Player> filteredPlayers = new ArrayList<>();
|
||||
for (Player player : players) {
|
||||
if (player.getCombatLevel() >= low && player.getCombatLevel() <= high)
|
||||
filteredPlayers.add(player);
|
||||
}
|
||||
players = filteredPlayers;
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean isEmpty() {
|
||||
return players.isEmpty();
|
||||
}
|
||||
|
||||
public Optional<Player> first() {
|
||||
if (players.isEmpty())
|
||||
return Optional.empty();
|
||||
return Optional.ofNullable(players.get(0));
|
||||
}
|
||||
|
||||
public List<Player> result() {
|
||||
return players;
|
||||
}
|
||||
|
||||
public Optional<Player> nearestByPath() {
|
||||
HashMap<WorldPoint, Player> playerMap = new HashMap<>();
|
||||
for (Player player : players) {
|
||||
for (WorldPoint wp : player.getWorldArea().toWorldPointList()) {
|
||||
playerMap.put(wp, player);
|
||||
}
|
||||
|
||||
for (WorldPoint wp : WorldAreaUtility.objectInteractableTiles(player)) {
|
||||
playerMap.put(wp, player);
|
||||
}
|
||||
}
|
||||
List<WorldPoint> path = BaseApiPlugin.pathToGoalSetFromPlayerNoCustomTiles(new HashSet<>(playerMap.keySet()));
|
||||
if (path == null) {
|
||||
return Optional.empty();
|
||||
}
|
||||
if (path.isEmpty()) {
|
||||
if (playerMap.containsKey(client.getLocalPlayer().getWorldLocation())) {
|
||||
return Optional.ofNullable(playerMap.get(client.getLocalPlayer().getWorldLocation()));
|
||||
} else {
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
return Optional.ofNullable(playerMap.get(path.get(path.size() - 1)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package ee.futur.baseapi.collections.query;
|
||||
|
||||
public enum QuickPrayer {
|
||||
THICK_SKIN(0),
|
||||
BURST_OF_STRENGTH(1),
|
||||
CLARITY_OF_THOUGHT(2),
|
||||
SHARP_EYE(18),
|
||||
MYSTIC_WILL(19),
|
||||
ROCK_SKIN(3),
|
||||
SUPERHUMAN_STRENGTH(4),
|
||||
IMPROVED_REFLEXES(5),
|
||||
RAPID_RESTORE(6),
|
||||
RAPID_HEAL(7),
|
||||
PROTECT_ITEM(8),
|
||||
HAWK_EYE(20),
|
||||
MYSTIC_LORE(21),
|
||||
STEEL_SKIN(9),
|
||||
ULTIMATE_STRENGTH(10),
|
||||
INCREDIBLE_REFLEXES(11),
|
||||
PROTECT_FROM_MAGIC(12),
|
||||
PROTECT_FROM_MISSILES(13),
|
||||
PROTECT_FROM_MELEE(14),
|
||||
EAGLE_EYE(22),
|
||||
MYSTIC_MIGHT(23),
|
||||
RETRIBUTION(15),
|
||||
REDEMPTION(16),
|
||||
SMITE(17),
|
||||
PRESERVE(28),
|
||||
CHIVALRY(25),
|
||||
PIETY(26),
|
||||
RIGOUR(24),
|
||||
AUGURY(27);
|
||||
private final int index;
|
||||
private int varbit;
|
||||
|
||||
QuickPrayer(int index) {
|
||||
this.varbit = varbit;
|
||||
this.index = index;
|
||||
}
|
||||
|
||||
public int getIndex() {
|
||||
return index;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,219 @@
|
||||
package ee.futur.baseapi.collections.query;
|
||||
|
||||
import ee.futur.baseapi.collections.ETileItem;
|
||||
import ee.futur.baseapi.BaseApiPlugin;
|
||||
import lombok.SneakyThrows;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.util.Text;
|
||||
import net.runelite.client.util.WildcardMatcher;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TileItemQuery {
|
||||
public List<ETileItem> tileItems;
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
static ItemManager itemManager = RuneLite.getInjector().getInstance(ItemManager.class);
|
||||
|
||||
public TileItemQuery(List<ETileItem> tileItems) {
|
||||
this.tileItems = new ArrayList<ETileItem>(tileItems);
|
||||
}
|
||||
|
||||
public TileItemQuery withId(int id) {
|
||||
tileItems = this.tileItems.stream().filter(tileItem -> tileItem.tileItem.getId() == id).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public TileItemQuery withName(String name) {
|
||||
tileItems = tileItems.stream().filter(tileItem ->
|
||||
{
|
||||
try {
|
||||
return BaseApiPlugin.itemDefs.get(tileItem.tileItem.getId()).getName().equals(name);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileItemQuery nameContains(String name) {
|
||||
tileItems = tileItems.stream().filter(tileItem ->
|
||||
{
|
||||
try {
|
||||
return BaseApiPlugin.itemDefs.get(tileItem.tileItem.getId()).getName().contains(name);
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileItemQuery filter(Predicate<? super ETileItem> predicate) {
|
||||
tileItems = tileItems.stream().filter(predicate).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileItemQuery onlyNoted() {
|
||||
tileItems = tileItems.stream().filter(this::isNoted).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileItemQuery onlyUnnoted() {
|
||||
tileItems = tileItems.stream().filter(item -> !isNoted(item)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileItemQuery matchesWildCardNoCase(String input) {
|
||||
tileItems =
|
||||
tileItems.stream().
|
||||
filter(item ->
|
||||
{
|
||||
try {
|
||||
return WildcardMatcher.matches(input.toLowerCase(),
|
||||
Text.removeTags(BaseApiPlugin.itemDefs.get(item.tileItem.getId()).getName().toLowerCase()));
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).
|
||||
collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileItemQuery eachItemAboveXValue(int value) {
|
||||
tileItems = tileItems.stream().filter(item -> itemManager.getItemPrice(item.getTileItem().getId()) > value).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileItemQuery stackAboveXValue(int value) {
|
||||
tileItems = tileItems.stream().filter(item -> item.getTileItem().getQuantity() * itemManager.getItemPrice(item.getTileItem().getId()) > value).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
//the 3 methods below are ugly af and might not work
|
||||
public TileItemQuery doesNotMatchWildCardNoCase(String input) {
|
||||
tileItems =
|
||||
tileItems.stream().
|
||||
filter(item ->
|
||||
{
|
||||
try {
|
||||
return !WildcardMatcher.matches(input.toLowerCase(),
|
||||
Text.removeTags(BaseApiPlugin.itemDefs.get(item.tileItem.getId()).getName().toLowerCase()));
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).
|
||||
collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileItemQuery itemsMatchingWildcardsNoCase(String... input) {
|
||||
List<ETileItem> tileItemsTemp = new ArrayList<>();
|
||||
for (String s : input) {
|
||||
tileItemsTemp.addAll(tileItems.stream().
|
||||
filter(item ->
|
||||
{
|
||||
try {
|
||||
return WildcardMatcher.matches(s.toLowerCase(),
|
||||
Text.removeTags(BaseApiPlugin.itemDefs.get(item.tileItem.getId()).getName().toLowerCase()));
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).
|
||||
collect(Collectors.toList()));
|
||||
}
|
||||
tileItems = tileItemsTemp;
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileItemQuery itemsExcludingMatchingWildcardsNoCase(String... input) {
|
||||
List<ETileItem> tileItemsTemp = new ArrayList<>();
|
||||
for (String s : input) {
|
||||
tileItemsTemp.addAll(tileItems.stream().
|
||||
filter(item ->
|
||||
{
|
||||
try {
|
||||
return WildcardMatcher.matches(s.toLowerCase(),
|
||||
Text.removeTags(BaseApiPlugin.itemDefs.get(item.tileItem.getId()).getName().toLowerCase()));
|
||||
} catch (ExecutionException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).
|
||||
collect(Collectors.toList()));
|
||||
}
|
||||
tileItems.removeAll(tileItemsTemp);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public boolean empty() {
|
||||
return tileItems.size() == 0;
|
||||
}
|
||||
|
||||
public List<ETileItem> result() {
|
||||
return tileItems;
|
||||
}
|
||||
|
||||
public Optional<ETileItem> first() {
|
||||
if (tileItems.size() == 0) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.ofNullable(tileItems.get(0));
|
||||
}
|
||||
|
||||
public TileItemQuery withinDistance(int distance) {
|
||||
tileItems = tileItems.stream().filter(tileItem -> tileItem.getLocation().distanceTo(client.getLocalPlayer().getWorldLocation()) <= distance).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileItemQuery withinDistanceToPoint(int distance, WorldPoint point) {
|
||||
tileItems = tileItems.stream().filter(tileItem -> tileItem.getLocation().distanceTo(point) <= distance).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileItemQuery alchValueAbove(int value) {
|
||||
tileItems = tileItems.stream().filter(tileItem -> itemManager.getItemComposition(tileItem.getTileItem().getId()).getHaPrice() > value).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public Optional<ETileItem> nearestToPlayer() {
|
||||
return nearestToPoint(client.getLocalPlayer().getWorldLocation());
|
||||
}
|
||||
|
||||
public Optional<ETileItem> nearestToPoint(WorldPoint point) {
|
||||
if (tileItems.size() == 0) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return tileItems.stream().min(Comparator.comparingInt(tileItem -> tileItem.location.distanceTo(point)));
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public boolean isNoted(ETileItem item) {
|
||||
ItemComposition itemComposition = BaseApiPlugin.itemDefs.get(item.tileItem.getId());
|
||||
return itemComposition.getNote() != -1;
|
||||
}
|
||||
|
||||
public Optional<ETileItem> nearestByPath() {
|
||||
HashSet<WorldPoint> tiles = new HashSet<>();
|
||||
HashMap<WorldPoint, ETileItem> map = new HashMap<>();
|
||||
WorldPoint playerLoc = client.getLocalPlayer().getWorldLocation();
|
||||
for (var t : tileItems) {
|
||||
if (playerLoc.equals(t.getLocation())) {
|
||||
return Optional.of(t);
|
||||
}
|
||||
map.put(t.getLocation(), t);
|
||||
tiles.add(t.getLocation());
|
||||
}
|
||||
List<WorldPoint> path = BaseApiPlugin.pathToGoalSetFromPlayerNoCustomTiles(new HashSet<>(tiles));
|
||||
if (path == null || path.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
return Optional.ofNullable(map.get(path.get(path.size() - 1)));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
package ee.futur.baseapi.collections.query;
|
||||
|
||||
import ee.futur.baseapi.BaseApiPlugin;
|
||||
import ee.futur.baseapi.utils.WorldAreaUtility;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ObjectComposition;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.RuneLite;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class TileObjectQuery {
|
||||
private List<TileObject> tileObjects;
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
|
||||
public TileObjectQuery(List<TileObject> tileObjects) {
|
||||
this.tileObjects = new ArrayList(tileObjects);
|
||||
}
|
||||
|
||||
public TileObjectQuery withName(String name) {
|
||||
tileObjects =
|
||||
tileObjects.stream().filter(tileObject -> {
|
||||
ObjectComposition objectComposition = getObjectComposition(tileObject);
|
||||
if (objectComposition == null)
|
||||
return false;
|
||||
return objectComposition.getName().equals(name);
|
||||
}).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
// public TileObjectQuery withActions(String... actions){
|
||||
//tileObjects =
|
||||
// tileObjects.stream().filter(tileObject -> {
|
||||
// ObjectComposition objectComposition = getObjectComposition(tileObject);
|
||||
// if (objectComposition == null)
|
||||
// return false;
|
||||
// String[] objectActions = objectComposition.getActions();
|
||||
// for (String action : actions) {
|
||||
// if (Arrays.stream(objectActions).filter(Objects::nonNull).anyMatch(a -> a.equalsIgnoreCase(action))) {
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }).collect(Collectors.toList());
|
||||
// return this;
|
||||
// }
|
||||
|
||||
public TileObjectQuery withId(int id) {
|
||||
tileObjects = tileObjects.stream().filter(tileObject -> tileObject.getId() == id).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileObjectQuery withAction(String action) {
|
||||
tileObjects =
|
||||
tileObjects.stream().filter(tileObject ->
|
||||
{
|
||||
ObjectComposition objectComposition = getObjectComposition(tileObject);
|
||||
if (objectComposition == null)
|
||||
return false;
|
||||
String[] actions = getObjectComposition(tileObject).getActions();
|
||||
return Arrays.stream(actions).filter(Objects::nonNull).anyMatch(a -> a.equalsIgnoreCase(action));
|
||||
}).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileObjectQuery atLocation(WorldPoint location) {
|
||||
tileObjects = tileObjects.stream().filter(tileObject -> tileObject.getWorldLocation().equals(location)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileObjectQuery withinDistance(int distance) {
|
||||
tileObjects = tileObjects.stream().filter(tileObject -> tileObject.getWorldLocation().distanceTo(client.getLocalPlayer().getWorldLocation()) <= distance).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileObjectQuery withinBounds(WorldPoint min, WorldPoint max) {
|
||||
int x1 = min.getX();
|
||||
int x2 = max.getX();
|
||||
int y1 = min.getY();
|
||||
int y2 = max.getY();
|
||||
|
||||
tileObjects = tileObjects.stream().filter(tileObject -> {
|
||||
int x3 = tileObject.getWorldLocation().getX();
|
||||
int y3 = tileObject.getWorldLocation().getY();
|
||||
|
||||
if (x3 > Math.max(x1, x2) || x3 < Math.min(x1, x2)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return y3 <= Math.max(y1, y2) && y3 >= Math.min(y1, y2);
|
||||
}).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileObjectQuery atLocation(int x, int y, int plane) {
|
||||
WorldPoint p = new WorldPoint(x, y, plane);
|
||||
tileObjects =
|
||||
tileObjects.stream().filter(tileObject -> tileObject.getWorldLocation().equals(p)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileObjectQuery filter(Predicate<? super TileObject> predicate) {
|
||||
tileObjects = tileObjects.stream().filter(predicate).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileObjectQuery nameContains(String name) {
|
||||
tileObjects =
|
||||
tileObjects.stream().filter(tileObject -> {
|
||||
ObjectComposition comp = getObjectComposition(tileObject);
|
||||
if (comp == null)
|
||||
return false;
|
||||
return comp.getName().contains(name);
|
||||
}).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public TileObjectQuery idInList(List<Integer> ids) {
|
||||
tileObjects = tileObjects.stream().filter(tileObject -> ids.contains(tileObject.getId())).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean empty() {
|
||||
return tileObjects.size() == 0;
|
||||
}
|
||||
|
||||
public List<TileObject> result() {
|
||||
return tileObjects;
|
||||
}
|
||||
|
||||
public Optional<TileObject> first() {
|
||||
return tileObjects.stream().findFirst();
|
||||
}
|
||||
|
||||
public Optional<TileObject> nearestToPlayer() {
|
||||
return tileObjects.stream().min(Comparator.comparingInt(o -> client.getLocalPlayer().getWorldLocation().distanceTo(o.getWorldLocation())));
|
||||
}
|
||||
|
||||
public Optional<TileObject> nearestByPath() {
|
||||
HashMap<WorldPoint, TileObject> map = new HashMap<>();
|
||||
var playerLoc = client.getLocalPlayer().getWorldLocation();
|
||||
for (TileObject tileObject : tileObjects) {
|
||||
List<WorldPoint> adjacentTiles = WorldAreaUtility.objectInteractableTiles(tileObject);
|
||||
for (WorldPoint worldPoint : adjacentTiles) {
|
||||
if (playerLoc.equals(worldPoint)) {
|
||||
return Optional.of(tileObject);
|
||||
}
|
||||
map.put(worldPoint, tileObject);
|
||||
}
|
||||
}
|
||||
|
||||
List<WorldPoint> path = BaseApiPlugin.pathToGoalSetFromPlayerNoCustomTiles(new HashSet<>(map.keySet()));
|
||||
if (path == null || path.isEmpty()) {
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
return Optional.ofNullable(map.get(path.get(path.size() - 1)));
|
||||
}
|
||||
|
||||
public Optional<TileObject> nearestToPoint(WorldPoint point) {
|
||||
return tileObjects.stream().min(Comparator.comparingInt(o -> point.distanceTo(o.getWorldLocation())));
|
||||
}
|
||||
|
||||
public static ObjectComposition getObjectComposition(TileObject tileObject) {
|
||||
if (client.getObjectDefinition(tileObject.getId()).getImpostorIds() == null || client.getObjectDefinition(tileObject.getId()).getImpostor() == null) {
|
||||
return client.getObjectDefinition(tileObject.getId());
|
||||
}
|
||||
return client.getObjectDefinition(tileObject.getId()).getImpostor();
|
||||
}
|
||||
|
||||
public static ObjectComposition getObjectComposition(int id) {
|
||||
if (client.getObjectDefinition(id).getImpostorIds() == null || client.getObjectDefinition(id).getImpostor() == null) {
|
||||
return client.getObjectDefinition(id);
|
||||
}
|
||||
return client.getObjectDefinition(id).getImpostor();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
package ee.futur.baseapi.collections.query;
|
||||
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.util.Text;
|
||||
import net.runelite.client.util.WildcardMatcher;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class WidgetQuery {
|
||||
List<Widget> widgets;
|
||||
|
||||
public WidgetQuery(HashSet<Widget> widgets) {
|
||||
this.widgets = new ArrayList<>(widgets);
|
||||
}
|
||||
|
||||
public List<Widget> result() {
|
||||
return widgets;
|
||||
}
|
||||
|
||||
public WidgetQuery filter(Predicate<? super Widget> predicate) {
|
||||
widgets = widgets.stream().filter(predicate).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public WidgetQuery withAction(String action) {
|
||||
widgets = widgets.stream().filter(x -> {
|
||||
String[] actions = x.getActions();
|
||||
if (actions == null) {
|
||||
return false;
|
||||
}
|
||||
for (String s : actions) {
|
||||
if (s == null) {
|
||||
continue;
|
||||
}
|
||||
if (Text.removeTags(s).equalsIgnoreCase(action)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public boolean empty() {
|
||||
return widgets.isEmpty();
|
||||
}
|
||||
|
||||
public WidgetQuery hiddenState(boolean hidden) {
|
||||
widgets = widgets.stream().filter(widget -> widget.isHidden() == hidden).collect(java.util.stream.Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public WidgetQuery withId(int id) {
|
||||
widgets = widgets.stream().filter(widget -> widget.getId() == id).collect(java.util.stream.Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public WidgetQuery withItemId(int itemId) {
|
||||
widgets = widgets.stream().filter(widget -> widget.getItemId() == itemId).collect(java.util.stream.Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public Optional<Widget> first() {
|
||||
return widgets.stream().findFirst();
|
||||
}
|
||||
|
||||
public WidgetQuery nonPlaceHolder() {
|
||||
return quantityGreaterThan(0);
|
||||
}
|
||||
|
||||
public WidgetQuery itemIdInList(List<Integer> ids) {
|
||||
widgets = widgets.stream().filter(item -> ids.contains(item.getItemId())).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public WidgetQuery quantityGreaterThan(int quanity) {
|
||||
widgets = widgets.stream().filter(item -> item.getItemQuantity() > quanity).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public WidgetQuery nameContains(String name) {
|
||||
widgets =
|
||||
widgets.stream().filter(item -> item.getName() != null && item.getName().contains(name)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public WidgetQuery withName(String name) {
|
||||
widgets = widgets.stream().filter(item -> item.getName() != null && Text.removeTags(item.getName()).equals(name)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public WidgetQuery withText(String text) {
|
||||
widgets = widgets.stream().filter(item -> item.getText() != null && item.getText().equals(text)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public WidgetQuery withTextContains(String text) {
|
||||
widgets = widgets.stream().filter(item -> item.getText() != null && item.getText().contains(text)).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public WidgetQuery withParentId(int parentId) {
|
||||
widgets = widgets.stream().filter(item -> item.getParentId() == parentId).collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
|
||||
public WidgetQuery nameMatchesWildCardNoCase(String input) {
|
||||
widgets =
|
||||
widgets.stream().
|
||||
filter(item -> item.getName() != null && WildcardMatcher.matches(input.toLowerCase(),
|
||||
Text.removeTags(item.getName().toLowerCase()))).
|
||||
collect(Collectors.toList());
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package ee.futur.baseapi.nono.interaction;
|
||||
|
||||
import ee.futur.baseapi.collections.TileObjects;
|
||||
import ee.futur.baseapi.collections.query.TileObjectQuery;
|
||||
import ee.futur.baseapi.nono.packets.MousePackets;
|
||||
import ee.futur.baseapi.nono.packets.ObjectPackets;
|
||||
import net.runelite.api.ObjectComposition;
|
||||
import net.runelite.api.TileObject;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
public class TileObjectInteraction {
|
||||
public static boolean interact(String name, String... actions) {
|
||||
return TileObjects.search().withName(name).first().flatMap(tileObject ->
|
||||
{
|
||||
MousePackets.queueClickPacket();
|
||||
ObjectPackets.queueObjectAction(tileObject, false, actions);
|
||||
return Optional.of(true);
|
||||
}).orElse(false);
|
||||
}
|
||||
|
||||
public static boolean interact(int id, String... actions) {
|
||||
return TileObjects.search().withId(id).first().flatMap(tileObject ->
|
||||
{
|
||||
MousePackets.queueClickPacket();
|
||||
ObjectPackets.queueObjectAction(tileObject, false, actions);
|
||||
return Optional.of(true);
|
||||
}).orElse(false);
|
||||
}
|
||||
|
||||
public static boolean interact(TileObject tileObject, String... actions) {
|
||||
if (tileObject == null) {
|
||||
return false;
|
||||
}
|
||||
ObjectComposition comp = TileObjectQuery.getObjectComposition(tileObject);
|
||||
if (comp == null) {
|
||||
return false;
|
||||
}
|
||||
MousePackets.queueClickPacket();
|
||||
ObjectPackets.queueObjectAction(tileObject, false, actions);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
106
src/main/java/ee/futur/baseapi/nono/packets/BufferMethods.java
Normal file
@@ -0,0 +1,106 @@
|
||||
package ee.futur.baseapi.nono.packets;
|
||||
|
||||
|
||||
import ee.futur.utils.ObfuscatedNames;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class BufferMethods {
|
||||
|
||||
public static void setOffset(Object bufferInstance, int offset) {
|
||||
try {
|
||||
Field offsetField = bufferInstance.getClass().getField(ObfuscatedNames.bufferOffsetField);
|
||||
offsetField.setAccessible(true);
|
||||
offsetField.setInt(bufferInstance, offset);
|
||||
offsetField.setAccessible(false);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static int getOffset(Object bufferInstance) {
|
||||
try {
|
||||
Field offsetField = bufferInstance.getClass().getField(ObfuscatedNames.bufferOffsetField);
|
||||
offsetField.setAccessible(true);
|
||||
int offset = offsetField.getInt(bufferInstance);
|
||||
offsetField.setAccessible(false);
|
||||
return offset;
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
public static void setArray(Object bufferInstance, byte[] array) {
|
||||
try {
|
||||
Field arrayField = bufferInstance.getClass().getField(ObfuscatedNames.bufferArrayField);
|
||||
arrayField.setAccessible(true);
|
||||
arrayField.set(bufferInstance, array);
|
||||
arrayField.setAccessible(false);
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static byte[] getArray(Object bufferInstance) {
|
||||
try {
|
||||
Field arrayField = bufferInstance.getClass().getField(ObfuscatedNames.bufferArrayField);
|
||||
arrayField.setAccessible(true);
|
||||
byte[] array = (byte[]) arrayField.get(bufferInstance);
|
||||
arrayField.setAccessible(false);
|
||||
return array;
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void writeValue(String writeDescription, int value, Object bufferInstance) {
|
||||
int writeTypeMagnitude = writeDescription.contains("v") ? 0 : Integer.parseInt(writeDescription.substring(1).trim());
|
||||
byte[] arr = getArray(bufferInstance);
|
||||
int index = nextIndex(getOffset(bufferInstance));
|
||||
setOffset(bufferInstance, index);
|
||||
index = index * Integer.parseInt(ObfuscatedNames.indexMultiplier) - 1;
|
||||
//System.out.println("Index: " + index);
|
||||
switch (writeDescription.charAt(0)) {
|
||||
case 's':
|
||||
setArray(bufferInstance, writeSub(writeTypeMagnitude, value, arr, index));
|
||||
break;
|
||||
case 'a':
|
||||
setArray(bufferInstance, writeAdd(writeTypeMagnitude, value, arr, index));
|
||||
break;
|
||||
case 'r':
|
||||
setArray(bufferInstance, writeRightShifted(writeTypeMagnitude, value, arr, index));
|
||||
break;
|
||||
case 'v':
|
||||
setArray(bufferInstance, writeVar(value, arr, index));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static byte[] writeSub(int subValue, int value, byte[] arr, int index) {
|
||||
arr[index] = (byte) (subValue - value);
|
||||
return arr;
|
||||
}
|
||||
|
||||
static byte[] writeAdd(int addValue, int value, byte[] arr, int index) {
|
||||
arr[index] = (byte) (addValue + value);
|
||||
return arr;
|
||||
}
|
||||
|
||||
static byte[] writeRightShifted(int shiftAmount, int value, byte[] arr, int index) {
|
||||
arr[index] = (byte) (value >> shiftAmount);
|
||||
return arr;
|
||||
}
|
||||
|
||||
static byte[] writeVar(int value, byte[] arr, int index) {
|
||||
arr[index] = (byte) (value);
|
||||
return arr;
|
||||
}
|
||||
|
||||
static public int nextIndex(int offset) {
|
||||
offset += (int) Long.parseLong(ObfuscatedNames.offsetMultiplier);
|
||||
return offset;
|
||||
}
|
||||
|
||||
}
|
||||
127
src/main/java/ee/futur/baseapi/nono/packets/MousePackets.java
Normal file
@@ -0,0 +1,127 @@
|
||||
package ee.futur.baseapi.nono.packets;
|
||||
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketDef;
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketReflection;
|
||||
import ee.futur.utils.ObfuscatedNames;
|
||||
import lombok.SneakyThrows;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.RuneLite;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import static java.awt.event.InputEvent.BUTTON1_DOWN_MASK;
|
||||
|
||||
public class MousePackets {
|
||||
|
||||
static Client client = RuneLite.getInjector().getInstance(Client.class);
|
||||
private static final Random random = new Random();
|
||||
private static long randomDelay = randomDelay();
|
||||
|
||||
public static BigInteger modInverse(BigInteger val, int bits) {
|
||||
try {
|
||||
BigInteger shift = BigInteger.ONE.shiftLeft(bits);
|
||||
return val.modInverse(shift);
|
||||
} catch (ArithmeticException e) {
|
||||
return val;
|
||||
}
|
||||
}
|
||||
|
||||
public static long modInverse(long val) {
|
||||
return modInverse(BigInteger.valueOf(val), 64).longValue();
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static void queueClickPacket(int x, int y) {
|
||||
long mouseHandlerMS = System.currentTimeMillis();
|
||||
setMouseHandlerLastMillis(mouseHandlerMS);
|
||||
long clientMS = getClientLastMillis();
|
||||
long deltaMs = mouseHandlerMS - clientMS;
|
||||
setClientLastMillis(mouseHandlerMS);
|
||||
if (deltaMs < 0) {
|
||||
deltaMs = 0L;
|
||||
}
|
||||
if (deltaMs > 32767) {
|
||||
deltaMs = 32767L;
|
||||
}
|
||||
int mouseInfo = ((int) deltaMs << 1);
|
||||
PacketReflection.sendPacket(PacketDef.getEventMouseClick(), mouseInfo, x, y, 0);
|
||||
if (checkIdleLogout()) {
|
||||
randomDelay = randomDelay();
|
||||
Executors.newSingleThreadExecutor()
|
||||
.submit(MousePackets::pressKey);
|
||||
}
|
||||
}
|
||||
|
||||
public static void queueClickPacket() {
|
||||
queueClickPacket(0, 0);
|
||||
}
|
||||
|
||||
private static boolean checkIdleLogout() {
|
||||
int idleClientTicks = client.getKeyboardIdleTicks();
|
||||
|
||||
if (client.getMouseIdleTicks() < idleClientTicks) {
|
||||
idleClientTicks = client.getMouseIdleTicks();
|
||||
}
|
||||
|
||||
return idleClientTicks >= randomDelay;
|
||||
}
|
||||
|
||||
private static long randomDelay() {
|
||||
return (long) clamp(
|
||||
Math.round(random.nextGaussian() * 8000)
|
||||
);
|
||||
}
|
||||
|
||||
private static double clamp(double val) {
|
||||
return Math.max(1, Math.min(13000, val));
|
||||
}
|
||||
|
||||
private static void pressKey() {
|
||||
KeyEvent keyPress = new KeyEvent(client.getCanvas(), KeyEvent.KEY_PRESSED, System.currentTimeMillis(), BUTTON1_DOWN_MASK, KeyEvent.VK_BACK_SPACE);
|
||||
client.getCanvas().dispatchEvent(keyPress);
|
||||
KeyEvent keyRelease = new KeyEvent(client.getCanvas(), KeyEvent.KEY_RELEASED, System.currentTimeMillis(), 0, KeyEvent.VK_BACK_SPACE);
|
||||
client.getCanvas().dispatchEvent(keyRelease);
|
||||
KeyEvent keyTyped = new KeyEvent(client.getCanvas(), KeyEvent.KEY_TYPED, System.currentTimeMillis(), 0, KeyEvent.VK_UNDEFINED);
|
||||
client.getCanvas().dispatchEvent(keyTyped);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static long getMouseHandlerLastMillis() {
|
||||
Class<?> mouseHandler = client.getClass().getClassLoader().loadClass(ObfuscatedNames.MouseHandler_lastPressedTimeMillisClass);
|
||||
Field mouseHandlerLastPressedTime = mouseHandler.getDeclaredField(ObfuscatedNames.MouseHandler_lastPressedTimeMillisField);
|
||||
mouseHandlerLastPressedTime.setAccessible(true);
|
||||
long retValue = mouseHandlerLastPressedTime.getLong(null) * Long.parseLong(ObfuscatedNames.mouseHandlerMillisMultiplier);
|
||||
mouseHandlerLastPressedTime.setAccessible(false);
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static long getClientLastMillis() {
|
||||
Field clientLastPressedTimeMillis = client.getClass().getDeclaredField(ObfuscatedNames.clientMillisField);
|
||||
clientLastPressedTimeMillis.setAccessible(true);
|
||||
long retValue = clientLastPressedTimeMillis.getLong(client) * Long.parseLong(ObfuscatedNames.clientMillisMultiplier);
|
||||
clientLastPressedTimeMillis.setAccessible(false);
|
||||
return retValue;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static void setMouseHandlerLastMillis(long time) {
|
||||
Class<?> mouseHandler = client.getClass().getClassLoader().loadClass(ObfuscatedNames.MouseHandler_lastPressedTimeMillisClass);
|
||||
Field mouseHandlerLastPressedTime = mouseHandler.getDeclaredField(ObfuscatedNames.MouseHandler_lastPressedTimeMillisField);
|
||||
mouseHandlerLastPressedTime.setAccessible(true);
|
||||
mouseHandlerLastPressedTime.setLong(null, time * modInverse(Long.parseLong(ObfuscatedNames.mouseHandlerMillisMultiplier)));
|
||||
mouseHandlerLastPressedTime.setAccessible(false);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static void setClientLastMillis(long time) {
|
||||
Field clientLastPressedTimeMillis = client.getClass().getDeclaredField(ObfuscatedNames.clientMillisField);
|
||||
clientLastPressedTimeMillis.setAccessible(true);
|
||||
clientLastPressedTimeMillis.setLong(client, time * modInverse(Long.parseLong(ObfuscatedNames.clientMillisMultiplier)));
|
||||
clientLastPressedTimeMillis.setAccessible(false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package ee.futur.baseapi.nono.packets;
|
||||
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketDef;
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketReflection;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
public class MovementPackets {
|
||||
public static void queueMovement(int worldPointX, int worldPointY, boolean ctrlDown) {
|
||||
int ctrl = ctrlDown ? 1 : 0;
|
||||
PacketReflection.sendPacket(PacketDef.getMoveGameClick(), worldPointX, worldPointY, ctrl, 5);
|
||||
}
|
||||
|
||||
public static void queueMovement(WorldPoint location) {
|
||||
queueMovement(location.getX(), location.getY(), false);
|
||||
}
|
||||
}
|
||||
81
src/main/java/ee/futur/baseapi/nono/packets/NPCPackets.java
Normal file
@@ -0,0 +1,81 @@
|
||||
package ee.futur.baseapi.nono.packets;
|
||||
|
||||
import ee.futur.baseapi.collections.query.NPCQuery;
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketDef;
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketReflection;
|
||||
import lombok.SneakyThrows;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class NPCPackets {
|
||||
|
||||
@SneakyThrows
|
||||
public static void queueNPCAction(int actionFieldNo, int npcIndex, boolean ctrlDown) {
|
||||
int ctrl = ctrlDown ? 1 : 0;
|
||||
switch (actionFieldNo) {
|
||||
case 1:
|
||||
PacketReflection.sendPacket(PacketDef.getOpNpc1(), npcIndex, ctrl);
|
||||
break;
|
||||
case 2:
|
||||
PacketReflection.sendPacket(PacketDef.getOpNpc2(), npcIndex, ctrl);
|
||||
break;
|
||||
case 3:
|
||||
PacketReflection.sendPacket(PacketDef.getOpNpc3(), npcIndex, ctrl);
|
||||
break;
|
||||
case 4:
|
||||
PacketReflection.sendPacket(PacketDef.getOpNpc4(), npcIndex, ctrl);
|
||||
break;
|
||||
case 5:
|
||||
PacketReflection.sendPacket(PacketDef.getOpNpc5(), npcIndex, ctrl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static void queueNPCAction(NPC npc, String... actionList) {
|
||||
if (npc == null) {
|
||||
return;
|
||||
}
|
||||
NPCComposition comp = NPCQuery.getNPCComposition(npc);
|
||||
if (comp == null) {
|
||||
return;
|
||||
}
|
||||
if (comp.getActions() == null) {
|
||||
return;
|
||||
}
|
||||
List<String> actions = Arrays.stream(comp.getActions()).collect(Collectors.toList());
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
if (actions.get(i) == null)
|
||||
continue;
|
||||
actions.set(i, actions.get(i).toLowerCase());
|
||||
}
|
||||
int num = -1;
|
||||
for (String action : actions) {
|
||||
for (String action2 : actionList) {
|
||||
if (action != null && action.equalsIgnoreCase(action2)) {
|
||||
num = actions.indexOf(action.toLowerCase()) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num < 1 || num > 10) {
|
||||
return;
|
||||
}
|
||||
queueNPCAction(num, npc.getIndex(), false);
|
||||
}
|
||||
|
||||
public static void queueWidgetOnNPC(int npcIndex, int sourceItemId, int sourceSlot, int sourceWidgetId,
|
||||
boolean ctrlDown) {
|
||||
int ctrl = ctrlDown ? 1 : 0;
|
||||
PacketReflection.sendPacket(PacketDef.getOpNpcT(), npcIndex, sourceItemId, sourceSlot, sourceWidgetId, ctrl);
|
||||
}
|
||||
|
||||
public static void queueWidgetOnNPC(NPC npc, Widget widget) {
|
||||
queueWidgetOnNPC(npc.getIndex(), widget.getItemId(), widget.getIndex(), widget.getId(), false);
|
||||
}
|
||||
}
|
||||
107
src/main/java/ee/futur/baseapi/nono/packets/ObjectPackets.java
Normal file
@@ -0,0 +1,107 @@
|
||||
package ee.futur.baseapi.nono.packets;
|
||||
|
||||
import ee.futur.baseapi.collections.query.TileObjectQuery;
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketDef;
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketReflection;
|
||||
import lombok.SneakyThrows;
|
||||
import net.runelite.api.GameObject;
|
||||
import net.runelite.api.ObjectComposition;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ObjectPackets {
|
||||
@SneakyThrows
|
||||
public static void queueObjectAction(int actionFieldNo, int objectId, int worldPointX, int worldPointY,
|
||||
boolean ctrlDown) {
|
||||
int ctrl = ctrlDown ? 1 : 0;
|
||||
switch (actionFieldNo) {
|
||||
case 1:
|
||||
PacketReflection.sendPacket(PacketDef.getOpLoc1(), objectId, worldPointX, worldPointY, ctrl);
|
||||
break;
|
||||
case 2:
|
||||
PacketReflection.sendPacket(PacketDef.getOpLoc2(), objectId, worldPointX, worldPointY, ctrl);
|
||||
break;
|
||||
case 3:
|
||||
PacketReflection.sendPacket(PacketDef.getOpLoc3(), objectId, worldPointX, worldPointY, ctrl);
|
||||
break;
|
||||
case 4:
|
||||
PacketReflection.sendPacket(PacketDef.getOpLoc4(), objectId, worldPointX, worldPointY, ctrl);
|
||||
break;
|
||||
case 5:
|
||||
PacketReflection.sendPacket(PacketDef.getOpLoc5(), objectId, worldPointX, worldPointY, ctrl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static void queueObjectAction(TileObject object, boolean ctrlDown, String... actionlist) {
|
||||
if (object == null) {
|
||||
return;
|
||||
}
|
||||
ObjectComposition comp = TileObjectQuery.getObjectComposition(object);
|
||||
if (comp == null) {
|
||||
return;
|
||||
}
|
||||
if (comp.getActions() == null) {
|
||||
return;
|
||||
}
|
||||
List<String> actions = Arrays.stream(comp.getActions()).collect(Collectors.toList());
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
if (actions.get(i) == null)
|
||||
continue;
|
||||
actions.set(i, actions.get(i).toLowerCase());
|
||||
}
|
||||
Point p;
|
||||
if (object instanceof GameObject) {
|
||||
GameObject gameObject = (GameObject) object;
|
||||
p = gameObject.getSceneMinLocation();
|
||||
} else {
|
||||
p = new Point(object.getLocalLocation().getSceneX(), object.getLocalLocation().getSceneY());
|
||||
}
|
||||
LocalPoint lp = new LocalPoint(p.getX(), p.getY());
|
||||
WorldPoint wp = WorldPoint.fromScene(PacketReflection.getClient(), lp.getX(), lp.getY(), object.getPlane());
|
||||
int num = -1;
|
||||
for (String action : actions) {
|
||||
for (String action2 : actionlist) {
|
||||
if (action != null && action.equalsIgnoreCase(action2.toLowerCase())) {
|
||||
num = actions.indexOf(action) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num < 1 || num > 10) {
|
||||
return;
|
||||
}
|
||||
queueObjectAction(num, object.getId(), wp.getX(), wp.getY(), ctrlDown);
|
||||
}
|
||||
|
||||
public static void queueWidgetOnTileObject(int objectId, int worldPointX, int worldPointY, int sourceSlot,
|
||||
int sourceItemId, int sourceWidgetId, boolean ctrlDown) {
|
||||
int ctrl = ctrlDown ? 1 : 0;
|
||||
PacketReflection.sendPacket(PacketDef.getOpLocT(), objectId, worldPointX, worldPointY, sourceSlot, sourceItemId,
|
||||
sourceWidgetId, ctrl);
|
||||
}
|
||||
|
||||
public static void queueWidgetOnTileObject(Widget widget, TileObject object) {
|
||||
Point p;
|
||||
if (object instanceof GameObject) {
|
||||
GameObject gameObject = (GameObject) object;
|
||||
p = gameObject.getSceneMinLocation();
|
||||
} else {
|
||||
p = new Point(object.getLocalLocation().getSceneX(), object.getLocalLocation().getSceneY());
|
||||
}
|
||||
LocalPoint lp = new LocalPoint(p.getX(), p.getY());
|
||||
WorldPoint wp = WorldPoint.fromScene(PacketReflection.getClient(), lp.getX(), lp.getY(), object.getPlane());
|
||||
queueWidgetOnTileObject(object.getId(), wp.getX(), wp.getY(), widget.getIndex(),
|
||||
widget.getItemId(),
|
||||
widget.getId(),
|
||||
false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
package ee.futur.baseapi.nono.packets;
|
||||
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketDef;
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketReflection;
|
||||
import lombok.SneakyThrows;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class PlayerPackets {
|
||||
@SneakyThrows
|
||||
public static void queuePlayerAction(int actionFieldNo, int playerIndex, boolean ctrlDown) {
|
||||
int ctrl = ctrlDown ? 1 : 0;
|
||||
switch (actionFieldNo) {
|
||||
case 1:
|
||||
PacketReflection.sendPacket(PacketDef.getOpPlayer1(), playerIndex, ctrl);
|
||||
break;
|
||||
case 2:
|
||||
PacketReflection.sendPacket(PacketDef.getOpPlayer2(), playerIndex, ctrl);
|
||||
break;
|
||||
case 3:
|
||||
PacketReflection.sendPacket(PacketDef.getOpPlayer3(), playerIndex, ctrl);
|
||||
break;
|
||||
case 4:
|
||||
PacketReflection.sendPacket(PacketDef.getOpPlayer4(), playerIndex, ctrl);
|
||||
break;
|
||||
case 5:
|
||||
PacketReflection.sendPacket(PacketDef.getOpPlayer5(), playerIndex, ctrl);
|
||||
break;
|
||||
case 6:
|
||||
PacketReflection.sendPacket(PacketDef.getOpPlayer6(), playerIndex, ctrl);
|
||||
break;
|
||||
case 7:
|
||||
PacketReflection.sendPacket(PacketDef.getOpPlayer7(), playerIndex, ctrl);
|
||||
break;
|
||||
case 8:
|
||||
PacketReflection.sendPacket(PacketDef.getOpPlayer8(), playerIndex, ctrl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static void queuePlayerAction(Player player, String... actionlist) {
|
||||
List<String> actions = Arrays.stream(PacketReflection.getClient().getPlayerOptions()).collect(Collectors.toList());
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
if (actions.get(i) == null)
|
||||
continue;
|
||||
actions.set(i, actions.get(i).toLowerCase());
|
||||
}
|
||||
int num = -1;
|
||||
for (String action : actions) {
|
||||
for (String action2 : actionlist) {
|
||||
if (action != null && action.equalsIgnoreCase(action2)) {
|
||||
num = actions.indexOf(action.toLowerCase()) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num < 1 || num > 10) {
|
||||
return;
|
||||
}
|
||||
queuePlayerAction(num, player.getId(), false);
|
||||
}
|
||||
|
||||
public static void queueWidgetOnPlayer(int playerIndex, int sourceItemId, int sourceSlot, int sourceWidgetId,
|
||||
boolean ctrlDown) {
|
||||
int ctrl = ctrlDown ? 1 : 0;
|
||||
PacketReflection.sendPacket(PacketDef.getOpPlayerT(), playerIndex, sourceItemId, sourceSlot, sourceWidgetId, ctrl);
|
||||
}
|
||||
|
||||
public static void queueWidgetOnPlayer(Player player, Widget widget) {
|
||||
queueWidgetOnPlayer(player.getId(), widget.getItemId(), widget.getIndex(), widget.getId(), false);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package ee.futur.baseapi.nono.packets;
|
||||
|
||||
import ee.futur.baseapi.collections.ETileItem;
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketDef;
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketReflection;
|
||||
import lombok.SneakyThrows;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
public class TileItemPackets {
|
||||
@SneakyThrows
|
||||
public static void queueTileItemAction(int actionFieldNo, int objectId, int worldPointX, int worldPointY,
|
||||
boolean ctrlDown) {
|
||||
int ctrl = ctrlDown ? 1 : 0;
|
||||
switch (actionFieldNo) {
|
||||
case 1:
|
||||
PacketReflection.sendPacket(PacketDef.getOpObj1(), objectId, worldPointX, worldPointY, ctrl);
|
||||
break;
|
||||
case 2:
|
||||
PacketReflection.sendPacket(PacketDef.getOpObj2(), objectId, worldPointX, worldPointY, ctrl);
|
||||
break;
|
||||
case 3:
|
||||
PacketReflection.sendPacket(PacketDef.getOpObj3(), objectId, worldPointX, worldPointY, ctrl);
|
||||
break;
|
||||
case 4:
|
||||
PacketReflection.sendPacket(PacketDef.getOpObj4(), objectId, worldPointX, worldPointY, ctrl);
|
||||
break;
|
||||
case 5:
|
||||
PacketReflection.sendPacket(PacketDef.getOpObj5(), objectId, worldPointX, worldPointY, ctrl);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void queueWidgetOnTileItem(int objectId, int worldPointX, int worldPointY, int sourceSlot,
|
||||
int sourceItemId, int sourceWidgetId, boolean ctrlDown) {
|
||||
int ctrl = ctrlDown ? 1 : 0;
|
||||
PacketReflection.sendPacket(PacketDef.getOpObjT(), objectId, worldPointX, worldPointY, sourceSlot, sourceItemId,
|
||||
sourceWidgetId, ctrl);
|
||||
}
|
||||
|
||||
public static void queueTileItemAction(ETileItem item, boolean ctrlDown) {
|
||||
queueTileItemAction(3, item.getTileItem().getId(), item.getLocation().getX(), item.getLocation().getY(),
|
||||
ctrlDown);
|
||||
}
|
||||
|
||||
public static void queueWidgetOnTileItem(ETileItem item, Widget w,
|
||||
boolean ctrlDown) {
|
||||
queueWidgetOnTileItem(item.getTileItem().getId(), item.getLocation().getX(), item.getLocation().getY(),
|
||||
w.getIndex(), w.getItemId(), w.getId(), ctrlDown);
|
||||
}
|
||||
}
|
||||
118
src/main/java/ee/futur/baseapi/nono/packets/WidgetPackets.java
Normal file
@@ -0,0 +1,118 @@
|
||||
package ee.futur.baseapi.nono.packets;
|
||||
|
||||
import ee.futur.baseapi.BaseApiPlugin;
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketDef;
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketReflection;
|
||||
import lombok.SneakyThrows;
|
||||
import net.runelite.api.ItemComposition;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class WidgetPackets {
|
||||
@SneakyThrows
|
||||
public static void queueWidgetActionPacket(int actionFieldNo, int widgetId, int itemId, int childId) {
|
||||
PacketReflection.sendPacket(PacketDef.getIfButtonX(), widgetId, childId, itemId, actionFieldNo & 65535);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static void queueWidgetSubAction(Widget widget, String menu, String action) {
|
||||
if (widget == null || widget.getItemId() == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemComposition composition = BaseApiPlugin.getClient().getItemDefinition(widget.getItemId());
|
||||
String[][] subOps = composition.getSubops();
|
||||
List<String> actions = Arrays.stream(widget.getActions()).collect(Collectors.toList());
|
||||
|
||||
int menuIndex = -1;
|
||||
int actionIndex = -1;
|
||||
|
||||
if (subOps == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (String[] subOp : subOps) {
|
||||
if (actionIndex != -1) {
|
||||
break;
|
||||
}
|
||||
if (subOp != null) {
|
||||
for (int i = 0; i < subOp.length; i++) {
|
||||
String op = subOp[i];
|
||||
if (op != null && op.equalsIgnoreCase(action)) {
|
||||
actionIndex = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
String a = actions.get(i);
|
||||
if (a != null && a.equalsIgnoreCase(menu)) {
|
||||
menuIndex = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (menuIndex == -1 || actionIndex == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
PacketReflection.sendPacket(PacketDef.getIfSubOp(), widget.getId(), widget.getIndex(),
|
||||
widget.getItemId(), menuIndex, actionIndex);
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static void queueWidgetAction(Widget widget, String... actionlist) {
|
||||
if (widget == null) {
|
||||
return;
|
||||
}
|
||||
List<String> actions = Arrays.stream(widget.getActions()).collect(Collectors.toList());
|
||||
for (int i = 0; i < actions.size(); i++) {
|
||||
if (actions.get(i) == null)
|
||||
continue;
|
||||
actions.set(i, actions.get(i).toLowerCase());
|
||||
}
|
||||
int num = -1;
|
||||
for (String action : actions) {
|
||||
for (String action2 : actionlist) {
|
||||
if (action != null && Text.removeTags(action).equalsIgnoreCase(action2)) {
|
||||
num = actions.indexOf(action.toLowerCase()) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (num < 1 || num > 10) {
|
||||
return;
|
||||
}
|
||||
queueWidgetActionPacket(num, widget.getId(), widget.getItemId(), widget.getIndex());
|
||||
}
|
||||
|
||||
public static void queueWidgetOnWidget(Widget srcWidget, Widget destWidget) {
|
||||
queueWidgetOnWidget(srcWidget.getId(), srcWidget.getIndex(), srcWidget.getItemId(),
|
||||
destWidget.getId(), destWidget.getIndex(), destWidget.getItemId());
|
||||
}
|
||||
|
||||
public static void queueWidgetOnWidget(int sourceWidgetId, int sourceSlot, int sourceItemId,
|
||||
int destinationWidgetId, int destinationSlot, int destinationItemId) {
|
||||
PacketReflection.sendPacket(PacketDef.getIfButtonT(), sourceWidgetId, sourceSlot, sourceItemId, destinationWidgetId,
|
||||
destinationSlot, destinationItemId);
|
||||
}
|
||||
|
||||
public static void queueResumePause(int widgetId, int childId) {
|
||||
PacketReflection.sendPacket(PacketDef.getResumePausebutton(), widgetId, childId);
|
||||
}
|
||||
|
||||
public static void queueResumeCount(int id) {
|
||||
PacketReflection.sendPacket(PacketDef.getResumeCountDialog(), id);
|
||||
}
|
||||
|
||||
public static void queueDragAndDrop(Widget src, Widget dest) {
|
||||
PacketReflection.sendPacket(PacketDef.getOpHeldd(), src.getId(), src.getIndex(),
|
||||
src.getItemId(), dest.getId(), dest.getIndex(), dest.getItemId());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,523 @@
|
||||
package ee.futur.baseapi.nono.packets.utils;
|
||||
|
||||
public final class ObfuscatedNames {
|
||||
|
||||
// public static final String EVENT_MOUSE_CLICK_OBFUSCATEDNAME = "cv";
|
||||
// public static final String EVENT_MOUSE_CLICK_WRITE1 = "mouseInfo";
|
||||
// public static final String EVENT_MOUSE_CLICK_METHOD_NAME1 = "xg";
|
||||
// public static final String EVENT_MOUSE_CLICK_WRITE2 = "mouseY";
|
||||
// public static final String EVENT_MOUSE_CLICK_METHOD_NAME2 = "xg";
|
||||
// public static final String EVENT_MOUSE_CLICK_WRITE3 = "mouseX";
|
||||
// public static final String EVENT_MOUSE_CLICK_METHOD_NAME3 = "xg";
|
||||
// public static final String[][] EVENT_MOUSE_CLICK_WRITES = new String[][] {
|
||||
// {"r 8", "v"},
|
||||
// {"r 8", "v"},
|
||||
// {"r 8", "v"}
|
||||
// };
|
||||
|
||||
// when officially live we switch to MOUSE_V2 packet
|
||||
public static final String EVENT_MOUSE_CLICK_OBFUSCATEDNAME = "ch";
|
||||
public static final String EVENT_MOUSE_CLICK_WRITE1 = "mouseX";
|
||||
public static final String EVENT_MOUSE_CLICK_METHOD_NAME1 = "dy";
|
||||
public static final String EVENT_MOUSE_CLICK_WRITE2 = "mouseInfo";
|
||||
public static final String EVENT_MOUSE_CLICK_METHOD_NAME2 = "kl";
|
||||
public static final String EVENT_MOUSE_CLICK_WRITE3 = "0";
|
||||
public static final String EVENT_MOUSE_CLICK_METHOD_NAME3 = "bg";
|
||||
public static final String EVENT_MOUSE_CLICK_WRITE4 = "mouseY";
|
||||
public static final String EVENT_MOUSE_CLICK_METHOD_NAME4 = "kl";
|
||||
public static final String[][] EVENT_MOUSE_CLICK_WRITES = new String[][] {
|
||||
{"v", "r 8"},
|
||||
{"a 128", "r 8"},
|
||||
{"v"},
|
||||
{"a 128", "r 8"},
|
||||
};
|
||||
|
||||
public static final String IF_BUTTONT_OBFUSCATEDNAME = "cn";
|
||||
public static final String IF_BUTTONT_WRITE1 = "destinationItemId";
|
||||
public static final String IF_BUTTONT_METHOD_NAME1 = "kl";
|
||||
public static final String IF_BUTTONT_WRITE2 = "destinationWidgetId";
|
||||
public static final String IF_BUTTONT_METHOD_NAME2 = "eg";
|
||||
public static final String IF_BUTTONT_WRITE3 = "sourceItemId";
|
||||
public static final String IF_BUTTONT_METHOD_NAME3 = "mp";
|
||||
public static final String IF_BUTTONT_WRITE4 = "destinationSlot";
|
||||
public static final String IF_BUTTONT_METHOD_NAME4 = "kl";
|
||||
public static final String IF_BUTTONT_WRITE5 = "sourceWidgetId";
|
||||
public static final String IF_BUTTONT_METHOD_NAME5 = "eg";
|
||||
public static final String IF_BUTTONT_WRITE6 = "sourceSlot";
|
||||
public static final String IF_BUTTONT_METHOD_NAME6 = "mp";
|
||||
public static final String[][] IF_BUTTONT_WRITES = new String[][]{
|
||||
{"a 128", "r 8"},
|
||||
{"r 8", "v", "r 24", "r 16"},
|
||||
{"r 8", "a 128"},
|
||||
{"a 128", "r 8"},
|
||||
{"r 8", "v", "r 24", "r 16"},
|
||||
{"r 8", "a 128"},
|
||||
};
|
||||
|
||||
public static final String IF_BUTTONX_OBFUSCATEDNAME = "al";
|
||||
public static final String IF_BUTTONX_WRITE1 = "widgetId";
|
||||
public static final String IF_BUTTONX_METHOD_NAME_1 = "bu";
|
||||
public static final String IF_BUTTONX_WRITE2 = "slot";
|
||||
public static final String IF_BUTTONX_METHOD_NAME_2 = "bt";
|
||||
public static final String IF_BUTTONX_WRITE3 = "itemId";
|
||||
public static final String IF_BUTTONX_METHOD_NAME_3 = "bt";
|
||||
public static final String IF_BUTTONX_WRITE4 = "opCode";
|
||||
public static final String IF_BUTTONX_METHOD_NAME_4 = "bg";
|
||||
public static final String[][] IF_BUTTONX_WRITES = {
|
||||
{"r 24", "r 16", "r 8", "v"},
|
||||
{"r 8", "v"},
|
||||
{"r 8", "v"},
|
||||
{"v"},
|
||||
};
|
||||
|
||||
public static final String IF_SUBOP_OBFUSCATEDNAME = "dj";
|
||||
public static final String IF_SUBOP_WRITE1 = "widgetId";
|
||||
public static final String IF_SUBOP_METHOD_NAME1 = "bu";
|
||||
public static final String IF_SUBOP_WRITE2 = "slot";
|
||||
public static final String IF_SUBOP_METHOD_NAME2 = "bt";
|
||||
public static final String IF_SUBOP_WRITE3 = "itemId";
|
||||
public static final String IF_SUBOP_METHOD_NAME3 = "bt";
|
||||
public static final String IF_SUBOP_WRITE4 = "menuIndex";
|
||||
public static final String IF_SUBOP_METHOD_NAME4 = "bg";
|
||||
public static final String IF_SUBOP_WRITE5 = "subActionIndex";
|
||||
public static final String IF_SUBOP_METHOD_NAME5 = "bg";
|
||||
public static final String[][] IF_SUBOP_WRITES = new String[][]{
|
||||
{"r 24", "r 16", "r 8", "v"},
|
||||
{"r 8", "v"},
|
||||
{"r 8", "v"},
|
||||
{"v"},
|
||||
{"v"}
|
||||
};
|
||||
|
||||
public static final String MOVE_GAMECLICK_OBFUSCATEDNAME = "bd";
|
||||
public static final String MOVE_GAMECLICK_WRITE1 = "5";
|
||||
public static final String MOVE_GAMECLICK_METHOD_NAME1 = "bg";
|
||||
public static final String MOVE_GAMECLICK_WRITE2 = "worldPointX";
|
||||
public static final String MOVE_GAMECLICK_METHOD_NAME2 = "dy";
|
||||
public static final String MOVE_GAMECLICK_WRITE3 = "worldPointY";
|
||||
public static final String MOVE_GAMECLICK_METHOD_NAME3 = "dy";
|
||||
public static final String MOVE_GAMECLICK_WRITE4 = "ctrlDown";
|
||||
public static final String MOVE_GAMECLICK_METHOD_NAME4 = "bg";
|
||||
public static final String[][] MOVE_GAMECLICK_WRITES = new String[][]{
|
||||
{"v"},
|
||||
{"v", "r 8"},
|
||||
{"v", "r 8"},
|
||||
{"v"},
|
||||
};
|
||||
public static final String OPLOC1_OBFUSCATEDNAME = "bi";
|
||||
public static final String OPLOC1_WRITE1 = "objectId";
|
||||
public static final String OPLOC1_METHOD_NAME1 = "bt";
|
||||
public static final String OPLOC1_WRITE2 = "ctrlDown";
|
||||
public static final String OPLOC1_METHOD_NAME2 = "db";
|
||||
public static final String OPLOC1_WRITE3 = "worldPointX";
|
||||
public static final String OPLOC1_METHOD_NAME3 = "dy";
|
||||
public static final String OPLOC1_WRITE4 = "worldPointY";
|
||||
public static final String OPLOC1_METHOD_NAME4 = "bt";
|
||||
public static final String[][] OPLOC1_WRITES = new String[][]{
|
||||
{"r 8", "v"},
|
||||
{"s 0"},
|
||||
{"v", "r 8"},
|
||||
{"r 8", "v"},
|
||||
};
|
||||
public static final String OPLOC2_OBFUSCATEDNAME = "bw";
|
||||
public static final String OPLOC2_WRITE1 = "worldPointX";
|
||||
public static final String OPLOC2_METHOD_NAME1 = "mp";
|
||||
public static final String OPLOC2_WRITE2 = "objectId";
|
||||
public static final String OPLOC2_METHOD_NAME2 = "bt";
|
||||
public static final String OPLOC2_WRITE3 = "worldPointY";
|
||||
public static final String OPLOC2_METHOD_NAME3 = "mp";
|
||||
public static final String OPLOC2_WRITE4 = "ctrlDown";
|
||||
public static final String OPLOC2_METHOD_NAME4 = "dg";
|
||||
public static final String[][] OPLOC2_WRITES = new String[][]{
|
||||
{"r 8", "a 128"},
|
||||
{"r 8", "v"},
|
||||
{"r 8", "a 128"},
|
||||
{"a 128"},
|
||||
};
|
||||
public static final String OPLOC3_OBFUSCATEDNAME = "by";
|
||||
public static final String OPLOC3_WRITE1 = "worldPointY";
|
||||
public static final String OPLOC3_METHOD_NAME1 = "dy";
|
||||
public static final String OPLOC3_WRITE2 = "ctrlDown";
|
||||
public static final String OPLOC3_METHOD_NAME2 = "dg";
|
||||
public static final String OPLOC3_WRITE3 = "worldPointX";
|
||||
public static final String OPLOC3_METHOD_NAME3 = "kl";
|
||||
public static final String OPLOC3_WRITE4 = "objectId";
|
||||
public static final String OPLOC3_METHOD_NAME4 = "kl";
|
||||
public static final String[][] OPLOC3_WRITES = new String[][]{
|
||||
{"v", "r 8"},
|
||||
{"a 128"},
|
||||
{"a 128", "r 8"},
|
||||
{"a 128", "r 8"},
|
||||
};
|
||||
public static final String OPLOC4_OBFUSCATEDNAME = "dk";
|
||||
public static final String OPLOC4_WRITE1 = "objectId";
|
||||
public static final String OPLOC4_METHOD_NAME1 = "bt";
|
||||
public static final String OPLOC4_WRITE2 = "worldPointX";
|
||||
public static final String OPLOC4_METHOD_NAME2 = "bt";
|
||||
public static final String OPLOC4_WRITE3 = "ctrlDown";
|
||||
public static final String OPLOC4_METHOD_NAME3 = "bg";
|
||||
public static final String OPLOC4_WRITE4 = "worldPointY";
|
||||
public static final String OPLOC4_METHOD_NAME4 = "mp";
|
||||
public static final String[][] OPLOC4_WRITES = new String[][]{
|
||||
{"r 8", "v"},
|
||||
{"r 8", "v"},
|
||||
{"v"},
|
||||
{"r 8", "a 128"},
|
||||
};
|
||||
public static final String OPLOC5_OBFUSCATEDNAME = "cl";
|
||||
public static final String OPLOC5_WRITE1 = "objectId";
|
||||
public static final String OPLOC5_METHOD_NAME1 = "bt";
|
||||
public static final String OPLOC5_WRITE2 = "ctrlDown";
|
||||
public static final String OPLOC5_METHOD_NAME2 = "db";
|
||||
public static final String OPLOC5_WRITE3 = "worldPointY";
|
||||
public static final String OPLOC5_METHOD_NAME3 = "kl";
|
||||
public static final String OPLOC5_WRITE4 = "worldPointX";
|
||||
public static final String OPLOC5_METHOD_NAME4 = "bt";
|
||||
public static final String[][] OPLOC5_WRITES = new String[][]{
|
||||
{"r 8", "v"},
|
||||
{"s 0"},
|
||||
{"a 128", "r 8"},
|
||||
{"r 8", "v"},
|
||||
};
|
||||
public static final String OPLOCT_OBFUSCATEDNAME = "ah";
|
||||
public static final String OPLOCT_WRITE1 = "ctrlDown";
|
||||
public static final String OPLOCT_METHOD_NAME1 = "dh";
|
||||
public static final String OPLOCT_WRITE2 = "slot";
|
||||
public static final String OPLOCT_METHOD_NAME2 = "dy";
|
||||
public static final String OPLOCT_WRITE3 = "worldPointX";
|
||||
public static final String OPLOCT_METHOD_NAME3 = "dy";
|
||||
public static final String OPLOCT_WRITE4 = "objectId";
|
||||
public static final String OPLOCT_METHOD_NAME4 = "kl";
|
||||
public static final String OPLOCT_WRITE5 = "worldPointY";
|
||||
public static final String OPLOCT_METHOD_NAME5 = "bt";
|
||||
public static final String OPLOCT_WRITE6 = "itemId";
|
||||
public static final String OPLOCT_METHOD_NAME6 = "dy";
|
||||
public static final String OPLOCT_WRITE7 = "widgetId";
|
||||
public static final String OPLOCT_METHOD_NAME7 = "eg";
|
||||
public static final String[][] OPLOCT_WRITES = new String[][]{
|
||||
{"s 128"},
|
||||
{"v", "r 8"},
|
||||
{"v", "r 8"},
|
||||
{"a 128", "r 8"},
|
||||
{"r 8", "v"},
|
||||
{"v", "r 8"},
|
||||
{"r 8", "v", "r 24", "r 16"},
|
||||
};
|
||||
public static final String OPNPC1_OBFUSCATEDNAME = "ac";
|
||||
public static final String OPNPC1_WRITE1 = "npcIndex";
|
||||
public static final String OPNPC1_METHOD_NAME1 = "dy";
|
||||
public static final String OPNPC1_WRITE2 = "ctrlDown";
|
||||
public static final String OPNPC1_METHOD_NAME2 = "dh";
|
||||
public static final String[][] OPNPC1_WRITES = new String[][]{
|
||||
{"v", "r 8"},
|
||||
{"s 128"},
|
||||
};
|
||||
public static final String OPNPC2_OBFUSCATEDNAME = "cr";
|
||||
public static final String OPNPC2_WRITE1 = "ctrlDown";
|
||||
public static final String OPNPC2_METHOD_NAME1 = "bg";
|
||||
public static final String OPNPC2_WRITE2 = "npcIndex";
|
||||
public static final String OPNPC2_METHOD_NAME2 = "kl";
|
||||
public static final String[][] OPNPC2_WRITES = new String[][]{
|
||||
{"v"},
|
||||
{"a 128", "r 8"},
|
||||
};
|
||||
public static final String OPNPC3_OBFUSCATEDNAME = "dw";
|
||||
public static final String OPNPC3_WRITE1 = "npcIndex";
|
||||
public static final String OPNPC3_METHOD_NAME1 = "dy";
|
||||
public static final String OPNPC3_WRITE2 = "ctrlDown";
|
||||
public static final String OPNPC3_METHOD_NAME2 = "dh";
|
||||
public static final String[][] OPNPC3_WRITES = new String[][]{
|
||||
{"v", "r 8"},
|
||||
{"s 128"},
|
||||
};
|
||||
public static final String OPNPC4_OBFUSCATEDNAME = "ar";
|
||||
public static final String OPNPC4_WRITE1 = "npcIndex";
|
||||
public static final String OPNPC4_METHOD_NAME1 = "mp";
|
||||
public static final String OPNPC4_WRITE2 = "ctrlDown";
|
||||
public static final String OPNPC4_METHOD_NAME2 = "dh";
|
||||
public static final String[][] OPNPC4_WRITES = new String[][]{
|
||||
{"r 8", "a 128"},
|
||||
{"s 128"},
|
||||
};
|
||||
public static final String OPNPC5_OBFUSCATEDNAME = "ab";
|
||||
public static final String OPNPC5_WRITE1 = "npcIndex";
|
||||
public static final String OPNPC5_METHOD_NAME1 = "dy";
|
||||
public static final String OPNPC5_WRITE2 = "ctrlDown";
|
||||
public static final String OPNPC5_METHOD_NAME2 = "dg";
|
||||
public static final String[][] OPNPC5_WRITES = new String[][]{
|
||||
{"v", "r 8"},
|
||||
{"a 128"},
|
||||
};
|
||||
public static final String OPNPCT_OBFUSCATEDNAME = "cf";
|
||||
public static final String OPNPCT_WRITE1 = "slot";
|
||||
public static final String OPNPCT_METHOD_NAME1 = "kl";
|
||||
public static final String OPNPCT_WRITE2 = "widgetId";
|
||||
public static final String OPNPCT_METHOD_NAME2 = "es";
|
||||
public static final String OPNPCT_WRITE3 = "itemId";
|
||||
public static final String OPNPCT_METHOD_NAME3 = "dy";
|
||||
public static final String OPNPCT_WRITE4 = "npcIndex";
|
||||
public static final String OPNPCT_METHOD_NAME4 = "bt";
|
||||
public static final String OPNPCT_WRITE5 = "ctrlDown";
|
||||
public static final String OPNPCT_METHOD_NAME5 = "db";
|
||||
public static final String[][] OPNPCT_WRITES = new String[][]{
|
||||
{"a 128", "r 8"},
|
||||
{"r 16", "r 24", "v", "r 8"},
|
||||
{"v", "r 8"},
|
||||
{"r 8", "v"},
|
||||
{"s 0"},
|
||||
};
|
||||
public static final String OPOBJ1_OBFUSCATEDNAME = "ct";
|
||||
public static final String OPOBJ1_WRITE1 = "ctrlDown";
|
||||
public static final String OPOBJ1_METHOD_NAME1 = "dg";
|
||||
public static final String OPOBJ1_WRITE2 = "worldPointY";
|
||||
public static final String OPOBJ1_METHOD_NAME2 = "dy";
|
||||
public static final String OPOBJ1_WRITE3 = "objectId";
|
||||
public static final String OPOBJ1_METHOD_NAME3 = "dy";
|
||||
public static final String OPOBJ1_WRITE4 = "worldPointX";
|
||||
public static final String OPOBJ1_METHOD_NAME4 = "bt";
|
||||
public static final String[][] OPOBJ1_WRITES = new String[][]{
|
||||
{"a 128"},
|
||||
{"v", "r 8"},
|
||||
{"v", "r 8"},
|
||||
{"r 8", "v"},
|
||||
};
|
||||
public static final String OPOBJ2_OBFUSCATEDNAME = "be";
|
||||
public static final String OPOBJ2_WRITE1 = "worldPointX";
|
||||
public static final String OPOBJ2_METHOD_NAME1 = "mp";
|
||||
public static final String OPOBJ2_WRITE2 = "worldPointY";
|
||||
public static final String OPOBJ2_METHOD_NAME2 = "dy";
|
||||
public static final String OPOBJ2_WRITE3 = "ctrlDown";
|
||||
public static final String OPOBJ2_METHOD_NAME3 = "bg";
|
||||
public static final String OPOBJ2_WRITE4 = "objectId";
|
||||
public static final String OPOBJ2_METHOD_NAME4 = "bt";
|
||||
public static final String[][] OPOBJ2_WRITES = new String[][]{
|
||||
{"r 8", "a 128"},
|
||||
{"v", "r 8"},
|
||||
{"v"},
|
||||
{"r 8", "v"},
|
||||
};
|
||||
public static final String OPOBJ3_OBFUSCATEDNAME = "cu";
|
||||
public static final String OPOBJ3_WRITE1 = "worldPointY";
|
||||
public static final String OPOBJ3_METHOD_NAME1 = "mp";
|
||||
public static final String OPOBJ3_WRITE2 = "ctrlDown";
|
||||
public static final String OPOBJ3_METHOD_NAME2 = "bg";
|
||||
public static final String OPOBJ3_WRITE3 = "worldPointX";
|
||||
public static final String OPOBJ3_METHOD_NAME3 = "kl";
|
||||
public static final String OPOBJ3_WRITE4 = "objectId";
|
||||
public static final String OPOBJ3_METHOD_NAME4 = "mp";
|
||||
public static final String[][] OPOBJ3_WRITES = new String[][]{
|
||||
{"r 8", "a 128"},
|
||||
{"v"},
|
||||
{"a 128", "r 8"},
|
||||
{"r 8", "a 128"},
|
||||
};
|
||||
public static final String OPOBJ4_OBFUSCATEDNAME = "ao";
|
||||
public static final String OPOBJ4_WRITE1 = "worldPointX";
|
||||
public static final String OPOBJ4_METHOD_NAME1 = "dy";
|
||||
public static final String OPOBJ4_WRITE2 = "ctrlDown";
|
||||
public static final String OPOBJ4_METHOD_NAME2 = "dh";
|
||||
public static final String OPOBJ4_WRITE3 = "worldPointY";
|
||||
public static final String OPOBJ4_METHOD_NAME3 = "dy";
|
||||
public static final String OPOBJ4_WRITE4 = "objectId";
|
||||
public static final String OPOBJ4_METHOD_NAME4 = "dy";
|
||||
public static final String[][] OPOBJ4_WRITES = new String[][]{
|
||||
{"v", "r 8"},
|
||||
{"s 128"},
|
||||
{"v", "r 8"},
|
||||
{"v", "r 8"},
|
||||
};
|
||||
public static final String OPOBJ5_OBFUSCATEDNAME = "cy";
|
||||
public static final String OPOBJ5_WRITE1 = "worldPointY";
|
||||
public static final String OPOBJ5_METHOD_NAME1 = "bt";
|
||||
public static final String OPOBJ5_WRITE2 = "objectId";
|
||||
public static final String OPOBJ5_METHOD_NAME2 = "dy";
|
||||
public static final String OPOBJ5_WRITE3 = "worldPointX";
|
||||
public static final String OPOBJ5_METHOD_NAME3 = "mp";
|
||||
public static final String OPOBJ5_WRITE4 = "ctrlDown";
|
||||
public static final String OPOBJ5_METHOD_NAME4 = "db";
|
||||
public static final String[][] OPOBJ5_WRITES = new String[][]{
|
||||
{"r 8", "v"},
|
||||
{"v", "r 8"},
|
||||
{"r 8", "a 128"},
|
||||
{"s 0"},
|
||||
};
|
||||
public static final String OPOBJT_OBFUSCATEDNAME = "cd";
|
||||
public static final String OPOBJT_WRITE1 = "itemId";
|
||||
public static final String OPOBJT_METHOD_NAME1 = "dy";
|
||||
public static final String OPOBJT_WRITE2 = "worldPointY";
|
||||
public static final String OPOBJT_METHOD_NAME2 = "kl";
|
||||
public static final String OPOBJT_WRITE3 = "ctrlDown";
|
||||
public static final String OPOBJT_METHOD_NAME3 = "db";
|
||||
public static final String OPOBJT_WRITE4 = "worldPointX";
|
||||
public static final String OPOBJT_METHOD_NAME4 = "mp";
|
||||
public static final String OPOBJT_WRITE5 = "objectId";
|
||||
public static final String OPOBJT_METHOD_NAME5 = "kl";
|
||||
public static final String OPOBJT_WRITE6 = "widgetId";
|
||||
public static final String OPOBJT_METHOD_NAME6 = "eg";
|
||||
public static final String OPOBJT_WRITE7 = "slot";
|
||||
public static final String OPOBJT_METHOD_NAME7 = "mp";
|
||||
public static final String[][] OPOBJT_WRITES = new String[][]{
|
||||
{"v", "r 8"},
|
||||
{"a 128", "r 8"},
|
||||
{"s 0"},
|
||||
{"r 8", "a 128"},
|
||||
{"a 128", "r 8"},
|
||||
{"r 8", "v", "r 24", "r 16"},
|
||||
{"r 8", "a 128"},
|
||||
};
|
||||
public static final String OPPLAYER1_OBFUSCATEDNAME = "am";
|
||||
public static final String OPPLAYER1_WRITE1 = "playerIndex";
|
||||
public static final String OPPLAYER1_METHOD_NAME1 = "dy";
|
||||
public static final String OPPLAYER1_WRITE2 = "ctrlDown";
|
||||
public static final String OPPLAYER1_METHOD_NAME2 = "bg";
|
||||
public static final String[][] OPPLAYER1_WRITES = new String[][]{
|
||||
{"v", "r 8"},
|
||||
{"v"},
|
||||
};
|
||||
public static final String OPPLAYER2_OBFUSCATEDNAME = "bx";
|
||||
public static final String OPPLAYER2_WRITE1 = "playerIndex";
|
||||
public static final String OPPLAYER2_METHOD_NAME1 = "bt";
|
||||
public static final String OPPLAYER2_WRITE2 = "ctrlDown";
|
||||
public static final String OPPLAYER2_METHOD_NAME2 = "dg";
|
||||
public static final String[][] OPPLAYER2_WRITES = new String[][]{
|
||||
{"r 8", "v"},
|
||||
{"a 128"},
|
||||
};
|
||||
public static final String OPPLAYER3_OBFUSCATEDNAME = "cc";
|
||||
public static final String OPPLAYER3_WRITE1 = "playerIndex";
|
||||
public static final String OPPLAYER3_METHOD_NAME1 = "mp";
|
||||
public static final String OPPLAYER3_WRITE2 = "ctrlDown";
|
||||
public static final String OPPLAYER3_METHOD_NAME2 = "db";
|
||||
public static final String[][] OPPLAYER3_WRITES = new String[][]{
|
||||
{"r 8", "a 128"},
|
||||
{"s 0"},
|
||||
};
|
||||
public static final String OPPLAYER4_OBFUSCATEDNAME = "bv";
|
||||
public static final String OPPLAYER4_WRITE1 = "ctrlDown";
|
||||
public static final String OPPLAYER4_METHOD_NAME1 = "bg";
|
||||
public static final String OPPLAYER4_WRITE2 = "playerIndex";
|
||||
public static final String OPPLAYER4_METHOD_NAME2 = "mp";
|
||||
public static final String[][] OPPLAYER4_WRITES = new String[][]{
|
||||
{"v"},
|
||||
{"r 8", "a 128"},
|
||||
};
|
||||
public static final String OPPLAYER5_OBFUSCATEDNAME = "bc";
|
||||
public static final String OPPLAYER5_WRITE1 = "ctrlDown";
|
||||
public static final String OPPLAYER5_METHOD_NAME1 = "bg";
|
||||
public static final String OPPLAYER5_WRITE2 = "playerIndex";
|
||||
public static final String OPPLAYER5_METHOD_NAME2 = "kl";
|
||||
public static final String[][] OPPLAYER5_WRITES = new String[][]{
|
||||
{"v"},
|
||||
{"a 128", "r 8"},
|
||||
};
|
||||
public static final String OPPLAYER6_OBFUSCATEDNAME = "ai";
|
||||
public static final String OPPLAYER6_WRITE1 = "playerIndex";
|
||||
public static final String OPPLAYER6_METHOD_NAME1 = "kl";
|
||||
public static final String OPPLAYER6_WRITE2 = "ctrlDown";
|
||||
public static final String OPPLAYER6_METHOD_NAME2 = "bg";
|
||||
public static final String[][] OPPLAYER6_WRITES = new String[][]{
|
||||
{"a 128", "r 8"},
|
||||
{"v"},
|
||||
};
|
||||
public static final String OPPLAYER7_OBFUSCATEDNAME = "ce";
|
||||
public static final String OPPLAYER7_WRITE1 = "playerIndex";
|
||||
public static final String OPPLAYER7_METHOD_NAME1 = "kl";
|
||||
public static final String OPPLAYER7_WRITE2 = "ctrlDown";
|
||||
public static final String OPPLAYER7_METHOD_NAME2 = "dg";
|
||||
public static final String[][] OPPLAYER7_WRITES = new String[][]{
|
||||
{"a 128", "r 8"},
|
||||
{"a 128"},
|
||||
};
|
||||
public static final String OPPLAYER8_OBFUSCATEDNAME = "bp";
|
||||
public static final String OPPLAYER8_WRITE1 = "ctrlDown";
|
||||
public static final String OPPLAYER8_METHOD_NAME1 = "bg";
|
||||
public static final String OPPLAYER8_WRITE2 = "playerIndex";
|
||||
public static final String OPPLAYER8_METHOD_NAME2 = "kl";
|
||||
public static final String[][] OPPLAYER8_WRITES = new String[][]{
|
||||
{"v"},
|
||||
{"a 128", "r 8"},
|
||||
};
|
||||
public static final String OPPLAYERT_OBFUSCATEDNAME = "ds";
|
||||
public static final String OPPLAYERT_WRITE1 = "playerIndex";
|
||||
public static final String OPPLAYERT_METHOD_NAME1 = "mp";
|
||||
public static final String OPPLAYERT_WRITE2 = "slot";
|
||||
public static final String OPPLAYERT_METHOD_NAME2 = "dy";
|
||||
public static final String OPPLAYERT_WRITE3 = "widgetId";
|
||||
public static final String OPPLAYERT_METHOD_NAME3 = "es";
|
||||
public static final String OPPLAYERT_WRITE4 = "ctrlDown";
|
||||
public static final String OPPLAYERT_METHOD_NAME4 = "dh";
|
||||
public static final String OPPLAYERT_WRITE5 = "itemId";
|
||||
public static final String OPPLAYERT_METHOD_NAME5 = "kl";
|
||||
public static final String[][] OPPLAYERT_WRITES = new String[][]{
|
||||
{"r 8", "a 128"},
|
||||
{"v", "r 8"},
|
||||
{"r 16", "r 24", "v", "r 8"},
|
||||
{"s 128"},
|
||||
{"a 128", "r 8"},
|
||||
};
|
||||
|
||||
public static final String OPHELDD_OBFUSCATEDNAME = "di";
|
||||
public static final String OPHELDD_WRITE1 = "selectedItemId";
|
||||
public static final String OPHELDD_METHOD_NAME1 = "bt";
|
||||
public static final String OPHELDD_WRITE2 = "destChildIndex";
|
||||
public static final String OPHELDD_METHOD_NAME2 = "dy";
|
||||
public static final String OPHELDD_WRITE3 = "destItemId";
|
||||
public static final String OPHELDD_METHOD_NAME3 = "dy";
|
||||
public static final String OPHELDD_WRITE4 = "selectedId";
|
||||
public static final String OPHELDD_METHOD_NAME4 = "en";
|
||||
public static final String OPHELDD_WRITE5 = "selectedChildIndex";
|
||||
public static final String OPHELDD_METHOD_NAME5 = "kl";
|
||||
public static final String OPHELDD_WRITE6 = "destId";
|
||||
public static final String OPHELDD_METHOD_NAME6 = "eg";
|
||||
public static final String[][] OPHELDD_WRITES = new String[][] {
|
||||
{"r 8", "v"},
|
||||
{"v", "r 8"},
|
||||
{"v", "r 8"},
|
||||
{"v", "r 8", "r 16", "r 24"},
|
||||
{"a 128", "r 8"},
|
||||
{"r 8", "v", "r 24", "r 16"}
|
||||
};
|
||||
public static final String RESUME_COUNTDIALOG_OBFUSCATEDNAME = "au";
|
||||
public static final String RESUME_COUNTDIALOG_WRITE1 = "var0";
|
||||
public static final String RESUME_COUNTDIALOG_METHOD_NAME1 = "bu";
|
||||
public static final String[][] RESUME_COUNTDIALOG_WRITES = new String[][]{
|
||||
{"r 24", "r 16", "r 8", "v"},
|
||||
};
|
||||
public static final String RESUME_PAUSEBUTTON_OBFUSCATEDNAME = "bj";
|
||||
public static final String RESUME_PAUSEBUTTON_WRITE1 = "var1";
|
||||
public static final String RESUME_PAUSEBUTTON_METHOD_NAME1 = "kl";
|
||||
public static final String RESUME_PAUSEBUTTON_WRITE2 = "var0";
|
||||
public static final String RESUME_PAUSEBUTTON_METHOD_NAME2 = "es";
|
||||
public static final String[][] RESUME_PAUSEBUTTON_WRITES = new String[][]{
|
||||
{"a 128", "r 8"},
|
||||
{"r 16", "r 24", "v", "r 8"}
|
||||
};
|
||||
|
||||
public static final String offsetMultiplier = "944624261";
|
||||
public static final String indexMultiplier = "-602712499";
|
||||
public static final String addNodeGarbageValue = "-41";
|
||||
public static final String getPacketBufferNodeGarbageValue = "-26977627";
|
||||
public static final String packetWriterFieldName = "cv";
|
||||
public static final String isaacCipherFieldName = "av";
|
||||
public static final String addNodeMethodName = "ac";
|
||||
public static final String clientPacketClassName = "mi";
|
||||
public static final String packetWriterClassName = "dw";
|
||||
public static final String classContainingGetPacketBufferNodeName = "lh";
|
||||
public static final String packetBufferNodeClassName = "mb";
|
||||
public static final String packetBufferFieldName = "ap";
|
||||
public static final String bufferOffsetField = "aa";
|
||||
public static final String bufferArrayField = "ay";
|
||||
public static final String MouseHandler_lastPressedTimeMillisClass = "bx";
|
||||
public static final String MouseHandler_lastPressedTimeMillisField = "ag";
|
||||
public static final String clientMillisField = "jp";
|
||||
public static final String mouseHandlerMillisMultiplier = "4013550640572753771";
|
||||
public static final String clientMillisMultiplier = "7881463686914378693";
|
||||
public static final int getAnimationMultiplier = 2116322795;
|
||||
public static final int skullIconMultiplier = 0;
|
||||
public static final String skullIconField = "null";
|
||||
|
||||
public static final int pathLengthMultiplier = 0;
|
||||
public static final String pathLengthFieldName = "null";
|
||||
public static final String doActionClassName = "fy";
|
||||
public static final String doActionMethodName = "lu";
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package ee.futur.baseapi.nono.packets.utils;
|
||||
|
||||
public class ObjectAndType {
|
||||
Object object;
|
||||
Class type;
|
||||
|
||||
public ObjectAndType(Object object, Class type) {
|
||||
this.object = object;
|
||||
this.type = type;
|
||||
}
|
||||
}
|
||||
232
src/main/java/ee/futur/baseapi/nono/packets/utils/PacketDef.java
Normal file
@@ -0,0 +1,232 @@
|
||||
package ee.futur.baseapi.nono.packets.utils;
|
||||
|
||||
public class PacketDef {
|
||||
public final String name;
|
||||
public final String[] writeData;
|
||||
public final String[][] writeMethods;
|
||||
public final PacketType type;
|
||||
PacketDef(String var1, String[] writeData, String[][] writeMethods, PacketType type) {
|
||||
this.name = var1;
|
||||
this.writeData = writeData;
|
||||
this.writeMethods = writeMethods;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public static PacketDef getOpObj1() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPOBJ1_WRITE1, ObfuscatedNames.OPOBJ1_WRITE2, ObfuscatedNames.OPOBJ1_WRITE3, ObfuscatedNames.OPOBJ1_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.OPOBJ1_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPOBJ1_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPOBJ);
|
||||
}
|
||||
|
||||
public static PacketDef getOpObj5() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPOBJ5_WRITE1, ObfuscatedNames.OPOBJ5_WRITE2, ObfuscatedNames.OPOBJ5_WRITE3, ObfuscatedNames.OPOBJ5_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.OPOBJ5_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPOBJ5_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPOBJ);
|
||||
}
|
||||
|
||||
|
||||
public static PacketDef getOpObj4() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPOBJ4_WRITE1, ObfuscatedNames.OPOBJ4_WRITE2, ObfuscatedNames.OPOBJ4_WRITE3, ObfuscatedNames.OPOBJ4_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.OPOBJ4_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPOBJ4_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPOBJ);
|
||||
}
|
||||
|
||||
|
||||
public static PacketDef getOpObj3() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPOBJ3_WRITE1, ObfuscatedNames.OPOBJ3_WRITE2, ObfuscatedNames.OPOBJ3_WRITE3, ObfuscatedNames.OPOBJ3_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.OPOBJ3_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPOBJ3_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPOBJ);
|
||||
}
|
||||
|
||||
|
||||
public static PacketDef getOpObj2() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPOBJ2_WRITE1, ObfuscatedNames.OPOBJ2_WRITE2, ObfuscatedNames.OPOBJ2_WRITE3, ObfuscatedNames.OPOBJ2_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.OPOBJ2_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPOBJ2_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPOBJ);
|
||||
}
|
||||
|
||||
|
||||
public static PacketDef getOpLocT() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPLOCT_WRITE1, ObfuscatedNames.OPLOCT_WRITE2, ObfuscatedNames.OPLOCT_WRITE3, ObfuscatedNames.OPLOCT_WRITE4, ObfuscatedNames.OPLOCT_WRITE5, ObfuscatedNames.OPLOCT_WRITE6, ObfuscatedNames.OPLOCT_WRITE7};
|
||||
String[][] writeMethods = ObfuscatedNames.OPLOCT_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPLOCT_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPLOCT);
|
||||
}
|
||||
|
||||
public static PacketDef getOpNpcT() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPNPCT_WRITE1, ObfuscatedNames.OPNPCT_WRITE2, ObfuscatedNames.OPNPCT_WRITE3,ObfuscatedNames.OPNPCT_WRITE4,ObfuscatedNames.OPNPCT_WRITE5};
|
||||
String[][] writeMethods = ObfuscatedNames.OPNPCT_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPNPCT_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPNPCT);
|
||||
}
|
||||
|
||||
public static PacketDef getOpPlayerT() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPPLAYERT_WRITE1, ObfuscatedNames.OPPLAYERT_WRITE2, ObfuscatedNames.OPPLAYERT_WRITE3, ObfuscatedNames.OPPLAYERT_WRITE4, ObfuscatedNames.OPPLAYERT_WRITE5};
|
||||
String[][] writeMethods = ObfuscatedNames.OPPLAYERT_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPPLAYERT_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPPLAYERT);
|
||||
}
|
||||
|
||||
public static PacketDef getOpObjT() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPOBJT_WRITE1, ObfuscatedNames.OPOBJT_WRITE2, ObfuscatedNames.OPOBJT_WRITE3, ObfuscatedNames.OPOBJT_WRITE4, ObfuscatedNames.OPOBJT_WRITE5, ObfuscatedNames.OPOBJT_WRITE6, ObfuscatedNames.OPOBJT_WRITE7};
|
||||
String[][] writeMethods = ObfuscatedNames.OPOBJT_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPOBJT_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPOBJT);
|
||||
}
|
||||
|
||||
public static PacketDef getIfButtonT() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.IF_BUTTONT_WRITE1, ObfuscatedNames.IF_BUTTONT_WRITE2, ObfuscatedNames.IF_BUTTONT_WRITE3, ObfuscatedNames.IF_BUTTONT_WRITE4, ObfuscatedNames.IF_BUTTONT_WRITE5, ObfuscatedNames.IF_BUTTONT_WRITE6};
|
||||
String[][] writeMethods = ObfuscatedNames.IF_BUTTONT_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.IF_BUTTONT_OBFUSCATEDNAME, writeData, writeMethods, PacketType.IF_BUTTONT);
|
||||
}
|
||||
|
||||
public static PacketDef getOpNpc2() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPNPC2_WRITE1, ObfuscatedNames.OPNPC2_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPNPC2_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPNPC2_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPNPC);
|
||||
}
|
||||
|
||||
public static PacketDef getOpPlayer6() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPPLAYER6_WRITE1, ObfuscatedNames.OPPLAYER6_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPPLAYER6_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPPLAYER6_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPPLAYER);
|
||||
}
|
||||
|
||||
public static PacketDef getOpNpc3() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPNPC3_WRITE1, ObfuscatedNames.OPNPC3_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPNPC3_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPNPC3_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPNPC);
|
||||
}
|
||||
|
||||
public static PacketDef getOpPlayer7() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPPLAYER7_WRITE1, ObfuscatedNames.OPPLAYER7_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPPLAYER7_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPPLAYER7_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPPLAYER);
|
||||
}
|
||||
|
||||
public static PacketDef getOpLoc2() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPLOC2_WRITE1, ObfuscatedNames.OPLOC2_WRITE2, ObfuscatedNames.OPLOC2_WRITE3, ObfuscatedNames.OPLOC2_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.OPLOC2_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPLOC2_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPLOC);
|
||||
}
|
||||
|
||||
public static PacketDef getOpPlayer8() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPPLAYER8_WRITE1, ObfuscatedNames.OPPLAYER8_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPPLAYER8_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPPLAYER8_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPPLAYER);
|
||||
}
|
||||
|
||||
public static PacketDef getOpLoc1() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPLOC1_WRITE1, ObfuscatedNames.OPLOC1_WRITE2, ObfuscatedNames.OPLOC1_WRITE3, ObfuscatedNames.OPLOC1_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.OPLOC1_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPLOC1_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPLOC);
|
||||
}
|
||||
|
||||
public static PacketDef getOpNpc1() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPNPC1_WRITE1, ObfuscatedNames.OPNPC1_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPNPC1_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPNPC1_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPNPC);
|
||||
}
|
||||
|
||||
public static PacketDef getOpLoc4() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPLOC4_WRITE1, ObfuscatedNames.OPLOC4_WRITE2, ObfuscatedNames.OPLOC4_WRITE3, ObfuscatedNames.OPLOC4_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.OPLOC4_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPLOC4_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPLOC);
|
||||
}
|
||||
|
||||
public static PacketDef getOpPlayer2() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPPLAYER2_WRITE1, ObfuscatedNames.OPPLAYER2_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPPLAYER2_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPPLAYER2_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPPLAYER);
|
||||
}
|
||||
|
||||
public static PacketDef getOpLoc3() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPLOC3_WRITE1, ObfuscatedNames.OPLOC3_WRITE2, ObfuscatedNames.OPLOC3_WRITE3, ObfuscatedNames.OPLOC3_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.OPLOC3_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPLOC3_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPLOC);
|
||||
}
|
||||
|
||||
public static PacketDef getOpPlayer3() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPPLAYER3_WRITE1, ObfuscatedNames.OPPLAYER3_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPPLAYER3_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPPLAYER3_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPPLAYER);
|
||||
}
|
||||
|
||||
public static PacketDef getOpNpc4() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPNPC4_WRITE1, ObfuscatedNames.OPNPC4_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPNPC4_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPNPC4_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPNPC);
|
||||
}
|
||||
|
||||
public static PacketDef getOpPlayer4() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPPLAYER4_WRITE1, ObfuscatedNames.OPPLAYER4_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPPLAYER4_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPPLAYER4_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPPLAYER);
|
||||
}
|
||||
|
||||
public static PacketDef getOpNpc5() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPNPC5_WRITE1, ObfuscatedNames.OPNPC5_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPNPC5_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPNPC5_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPNPC);
|
||||
}
|
||||
|
||||
public static PacketDef getOpPlayer5() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPPLAYER5_WRITE1, ObfuscatedNames.OPPLAYER5_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPPLAYER5_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPPLAYER5_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPPLAYER);
|
||||
}
|
||||
|
||||
public static PacketDef getOpLoc5() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPLOC5_WRITE1, ObfuscatedNames.OPLOC5_WRITE2, ObfuscatedNames.OPLOC5_WRITE3, ObfuscatedNames.OPLOC5_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.OPLOC5_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPLOC5_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPLOC);
|
||||
}
|
||||
|
||||
public static PacketDef getOpPlayer1() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPPLAYER1_WRITE1, ObfuscatedNames.OPPLAYER1_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.OPPLAYER1_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPPLAYER1_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPPLAYER);
|
||||
}
|
||||
|
||||
public static PacketDef getMoveGameClick() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.MOVE_GAMECLICK_WRITE1, ObfuscatedNames.MOVE_GAMECLICK_WRITE2, ObfuscatedNames.MOVE_GAMECLICK_WRITE3, ObfuscatedNames.MOVE_GAMECLICK_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.MOVE_GAMECLICK_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.MOVE_GAMECLICK_OBFUSCATEDNAME, writeData, writeMethods, PacketType.MOVE_GAMECLICK);
|
||||
}
|
||||
|
||||
public static PacketDef getEventMouseClick() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.EVENT_MOUSE_CLICK_WRITE1, ObfuscatedNames.EVENT_MOUSE_CLICK_WRITE2, ObfuscatedNames.EVENT_MOUSE_CLICK_WRITE3, ObfuscatedNames.EVENT_MOUSE_CLICK_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.EVENT_MOUSE_CLICK_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.EVENT_MOUSE_CLICK_OBFUSCATEDNAME, writeData, writeMethods, PacketType.EVENT_MOUSE_CLICK);
|
||||
}
|
||||
|
||||
|
||||
public static PacketDef getIfSubOp() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.IF_SUBOP_WRITE1, ObfuscatedNames.IF_SUBOP_WRITE2, ObfuscatedNames.IF_SUBOP_WRITE3,
|
||||
ObfuscatedNames.IF_SUBOP_WRITE4, ObfuscatedNames.IF_SUBOP_WRITE5};
|
||||
String[][] writeMethods = ObfuscatedNames.IF_SUBOP_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.IF_SUBOP_OBFUSCATEDNAME, writeData, writeMethods, PacketType.IF_SUBOP);
|
||||
}
|
||||
|
||||
public static PacketDef getResumePausebutton() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.RESUME_PAUSEBUTTON_WRITE1, ObfuscatedNames.RESUME_PAUSEBUTTON_WRITE2};
|
||||
String[][] writeMethods = ObfuscatedNames.RESUME_PAUSEBUTTON_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.RESUME_PAUSEBUTTON_OBFUSCATEDNAME, writeData, writeMethods, PacketType.RESUME_PAUSEBUTTON);
|
||||
}
|
||||
|
||||
public static PacketDef getResumeCountDialog() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.RESUME_COUNTDIALOG_WRITE1};
|
||||
String[][] writeMethods = ObfuscatedNames.RESUME_COUNTDIALOG_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.RESUME_COUNTDIALOG_OBFUSCATEDNAME, writeData, writeMethods, PacketType.RESUME_COUNTDIALOG);
|
||||
}
|
||||
|
||||
public static PacketDef getOpHeldd() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.OPHELDD_WRITE1, ObfuscatedNames.OPHELDD_WRITE2, ObfuscatedNames.OPHELDD_WRITE3,
|
||||
ObfuscatedNames.OPHELDD_WRITE4, ObfuscatedNames.OPHELDD_WRITE5, ObfuscatedNames.OPHELDD_WRITE6};
|
||||
String[][] writeMethods = ObfuscatedNames.OPHELDD_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.OPHELDD_OBFUSCATEDNAME, writeData, writeMethods, PacketType.OPHELDD);
|
||||
}
|
||||
|
||||
public static PacketDef getIfButtonX() {
|
||||
String[] writeData = new String[]{ObfuscatedNames.IF_BUTTONX_WRITE1, ObfuscatedNames.IF_BUTTONX_WRITE2, ObfuscatedNames.IF_BUTTONX_WRITE3,
|
||||
ObfuscatedNames.IF_BUTTONX_WRITE4};
|
||||
String[][] writeMethods = ObfuscatedNames.IF_BUTTONX_WRITES;
|
||||
return new PacketDef(ObfuscatedNames.IF_BUTTONX_OBFUSCATEDNAME, writeData, writeMethods, PacketType.IF_BUTTONX);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,290 @@
|
||||
package ee.futur.baseapi.nono.packets.utils;
|
||||
|
||||
import ee.futur.baseapi.nono.packets.BufferMethods;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.RuneLite;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigInteger;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
public class PacketReflection {
|
||||
public static Client getClient() {
|
||||
return RuneLite.getInjector().getInstance(Client.class);
|
||||
}
|
||||
|
||||
public static Class loadClassFromClientClassLoader(String name) {
|
||||
try {
|
||||
ClassLoader clientLoader = getClient().getClass().getClassLoader();
|
||||
return clientLoader.loadClass(name);
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Class getClassWithGetPacketBufferNode() {
|
||||
return loadClassFromClientClassLoader(ObfuscatedNames.classContainingGetPacketBufferNodeName);
|
||||
}
|
||||
|
||||
public static Method getGetPacketBufferNode() {
|
||||
try {
|
||||
return Arrays.stream(getClassWithGetPacketBufferNode().getDeclaredMethods()).filter(m -> m.getReturnType().equals(getPacketBufferNodeClass())).collect(Collectors.toList()).get(0);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Class getClientPacketClass() {
|
||||
return loadClassFromClientClassLoader(ObfuscatedNames.clientPacketClassName);
|
||||
}
|
||||
|
||||
public static Field getPacketWriterField() {
|
||||
try {
|
||||
return getClient().getClass().getDeclaredField(ObfuscatedNames.packetWriterFieldName);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Class getPacketWriterClass() {
|
||||
try {
|
||||
Field packetWriterField = getPacketWriterField();
|
||||
packetWriterField.setAccessible(true);
|
||||
Class packetWriterClass = packetWriterField.get(null).getClass();
|
||||
packetWriterField.setAccessible(false);
|
||||
return packetWriterClass;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Object getIsaacObject() {
|
||||
try {
|
||||
Field isaacField = getPacketWriterClass().getDeclaredField(ObfuscatedNames.isaacCipherFieldName);
|
||||
isaacField.setAccessible(true);
|
||||
Object isaacObject = isaacField.get(getPacketWriteObject());
|
||||
isaacField.setAccessible(false);
|
||||
return isaacObject;
|
||||
} catch (NoSuchFieldException | IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Class getIsaacClass() {
|
||||
return getIsaacObject().getClass();
|
||||
}
|
||||
|
||||
public static Class getPacketBufferNodeClass() {
|
||||
return loadClassFromClientClassLoader(ObfuscatedNames.packetBufferNodeClassName);
|
||||
}
|
||||
|
||||
public static Object getPacketWriteObject() {
|
||||
Field packetWriterField = getPacketWriterField();
|
||||
packetWriterField.setAccessible(true);
|
||||
try {
|
||||
Object packetWriter = packetWriterField.get(null);
|
||||
packetWriterField.setAccessible(false);
|
||||
return packetWriter;
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public static void sendPacket(PacketDef def, Object... objects) {
|
||||
Object packetBufferNode = null;
|
||||
Method getPacketBufferNode = getGetPacketBufferNode();
|
||||
Class ClientPacket = getClientPacketClass();
|
||||
Object isaac = getIsaacObject();
|
||||
getPacketBufferNode.setAccessible(true);
|
||||
long garbageValue = Math.abs(Long.parseLong(ObfuscatedNames.getPacketBufferNodeGarbageValue));
|
||||
if (garbageValue < 256) {
|
||||
try {
|
||||
packetBufferNode = getPacketBufferNode.invoke(null, fetchPacketField(def.name).get(ClientPacket),
|
||||
isaac, Byte.parseByte(ObfuscatedNames.getPacketBufferNodeGarbageValue));
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (garbageValue < 32768) {
|
||||
try {
|
||||
//System.out.println("getPacketBufferNode: "+getPacketBufferNode);
|
||||
//System.out.println("isaac: "+isaac);
|
||||
packetBufferNode = getPacketBufferNode.invoke(null, fetchPacketField(def.name).get(ClientPacket),
|
||||
isaac, Short.parseShort(ObfuscatedNames.getPacketBufferNodeGarbageValue));
|
||||
//System.out.println("packetBufferNode: "+packetBufferNode);
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else if (garbageValue < Integer.MAX_VALUE) {
|
||||
try {
|
||||
packetBufferNode = getPacketBufferNode.invoke(null, fetchPacketField(def.name).get(ClientPacket),
|
||||
isaac, Integer.parseInt(ObfuscatedNames.getPacketBufferNodeGarbageValue));
|
||||
} catch (IllegalAccessException | InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Object buffer = null;
|
||||
try {
|
||||
buffer = packetBufferNode.getClass().getDeclaredField(ObfuscatedNames.packetBufferFieldName).get(packetBufferNode);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
getPacketBufferNode.setAccessible(false);
|
||||
List<String> params = null;
|
||||
if (def.type == PacketType.OPHELDD) {
|
||||
params = List.of("selectedId", "selectedChildIndex", "selectedItemId", "destId", "destChildIndex", "destItemId");
|
||||
}
|
||||
if (def.type == PacketType.RESUME_COUNTDIALOG) {
|
||||
params = List.of("var0");
|
||||
}
|
||||
if (def.type == PacketType.RESUME_PAUSEBUTTON) {
|
||||
params = List.of("var0", "var1");
|
||||
}
|
||||
if (def.type == PacketType.IF_BUTTON) {
|
||||
params = List.of("widgetId", "slot", "itemId");
|
||||
}
|
||||
if (def.type == PacketType.IF_BUTTONX) {
|
||||
params = List.of("widgetId", "slot", "itemId", "opCode");
|
||||
}
|
||||
if (def.type == PacketType.IF_SUBOP) {
|
||||
params = List.of("widgetId", "slot", "itemId", "menuIndex", "subActionIndex");
|
||||
}
|
||||
if (def.type == PacketType.OPLOC) {
|
||||
params = List.of("objectId", "worldPointX", "worldPointY", "ctrlDown");
|
||||
}
|
||||
if (def.type == PacketType.OPNPC) {
|
||||
params = List.of("npcIndex", "ctrlDown");
|
||||
}
|
||||
if (def.type == PacketType.OPPLAYER) {
|
||||
params = List.of("playerIndex", "ctrlDown");
|
||||
}
|
||||
if (def.type == PacketType.OPOBJ) {
|
||||
params = List.of("objectId", "worldPointX", "worldPointY", "ctrlDown");
|
||||
}
|
||||
if (def.type == PacketType.OPOBJT) {
|
||||
params = List.of("objectId", "worldPointX", "worldPointY", "slot", "itemId", "widgetId",
|
||||
"ctrlDown");
|
||||
}
|
||||
if (def.type == PacketType.EVENT_MOUSE_CLICK) {
|
||||
params = List.of("mouseInfo", "mouseX", "mouseY", "0");
|
||||
}
|
||||
if (def.type == PacketType.MOVE_GAMECLICK) {
|
||||
params = List.of("worldPointX", "worldPointY", "ctrlDown", "5");
|
||||
}
|
||||
if (def.type == PacketType.IF_BUTTONT) {
|
||||
params = List.of("sourceWidgetId", "sourceSlot", "sourceItemId", "destinationWidgetId",
|
||||
"destinationSlot", "destinationItemId");
|
||||
}
|
||||
if (def.type == PacketType.OPLOCT) {
|
||||
params = List.of("objectId", "worldPointX", "worldPointY", "slot", "itemId", "widgetId",
|
||||
"ctrlDown");
|
||||
}
|
||||
if (def.type == PacketType.OPPLAYERT) {
|
||||
params = List.of("playerIndex", "itemId", "slot", "widgetId", "ctrlDown");
|
||||
}
|
||||
if (def.type == PacketType.OPNPCT) {
|
||||
params = List.of("npcIndex", "itemId", "slot", "widgetId", "ctrlDown");
|
||||
}
|
||||
if (params != null) {
|
||||
for (int i = 0; i < def.writeData.length; i++) {
|
||||
int index = params.indexOf(def.writeData[i]);
|
||||
Object writeValue = objects[index];
|
||||
for (String s : def.writeMethods[i]) {
|
||||
// System.out.println("Writing " + s + " " + writeValue);
|
||||
BufferMethods.writeValue(s, (Integer) writeValue, buffer);
|
||||
}
|
||||
}
|
||||
Field PACKETWRITER = getPacketWriterField();
|
||||
PACKETWRITER.setAccessible(true);
|
||||
try {
|
||||
//System.out.println(PACKETWRITER);
|
||||
//System.out.println(PACKETWRITER.get(null));
|
||||
addNode(PACKETWRITER.get(null), packetBufferNode);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
PACKETWRITER.setAccessible(false);
|
||||
}
|
||||
}
|
||||
|
||||
public static void addNode(Object packetWriter, Object packetBufferNode) {
|
||||
if (PacketUtilsPlugin.usingClientAddNode) {
|
||||
try {
|
||||
Method addNode = null;
|
||||
long garbageValue = Math.abs(Long.parseLong(ObfuscatedNames.addNodeGarbageValue));
|
||||
if (garbageValue < 256) {
|
||||
addNode = packetWriter.getClass().getDeclaredMethod(ObfuscatedNames.addNodeMethodName, packetBufferNode.getClass(), byte.class);
|
||||
addNode.setAccessible(true);
|
||||
addNode.invoke(packetWriter, packetBufferNode, Byte.parseByte(ObfuscatedNames.addNodeGarbageValue));
|
||||
} else if (garbageValue < 32768) {
|
||||
addNode = packetWriter.getClass().getDeclaredMethod(ObfuscatedNames.addNodeMethodName, packetBufferNode.getClass(), short.class);
|
||||
addNode.setAccessible(true);
|
||||
addNode.invoke(packetWriter, packetBufferNode, Short.parseShort(ObfuscatedNames.addNodeGarbageValue));
|
||||
} else if (garbageValue < Integer.MAX_VALUE) {
|
||||
addNode = packetWriter.getClass().getDeclaredMethod(ObfuscatedNames.addNodeMethodName, packetBufferNode.getClass(), int.class);
|
||||
//System.out.println("addnode: "+addNode);
|
||||
addNode.setAccessible(true);
|
||||
addNode.invoke(packetWriter, packetBufferNode, Integer.parseInt(ObfuscatedNames.addNodeGarbageValue));
|
||||
}
|
||||
if (addNode != null) {
|
||||
addNode.setAccessible(false);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
Method addNode = PacketUtilsPlugin.addNodeMethod;
|
||||
addNode.setAccessible(true);
|
||||
if (addNode.getParameterCount() == 2) {
|
||||
addNode.invoke(null, packetWriter, packetBufferNode);
|
||||
} else {
|
||||
long garbageValue = Math.abs(Long.parseLong(ObfuscatedNames.addNodeGarbageValue));
|
||||
if (garbageValue < 256) {
|
||||
addNode.invoke(null, packetWriter, packetBufferNode, Byte.parseByte(ObfuscatedNames.addNodeGarbageValue));
|
||||
} else if (garbageValue < 32768) {
|
||||
addNode.invoke(null, packetWriter, packetBufferNode, Short.parseShort(ObfuscatedNames.addNodeGarbageValue));
|
||||
} else if (garbageValue < Integer.MAX_VALUE) {
|
||||
addNode.invoke(null, packetWriter, packetBufferNode, Integer.parseInt(ObfuscatedNames.addNodeGarbageValue));
|
||||
}
|
||||
}
|
||||
addNode.setAccessible(false);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Field fetchPacketField(String name) {
|
||||
try {
|
||||
Class ClientPacket = getClientPacketClass();
|
||||
return ClientPacket.getDeclaredField(name);
|
||||
} catch (NoSuchFieldException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static BigInteger modInverse(BigInteger val) {
|
||||
BigInteger shift = BigInteger.ONE.shiftLeft(32);
|
||||
return val.modInverse(shift);
|
||||
}
|
||||
|
||||
private static int modInverse(int val) {
|
||||
return modInverse(BigInteger.valueOf(val)).intValue();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package ee.futur.baseapi.nono.packets.utils;
|
||||
|
||||
public enum PacketType {
|
||||
OPHELDD,
|
||||
RESUME_COUNTDIALOG,
|
||||
RESUME_PAUSEBUTTON,
|
||||
IF_BUTTON,
|
||||
IF_SUBOP,
|
||||
IF_BUTTONX,
|
||||
OPNPC,
|
||||
OPPLAYER,
|
||||
OPOBJ,
|
||||
OPLOC,
|
||||
MOVE_GAMECLICK,
|
||||
EVENT_MOUSE_CLICK,
|
||||
IF_BUTTONT,
|
||||
OPNPCT,
|
||||
OPPLAYERT,
|
||||
OPOBJT,
|
||||
OPLOCT
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package ee.futur.baseapi.nono.packets.utils;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("PacketUtils")
|
||||
public interface PacketUtilsConfig extends Config {
|
||||
@ConfigItem(
|
||||
keyName = "debug",
|
||||
name = "debug",
|
||||
description = "enable menuaction debug output"
|
||||
)
|
||||
default boolean debug() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "alwaysOn",
|
||||
name = "Always enabled.",
|
||||
description = "Makes this plugin always enabled on startup if the revision matches."
|
||||
)
|
||||
default boolean alwaysOn() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
package ee.futur.baseapi.nono.packets.utils;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import com.google.inject.Singleton;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.client.RuneLite;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginInstantiationException;
|
||||
import net.runelite.client.plugins.PluginManager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.*;
|
||||
import java.io.*;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.net.URL;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.*;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Slf4j
|
||||
@Singleton
|
||||
@PluginDescriptor(
|
||||
name = "Packet Utils",
|
||||
description = "Packet Utils for Plugins",
|
||||
enabledByDefault = true,
|
||||
tags = {"ethan"}
|
||||
)
|
||||
public class PacketUtilsPlugin extends Plugin {
|
||||
@Inject
|
||||
PacketUtilsConfig config;
|
||||
@Inject
|
||||
Client client;
|
||||
static Client staticClient;
|
||||
public static Method addNodeMethod;
|
||||
public static boolean usingClientAddNode = false;
|
||||
public static final int CLIENT_REV = 232;
|
||||
private static String loadedConfigName = "";
|
||||
@Inject
|
||||
private PluginManager pluginManager;
|
||||
|
||||
@Provides
|
||||
public PacketUtilsConfig getConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(PacketUtilsConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuOptionClicked(MenuOptionClicked e) {
|
||||
if (config.debug()) {
|
||||
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "Packet Utils", e.toString(), null);
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SneakyThrows
|
||||
public void startUp() {
|
||||
staticClient = client;
|
||||
if (client.getRevision() != CLIENT_REV) {
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
JOptionPane.showMessageDialog(null, "PacketUtils not updated for this rev please " +
|
||||
"wait for " +
|
||||
"plugin update");
|
||||
try {
|
||||
pluginManager.setPluginEnabled(this, false);
|
||||
pluginManager.stopPlugin(this);
|
||||
} catch (PluginInstantiationException ignored) {
|
||||
}
|
||||
});
|
||||
return;
|
||||
}
|
||||
//setupNeverlog();
|
||||
int feature = Runtime.version().feature();
|
||||
if (feature != 11) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
log.error("ETHAN VANN PLUGINS LOADED ON JAVA != 11 THIS IS NOT SUPPORTED");
|
||||
log.error("DEVELOPERS SHOULD IGNORE BUG REPORTS CONTAINING THIS LINE UNTIL THIS ISSUE IS RESOLVED");
|
||||
}
|
||||
} else {
|
||||
log.info("Ethan Vann Plugins loaded on Java 11");
|
||||
}
|
||||
//setupRuneliteUpdateHandling(RuneLiteProperties.getVersion());
|
||||
cleanup();
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
for (Plugin plugin : pluginManager.getPlugins()) {
|
||||
if (plugin.getName().contains("BaseApiPlugin")) {
|
||||
if (pluginManager.isPluginEnabled(plugin)) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
pluginManager.setPluginEnabled(plugin, true);
|
||||
pluginManager.startPlugin(plugin);
|
||||
} catch (PluginInstantiationException e) {
|
||||
//e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static void setupNeverlog() {
|
||||
staticClient.setIdleTimeout(42069);
|
||||
for (Field declaredField : staticClient.getClass().getDeclaredFields()) {
|
||||
if (declaredField.getType() == int.class && Modifier.isStatic(declaredField.getModifiers())) {
|
||||
declaredField.setAccessible(true);
|
||||
int value = declaredField.getInt(null);
|
||||
if (value != 42069) {
|
||||
declaredField.setAccessible(false);
|
||||
continue;
|
||||
}
|
||||
System.out.println("found idle ticks field: " + declaredField.getName());
|
||||
declaredField.setInt(null, Integer.MAX_VALUE);
|
||||
declaredField.setAccessible(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public void cleanup() {
|
||||
if (!loadedConfigName.equals(makeString())) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
log.error("ETHAN VANN PLUGINS LOADED WITH INCORRECT CONFIG DATA THIS IS NOT SUPPORTED");
|
||||
log.error("DEVELOPERS SHOULD IGNORE BUG REPORTS CONTAINING THIS LINE UNTIL THIS ISSUE IS RESOLVED");
|
||||
}
|
||||
} else {
|
||||
log.info("config loaded from correct path");
|
||||
}
|
||||
Path codeSource = RuneLite.RUNELITE_DIR.toPath().resolve("PacketUtils");
|
||||
List<Path> toDelete = new ArrayList<>();
|
||||
toDelete.add(codeSource.resolve("vanilla.jar"));
|
||||
toDelete.add(codeSource.resolve("patched.jar"));
|
||||
toDelete.add(codeSource.resolve("doAction.class"));
|
||||
toDelete.add(codeSource.resolve("decompiled.txt"));
|
||||
for (Path path : toDelete) {
|
||||
Files.deleteIfExists(path);
|
||||
}
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public void setupRuneliteUpdateHandling(String version) {
|
||||
Path codeSource = RuneLite.RUNELITE_DIR.toPath().resolve("PacketUtils");
|
||||
if (Files.exists(codeSource.resolve(version + "-" + client.getRevision() + ".txt"))) {
|
||||
Path f = codeSource.resolve(version + "-" + client.getRevision() + ".txt");
|
||||
List<String> lines = Files.readAllLines(f);
|
||||
loadedConfigName = f.getFileName().toString();
|
||||
System.out.println("config name: " + loadedConfigName);
|
||||
if (lines.size() < 2) {
|
||||
return;
|
||||
}
|
||||
usingClientAddNode = Boolean.parseBoolean(lines.get(0));
|
||||
if (usingClientAddNode) {
|
||||
log.info("loaded addNode config from file");
|
||||
log.info("usingClientAddNode: " + usingClientAddNode);
|
||||
log.info("addNodeMethod: " + "N/A");
|
||||
return;
|
||||
}
|
||||
String[] split = lines.get(1).split("\\.");
|
||||
Class<?> addNodeClassName = client.getClass().getClassLoader().loadClass(split[0]);
|
||||
for (Method declaredMethod : addNodeClassName.getDeclaredMethods()) {
|
||||
if (declaredMethod.getName().equals(split[1]) && declaredMethod.getParameterCount() > 0 && declaredMethod.getParameterTypes()[0].getSimpleName().equals(ObfuscatedNames.packetWriterClassName)) {
|
||||
addNodeMethod = declaredMethod;
|
||||
}
|
||||
}
|
||||
log.info("loaded addNode config from file");
|
||||
log.info("usingClientAddNode: " + usingClientAddNode);
|
||||
log.info("addNodeMethod: " + addNodeMethod);
|
||||
return;
|
||||
}
|
||||
String doActionClassName = ObfuscatedNames.doActionClassName;
|
||||
String doActionMethodName = ObfuscatedNames.doActionMethodName;
|
||||
System.out.print("finished");
|
||||
final String doActionFinalClassName = doActionClassName;
|
||||
final String doActionFinalMethodName = doActionMethodName;
|
||||
System.out.println(doActionFinalClassName);
|
||||
System.out.println(doActionFinalMethodName);
|
||||
URL rlConfigURL = new URL("https://static.runelite.net/jav_config.ws");
|
||||
if (!codeSource.toFile().isDirectory()) {
|
||||
Files.createDirectory(codeSource);
|
||||
}
|
||||
Path vanillaOutputPath = codeSource.resolve("vanilla.jar");
|
||||
Path patchedOutputPath = codeSource.resolve("patched.jar");
|
||||
Path doActionOutputPath = codeSource.resolve("doAction.class");
|
||||
Path decompilationOutputPath = codeSource.resolve("decompiled.txt");
|
||||
System.out.println("Downloading vanilla client");
|
||||
downloadVanillaJar(vanillaOutputPath, rlConfigURL);
|
||||
File vanilla = vanillaOutputPath.toFile();
|
||||
if (vanilla.exists()) {
|
||||
log.info("Vanilla jar exists");
|
||||
} else {
|
||||
log.info("Vanilla jar does not exist");
|
||||
}
|
||||
|
||||
if (version.contains("SNAPSHOT")) {
|
||||
log.info("replacing snapshot version");
|
||||
version = version.replace("-SNAPSHOT", "");
|
||||
}
|
||||
|
||||
String[] versionSplits = version.split("\\.");
|
||||
int length = versionSplits.length;
|
||||
|
||||
if ((length > 0 && Integer.parseInt(versionSplits[0]) > 1 || (length > 1) && (Integer.parseInt(versionSplits[1]) > 10) )|| (length > 2 && Integer.parseInt(versionSplits[2]) > 34)) {
|
||||
String url = "https://repo.runelite.net/net/runelite/injected-client/" + version + "/injected-client-" + version + ".jar";
|
||||
URL injectedURL = new URL(url);
|
||||
log.info("Downloading injected client from " + injectedURL);
|
||||
try (InputStream clientStream = injectedURL.openStream()) {
|
||||
Files.copy(clientStream, patchedOutputPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
} else {
|
||||
System.out.println("unsupported rl version");
|
||||
throw new UnsupportedOperationException("unsupported rl version");
|
||||
}
|
||||
System.out.println(doActionFinalClassName);
|
||||
try (JarFile patchedJar = new JarFile(patchedOutputPath.toFile())) {
|
||||
patchedJar.entries().asIterator().forEachRemaining(jarEntry -> {
|
||||
//System.out.println("jar entry: " + jarEntry.getName());
|
||||
if (jarEntry.getName().equals(doActionFinalClassName + ".class")) {
|
||||
try (InputStream inputStream = patchedJar.getInputStream(jarEntry)) {
|
||||
Files.copy(inputStream, doActionOutputPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
OutputStream decompilationOutputStream = Files.newOutputStream(decompilationOutputPath);
|
||||
PrintStream s = new PrintStream(decompilationOutputStream);
|
||||
System.setOut(s);
|
||||
//Main.main(new String[]{doActionOutputPath.toAbsolutePath().toString(), "--methodname", doActionFinalMethodName});
|
||||
s.flush();
|
||||
s.close();
|
||||
decompilationOutputStream.close();
|
||||
System.setOut(new PrintStream(new FileOutputStream(FileDescriptor.out)));
|
||||
File output = decompilationOutputPath.toFile();
|
||||
BufferedReader reader = new BufferedReader(new FileReader(output));
|
||||
List<String> lines = reader.lines().collect(Collectors.toList());
|
||||
String previousLine = null;
|
||||
ArrayList<String> methodCalls = new ArrayList<>();
|
||||
for (String line : lines) {
|
||||
if (line.length() < 300) {
|
||||
if (line.contains("}")) {
|
||||
if (previousLine != null && previousLine.contains("(")) {
|
||||
methodCalls.add(previousLine.split("\\(")[0].trim());
|
||||
}
|
||||
}
|
||||
previousLine = line;
|
||||
}
|
||||
}
|
||||
reader.close();
|
||||
String mostUsedMethod = methodCalls.stream()
|
||||
.filter(str -> !str.contains("** while"))
|
||||
.collect(Collectors.groupingBy(str -> str, Collectors.counting()))
|
||||
.entrySet().stream().sorted(Map.Entry.comparingByValue(Comparator.reverseOrder()))
|
||||
.findFirst().get().getKey();
|
||||
if (mostUsedMethod.contains("client")) {
|
||||
usingClientAddNode = true;
|
||||
} else {
|
||||
String[] split = mostUsedMethod.split("\\.");
|
||||
Class<?> addNodeClassName = client.getClass().getClassLoader().loadClass(split[0]);
|
||||
for (Method declaredMethod : addNodeClassName.getDeclaredMethods()) {
|
||||
if (declaredMethod.getName().equals(split[1]) && declaredMethod.getParameterTypes()[0].getSimpleName().equals(ObfuscatedNames.packetWriterClassName)) {
|
||||
addNodeMethod = declaredMethod;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String line : lines) {
|
||||
if (line.contains(mostUsedMethod)) {
|
||||
log.info("found addNode method call example " + line.trim());
|
||||
String stringOutput = usingClientAddNode +
|
||||
"\n" +
|
||||
mostUsedMethod;
|
||||
Path config = Files.write(Files.createFile(codeSource.resolve(version + "-" + client.getRevision() + ".txt")), stringOutput.getBytes(StandardCharsets.UTF_8));
|
||||
loadedConfigName = config.getFileName().toString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void downloadVanillaJar(Path vanillaOutputPath, URL rlConfigURL) throws IOException {
|
||||
BufferedReader configReader = new BufferedReader(new InputStreamReader(rlConfigURL.openConnection().getInputStream()));
|
||||
while (configReader.ready()) {
|
||||
String line = configReader.readLine();
|
||||
if (line == null) {
|
||||
continue;
|
||||
}
|
||||
if (line.contains("runelite.gamepack")) {
|
||||
URL clientURL = new URL(line.split("=")[1]);
|
||||
log.info("Downloading vanilla client from " + clientURL);
|
||||
try (InputStream clientStream = clientURL.openStream()) {
|
||||
Files.copy(clientStream, vanillaOutputPath, StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
}
|
||||
}
|
||||
configReader.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutDown() {
|
||||
log.info("Shutdown");
|
||||
}
|
||||
|
||||
@Inject
|
||||
private void init() {
|
||||
if (config.alwaysOn() && client.getRevision() == CLIENT_REV) {
|
||||
SwingUtilities.invokeLater(() ->
|
||||
{
|
||||
try {
|
||||
RuneLite.getInjector().getInstance(PluginManager.class).setPluginEnabled(this, true);
|
||||
RuneLite.getInjector().getInstance(PluginManager.class).startPlugin(this);
|
||||
} catch (PluginInstantiationException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public String makeString() {
|
||||
return RuneLiteProperties.getVersion() + "-" + client.getRevision() + ".txt";
|
||||
}
|
||||
}
|
||||
1412
src/main/java/ee/futur/baseapi/nono/packets/utils/WidgetID.java
Normal file
@@ -0,0 +1,104 @@
|
||||
package ee.futur.baseapi.pathfinding;
|
||||
|
||||
import ee.futur.baseapi.BaseApiPlugin;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import org.roaringbitmap.RoaringBitmap;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
public class GlobalCollisionMap {
|
||||
static RoaringBitmap bitmap = init();
|
||||
|
||||
static byte[] load() {
|
||||
try {
|
||||
InputStream is = GlobalCollisionMap.class.getResourceAsStream("map");
|
||||
return new GZIPInputStream(is).readAllBytes();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static RoaringBitmap init() {
|
||||
RoaringBitmap bitmap = new RoaringBitmap();
|
||||
try {
|
||||
bitmap.deserialize(ByteBuffer.wrap(load()));
|
||||
bitmap.runOptimize();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return bitmap;
|
||||
}
|
||||
|
||||
public static boolean east(WorldPoint wp) {
|
||||
return bitmap.contains(packed(wp) | (1 << 30));
|
||||
}
|
||||
|
||||
public static boolean north(WorldPoint wp) {
|
||||
return bitmap.contains(packed(wp));
|
||||
}
|
||||
|
||||
public static boolean south(WorldPoint wp) {
|
||||
return north(wp.dy(-1));
|
||||
}
|
||||
|
||||
public static boolean west(WorldPoint wp) {
|
||||
return east(wp.dx(-1));
|
||||
}
|
||||
|
||||
public static int packed(int x, int y, int plane) {
|
||||
return (x & 16383) | ((y & 16383) << 14) | (plane << 28);
|
||||
}
|
||||
|
||||
public static WorldPoint unpack(int packed) {
|
||||
return new WorldPoint(packed & 16383, (packed >> 14) & 16383, packed >> 28);
|
||||
}
|
||||
|
||||
public static int packed(WorldPoint wp) {
|
||||
return (wp.getX() & 16383) | ((wp.getY() & 16383) << 14) | (wp.getPlane() << 28);
|
||||
}
|
||||
|
||||
public static List<WorldPoint> findPath(WorldPoint p) {
|
||||
long start = System.currentTimeMillis();
|
||||
WorldPoint starting = BaseApiPlugin.getClient().getLocalPlayer().getWorldLocation();
|
||||
HashSet<WorldPoint> visited = new HashSet<>();
|
||||
ArrayDeque<Node> queue = new ArrayDeque<Node>();
|
||||
queue.add(new Node(starting));
|
||||
while (!queue.isEmpty()) {
|
||||
Node current = queue.poll();
|
||||
WorldPoint currentData = current.getData();
|
||||
if (currentData.equals(p)) {
|
||||
List<WorldPoint> ret = new ArrayList<>();
|
||||
while (current != null) {
|
||||
ret.add(current.getData());
|
||||
current = current.getPrevious();
|
||||
}
|
||||
Collections.reverse(ret);
|
||||
ret.remove(0);
|
||||
System.out.println("Path took " + (System.currentTimeMillis() - start) + "ms");
|
||||
return ret;
|
||||
}
|
||||
//west
|
||||
if (west(currentData) && visited.add(currentData.dx(-1))) {
|
||||
queue.add(new Node(currentData.dx(-1), current));
|
||||
}
|
||||
//east
|
||||
if (east(currentData) && visited.add(currentData.dx(1))) {
|
||||
queue.add(new Node(currentData.dx(1), current));
|
||||
}
|
||||
//south
|
||||
if (south(currentData) && visited.add(currentData.dy(-1))) {
|
||||
queue.add(new Node(currentData.dy(-1), current));
|
||||
}
|
||||
//north
|
||||
if (north(currentData) && visited.add(currentData.dy(1))) {
|
||||
queue.add(new Node(currentData.dy(1), current));
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
35
src/main/java/ee/futur/baseapi/pathfinding/Node.java
Normal file
@@ -0,0 +1,35 @@
|
||||
package ee.futur.baseapi.pathfinding;
|
||||
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
public class Node {
|
||||
WorldPoint data;
|
||||
Node previous;
|
||||
|
||||
public Node(WorldPoint data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
Node() {
|
||||
this.data = null;
|
||||
this.previous = null;
|
||||
}
|
||||
|
||||
public Node(WorldPoint data, Node previous) {
|
||||
this.data = data;
|
||||
this.previous = previous;
|
||||
}
|
||||
|
||||
public WorldPoint getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public Node getPrevious() {
|
||||
return previous;
|
||||
}
|
||||
|
||||
public void setNode(WorldPoint data, Node previous) {
|
||||
this.data = data;
|
||||
this.previous = previous;
|
||||
}
|
||||
}
|
||||
110
src/main/java/ee/futur/baseapi/utils/WorldAreaUtility.java
Normal file
@@ -0,0 +1,110 @@
|
||||
package ee.futur.baseapi.utils;
|
||||
|
||||
import ee.futur.baseapi.nono.packets.utils.PacketReflection;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldArea;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class WorldAreaUtility {
|
||||
public static List<WorldPoint> objectInteractableTiles(TileObject e) {
|
||||
Point p;
|
||||
int width = 1;
|
||||
int height = 1;
|
||||
if (e instanceof GameObject) {
|
||||
GameObject gameObject = (GameObject) e;
|
||||
width = gameObject.sizeX();
|
||||
height = gameObject.sizeY();
|
||||
p = gameObject.getSceneMinLocation();
|
||||
} else {
|
||||
p = new Point(e.getLocalLocation().getSceneX(), e.getLocalLocation().getSceneY());
|
||||
}
|
||||
LocalPoint objectMinLocation = new LocalPoint(p.getX(), p.getY());
|
||||
WorldPoint objectMinWorldPoint = WorldPoint.fromScene(PacketReflection.getClient(), objectMinLocation.getX(), objectMinLocation.getY(), e.getPlane());
|
||||
int xSW = objectMinWorldPoint.getX();
|
||||
int ySW = objectMinWorldPoint.getY();
|
||||
int xNE = xSW + width - 1;
|
||||
int yNE = ySW + height - 1;
|
||||
List<WorldPoint> surroundingTiles = new ArrayList<>();
|
||||
for (int x = xSW - 1; x <= xNE + 1; x++) {
|
||||
for (int y = ySW - 1; y <= yNE + 1; y++) {
|
||||
// Check if the tile is a corner
|
||||
boolean isCorner = (x == xSW - 1 && y == ySW - 1) || (x == xNE + 1 && y == ySW - 1) ||
|
||||
(x == xSW - 1 && y == yNE + 1) || (x == xNE + 1 && y == yNE + 1);
|
||||
|
||||
// Exclude tiles that are within the object or are corner tiles
|
||||
if ((x >= xSW && x <= xNE && y >= ySW && y <= yNE) || isCorner) {
|
||||
continue;
|
||||
}
|
||||
surroundingTiles.add(new WorldPoint(x, y, objectMinWorldPoint.getPlane()));
|
||||
}
|
||||
}
|
||||
CollisionData[] collisionData = PacketReflection.getClient().getCollisionMaps();
|
||||
if (collisionData == null) {
|
||||
return surroundingTiles;
|
||||
}
|
||||
|
||||
int[][] planeData = collisionData[PacketReflection.getClient().getPlane()].getFlags();
|
||||
|
||||
var iter = surroundingTiles.iterator();
|
||||
|
||||
while (iter.hasNext()) {
|
||||
WorldPoint testPoint = iter.next();
|
||||
LocalPoint localScenePoint = LocalPoint.fromWorld(PacketReflection.getClient(), testPoint);
|
||||
if (localScenePoint == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int flags = planeData[localScenePoint.getSceneX()][localScenePoint.getSceneY()];
|
||||
if ((flags & CollisionDataFlag.BLOCK_MOVEMENT_FULL) != 0) {
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
return surroundingTiles;
|
||||
}
|
||||
|
||||
public static List<WorldPoint> objectInteractableTiles(Actor e) {
|
||||
int x = 1;
|
||||
int y = 1;
|
||||
if (e instanceof NPC) {
|
||||
NPC gameObject = (NPC) e;
|
||||
x = gameObject.getComposition().getSize();
|
||||
y = gameObject.getComposition().getSize();
|
||||
}
|
||||
WorldPoint areaMinCornerWorldPoint = new WorldPoint(e.getWorldLocation().getX() - 1, e.getWorldLocation().getY() - 1, e.getWorldLocation().getPlane());
|
||||
List<WorldPoint> objectArea = e.getWorldArea().toWorldPointList();
|
||||
int sx = x + 2;
|
||||
int sy = y + 2;
|
||||
ArrayList<WorldPoint> grownArea = new ArrayList<>(new WorldArea(areaMinCornerWorldPoint, sx, sy).toWorldPointList());
|
||||
grownArea.remove(grownArea.size() - 1);
|
||||
grownArea.remove((sx * sy) - sx);
|
||||
grownArea.remove(sx - 1);
|
||||
grownArea.remove(0);
|
||||
grownArea.removeAll(objectArea);
|
||||
|
||||
CollisionData[] collisionData = PacketReflection.getClient().getCollisionMaps();
|
||||
if (collisionData == null) {
|
||||
return grownArea;
|
||||
}
|
||||
|
||||
int[][] planeData = collisionData[PacketReflection.getClient().getPlane()].getFlags();
|
||||
|
||||
for (int i = grownArea.size() - 1; i >= 0; i--) {
|
||||
WorldPoint testPoint = grownArea.get(i);
|
||||
LocalPoint localScenePoint = LocalPoint.fromWorld(PacketReflection.getClient(), testPoint);
|
||||
if (localScenePoint == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int flags = planeData[localScenePoint.getSceneX()][localScenePoint.getSceneY()];
|
||||
if ((flags & CollisionDataFlag.BLOCK_MOVEMENT_FULL) != 0) {
|
||||
grownArea.remove(testPoint);
|
||||
}
|
||||
}
|
||||
|
||||
return grownArea;
|
||||
}
|
||||
}
|
||||
23
src/main/java/ee/futur/baseapi/utils/WorldPointUtility.java
Normal file
@@ -0,0 +1,23 @@
|
||||
package ee.futur.baseapi.utils;
|
||||
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
public class WorldPointUtility {
|
||||
public static boolean arePointsAdjacent(WorldPoint reference, WorldPoint target) {
|
||||
int x1 = reference.getX();
|
||||
int x2 = target.getX();
|
||||
|
||||
int y1 = reference.getY();
|
||||
int y2 = target.getY();
|
||||
|
||||
if (x1 != x2 && y1 != y2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (x1 == x2 && Math.abs(y1 - y2) == 1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return y1 == y2 && Math.abs(x1 - x2) == 1;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
public class EasyGiantsFoundryClientIDs
|
||||
{
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
import com.toofifty.easygiantsfoundry.enums.FontType;
|
||||
import ee.futur.easygiantsfoundry.enums.FontType;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Point;
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
|
||||
import static com.toofifty.easygiantsfoundry.EasyGiantsFoundryClientIDs.VARBIT_GAME_STAGE;
|
||||
import static com.toofifty.easygiantsfoundry.EasyGiantsFoundryClientIDs.VARBIT_HEAT;
|
||||
import com.toofifty.easygiantsfoundry.enums.Stage;
|
||||
import static ee.futur.easygiantsfoundry.EasyGiantsFoundryClientIDs.VARBIT_GAME_STAGE;
|
||||
import static ee.futur.easygiantsfoundry.EasyGiantsFoundryClientIDs.VARBIT_HEAT;
|
||||
import ee.futur.easygiantsfoundry.enums.Stage;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
@@ -35,8 +35,8 @@ import java.util.Set;
|
||||
|
||||
@Slf4j
|
||||
@PluginDescriptor(
|
||||
name = "Easy Giants' Foundry",
|
||||
description = "Helpful overlays for the Giants' Foundry minigame"
|
||||
name = "<html><font color=\"#FF9DF9\">[k4rli]</font> Giants' Foundry</html>",
|
||||
description = "Helpful overlays for the Giants' Foundry minigame"
|
||||
)
|
||||
public class EasyGiantsFoundryPlugin extends Plugin
|
||||
{
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
import static com.toofifty.easygiantsfoundry.MathUtil.max1;
|
||||
import static com.toofifty.easygiantsfoundry.EasyGiantsFoundryClientIDs.*;
|
||||
import static ee.futur.easygiantsfoundry.MathUtil.max1;
|
||||
import static ee.futur.easygiantsfoundry.EasyGiantsFoundryClientIDs.*;
|
||||
|
||||
import com.toofifty.easygiantsfoundry.enums.Heat;
|
||||
import com.toofifty.easygiantsfoundry.enums.Stage;
|
||||
import static com.toofifty.easygiantsfoundry.enums.Stage.GRINDSTONE;
|
||||
import static com.toofifty.easygiantsfoundry.enums.Stage.POLISHING_WHEEL;
|
||||
import static com.toofifty.easygiantsfoundry.enums.Stage.TRIP_HAMMER;
|
||||
import ee.futur.easygiantsfoundry.enums.Heat;
|
||||
import ee.futur.easygiantsfoundry.enums.Stage;
|
||||
import static ee.futur.easygiantsfoundry.enums.Stage.GRINDSTONE;
|
||||
import static ee.futur.easygiantsfoundry.enums.Stage.POLISHING_WHEEL;
|
||||
import static ee.futur.easygiantsfoundry.enums.Stage.TRIP_HAMMER;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
import com.toofifty.easygiantsfoundry.enums.Heat;
|
||||
import com.toofifty.easygiantsfoundry.enums.MetalBarType;
|
||||
import com.toofifty.easygiantsfoundry.enums.Stage;
|
||||
import ee.futur.easygiantsfoundry.enums.Heat;
|
||||
import ee.futur.easygiantsfoundry.enums.MetalBarType;
|
||||
import ee.futur.easygiantsfoundry.enums.Stage;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
@@ -1,14 +1,14 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
import static com.toofifty.easygiantsfoundry.EasyGiantsFoundryClientIDs.*;
|
||||
import static com.toofifty.easygiantsfoundry.EasyGiantsFoundryHelper.getHeatColor;
|
||||
import static com.toofifty.easygiantsfoundry.EasyGiantsFoundryHelper.renderTextLocation;
|
||||
import static com.toofifty.easygiantsfoundry.MouldHelper.SWORD_TYPE_1_VARBIT;
|
||||
import static com.toofifty.easygiantsfoundry.MouldHelper.SWORD_TYPE_2_VARBIT;
|
||||
import com.toofifty.easygiantsfoundry.enums.CommissionType;
|
||||
import com.toofifty.easygiantsfoundry.enums.FontType;
|
||||
import com.toofifty.easygiantsfoundry.enums.Heat;
|
||||
import com.toofifty.easygiantsfoundry.enums.Stage;
|
||||
import static ee.futur.easygiantsfoundry.EasyGiantsFoundryClientIDs.*;
|
||||
import static ee.futur.easygiantsfoundry.EasyGiantsFoundryHelper.getHeatColor;
|
||||
import static ee.futur.easygiantsfoundry.EasyGiantsFoundryHelper.renderTextLocation;
|
||||
import static ee.futur.easygiantsfoundry.MouldHelper.SWORD_TYPE_1_VARBIT;
|
||||
import static ee.futur.easygiantsfoundry.MouldHelper.SWORD_TYPE_2_VARBIT;
|
||||
import ee.futur.easygiantsfoundry.enums.CommissionType;
|
||||
import ee.futur.easygiantsfoundry.enums.FontType;
|
||||
import ee.futur.easygiantsfoundry.enums.Heat;
|
||||
import ee.futur.easygiantsfoundry.enums.Stage;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.List;
|
||||
|
||||
import com.toofifty.easygiantsfoundry.enums.Stage;
|
||||
import ee.futur.easygiantsfoundry.enums.Stage;
|
||||
import lombok.Value;
|
||||
|
||||
/**
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
public enum HighlightStyle
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
public class MathUtil
|
||||
{
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
import com.toofifty.easygiantsfoundry.enums.MetalBarSource;
|
||||
import com.toofifty.easygiantsfoundry.enums.MetalBarType;
|
||||
import ee.futur.easygiantsfoundry.enums.MetalBarSource;
|
||||
import ee.futur.easygiantsfoundry.enums.MetalBarType;
|
||||
import lombok.Getter;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.Item;
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
import com.toofifty.easygiantsfoundry.enums.MetalBarSource;
|
||||
import com.toofifty.easygiantsfoundry.enums.MetalBarType;
|
||||
import ee.futur.easygiantsfoundry.enums.MetalBarSource;
|
||||
import ee.futur.easygiantsfoundry.enums.MetalBarType;
|
||||
import lombok.Value;
|
||||
import net.runelite.api.gameval.ItemID;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.toofifty.easygiantsfoundry;
|
||||
package ee.futur.easygiantsfoundry;
|
||||
|
||||
import com.toofifty.easygiantsfoundry.enums.CommissionType;
|
||||
import com.toofifty.easygiantsfoundry.enums.Mould;
|
||||
import ee.futur.easygiantsfoundry.enums.CommissionType;
|
||||
import ee.futur.easygiantsfoundry.enums.Mould;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry.enums;
|
||||
package ee.futur.easygiantsfoundry.enums;
|
||||
|
||||
public enum CommissionType
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry.enums;
|
||||
package ee.futur.easygiantsfoundry.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry.enums;
|
||||
package ee.futur.easygiantsfoundry.enums;
|
||||
|
||||
import java.awt.Color;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry.enums;
|
||||
package ee.futur.easygiantsfoundry.enums;
|
||||
|
||||
public enum MetalBarSource
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry.enums;
|
||||
package ee.futur.easygiantsfoundry.enums;
|
||||
|
||||
public enum MetalBarType
|
||||
{
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.toofifty.easygiantsfoundry.enums;
|
||||
package ee.futur.easygiantsfoundry.enums;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import lombok.AllArgsConstructor;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import static com.toofifty.easygiantsfoundry.enums.CommissionType.*;
|
||||
import static com.toofifty.easygiantsfoundry.enums.MouldType.*;
|
||||
import static ee.futur.easygiantsfoundry.enums.CommissionType.*;
|
||||
import static ee.futur.easygiantsfoundry.enums.MouldType.*;
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum Mould
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry.enums;
|
||||
package ee.futur.easygiantsfoundry.enums;
|
||||
|
||||
public enum MouldType
|
||||
{
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.toofifty.easygiantsfoundry.enums;
|
||||
package ee.futur.easygiantsfoundry.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
28
src/main/java/ee/futur/easygotr/EasyGOTRActionHint.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package ee.futur.easygotr;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Singular;
|
||||
import lombok.Value;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@Value
|
||||
@Builder(toBuilder = true)
|
||||
public class EasyGOTRActionHint {
|
||||
EasyGOTRState state;
|
||||
String currentAction;
|
||||
String nextAction;
|
||||
@Singular
|
||||
List<String> notes;
|
||||
@Singular
|
||||
List<EasyGOTRHighlightTarget> highlights;
|
||||
|
||||
public List<String> getNotesSafe() {
|
||||
return notes == null ? Collections.emptyList() : notes;
|
||||
}
|
||||
|
||||
public List<EasyGOTRHighlightTarget> getHighlightsSafe() {
|
||||
return highlights == null ? Collections.emptyList() : highlights;
|
||||
}
|
||||
}
|
||||
417
src/main/java/ee/futur/easygotr/EasyGOTRConfig.java
Normal file
@@ -0,0 +1,417 @@
|
||||
package ee.futur.easygotr;
|
||||
|
||||
import net.runelite.client.config.*;
|
||||
|
||||
@ConfigGroup("EasyGOTR")
|
||||
public interface EasyGOTRConfig extends Config {
|
||||
@ConfigItem(
|
||||
keyName = "Toggle",
|
||||
name = "Toggle",
|
||||
description = "",
|
||||
position = 0
|
||||
)
|
||||
default Keybind toggle() {
|
||||
return Keybind.NOT_SET;
|
||||
}
|
||||
|
||||
@ConfigSection(
|
||||
name = "Easy GOTR Configuration",
|
||||
description = "Configure your settings for the Easy GOTR plugin",
|
||||
position = 1,
|
||||
closedByDefault = true
|
||||
)
|
||||
String easyGOTRConfig = "easyGOTRConfig";
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "prioritizeBloodDeath",
|
||||
name = "Always use blood/death altars",
|
||||
description = "Will ignore point balance for these altars and always use them if available.",
|
||||
position = 2,
|
||||
section = easyGOTRConfig
|
||||
)
|
||||
default boolean prioritizeBloodDeath() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "dropRunes",
|
||||
name = "Drop Runes",
|
||||
description = "Drop Runes instead of depositing (kek uim)",
|
||||
position = 3,
|
||||
section = easyGOTRConfig
|
||||
)
|
||||
default boolean dropRunes() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "dropRunesFilter",
|
||||
name = "Drop Runes Filter",
|
||||
description = "If Drop Runes is not enabled and this has runes entered, the type of rune entered here will still get dropped, others will get deposited (ex: air, Mind, Body). Add runes with full name, air rune, mind rune , cosmic rune, etc... and split with comma ','",
|
||||
position = 5,
|
||||
section = easyGOTRConfig
|
||||
)
|
||||
default String dropRunesFilter() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "collectUnchargedCells",
|
||||
name = "Collect Uncharged Cells",
|
||||
description = "When disabled, the plugin will no longer recommend picking up uncharged cells.",
|
||||
position = 6,
|
||||
section = easyGOTRConfig
|
||||
)
|
||||
default boolean collectUnchargedCells() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "keepImbueRunes",
|
||||
name = "Keep Imbue Runes",
|
||||
description = "Ignore water and fire runes when deciding to deposit runes (useful for Magic Imbue).",
|
||||
position = 7,
|
||||
section = easyGOTRConfig
|
||||
)
|
||||
default boolean keepImbueRunes() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "usePouches",
|
||||
name = "Use Essence Pouches?",
|
||||
description = "Requires NPC Contact runes in Rune Pouch or Redwood lit Lantern",
|
||||
position = 8,
|
||||
section = easyGOTRConfig
|
||||
)
|
||||
default boolean usePouches() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "startFrags",
|
||||
name = "Starting Fragments (0 to wait for first portal)",
|
||||
description = "How many fragments you should get before leaving the starting zone",
|
||||
position = 10,
|
||||
section = easyGOTRConfig
|
||||
)
|
||||
default int startingFrags() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ConfigSection(
|
||||
name = "Altar Ignore Configuration",
|
||||
description = "",
|
||||
position = 60,
|
||||
closedByDefault = true
|
||||
)
|
||||
String ignoreSection = "ignoreSection";
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ignoreAir",
|
||||
name = "Ignore Air Altar",
|
||||
description = "",
|
||||
position = 61,
|
||||
section = ignoreSection
|
||||
)
|
||||
default boolean ignoreAir() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ignoreMind",
|
||||
name = "Ignore Mind Altar",
|
||||
description = "",
|
||||
position = 62,
|
||||
section = ignoreSection
|
||||
)
|
||||
default boolean ignoreMind() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ignoreWater",
|
||||
name = "Ignore Water Altar",
|
||||
description = "",
|
||||
position = 63,
|
||||
section = ignoreSection
|
||||
)
|
||||
default boolean ignoreWater() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ignoreEarth",
|
||||
name = "Ignore Earth Altar",
|
||||
description = "",
|
||||
position = 64,
|
||||
section = ignoreSection
|
||||
)
|
||||
default boolean ignoreEarth() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ignoreFire",
|
||||
name = "Ignore Fire Altar",
|
||||
description = "",
|
||||
position = 65,
|
||||
section = ignoreSection
|
||||
)
|
||||
default boolean ignoreFire() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ignoreBody",
|
||||
name = "Ignore Body Altar",
|
||||
description = "",
|
||||
position = 66,
|
||||
section = ignoreSection
|
||||
)
|
||||
default boolean ignoreBody() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ignoreCosmic",
|
||||
name = "Ignore Cosmic Altar",
|
||||
description = "",
|
||||
position = 67,
|
||||
section = ignoreSection
|
||||
)
|
||||
default boolean ignoreCosmic() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ignoreChaos",
|
||||
name = "Ignore Chaos Altar",
|
||||
description = "",
|
||||
position = 68,
|
||||
section = ignoreSection
|
||||
)
|
||||
default boolean ignoreChaos() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ignoreNature",
|
||||
name = "Ignore Nature Altar",
|
||||
description = "",
|
||||
position = 69,
|
||||
section = ignoreSection
|
||||
)
|
||||
default boolean ignoreNature() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ignoreLaw",
|
||||
name = "Ignore Law Altar",
|
||||
description = "",
|
||||
position = 70,
|
||||
section = ignoreSection
|
||||
)
|
||||
default boolean ignoreLaw() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ignoreDeath",
|
||||
name = "Ignore Death Altar",
|
||||
description = "",
|
||||
position = 71,
|
||||
section = ignoreSection
|
||||
)
|
||||
default boolean ignoreDeath() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "ignoreBlood",
|
||||
name = "Ignore Blood Altar",
|
||||
description = "",
|
||||
position = 72,
|
||||
section = ignoreSection
|
||||
)
|
||||
default boolean ignoreBlood() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigSection(
|
||||
name = "Game Tick Configuration",
|
||||
description = "Configure how to handles game tick delays, 1 game tick equates to roughly 600ms",
|
||||
position = 100,
|
||||
closedByDefault = true
|
||||
)
|
||||
String delayTickConfig = "delayTickConfig";
|
||||
|
||||
@Range(
|
||||
max = 10
|
||||
)
|
||||
@ConfigItem(
|
||||
keyName = "tickDelayMin",
|
||||
name = "Game Tick Min",
|
||||
description = "",
|
||||
position = 101,
|
||||
section = delayTickConfig
|
||||
)
|
||||
default int tickDelayMin() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Range(
|
||||
max = 10
|
||||
)
|
||||
@ConfigItem(
|
||||
keyName = "tickDelayMax",
|
||||
name = "Game Tick Max",
|
||||
description = "",
|
||||
position = 102,
|
||||
section = delayTickConfig
|
||||
)
|
||||
default int tickDelayMax() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "tickDelayEnabled",
|
||||
name = "Tick delay",
|
||||
description = "enables some tick delays",
|
||||
position = 103,
|
||||
section = delayTickConfig
|
||||
)
|
||||
default boolean tickDelay() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigSection(
|
||||
name = "Debug Highlights",
|
||||
description = "Enable debug highlighting for specific game elements. Useful for debugging plugin behavior.",
|
||||
position = 200,
|
||||
closedByDefault = true
|
||||
)
|
||||
String debugSection = "debugSection";
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "debugHighlightBarriers",
|
||||
name = "Highlight Barriers",
|
||||
description = "Highlight barrier objects",
|
||||
position = 201,
|
||||
section = debugSection
|
||||
)
|
||||
default boolean debugHighlightBarriers() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "debugHighlightPortals",
|
||||
name = "Highlight Portals",
|
||||
description = "Highlight portal objects (huge guardian portal, altar portals)",
|
||||
position = 202,
|
||||
section = debugSection
|
||||
)
|
||||
default boolean debugHighlightPortals() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "debugHighlightAltars",
|
||||
name = "Highlight Altars/Guardians",
|
||||
description = "Highlight guardian portals (altar entrances)",
|
||||
position = 203,
|
||||
section = debugSection
|
||||
)
|
||||
default boolean debugHighlightAltars() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "debugHighlightWorkbench",
|
||||
name = "Highlight Workbench",
|
||||
description = "Highlight the workbench for crafting essence",
|
||||
position = 204,
|
||||
section = debugSection
|
||||
)
|
||||
default boolean debugHighlightWorkbench() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "debugHighlightGreatGuardian",
|
||||
name = "Highlight Great Guardian",
|
||||
description = "Highlight the Great Guardian NPC",
|
||||
position = 205,
|
||||
section = debugSection
|
||||
)
|
||||
default boolean debugHighlightGreatGuardian() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "debugHighlightRemains",
|
||||
name = "Highlight Guardian Remains",
|
||||
description = "Highlight guardian remains (regular, large, huge) for mining",
|
||||
position = 206,
|
||||
section = debugSection
|
||||
)
|
||||
default boolean debugHighlightRemains() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "debugHighlightRubble",
|
||||
name = "Highlight Rubble/Climb Points",
|
||||
description = "Highlight climbable rubble to access east mine",
|
||||
position = 207,
|
||||
section = debugSection
|
||||
)
|
||||
default boolean debugHighlightRubble() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "debugHighlightDepositPool",
|
||||
name = "Highlight Deposit Pool",
|
||||
description = "Highlight the deposit pool for runes",
|
||||
position = 208,
|
||||
section = debugSection
|
||||
)
|
||||
default boolean debugHighlightDepositPool() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "debugHighlightUnchargedCells",
|
||||
name = "Highlight Uncharged Cells",
|
||||
description = "Highlight uncharged cell containers",
|
||||
position = 209,
|
||||
section = debugSection
|
||||
)
|
||||
default boolean debugHighlightUnchargedCells() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "debugHighlightCellTiles",
|
||||
name = "Highlight Cell Tiles",
|
||||
description = "Highlight cell tiles for barrier placement",
|
||||
position = 210,
|
||||
section = debugSection
|
||||
)
|
||||
default boolean debugHighlightCellTiles() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "debugHighlightBindingNecklace",
|
||||
name = "Highlight Binding Necklace",
|
||||
description = "Highlight binding necklace in inventory when broken",
|
||||
position = 211,
|
||||
section = debugSection
|
||||
)
|
||||
default boolean debugHighlightBindingNecklace() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
68
src/main/java/ee/futur/easygotr/EasyGOTRHighlightTarget.java
Normal file
@@ -0,0 +1,68 @@
|
||||
package ee.futur.easygotr;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
|
||||
import java.awt.*;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Represents an entity or tile that should be highlighted for the player.
|
||||
*/
|
||||
@Getter
|
||||
public class EasyGOTRHighlightTarget {
|
||||
private final TileObject tileObject;
|
||||
private final NPC npc;
|
||||
private final WorldPoint worldPoint;
|
||||
private final Widget widget;
|
||||
private final Color color;
|
||||
private final String label;
|
||||
|
||||
private EasyGOTRHighlightTarget(TileObject tileObject, NPC npc, WorldPoint worldPoint, Widget widget, Color color, String label) {
|
||||
this.tileObject = tileObject;
|
||||
this.npc = npc;
|
||||
this.worldPoint = worldPoint;
|
||||
this.widget = widget;
|
||||
this.color = color;
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public static EasyGOTRHighlightTarget forTileObject(TileObject tileObject, Color color, String label) {
|
||||
return new EasyGOTRHighlightTarget(tileObject, null, null, null, color, label);
|
||||
}
|
||||
|
||||
public static EasyGOTRHighlightTarget forNpc(NPC npc, Color color, String label) {
|
||||
return new EasyGOTRHighlightTarget(null, npc, null, null, color, label);
|
||||
}
|
||||
|
||||
public static EasyGOTRHighlightTarget forWorldPoint(WorldPoint worldPoint, Color color, String label) {
|
||||
return new EasyGOTRHighlightTarget(null, null, worldPoint, null, color, label);
|
||||
}
|
||||
|
||||
public static EasyGOTRHighlightTarget forWidget(Widget widget, Color color, String label) {
|
||||
return new EasyGOTRHighlightTarget(null, null, null, widget, color, label);
|
||||
}
|
||||
|
||||
public Optional<TileObject> getTileObjectOptional() {
|
||||
return Optional.ofNullable(tileObject);
|
||||
}
|
||||
|
||||
public Optional<NPC> getNpcOptional() {
|
||||
return Optional.ofNullable(npc);
|
||||
}
|
||||
|
||||
public Optional<WorldPoint> getWorldPointOptional() {
|
||||
return Optional.ofNullable(worldPoint);
|
||||
}
|
||||
|
||||
public Optional<Widget> getWidgetOptional() {
|
||||
return Optional.ofNullable(widget);
|
||||
}
|
||||
|
||||
public Color getColorOrDefault(Color defaultColor) {
|
||||
return color != null ? color : defaultColor;
|
||||
}
|
||||
}
|
||||
194
src/main/java/ee/futur/easygotr/EasyGOTROverlay.java
Normal file
@@ -0,0 +1,194 @@
|
||||
package ee.futur.easygotr;
|
||||
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.ui.overlay.OverlayPanel;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
|
||||
import static org.apache.commons.lang3.time.DurationFormatUtils.formatDuration;
|
||||
|
||||
public class EasyGOTROverlay extends OverlayPanel {
|
||||
|
||||
private final Client client;
|
||||
private final EasyGOTRPlugin plugin;
|
||||
public String overlayState = "";
|
||||
private EasyGOTRActionHint hint;
|
||||
|
||||
@Inject
|
||||
private EasyGOTROverlay(Client client, EasyGOTRPlugin plugin) {
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
setPosition(OverlayPosition.BOTTOM_LEFT);
|
||||
}
|
||||
|
||||
public void setHint(EasyGOTRActionHint hint) {
|
||||
this.hint = hint;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
panelComponent.getChildren().clear();
|
||||
String timeFormat = (plugin.runningDuration.toHours() < 1) ? "mm:ss" : "HH:mm:ss";
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text("EasyGOTR")
|
||||
.color(plugin.started ? Color.GREEN : Color.RED)
|
||||
.build());
|
||||
|
||||
if (plugin.started) {
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Time running:")
|
||||
.leftColor(Color.WHITE)
|
||||
.right(formatDuration(plugin.runningDuration.toMillis(), timeFormat))
|
||||
.rightColor(Color.WHITE)
|
||||
.build());
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Status:")
|
||||
.leftColor(Color.WHITE)
|
||||
.right(overlayState)
|
||||
.rightColor(Color.WHITE)
|
||||
.build());
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Game Started:")
|
||||
.leftColor(Color.WHITE)
|
||||
.right(String.valueOf(plugin.riftState.isGameStarted()))
|
||||
.rightColor(Color.WHITE)
|
||||
.build());
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Portal Spawned:")
|
||||
.leftColor(Color.WHITE)
|
||||
.right(String.valueOf(plugin.riftState.isPortalSpawned()))
|
||||
.rightColor(Color.WHITE)
|
||||
.build());
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("First Portal Spawned:")
|
||||
.leftColor(Color.WHITE)
|
||||
.right(String.valueOf(plugin.riftState.hasFirstPortalSpawned))
|
||||
.rightColor(Color.WHITE)
|
||||
.build());
|
||||
|
||||
plugin.getPortalTimerText().ifPresent(timer -> panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Portal:")
|
||||
.leftColor(Color.WHITE)
|
||||
.right(timer)
|
||||
.rightColor(Color.WHITE)
|
||||
.build()));
|
||||
|
||||
plugin.getPortalTimingSummary().ifPresent(summary -> panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Portal Timing:")
|
||||
.leftColor(Color.WHITE)
|
||||
.right(summary)
|
||||
.rightColor(Color.WHITE)
|
||||
.build()));
|
||||
|
||||
plugin.getMainTimerText().ifPresent(mainTimer -> panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Main Timer:")
|
||||
.leftColor(Color.WHITE)
|
||||
.right(mainTimer)
|
||||
.rightColor(Color.WHITE)
|
||||
.build()));
|
||||
|
||||
plugin.getNextAltarName().ifPresent(name -> panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Next Altar:")
|
||||
.leftColor(Color.WHITE)
|
||||
.right(name)
|
||||
.rightColor(Color.WHITE)
|
||||
.build()));
|
||||
|
||||
plugin.getEnergySummary().ifPresent(summary -> panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Energy:")
|
||||
.leftColor(Color.WHITE)
|
||||
.right(summary)
|
||||
.rightColor(Color.WHITE)
|
||||
.build()));
|
||||
|
||||
EasyGOTRActionHint localHint = hint;
|
||||
if (localHint != null) {
|
||||
if (localHint.getCurrentAction() != null && !localHint.getCurrentAction().isEmpty()) {
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Current:")
|
||||
.leftColor(Color.WHITE)
|
||||
.right(localHint.getCurrentAction())
|
||||
.rightColor(Color.WHITE)
|
||||
.build());
|
||||
}
|
||||
if (localHint.getNextAction() != null && !localHint.getNextAction().isEmpty()) {
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Next:")
|
||||
.leftColor(Color.WHITE)
|
||||
.right(localHint.getNextAction())
|
||||
.rightColor(Color.WHITE)
|
||||
.build());
|
||||
}
|
||||
|
||||
for (String note : localHint.getNotesSafe()) {
|
||||
// Split long notes into multiple lines for better readability
|
||||
String[] lines = splitNoteIntoLines(note, 50); // ~50 chars per line
|
||||
for (String line : lines) {
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("")
|
||||
.right(line)
|
||||
.rightColor(Color.LIGHT_GRAY)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Dynamically size panel based on content
|
||||
int estimatedHeight = 50 + (panelComponent.getChildren().size() * 16);
|
||||
panelComponent.setPreferredSize(new Dimension(280, Math.min(estimatedHeight, 400)));
|
||||
}
|
||||
return super.render(graphics);
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits a note into multiple lines, breaking at word boundaries when possible.
|
||||
* @param note The note text to split
|
||||
* @param maxLength Maximum characters per line
|
||||
* @return Array of lines
|
||||
*/
|
||||
private String[] splitNoteIntoLines(String note, int maxLength) {
|
||||
if (note == null || note.length() <= maxLength) {
|
||||
return new String[]{note};
|
||||
}
|
||||
|
||||
java.util.List<String> lines = new java.util.ArrayList<>();
|
||||
String[] words = note.split(" ");
|
||||
StringBuilder currentLine = new StringBuilder();
|
||||
|
||||
for (String word : words) {
|
||||
if (currentLine.length() + word.length() + 1 <= maxLength) {
|
||||
if (currentLine.length() > 0) {
|
||||
currentLine.append(" ");
|
||||
}
|
||||
currentLine.append(word);
|
||||
} else {
|
||||
if (currentLine.length() > 0) {
|
||||
lines.add(currentLine.toString());
|
||||
currentLine = new StringBuilder();
|
||||
}
|
||||
// If a single word is longer than maxLength, split it anyway
|
||||
if (word.length() > maxLength) {
|
||||
// Split the long word
|
||||
int start = 0;
|
||||
while (start < word.length()) {
|
||||
int end = Math.min(start + maxLength, word.length());
|
||||
lines.add(word.substring(start, end));
|
||||
start = end;
|
||||
}
|
||||
} else {
|
||||
currentLine.append(word);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (currentLine.length() > 0) {
|
||||
lines.add(currentLine.toString());
|
||||
}
|
||||
|
||||
return lines.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
1541
src/main/java/ee/futur/easygotr/EasyGOTRPlugin.java
Normal file
111
src/main/java/ee/futur/easygotr/EasyGOTRSceneOverlay.java
Normal file
@@ -0,0 +1,111 @@
|
||||
package ee.futur.easygotr;
|
||||
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.TileObject;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.ui.overlay.outline.ModelOutlineRenderer;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Scene overlay that highlights the objects the user should click next.
|
||||
*/
|
||||
public class EasyGOTRSceneOverlay extends Overlay {
|
||||
private static final Color DEFAULT_COLOR = new Color(255, 140, 0, 180);
|
||||
private static final int OUTLINE_WIDTH = 3;
|
||||
private static final int OUTLINE_FEATHER = 2;
|
||||
|
||||
private final Client client;
|
||||
private final ModelOutlineRenderer modelOutlineRenderer;
|
||||
|
||||
@Setter
|
||||
private EasyGOTRActionHint hint;
|
||||
|
||||
@Inject
|
||||
private EasyGOTRSceneOverlay(Client client, ModelOutlineRenderer modelOutlineRenderer) {
|
||||
this.client = client;
|
||||
this.modelOutlineRenderer = modelOutlineRenderer;
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
if (client.getLocalPlayer() == null || hint == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (EasyGOTRHighlightTarget target : hint.getHighlightsSafe()) {
|
||||
Color color = target.getColorOrDefault(DEFAULT_COLOR);
|
||||
String label = target.getLabel();
|
||||
target.getTileObjectOptional().ifPresent(tileObject -> drawTileObject(graphics, tileObject, color, label));
|
||||
target.getNpcOptional().ifPresent(npc -> drawNpc(graphics, npc, color, label));
|
||||
target.getWorldPointOptional().ifPresent(worldPoint -> drawWorldPoint(graphics, worldPoint, color, label));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void drawTileObject(Graphics2D graphics, TileObject tileObject, Color color, String label) {
|
||||
modelOutlineRenderer.drawOutline(tileObject, OUTLINE_WIDTH, color, OUTLINE_FEATHER);
|
||||
if (label == null || label.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
LocalPoint localLocation = tileObject.getLocalLocation();
|
||||
if (localLocation == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Polygon poly = Perspective.getCanvasTilePoly(client, localLocation);
|
||||
if (poly == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Point labelPoint = new Point(poly.getBounds().x + poly.getBounds().width / 2, poly.getBounds().y);
|
||||
OverlayUtil.renderTextLocation(graphics, labelPoint, label, color);
|
||||
}
|
||||
|
||||
private void drawNpc(Graphics2D graphics, NPC npc, Color color, String label) {
|
||||
modelOutlineRenderer.drawOutline(npc, OUTLINE_WIDTH, color, OUTLINE_FEATHER);
|
||||
if (label == null || label.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
net.runelite.api.Point textLocation = npc.getCanvasTextLocation(graphics, label, npc.getLogicalHeight());
|
||||
if (textLocation != null) {
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, label, color);
|
||||
}
|
||||
}
|
||||
|
||||
private void drawWorldPoint(Graphics2D graphics, WorldPoint worldPoint, Color color, String label) {
|
||||
LocalPoint localPoint = LocalPoint.fromWorld(client, worldPoint);
|
||||
if (localPoint == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Polygon poly = Perspective.getCanvasTilePoly(client, localPoint);
|
||||
if (poly == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.draw(poly);
|
||||
|
||||
if (label != null && !label.isEmpty()) {
|
||||
Point labelPoint = new Point(poly.getBounds().x + poly.getBounds().width / 2, poly.getBounds().y);
|
||||
OverlayUtil.renderTextLocation(graphics, labelPoint, label, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
25
src/main/java/ee/futur/easygotr/EasyGOTRState.java
Normal file
@@ -0,0 +1,25 @@
|
||||
package ee.futur.easygotr;
|
||||
|
||||
public enum EasyGOTRState {
|
||||
GET_CELLS,
|
||||
MOVE_TO_EAST_MINE,
|
||||
WAITING_FOR_GAME,
|
||||
ENTER_PORTAL,
|
||||
MINE_HUGE_GUARDIANS,
|
||||
MINE_LARGE_GUARDIANS,
|
||||
MINE_REGULAR_GUARDIANS,
|
||||
REPAIR_POUCH,
|
||||
CRAFTING_ESSENCE,
|
||||
CRAFT_ESSENCE,
|
||||
DEPOSIT_RUNES,
|
||||
CRAFT_RUNES,
|
||||
LEAVE_EAST_MINE,
|
||||
LEAVE_ALTAR,
|
||||
POWER_GUARDIAN,
|
||||
USE_CELL,
|
||||
ENTER_ALTAR,
|
||||
MINING,
|
||||
ENTER_GAME,
|
||||
GAME_BUSY,
|
||||
BREAK
|
||||
}
|
||||
57
src/main/java/ee/futur/easygotr/EasyGOTRWidgetOverlay.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package ee.futur.easygotr;
|
||||
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* Overlay that highlights UI widgets (inventory items) the player should interact with.
|
||||
*/
|
||||
public class EasyGOTRWidgetOverlay extends Overlay {
|
||||
|
||||
@Setter
|
||||
private EasyGOTRActionHint hint;
|
||||
|
||||
@Inject
|
||||
private EasyGOTRWidgetOverlay() {
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
EasyGOTRActionHint localHint = hint;
|
||||
if (localHint == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
for (EasyGOTRHighlightTarget target : localHint.getHighlightsSafe()) {
|
||||
target.getWidgetOptional().ifPresent(widget -> highlightWidget(graphics, widget, target.getColorOrDefault(Color.CYAN), target.getLabel()));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void highlightWidget(Graphics2D graphics, Widget widget, Color color, String label) {
|
||||
Rectangle bounds = widget.getBounds();
|
||||
if (bounds == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.draw(bounds);
|
||||
|
||||
if (label != null && !label.isEmpty()) {
|
||||
graphics.drawString(label, (int) bounds.getX(), (int) (bounds.getY() - 4));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
479
src/main/java/ee/futur/easygotr/GOTRState.java
Normal file
@@ -0,0 +1,479 @@
|
||||
package ee.futur.easygotr;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Inject;
|
||||
import ee.futur.baseapi.collections.Inventory;
|
||||
import ee.futur.baseapi.collections.TileObjects;
|
||||
import ee.futur.baseapi.collections.Widgets;
|
||||
import ee.futur.easygotr.data.GOTRGameConstants;
|
||||
import ee.futur.easygotr.data.Utility;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Slf4j
|
||||
public class GOTRState {
|
||||
public static final int AIR_ALTAR = 43701;
|
||||
public static final int WATER_ALTAR = 43702;
|
||||
public static final int EARTH_ALTAR = 43703;
|
||||
public static final int FIRE_ALTAR = 43704;
|
||||
public static final int MIND_ALTAR = 43705;
|
||||
public static final int CHAOS_ALTAR = 43706;
|
||||
public static final int DEATH_ALTAR = 43707;
|
||||
public static final int BLOOD_ALTAR = 43708;
|
||||
public static final int BODY_ALTAR = 43709;
|
||||
public static final int COSMIC_ALTAR = 43710;
|
||||
public static final int NATURE_ALTAR = 43711;
|
||||
public static final int LAW_ALTAR = 43712;
|
||||
@Getter
|
||||
private int elementalPoints = -1;
|
||||
@Getter
|
||||
private int catalyticPoints = -1;
|
||||
@Getter
|
||||
private boolean gameStarted;
|
||||
private boolean started;
|
||||
public boolean hasFirstPortalSpawned = false;
|
||||
@Inject
|
||||
private Client client;
|
||||
private final EventBus eventBus;
|
||||
private final EasyGOTRConfig config;
|
||||
private static final String CHECK_POINT_REGEX = "You have (\\d+) catalytic energy and (\\d+) elemental energy";
|
||||
private static final Pattern CHECK_POINT_PATTERN = Pattern.compile(CHECK_POINT_REGEX);
|
||||
private static final String REWARD_POINT_REGEX = "Total elemental energy:[^>]+>([\\d,]+).*Total catalytic energy:[^>]+>([\\d,]+).";
|
||||
private static final Pattern REWARD_POINT_PATTERN = Pattern.compile(REWARD_POINT_REGEX);
|
||||
private static final Pattern PERCENT_PATTERN = Pattern.compile("(\\d+)%");
|
||||
private Set<Integer> accessibleAltars = new HashSet<>();
|
||||
private static final Set<Integer> GOTR_REGIONS = ImmutableSet.of(14483, 14484);
|
||||
private static final int PORTAL_WIDGET_ID = 48889884;
|
||||
int timeout = 0;
|
||||
int gameEndTimeout = 10;
|
||||
public boolean isGameEnding = false;
|
||||
@Getter
|
||||
private Optional<Instant> portalSpawnTime = Optional.empty();
|
||||
@Getter
|
||||
private Optional<Instant> lastPortalCloseTime = Optional.empty();
|
||||
private boolean portalVisibleLastTick = false;
|
||||
|
||||
@Inject
|
||||
public GOTRState(EventBus eventBus, EasyGOTRConfig config) {
|
||||
eventBus.register(this);
|
||||
this.eventBus = eventBus;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
public void register() {
|
||||
eventBus.register(this);
|
||||
}
|
||||
|
||||
public void deregister() {
|
||||
eventBus.unregister(this);
|
||||
}
|
||||
|
||||
public void setStarted(boolean started) {
|
||||
this.started = started;
|
||||
if (!started) {
|
||||
portalSpawnTime = Optional.empty();
|
||||
lastPortalCloseTime = Optional.empty();
|
||||
portalVisibleLastTick = false;
|
||||
gameStarted = false;
|
||||
hasFirstPortalSpawned = false;
|
||||
isGameEnding = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onGameTick(GameTick event) {
|
||||
if (client.getGameState() != GameState.LOGGED_IN || !started) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (timeout > 0) {
|
||||
timeout--;
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.accessibleAltars.isEmpty()) {
|
||||
this.accessibleAltars = Utility.getAccessibleAltars(client.getRealSkillLevel(Skill.RUNECRAFT),
|
||||
Quest.LOST_CITY.getState(client), Quest.TROLL_STRONGHOLD.getState(client),
|
||||
Quest.MOURNINGS_END_PART_II.getState(client), Quest.SINS_OF_THE_FATHER.getState(client));
|
||||
}
|
||||
|
||||
boolean portalVisible = isPortalSpawned();
|
||||
if (portalVisible && !portalVisibleLastTick) {
|
||||
portalSpawnTime = Optional.of(Instant.now());
|
||||
lastPortalCloseTime = Optional.empty();
|
||||
} else if (!portalVisible && portalVisibleLastTick) {
|
||||
lastPortalCloseTime = Optional.of(Instant.now());
|
||||
portalSpawnTime = Optional.empty();
|
||||
}
|
||||
portalVisibleLastTick = portalVisible;
|
||||
|
||||
Optional<Widget> frags = Inventory.search().withId(ItemID.GUARDIAN_FRAGMENTS).first();
|
||||
|
||||
if (!hasFirstPortalSpawned && (isPortalSpawned() || getPower() > 15 || (frags.isPresent() && frags.get().getItemQuantity() >= 250))) {
|
||||
hasFirstPortalSpawned = true;
|
||||
}
|
||||
|
||||
if (!gameStarted && isWidgetVisible()) {
|
||||
gameStarted = true;
|
||||
}
|
||||
|
||||
if (!isInAltar() && !isWidgetVisible()) {
|
||||
gameEndTimeout--;
|
||||
if (gameEndTimeout == 0) {
|
||||
log.info("Setting game to ended");
|
||||
gameStarted = false;
|
||||
isGameEnding = false;
|
||||
hasFirstPortalSpawned = false;
|
||||
}
|
||||
} else {
|
||||
gameEndTimeout = 10;
|
||||
}
|
||||
}
|
||||
|
||||
private int getPower() {
|
||||
Optional<Widget> pWidget = Widgets.search().withId(48889874).first();
|
||||
if (pWidget.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Matcher matcher = PERCENT_PATTERN.matcher(pWidget.get().getText());
|
||||
if (matcher.find()) {
|
||||
return Integer.parseInt(matcher.group(1));
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onChatMessage(ChatMessage event) {
|
||||
if (client.getGameState() != GameState.LOGGED_IN || !started) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getType() != ChatMessageType.SPAM && event.getType() != ChatMessageType.GAMEMESSAGE && event.getType() != ChatMessageType.MESBOX) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (client.getGameState() != GameState.LOGGED_IN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getMessage().contains(GOTRGameConstants.GAME_STARTED)) {
|
||||
gameStarted = true;
|
||||
}
|
||||
|
||||
if (event.getType() == ChatMessageType.MESBOX) {
|
||||
Matcher checkPointMatcher = CHECK_POINT_PATTERN.matcher(event.getMessage());
|
||||
if (checkPointMatcher.find()) {
|
||||
catalyticPoints = Integer.parseInt(checkPointMatcher.group(1));
|
||||
elementalPoints = Integer.parseInt(checkPointMatcher.group(2));
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getMessage().contains("successfully closed the rift")) {
|
||||
gameStarted = false;
|
||||
hasFirstPortalSpawned = false;
|
||||
isGameEnding = false;
|
||||
}
|
||||
|
||||
if (event.getMessage().contains("Guardian was defeated")) {
|
||||
gameStarted = false;
|
||||
hasFirstPortalSpawned = false;
|
||||
isGameEnding = false;
|
||||
}
|
||||
|
||||
if (event.getMessage().contains("is fully charged")) {
|
||||
isGameEnding = true;
|
||||
}
|
||||
|
||||
Matcher rewardPointMatcher = REWARD_POINT_PATTERN.matcher(event.getMessage());
|
||||
if (rewardPointMatcher.find()) {
|
||||
elementalPoints = Integer.parseInt(rewardPointMatcher.group(1).replaceAll(",", ""));
|
||||
catalyticPoints = Integer.parseInt(rewardPointMatcher.group(2).replaceAll(",", ""));
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isWidgetVisible() {
|
||||
Optional<Widget> widget = Widgets.search().withId(GOTRGameConstants.PARENT_WIDGET).first();
|
||||
return widget.isPresent() && !widget.get().isHidden();
|
||||
}
|
||||
|
||||
|
||||
public boolean isInAltar() {
|
||||
for (int region : client.getMapRegions()) {
|
||||
if (GOTR_REGIONS.contains(region)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isOutsideBarrier() {
|
||||
return client.getLocalPlayer().getWorldLocation().getY() <= GOTRGameConstants.OUTSIDE_BARRIER_Y && !isInAltar();
|
||||
}
|
||||
|
||||
public boolean isInLargeMine() {
|
||||
return !isInAltar() && client.getLocalPlayer().getWorldLocation().getX() >= GOTRGameConstants.LARGE_MINE_X;
|
||||
}
|
||||
|
||||
public boolean isInHugeMine() {
|
||||
return !isInAltar() && client.getLocalPlayer().getWorldLocation().getX() <= GOTRGameConstants.HUGE_MINE_X;
|
||||
}
|
||||
|
||||
public boolean isGameBusy() {
|
||||
return !isInAltar() && isOutsideBarrier() && TileObjects.search().withId(GOTRGameConstants.BARRIER_BUSY_ID).nearestToPlayer().isPresent();
|
||||
}
|
||||
|
||||
public boolean isPortalSpawned() {
|
||||
Widget portalWidget = client.getWidget(PORTAL_WIDGET_ID);
|
||||
return portalWidget != null && !portalWidget.isHidden();
|
||||
}
|
||||
|
||||
public TileObject getNextAltar() {
|
||||
int catalytic;
|
||||
int elemental;
|
||||
TileObject catalyticAltar = null;
|
||||
TileObject elementalAltar = null;
|
||||
List<TileObject> guardians = TileObjects.search().nameContains("Guardian of").result();
|
||||
for (TileObject guardian : guardians) {
|
||||
GameObject gameObject = (GameObject) guardian;
|
||||
Animation animation = ((DynamicObject) gameObject.getRenderable()).getAnimation();
|
||||
//Active guardians
|
||||
if (animation.getId() == 9363) {
|
||||
if (isCatalytic(guardian)) {
|
||||
if (accessibleAltars.contains(guardian.getId()) && isAltarBetter(catalyticAltar, guardian)) {
|
||||
catalyticAltar = guardian;
|
||||
}
|
||||
} else if (isAltarBetter(elementalAltar, guardian)) {
|
||||
elementalAltar = guardian;
|
||||
}
|
||||
} else {
|
||||
if (!hasTalisman(guardian)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isCatalytic(guardian)) {
|
||||
if (accessibleAltars.contains(guardian.getId()) && isAltarBetter(catalyticAltar, guardian)) {
|
||||
catalyticAltar = guardian;
|
||||
}
|
||||
} else {
|
||||
if (isAltarBetter(elementalAltar, guardian)) {
|
||||
elementalAltar = guardian;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (catalyticPoints < 0 && elementalPoints < 0) {
|
||||
elemental = client.getVarbitValue(13686);
|
||||
catalytic = client.getVarbitValue(13685);
|
||||
} else {
|
||||
elemental = elementalPoints;
|
||||
catalytic = catalyticPoints;
|
||||
elemental += (int) Math.floor((double) client.getVarbitValue(13686) / 100);
|
||||
catalytic += (int) Math.floor((double) client.getVarbitValue(13685) / 100);
|
||||
}
|
||||
|
||||
//log.info("Catalytic: " + catalytic + " Elemental: " + elemental);
|
||||
|
||||
if (catalytic == 0 && elemental == 0) {
|
||||
elemental = 1;
|
||||
}
|
||||
|
||||
Widget catalyticWidget = client.getWidget(48889879);
|
||||
Widget elementalWidget = client.getWidget(48889876);
|
||||
|
||||
if (elementalWidget == null || catalyticWidget == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (catalyticAltar == null) {
|
||||
return elementalAltar;
|
||||
}
|
||||
|
||||
if (elementalAltar == null) {
|
||||
return catalyticAltar;
|
||||
}
|
||||
|
||||
if (config.prioritizeBloodDeath() && isBloodDeath(catalyticAltar)) {
|
||||
return catalyticAltar;
|
||||
}
|
||||
|
||||
if (isAltarIgnored(catalyticAltar)) {
|
||||
if (isAltarIgnored(elementalAltar)) {
|
||||
if (catalytic > elemental) {
|
||||
return elementalAltar;
|
||||
} else {
|
||||
return catalyticAltar;
|
||||
}
|
||||
}
|
||||
|
||||
return elementalAltar;
|
||||
}
|
||||
|
||||
if (isAltarIgnored(elementalAltar)) {
|
||||
return catalyticAltar;
|
||||
}
|
||||
|
||||
// Early game: prioritize elemental altars for combination runes (polyelemental stones give +3 energy)
|
||||
// Guide suggests focusing elemental until ~500-1000 points, then balance with catalytic
|
||||
if (elemental < 500) {
|
||||
// Prefer elemental early, but still use catalytic if it's very low (< 100) to avoid being too unbalanced
|
||||
if (catalytic < 100) {
|
||||
return catalyticAltar;
|
||||
}
|
||||
return elementalAltar;
|
||||
}
|
||||
|
||||
// Mid/late game: balance points (current logic)
|
||||
if (catalytic > elemental) {
|
||||
return elementalAltar;
|
||||
}
|
||||
|
||||
return catalyticAltar;
|
||||
}
|
||||
|
||||
private boolean isBloodDeath(TileObject altar) {
|
||||
switch (altar.getId()) {
|
||||
case BLOOD_ALTAR:
|
||||
case DEATH_ALTAR:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAltarBetter(TileObject oldAltar, TileObject candidate) {
|
||||
if (oldAltar == null) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getAltarPriority(oldAltar) < getAltarPriority(candidate)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (getAltarPriority(oldAltar) == getAltarPriority(candidate) && hasTalisman(candidate)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isAltarIgnored(TileObject altar) {
|
||||
switch (altar.getId()) {
|
||||
case AIR_ALTAR:
|
||||
return config.ignoreAir();
|
||||
case MIND_ALTAR:
|
||||
return config.ignoreMind();
|
||||
case BODY_ALTAR:
|
||||
return config.ignoreBody();
|
||||
case WATER_ALTAR:
|
||||
return config.ignoreWater();
|
||||
case COSMIC_ALTAR:
|
||||
return config.ignoreCosmic();
|
||||
case CHAOS_ALTAR:
|
||||
return config.ignoreChaos();
|
||||
case EARTH_ALTAR:
|
||||
return config.ignoreEarth();
|
||||
case NATURE_ALTAR:
|
||||
return config.ignoreNature();
|
||||
case LAW_ALTAR:
|
||||
return config.ignoreLaw();
|
||||
case FIRE_ALTAR:
|
||||
return config.ignoreFire();
|
||||
case DEATH_ALTAR:
|
||||
return config.ignoreDeath();
|
||||
case BLOOD_ALTAR:
|
||||
return config.ignoreBlood();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private int getAltarPriority(TileObject altar) {
|
||||
switch (altar.getId()) {
|
||||
case AIR_ALTAR:
|
||||
case MIND_ALTAR:
|
||||
case BODY_ALTAR:
|
||||
return 1;
|
||||
case WATER_ALTAR:
|
||||
case COSMIC_ALTAR:
|
||||
case CHAOS_ALTAR:
|
||||
return 2;
|
||||
case EARTH_ALTAR:
|
||||
case NATURE_ALTAR:
|
||||
case LAW_ALTAR:
|
||||
return 3;
|
||||
case FIRE_ALTAR:
|
||||
case DEATH_ALTAR:
|
||||
return 4;
|
||||
case BLOOD_ALTAR:
|
||||
return 5;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
private boolean hasTalisman(TileObject altar) {
|
||||
int talismanID = 0;
|
||||
switch (altar.getId()) {
|
||||
case AIR_ALTAR:
|
||||
talismanID = ItemID.PORTAL_TALISMAN_AIR;
|
||||
break;
|
||||
case WATER_ALTAR:
|
||||
talismanID = ItemID.PORTAL_TALISMAN_WATER;
|
||||
break;
|
||||
case EARTH_ALTAR:
|
||||
talismanID = ItemID.PORTAL_TALISMAN_EARTH;
|
||||
break;
|
||||
case FIRE_ALTAR:
|
||||
talismanID = ItemID.PORTAL_TALISMAN_FIRE;
|
||||
break;
|
||||
case MIND_ALTAR:
|
||||
talismanID = ItemID.PORTAL_TALISMAN_MIND;
|
||||
break;
|
||||
case CHAOS_ALTAR:
|
||||
talismanID = ItemID.PORTAL_TALISMAN_CHAOS;
|
||||
break;
|
||||
case DEATH_ALTAR:
|
||||
talismanID = ItemID.PORTAL_TALISMAN_DEATH;
|
||||
break;
|
||||
case BLOOD_ALTAR:
|
||||
talismanID = ItemID.PORTAL_TALISMAN_BLOOD;
|
||||
break;
|
||||
case BODY_ALTAR:
|
||||
talismanID = ItemID.PORTAL_TALISMAN_BODY;
|
||||
break;
|
||||
case COSMIC_ALTAR:
|
||||
talismanID = ItemID.PORTAL_TALISMAN_COSMIC;
|
||||
break;
|
||||
case NATURE_ALTAR:
|
||||
talismanID = ItemID.PORTAL_TALISMAN_NATURE;
|
||||
break;
|
||||
case LAW_ALTAR:
|
||||
talismanID = ItemID.PORTAL_TALISMAN_LAW;
|
||||
break;
|
||||
}
|
||||
|
||||
return Inventory.getItemAmount(talismanID) > 0;
|
||||
}
|
||||
|
||||
private boolean isCatalytic(TileObject altar) {
|
||||
Set<Integer> catalyticAltars = Set.of(43705, 43709, 43706, 43710, 43711, 43708, 43712, 43707);
|
||||
return catalyticAltars.contains(altar.getId());
|
||||
}
|
||||
}
|
||||
260
src/main/java/ee/futur/easygotr/PouchManager.java
Normal file
@@ -0,0 +1,260 @@
|
||||
package ee.futur.easygotr;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import ee.futur.baseapi.collections.Inventory;
|
||||
import ee.futur.easygotr.data.GOTRGameConstants;
|
||||
import ee.futur.easygotr.data.Pouch;
|
||||
import lombok.Setter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class PouchManager {
|
||||
private final List<Pouch> pouches = new ArrayList<>();
|
||||
@Inject
|
||||
private Client client;
|
||||
private final EventBus eventBus;
|
||||
@Setter
|
||||
private boolean started;
|
||||
private final List<Integer> DEGRADED_POUCH_IDS = ImmutableList.of(ItemID.MEDIUM_POUCH_5511, ItemID.LARGE_POUCH_5513, ItemID.GIANT_POUCH_5515,
|
||||
ItemID.COLOSSAL_POUCH_26786);
|
||||
|
||||
@Inject
|
||||
public PouchManager(EventBus eventBus) {
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
||||
public void register() {
|
||||
eventBus.register(this);
|
||||
}
|
||||
|
||||
public void deregister() {
|
||||
eventBus.unregister(this);
|
||||
}
|
||||
|
||||
public void refreshPouches() {
|
||||
//pouches.clear();
|
||||
Optional<Widget> smallpouch = Inventory.search().withId(ItemID.SMALL_POUCH).first();
|
||||
Optional<Widget> medpouch = Inventory.search().withId(ItemID.MEDIUM_POUCH).first();
|
||||
Optional<Widget> largepouch = Inventory.search().withId(ItemID.LARGE_POUCH).first();
|
||||
Optional<Widget> giantpouch = Inventory.search().withId(ItemID.GIANT_POUCH).first();
|
||||
Optional<Widget> collosalpouch = Inventory.search().withId(ItemID.COLOSSAL_POUCH).first();
|
||||
if (smallpouch.isPresent()) {
|
||||
Pouch smallEssPouch = new Pouch(ItemID.SMALL_POUCH, 3);
|
||||
pouches.removeIf(p -> p.getPouchID() == ItemID.SMALL_POUCH);
|
||||
pouches.add(smallEssPouch);
|
||||
}
|
||||
|
||||
if (medpouch.isPresent() && client.getRealSkillLevel(Skill.RUNECRAFT) >= 25) {
|
||||
Pouch medEssPouch = new Pouch(ItemID.MEDIUM_POUCH, 6);
|
||||
pouches.removeIf(p -> p.getPouchID() == ItemID.MEDIUM_POUCH);
|
||||
pouches.add(medEssPouch);
|
||||
}
|
||||
|
||||
if (largepouch.isPresent() && client.getRealSkillLevel(Skill.RUNECRAFT) >= 50) {
|
||||
Pouch largeEssPouch = new Pouch(ItemID.LARGE_POUCH, 9);
|
||||
pouches.removeIf(p -> p.getPouchID() == ItemID.LARGE_POUCH);
|
||||
pouches.add(largeEssPouch);
|
||||
}
|
||||
|
||||
if (giantpouch.isPresent() && client.getRealSkillLevel(Skill.RUNECRAFT) >= 75) {
|
||||
Pouch giantEssPouch = new Pouch(ItemID.GIANT_POUCH, 12);
|
||||
pouches.removeIf(p -> p.getPouchID() == ItemID.GIANT_POUCH);
|
||||
pouches.add(giantEssPouch);
|
||||
}
|
||||
|
||||
if (collosalpouch.isPresent() && client.getRealSkillLevel(Skill.RUNECRAFT) >= 85) {
|
||||
Pouch colossalEssPouch = new Pouch(ItemID.COLOSSAL_POUCH, 40);
|
||||
pouches.removeIf(p -> p.getPouchID() == ItemID.COLOSSAL_POUCH);
|
||||
pouches.add(colossalEssPouch);
|
||||
}
|
||||
syncPouchQuantities();
|
||||
log.info("Setting Pouches: {}", pouches);
|
||||
}
|
||||
|
||||
private void syncPouchQuantities() {
|
||||
for (Pouch pouch : pouches) {
|
||||
pouch.setCurrentEssence(getPouchAmount(pouch.getPouchID(), pouch.getEssenceTotal()));
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onChatMessage(ChatMessage event) {
|
||||
//log.info(pouches.toString());
|
||||
if (client.getGameState() != GameState.LOGGED_IN || !started) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getType() != ChatMessageType.SPAM && event.getType() != ChatMessageType.GAMEMESSAGE) return;
|
||||
|
||||
if (client.getGameState() != GameState.LOGGED_IN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getMessage().contains(GOTRGameConstants.GAME_STARTED)) {
|
||||
setEssenceInPouches(0);
|
||||
}
|
||||
|
||||
if (event.getMessage().contains(GOTRGameConstants.GAME_WIN)) {
|
||||
setEssenceInPouches(0);
|
||||
}
|
||||
|
||||
if (event.getMessage().contains(GOTRGameConstants.GAME_OVER)) {
|
||||
setEssenceInPouches(0);
|
||||
}
|
||||
}
|
||||
|
||||
public List<Pouch> getFullPouches() {
|
||||
syncPouchQuantities();
|
||||
List<Pouch> result = new ArrayList<>();
|
||||
for (Pouch pouch : pouches) {
|
||||
if (pouch.getCurrentEssence() > 0) {
|
||||
result.add(pouch);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean hasFullPouch() {
|
||||
syncPouchQuantities();
|
||||
for (Pouch pouch : pouches) {
|
||||
if (pouch.getCurrentEssence() > 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void fillPouches() {
|
||||
syncPouchQuantities();
|
||||
int essenceAmount = Inventory.getItemAmount(ItemID.GUARDIAN_ESSENCE);
|
||||
List<Pouch> result = getEmptyPouches();
|
||||
for (Pouch pouch : result) {
|
||||
Optional<Widget> emptyPouch = Inventory.search().withId(pouch.getPouchID()).first();
|
||||
if (emptyPouch.isPresent()) {
|
||||
Widget p = emptyPouch.get();
|
||||
//InventoryInteraction.useItem(p, "Fill");
|
||||
int essenceWithdrawn = pouch.getEssenceTotal() - pouch.getCurrentEssence();
|
||||
if (essenceAmount - essenceWithdrawn >= 0) {
|
||||
essenceAmount -= essenceWithdrawn;
|
||||
pouch.setCurrentEssence(pouch.getEssenceTotal());
|
||||
} else {
|
||||
pouch.setCurrentEssence(pouch.getCurrentEssence() + essenceAmount);
|
||||
essenceAmount = 0;
|
||||
}
|
||||
if (essenceAmount == 0) {
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void emptyPouches() {
|
||||
syncPouchQuantities();
|
||||
int spaces = Inventory.getEmptySlots();
|
||||
List<Pouch> result = getFullPouches();
|
||||
for (Pouch pouch : result) {
|
||||
Optional<Widget> emptyPouch = Inventory.search().withId(pouch.getPouchID()).first();
|
||||
if (emptyPouch.isPresent()) {
|
||||
//InventoryInteraction.useItem(emptyPouch.get(), "Empty");
|
||||
if (pouch.getCurrentEssence() - spaces < 0) {
|
||||
spaces -= pouch.getCurrentEssence();
|
||||
pouch.setCurrentEssence(0);
|
||||
} else {
|
||||
pouch.setCurrentEssence(pouch.getCurrentEssence() - spaces);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<Pouch> getEmptyPouches() {
|
||||
syncPouchQuantities();
|
||||
List<Pouch> result = new ArrayList<>();
|
||||
for (Pouch pouch : pouches) {
|
||||
if (!isPouchFull(pouch)) {
|
||||
result.add(pouch);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public boolean hasEmptyPouches() {
|
||||
syncPouchQuantities();
|
||||
for (Pouch pouch : pouches) {
|
||||
if (!isPouchFull(pouch)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isPouchFull(Pouch pouch) {
|
||||
return pouch.getCurrentEssence() == pouch.getEssenceTotal();
|
||||
}
|
||||
|
||||
private void setEssenceInPouches(int amount) {
|
||||
for (Pouch curr : pouches) {
|
||||
curr.setCurrentEssence(amount);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasDegradedPouches() {
|
||||
return Inventory.search().idInList(DEGRADED_POUCH_IDS).first().isPresent();
|
||||
}
|
||||
|
||||
public int getAvailableSpace() {
|
||||
syncPouchQuantities();
|
||||
return pouches.stream().mapToInt(pouch -> pouch.getEssenceTotal() - pouch.getCurrentEssence()).sum();
|
||||
}
|
||||
|
||||
public int getEssenceInPouches() {
|
||||
syncPouchQuantities();
|
||||
return pouches.stream().mapToInt(Pouch::getCurrentEssence).sum();
|
||||
}
|
||||
|
||||
private int getPouchAmount(int pouchId, int capacity) {
|
||||
int varbit = getVarbitForPouch(pouchId);
|
||||
if (varbit == -1 || client == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int amount = client.getVarbitValue(varbit);
|
||||
if (amount < 0) {
|
||||
return 0;
|
||||
}
|
||||
if (amount > capacity) {
|
||||
return capacity;
|
||||
}
|
||||
return amount;
|
||||
}
|
||||
|
||||
private int getVarbitForPouch(int pouchId) {
|
||||
switch (pouchId) {
|
||||
case ItemID.SMALL_POUCH:
|
||||
return Varbits.ESSENCE_POUCH_SMALL_AMOUNT;
|
||||
case ItemID.MEDIUM_POUCH:
|
||||
return Varbits.ESSENCE_POUCH_MEDIUM_AMOUNT;
|
||||
case ItemID.LARGE_POUCH:
|
||||
return Varbits.ESSENCE_POUCH_LARGE_AMOUNT;
|
||||
case ItemID.GIANT_POUCH:
|
||||
return Varbits.ESSENCE_POUCH_GIANT_AMOUNT;
|
||||
case ItemID.COLOSSAL_POUCH:
|
||||
return Varbits.ESSENCE_POUCH_COLOSSAL_AMOUNT;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
32
src/main/java/ee/futur/easygotr/README.md
Normal file
@@ -0,0 +1,32 @@
|
||||
EasyGOTR
|
||||
|
||||
Automation plugins for runelite
|
||||
|
||||
# Discord
|
||||
https://discord.gg/kwYBYEg4uu
|
||||
|
||||
# [PP] EasyGOTR
|
||||
|
||||
**How to setup**:
|
||||
|
||||
- Starting Fragments
|
||||
- How many fragments to mine before leaving the starting area
|
||||
- Minimum Fragments
|
||||
- Amount in inventory to start mining more fragments
|
||||
- Ignore Portal Ess
|
||||
- Ignores the portal if you have at least this many essence in inventory
|
||||
- Drop Runes
|
||||
- Check to drop all runes instead of depositing
|
||||
- Drop Runes Filter
|
||||
- Comma delimited, rune names to drop - the rest will be deposited
|
||||
- Use Essence Pouches?
|
||||
- Requires NPC Contact runes or redwood lit lantern
|
||||
- Abyssal Book in bank? (IMPORTANT FOR NPC CONTACT)
|
||||
- Check if you have the abyssal book in the bank
|
||||
- This is required because owning the abyssal book changes the dialogue option
|
||||
- Prioritize Catalytic Energy
|
||||
- Will try to balance points if not checked
|
||||
- Prioritize Higher Tier Runes (BETA)
|
||||
- Prioritizes Nature/Law/Death/Blood runes even if points aren't balanced - Expect some bugs
|
||||
- Prioritize Portal (BETA)
|
||||
- Prioritizes the portal, mainly affects when to drop/deposit runes - Expect some bugs
|
||||
45
src/main/java/ee/futur/easygotr/data/Altar.java
Normal file
@@ -0,0 +1,45 @@
|
||||
package ee.futur.easygotr.data;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum Altar {
|
||||
AIR(43701, GOTRGameConstants.AIR_SPRITE),
|
||||
MIND(43705, GOTRGameConstants.MIND_SPRITE),
|
||||
WATER(43702, GOTRGameConstants.WATER_SPRITE),
|
||||
EARTH(43703, GOTRGameConstants.EARTH_SPRITE),
|
||||
FIRE(43704, GOTRGameConstants.FIRE_SPRITE),
|
||||
BODY(43709, GOTRGameConstants.BODY_SPRITE),
|
||||
COSMIC(43710, GOTRGameConstants.COSMIC_SPRITE),
|
||||
CHAOS(43706, GOTRGameConstants.CHAOS_SPRITE),
|
||||
NATURE(43711, GOTRGameConstants.NATURE_SPRITE),
|
||||
LAW(43712, GOTRGameConstants.LAW_SPRITE),
|
||||
DEATH(43707, GOTRGameConstants.DEATH_SPRITE),
|
||||
BLOOD(43708, GOTRGameConstants.BLOOD_SPRITE);
|
||||
|
||||
final int id;
|
||||
final int spriteId;
|
||||
|
||||
Altar(int id, int spriteId) {
|
||||
this.id = id;
|
||||
this.spriteId = spriteId;
|
||||
}
|
||||
|
||||
public static Altar getAltarBySpriteId(int spriteId) {
|
||||
for (Altar altar : Altar.values()) {
|
||||
if (altar.getSpriteId() == spriteId) {
|
||||
return altar;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static Altar getAltarByObjectId(int id) {
|
||||
for (Altar altar : Altar.values()) {
|
||||
if (altar.getId() == id) {
|
||||
return altar;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
38
src/main/java/ee/futur/easygotr/data/CellMapper.java
Normal file
@@ -0,0 +1,38 @@
|
||||
package ee.futur.easygotr.data;
|
||||
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.ObjectID;
|
||||
|
||||
public class CellMapper {
|
||||
public static int GetCellTier(int cellID) {
|
||||
switch (cellID) {
|
||||
case ItemID.WEAK_CELL:
|
||||
return 1;
|
||||
case ItemID.MEDIUM_CELL:
|
||||
return 2;
|
||||
case ItemID.STRONG_CELL:
|
||||
return 3;
|
||||
case ItemID.OVERCHARGED_CELL:
|
||||
return 4;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetShieldTier(int shieldID) {
|
||||
switch (shieldID) {
|
||||
case ObjectID.INACTIVE_CELL_TILE:
|
||||
return 0;
|
||||
case ObjectID.WEAK_CELL_TILE:
|
||||
return 1;
|
||||
case ObjectID.MEDIUM_CELL_TILE:
|
||||
return 2;
|
||||
case ObjectID.STRONG_CELL_TILE:
|
||||
return 3;
|
||||
case ObjectID.OVERPOWERED_CELL_TILE:
|
||||
return 4;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
74
src/main/java/ee/futur/easygotr/data/GOTRGameConstants.java
Normal file
@@ -0,0 +1,74 @@
|
||||
package ee.futur.easygotr.data;
|
||||
|
||||
public class GOTRGameConstants {
|
||||
//Locations
|
||||
public static final int OUTSIDE_BARRIER_Y = 9482;
|
||||
public static final int LARGE_MINE_X = 3637;
|
||||
public static final int HUGE_MINE_X = 3592;
|
||||
|
||||
// Game Object IDs
|
||||
public static final int BARRIER_BUSY_ID = 43849;
|
||||
public static final int BARRIER_READY_ID = 43700;
|
||||
|
||||
public static final int ACTIVE_ALTAR = 9363;
|
||||
|
||||
// Widget IDs
|
||||
public static final int PARENT_WIDGET = 48889857;
|
||||
public static final int WIDGET_POWER_PC = 48889874;
|
||||
public static final int MAIN_TIMER = 48889861;
|
||||
public static final int ELEMENTAL_ENERGY_COUNTER = 48889878;
|
||||
public static final int CATALYTIC_ENERGY_COUNTER = 48889878;
|
||||
public static final int GUARDIANS_ALIVE_COUNTER = 48889881;
|
||||
public static final int PORTAL_TIMER = 48889884;
|
||||
|
||||
public static final int WAITING_CATALYTIC_INDICATOR_SPRITE = 4355;
|
||||
|
||||
|
||||
// Widget Text
|
||||
private static final String OUTSIDE_GUARDED = "It looks like the rift is already being guarded. You must wait until they are done to join.";
|
||||
private static final String GREAT_GUARDIAN_POWER = "Great Guardian power: ";
|
||||
|
||||
|
||||
// Chat text
|
||||
public static final String ENTER_ALTAR = "You step through the rift";
|
||||
public static final String EXIT_ALTAR = "You step through the portal and find yourself back in the temple.";
|
||||
public static final String GAME_STARTED = "Creatures from the Abyss will attack in 120 seconds.";
|
||||
public static final String ATTACK_STARTED = "Creatures from the Abyss begin their attack!";
|
||||
public static final String GAME_OVER = "The Great guardian was defeated";
|
||||
public static final String GAME_WIN = "The Great Guardian successfully closed the rift!";
|
||||
|
||||
|
||||
// Game Objects
|
||||
public static final String BARRIER = "Barrier";
|
||||
public static final String WORKBENCH = "Workbench";
|
||||
public static final String WEAK_CELLS = "Weak cell";
|
||||
public static final String UNCHARGED_CELLS = "Uncharged cell";
|
||||
public static final String DEPOSIT_POOL = "Deposit pool";
|
||||
public static final String GAME_PARTS = "Guardian parts";
|
||||
public static final String LARGE_REMAINS = "Large guardian remains";
|
||||
public static final String HUGE_REMAINS = "Huge guardian remains";
|
||||
public static final String FRAGS = "Guardian fragments";
|
||||
public static final String ESS = "Guardian essence";
|
||||
public static final String PORTAL = "Portal";
|
||||
public static final int PORTAL_SPAWN = 43729;
|
||||
|
||||
public static final String CATALYTIC_ENERGY = "Catalytic guardian stone";
|
||||
public static final String ELEMENTAL_ENERGY = "Elemental guardian stone";
|
||||
public static final String GREAT_GUARDIAN = "The Great Guardian";
|
||||
|
||||
public static final String CRAFT_RUNES = "Craft-rune";
|
||||
|
||||
public static final int AIR_SPRITE = 4353;
|
||||
public static final int MIND_SPRITE = 4354;
|
||||
public static final int WATER_SPRITE = 4355;
|
||||
public static final int EARTH_SPRITE = 4356;
|
||||
public static final int FIRE_SPRITE = 4357;
|
||||
public static final int BODY_SPRITE = 4358;
|
||||
public static final int COSMIC_SPRITE = 4359;
|
||||
public static final int CHAOS_SPRITE = 4360;
|
||||
public static final int NATURE_SPRITE = 4361;
|
||||
public static final int LAW_SPRITE = 4362;
|
||||
public static final int DEATH_SPRITE = 4363;
|
||||
public static final int BLOOD_SPRITE = 4364;
|
||||
|
||||
}
|
||||
24
src/main/java/ee/futur/easygotr/data/Pouch.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package ee.futur.easygotr.data;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class Pouch {
|
||||
|
||||
public Pouch(int id, int maxEssence) {
|
||||
this.pouchID = id;
|
||||
this.currentEssence = 0;
|
||||
this.essenceTotal = maxEssence;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
int pouchID;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
int currentEssence;
|
||||
|
||||
@Getter
|
||||
int essenceTotal;
|
||||
}
|
||||
77
src/main/java/ee/futur/easygotr/data/Runes.java
Normal file
@@ -0,0 +1,77 @@
|
||||
package ee.futur.easygotr.data;
|
||||
|
||||
/**
|
||||
* Taken from marcojacobsNL
|
||||
* https://github.com/marcojacobsNL/runelite-plugins/blob/master/src/main/java/com/koffee/KoffeeUtils/Runes.java
|
||||
*/
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.Map;
|
||||
|
||||
import static net.runelite.api.ItemID.*;
|
||||
|
||||
public enum Runes {
|
||||
AIR(1, AIR_RUNE),
|
||||
WATER(2, WATER_RUNE),
|
||||
EARTH(3, EARTH_RUNE),
|
||||
FIRE(4, FIRE_RUNE),
|
||||
MIND(5, MIND_RUNE),
|
||||
CHAOS(6, CHAOS_RUNE),
|
||||
DEATH(7, DEATH_RUNE),
|
||||
BLOOD(8, BLOOD_RUNE),
|
||||
COSMIC(9, COSMIC_RUNE),
|
||||
NATURE(10, NATURE_RUNE),
|
||||
LAW(11, LAW_RUNE),
|
||||
BODY(12, BODY_RUNE),
|
||||
SOUL(13, SOUL_RUNE),
|
||||
ASTRAL(14, ASTRAL_RUNE),
|
||||
MIST(15, MIST_RUNE),
|
||||
MUD(16, MUD_RUNE),
|
||||
DUST(17, DUST_RUNE),
|
||||
LAVA(18, LAVA_RUNE),
|
||||
STEAM(19, STEAM_RUNE),
|
||||
SMOKE(20, SMOKE_RUNE),
|
||||
WRATH(21, WRATH_RUNE);
|
||||
|
||||
private static final Map<Integer, Runes> runes;
|
||||
|
||||
static {
|
||||
ImmutableMap.Builder<Integer, Runes> builder = new ImmutableMap.Builder<>();
|
||||
for (Runes rune : values()) {
|
||||
builder.put(rune.getId(), rune);
|
||||
}
|
||||
runes = builder.build();
|
||||
}
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final int id;
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
private final int itemId;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@Setter(AccessLevel.PACKAGE)
|
||||
private BufferedImage image;
|
||||
|
||||
Runes(final int id, final int itemId) {
|
||||
this.id = id;
|
||||
this.itemId = itemId;
|
||||
}
|
||||
|
||||
public static Runes getRuneVarbit(int runeID) {
|
||||
return runes.get(runeID);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
String name = this.name();
|
||||
name = name.substring(0, 1) + name.substring(1).toLowerCase();
|
||||
return name;
|
||||
}
|
||||
|
||||
public static Runes getRune(int varbit) {
|
||||
return runes.get(varbit);
|
||||
}
|
||||
}
|
||||