update and fix raids thieving plugin

This commit is contained in:
HSJ-OSRS
2019-08-03 03:46:58 +01:00
parent 063e1e9672
commit dec35ff5bb
11 changed files with 386 additions and 571 deletions

View File

@@ -34,6 +34,7 @@ public class GraphicID
public static final int ENTANGLE = 179;
public static final int SNARE = 180;
public static final int BIND = 181;
public static final int POISON_SPLAT = 184;
public static final int ICE_RUSH = 361;
public static final int ICE_BURST = 363;
public static final int ICE_BLITZ = 367;
@@ -57,4 +58,4 @@ public class GraphicID
public static final int OLM_CRYSTAL = 1447;
public static final int XERIC_TELEPORT = 1612;
public static final int HYDRA_LIGHTNING = 1666;
}
}

View File

@@ -24,26 +24,27 @@
*/
package net.runelite.client.plugins.raidsthieving.BatSolver;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.HashMap;
import java.util.TreeSet;
import static net.runelite.client.plugins.raidsthieving.BatSolver.SolutionSet.SOLUTION_SETS;
import java.util.List;
import java.util.HashSet;
import java.util.Set;
import java.util.ArrayList;
public class BatSolver
{
private Map<Integer, Integer> numberOfSolutionsWithPoison;
private final SolutionSet solution;
private final ThievingRoomType roomType;
private final Set<Integer> grubsChests;
public BatSolver(final ThievingRoomType roomType)
{
solution = new SolutionSet(roomType);
solution = new SolutionSet();
grubsChests = new HashSet<>();
this.roomType = roomType;
}
public void addEmptyChest(int chestId)
@@ -63,12 +64,15 @@ public class BatSolver
public Set<Integer> matchSolutions()
{
Set<Integer> possibleEmptyChests = new TreeSet<>();
for (SolutionSet knownSolution : SolutionSet.SOLUTION_SETS)
List<Set<Integer>> sols = SolutionSet.SOLUTION_SETS.get(roomType).stream()
.filter(this::matchSolution)
.map(SolutionSet::getEmptyChests)
.collect(Collectors.toList());
for (Set<Integer> sol : sols)
{
if (knownSolution.getType() == solution.getType() && matchSolution(knownSolution))
{
possibleEmptyChests.addAll(knownSolution.getEmptyChests());
}
possibleEmptyChests.addAll(sol);
}
return possibleEmptyChests;
@@ -101,24 +105,12 @@ public class BatSolver
return matchesAll && everMatched;
}
private ThievingRoomType getType()
{
return solution.getType();
}
private void calculateChanceOfPoison()
{
if (getType() == null)
{
numberOfSolutionsWithPoison = null;
return;
}
numberOfSolutionsWithPoison = new HashMap<>();
for (SolutionSet sol : getPosssibleSolutions())
{
if (getType() == sol.getType() && (solution.getEmptyChests().size() == 0 || matchSolution(sol)))
if (solution.getEmptyChests().size() == 0 || matchSolution(sol))
{
for (Integer i : sol.getEmptyChests())
{
@@ -138,7 +130,7 @@ public class BatSolver
private List<SolutionSet> getPosssibleSolutions()
{
List<SolutionSet> possibleSolutions = new ArrayList<>();
for (SolutionSet soln : SOLUTION_SETS)
for (SolutionSet soln : SolutionSet.SOLUTION_SETS.get(roomType))
{
// Check if we've found grubs in one of the chests, invalidating it as an solution
boolean foundMatch = false;

View File

@@ -24,10 +24,10 @@
*/
package net.runelite.client.plugins.raidsthieving.BatSolver;
import java.util.HashMap;
import java.util.Map;
import net.runelite.client.plugins.raidsthieving.InstancePoint;
import net.runelite.api.Point;
import net.runelite.client.plugins.raidsthieving.ThievingChest;
import java.util.HashMap;
public class ChestIdentifier
{
@@ -37,217 +37,216 @@ public class ChestIdentifier
switch (roomType)
{
case LEFT_TURN:
chestIds.put(new InstancePoint(3283, 5379), 1);
chestIds.put(new InstancePoint(3285, 5380), 2);
chestIds.put(new InstancePoint(3279, 5381), 3);
chestIds.put(new InstancePoint(3287, 5382), 4);
chestIds.put(new InstancePoint(3281, 5382), 5);
chestIds.put(new InstancePoint(3284, 5383), 6);
chestIds.put(new InstancePoint(3283, 5384), 7);
chestIds.put(new InstancePoint(3286, 5384), 8);
chestIds.put(new InstancePoint(3288, 5384), 9);
chestIds.put(new InstancePoint(3277, 5385), 10);
chestIds.put(new InstancePoint(3280, 5385), 11);
chestIds.put(new InstancePoint(3285, 5386), 12);
chestIds.put(new InstancePoint(3290, 5386), 13);
chestIds.put(new InstancePoint(3275, 5387), 14);
chestIds.put(new InstancePoint(3287, 5387), 15);
chestIds.put(new InstancePoint(3288, 5387), 16);
chestIds.put(new InstancePoint(3281, 5388), 17);
chestIds.put(new InstancePoint(3291, 5388), 18);
chestIds.put(new InstancePoint(3280, 5389), 19);
chestIds.put(new InstancePoint(3285, 5389), 20);
chestIds.put(new InstancePoint(3289, 5389), 21);
chestIds.put(new InstancePoint(3283, 5390), 22);
chestIds.put(new InstancePoint(3285, 5390), 23);
chestIds.put(new InstancePoint(3288, 5390), 24);
chestIds.put(new InstancePoint(3290, 5390), 25);
chestIds.put(new InstancePoint(3282, 5391), 26);
chestIds.put(new InstancePoint(3289, 5391), 27);
chestIds.put(new InstancePoint(3292, 5391), 28);
chestIds.put(new InstancePoint(3279, 5392), 29);
chestIds.put(new InstancePoint(3276, 5393), 30);
chestIds.put(new InstancePoint(3279, 5393), 31);
chestIds.put(new InstancePoint(3284, 5393), 32);
chestIds.put(new InstancePoint(3285, 5393), 33);
chestIds.put(new InstancePoint(3291, 5393), 34);
chestIds.put(new InstancePoint(3275, 5394), 35);
chestIds.put(new InstancePoint(3277, 5394), 36);
chestIds.put(new InstancePoint(3288, 5394), 37);
chestIds.put(new InstancePoint(3276, 5395), 38);
chestIds.put(new InstancePoint(3281, 5395), 39);
chestIds.put(new InstancePoint(3285, 5395), 40);
chestIds.put(new InstancePoint(3287, 5395), 41);
chestIds.put(new InstancePoint(3289, 5395), 42);
chestIds.put(new InstancePoint(3274, 5396), 43);
chestIds.put(new InstancePoint(3283, 5396), 44);
chestIds.put(new InstancePoint(3285, 5396), 45);
chestIds.put(new InstancePoint(3288, 5396), 46);
chestIds.put(new InstancePoint(3272, 5397), 47);
chestIds.put(new InstancePoint(3280, 5397), 48);
chestIds.put(new InstancePoint(3277, 5398), 49);
chestIds.put(new InstancePoint(3281, 5398), 50);
chestIds.put(new InstancePoint(3284, 5398), 51);
chestIds.put(new InstancePoint(3276, 5399), 52);
chestIds.put(new InstancePoint(3278, 5399), 53);
chestIds.put(new InstancePoint(3283, 5399), 54);
chestIds.put(new InstancePoint(3285, 5399), 55);
chestIds.put(new InstancePoint(3277, 5400), 56);
chestIds.put(new InstancePoint(3284, 5400), 57);
chestIds.put(new InstancePoint(3288, 5400), 58);
chestIds.put(new InstancePoint(3281, 5401), 59);
chestIds.put(new InstancePoint(3286, 5401), 60);
chestIds.put(new InstancePoint(3279, 5402), 61);
chestIds.put(new InstancePoint(3285, 5402), 62);
chestIds.put(new InstancePoint(3280, 5403), 63);
chestIds.put(new InstancePoint(3283, 5403), 64);
chestIds.put(new Point(3283, 5379), 1);
chestIds.put(new Point(3285, 5380), 2);
chestIds.put(new Point(3279, 5381), 3);
chestIds.put(new Point(3287, 5382), 4);
chestIds.put(new Point(3281, 5382), 5);
chestIds.put(new Point(3284, 5383), 6);
chestIds.put(new Point(3283, 5384), 7);
chestIds.put(new Point(3286, 5384), 8);
chestIds.put(new Point(3288, 5384), 9);
chestIds.put(new Point(3277, 5385), 10);
chestIds.put(new Point(3280, 5385), 11);
chestIds.put(new Point(3285, 5386), 12);
chestIds.put(new Point(3290, 5386), 13);
chestIds.put(new Point(3275, 5387), 14);
chestIds.put(new Point(3287, 5387), 15);
chestIds.put(new Point(3288, 5387), 16);
chestIds.put(new Point(3281, 5388), 17);
chestIds.put(new Point(3291, 5388), 18);
chestIds.put(new Point(3280, 5389), 19);
chestIds.put(new Point(3285, 5389), 20);
chestIds.put(new Point(3289, 5389), 21);
chestIds.put(new Point(3283, 5390), 22);
chestIds.put(new Point(3285, 5390), 23);
chestIds.put(new Point(3288, 5390), 24);
chestIds.put(new Point(3290, 5390), 25);
chestIds.put(new Point(3282, 5391), 26);
chestIds.put(new Point(3289, 5391), 27);
chestIds.put(new Point(3292, 5391), 28);
chestIds.put(new Point(3279, 5392), 29);
chestIds.put(new Point(3276, 5393), 30);
chestIds.put(new Point(3279, 5393), 31);
chestIds.put(new Point(3284, 5393), 32);
chestIds.put(new Point(3285, 5393), 33);
chestIds.put(new Point(3291, 5393), 34);
chestIds.put(new Point(3275, 5394), 35);
chestIds.put(new Point(3277, 5394), 36);
chestIds.put(new Point(3288, 5394), 37);
chestIds.put(new Point(3276, 5395), 38);
chestIds.put(new Point(3281, 5395), 39);
chestIds.put(new Point(3285, 5395), 40);
chestIds.put(new Point(3287, 5395), 41);
chestIds.put(new Point(3289, 5395), 42);
chestIds.put(new Point(3274, 5396), 43);
chestIds.put(new Point(3283, 5396), 44);
chestIds.put(new Point(3285, 5396), 45);
chestIds.put(new Point(3288, 5396), 46);
chestIds.put(new Point(3272, 5397), 47);
chestIds.put(new Point(3280, 5397), 48);
chestIds.put(new Point(3277, 5398), 49);
chestIds.put(new Point(3281, 5398), 50);
chestIds.put(new Point(3284, 5398), 51);
chestIds.put(new Point(3276, 5399), 52);
chestIds.put(new Point(3278, 5399), 53);
chestIds.put(new Point(3283, 5399), 54);
chestIds.put(new Point(3285, 5399), 55);
chestIds.put(new Point(3277, 5400), 56);
chestIds.put(new Point(3284, 5400), 57);
chestIds.put(new Point(3288, 5400), 58);
chestIds.put(new Point(3281, 5401), 59);
chestIds.put(new Point(3286, 5401), 60);
chestIds.put(new Point(3279, 5402), 61);
chestIds.put(new Point(3285, 5402), 62);
chestIds.put(new Point(3280, 5403), 63);
chestIds.put(new Point(3283, 5403), 64);
break;
case RIGHT_TURN:
chestIds.put(new InstancePoint(3338, 5405), 1);
chestIds.put(new InstancePoint(3334, 5405), 2);
chestIds.put(new InstancePoint(3342, 5404), 3);
chestIds.put(new InstancePoint(3340, 5404), 4);
chestIds.put(new InstancePoint(3345, 5403), 5);
chestIds.put(new InstancePoint(3334, 5403), 6);
chestIds.put(new InstancePoint(3330, 5403), 7);
chestIds.put(new InstancePoint(3343, 5402), 8);
chestIds.put(new InstancePoint(3342, 5402), 9);
chestIds.put(new InstancePoint(3339, 5402), 10);
chestIds.put(new InstancePoint(3338, 5402), 11);
chestIds.put(new InstancePoint(3336, 5402), 12);
chestIds.put(new InstancePoint(3347, 5401), 13);
chestIds.put(new InstancePoint(3330, 5401), 14);
chestIds.put(new InstancePoint(3345, 5400), 15);
chestIds.put(new InstancePoint(3341, 5400), 16);
chestIds.put(new InstancePoint(3337, 5400), 17);
chestIds.put(new InstancePoint(3334, 5400), 18);
chestIds.put(new InstancePoint(3345, 5399), 19);
chestIds.put(new InstancePoint(3343, 5399), 20);
chestIds.put(new InstancePoint(3340, 5399), 21);
chestIds.put(new InstancePoint(3335, 5399), 22);
chestIds.put(new InstancePoint(3331, 5399), 23);
chestIds.put(new InstancePoint(3338, 5398), 24);
chestIds.put(new InstancePoint(3337, 5398), 25);
chestIds.put(new InstancePoint(3345, 5397), 26);
chestIds.put(new InstancePoint(3341, 5397), 27);
chestIds.put(new InstancePoint(3334, 5397), 28);
chestIds.put(new InstancePoint(3331, 5397), 29);
chestIds.put(new InstancePoint(3346, 5396), 30);
chestIds.put(new InstancePoint(3343, 5396), 31);
chestIds.put(new InstancePoint(3339, 5396), 32);
chestIds.put(new InstancePoint(3335, 5396), 33);
chestIds.put(new InstancePoint(3333, 5396), 34);
chestIds.put(new InstancePoint(3340, 5395), 35);
chestIds.put(new InstancePoint(3337, 5395), 36);
chestIds.put(new InstancePoint(3334, 5395), 37);
chestIds.put(new InstancePoint(3345, 5394), 38);
chestIds.put(new InstancePoint(3342, 5394), 39);
chestIds.put(new InstancePoint(3332, 5394), 40);
chestIds.put(new InstancePoint(3343, 5393), 41);
chestIds.put(new InstancePoint(3341, 5393), 42);
chestIds.put(new InstancePoint(3338, 5393), 43);
chestIds.put(new InstancePoint(3335, 5393), 44);
chestIds.put(new InstancePoint(3334, 5393), 45);
chestIds.put(new InstancePoint(3346, 5392), 46);
chestIds.put(new InstancePoint(3342, 5392), 47);
chestIds.put(new InstancePoint(3332, 5392), 48);
chestIds.put(new InstancePoint(3350, 5391), 49);
chestIds.put(new InstancePoint(3346, 5391), 50);
chestIds.put(new InstancePoint(3340, 5391), 51);
chestIds.put(new InstancePoint(3339, 5391), 52);
chestIds.put(new InstancePoint(3336, 5391), 53);
chestIds.put(new InstancePoint(3333, 5391), 54);
chestIds.put(new InstancePoint(3349, 5390), 55);
chestIds.put(new InstancePoint(3343, 5390), 56);
chestIds.put(new InstancePoint(3337, 5390), 57);
chestIds.put(new InstancePoint(3335, 5390), 58);
chestIds.put(new InstancePoint(3344, 5389), 59);
chestIds.put(new InstancePoint(3340, 5389), 60);
chestIds.put(new InstancePoint(3336, 5389), 61);
chestIds.put(new InstancePoint(3333, 5389), 62);
chestIds.put(new InstancePoint(3346, 5388), 63);
chestIds.put(new InstancePoint(3340, 5387), 64);
chestIds.put(new InstancePoint(3337, 5386), 65);
chestIds.put(new InstancePoint(3333, 5386), 66);
chestIds.put(new InstancePoint(3338, 5385), 67);
chestIds.put(new InstancePoint(3336, 5385), 68);
chestIds.put(new InstancePoint(3337, 5384), 69);
chestIds.put(new InstancePoint(3340, 5382), 70);
chestIds.put(new InstancePoint(3334, 5383), 71);
chestIds.put(new InstancePoint(3340, 5379), 72);
chestIds.put(new InstancePoint(3338, 5380), 73);
chestIds.put(new InstancePoint(3336, 5381), 74);
chestIds.put(new Point(3338, 5405), 1);
chestIds.put(new Point(3334, 5405), 2);
chestIds.put(new Point(3342, 5404), 3);
chestIds.put(new Point(3340, 5404), 4);
chestIds.put(new Point(3345, 5403), 5);
chestIds.put(new Point(3334, 5403), 6);
chestIds.put(new Point(3330, 5403), 7);
chestIds.put(new Point(3343, 5402), 8);
chestIds.put(new Point(3342, 5402), 9);
chestIds.put(new Point(3339, 5402), 10);
chestIds.put(new Point(3338, 5402), 11);
chestIds.put(new Point(3336, 5402), 12);
chestIds.put(new Point(3347, 5401), 13);
chestIds.put(new Point(3330, 5401), 14);
chestIds.put(new Point(3345, 5400), 15);
chestIds.put(new Point(3341, 5400), 16);
chestIds.put(new Point(3337, 5400), 17);
chestIds.put(new Point(3334, 5400), 18);
chestIds.put(new Point(3345, 5399), 19);
chestIds.put(new Point(3343, 5399), 20);
chestIds.put(new Point(3340, 5399), 21);
chestIds.put(new Point(3335, 5399), 22);
chestIds.put(new Point(3331, 5399), 23);
chestIds.put(new Point(3338, 5398), 24);
chestIds.put(new Point(3337, 5398), 25);
chestIds.put(new Point(3345, 5397), 26);
chestIds.put(new Point(3341, 5397), 27);
chestIds.put(new Point(3334, 5397), 28);
chestIds.put(new Point(3331, 5397), 29);
chestIds.put(new Point(3346, 5396), 30);
chestIds.put(new Point(3343, 5396), 31);
chestIds.put(new Point(3339, 5396), 32);
chestIds.put(new Point(3335, 5396), 33);
chestIds.put(new Point(3333, 5396), 34);
chestIds.put(new Point(3340, 5395), 35);
chestIds.put(new Point(3337, 5395), 36);
chestIds.put(new Point(3334, 5395), 37);
chestIds.put(new Point(3345, 5394), 38);
chestIds.put(new Point(3342, 5394), 39);
chestIds.put(new Point(3332, 5394), 40);
chestIds.put(new Point(3343, 5393), 41);
chestIds.put(new Point(3341, 5393), 42);
chestIds.put(new Point(3338, 5393), 43);
chestIds.put(new Point(3335, 5393), 44);
chestIds.put(new Point(3334, 5393), 45);
chestIds.put(new Point(3346, 5392), 46);
chestIds.put(new Point(3342, 5392), 47);
chestIds.put(new Point(3332, 5392), 48);
chestIds.put(new Point(3350, 5391), 49);
chestIds.put(new Point(3346, 5391), 50);
chestIds.put(new Point(3340, 5391), 51);
chestIds.put(new Point(3339, 5391), 52);
chestIds.put(new Point(3336, 5391), 53);
chestIds.put(new Point(3333, 5391), 54);
chestIds.put(new Point(3349, 5390), 55);
chestIds.put(new Point(3343, 5390), 56);
chestIds.put(new Point(3337, 5390), 57);
chestIds.put(new Point(3335, 5390), 58);
chestIds.put(new Point(3344, 5389), 59);
chestIds.put(new Point(3340, 5389), 60);
chestIds.put(new Point(3336, 5389), 61);
chestIds.put(new Point(3333, 5389), 62);
chestIds.put(new Point(3346, 5388), 63);
chestIds.put(new Point(3340, 5387), 64);
chestIds.put(new Point(3337, 5386), 65);
chestIds.put(new Point(3333, 5386), 66);
chestIds.put(new Point(3338, 5385), 67);
chestIds.put(new Point(3336, 5385), 68);
chestIds.put(new Point(3337, 5384), 69);
chestIds.put(new Point(3340, 5382), 70);
chestIds.put(new Point(3334, 5383), 71);
chestIds.put(new Point(3340, 5379), 72);
chestIds.put(new Point(3338, 5380), 73);
chestIds.put(new Point(3336, 5381), 74);
break;
case STRAIGHT:
chestIds.put(new InstancePoint(3308, 5378), 1);
chestIds.put(new InstancePoint(3305, 5379), 2);
chestIds.put(new InstancePoint(3307, 5379), 3);
chestIds.put(new InstancePoint(3304, 5381), 4);
chestIds.put(new InstancePoint(3310, 5381), 5);
chestIds.put(new InstancePoint(3302, 5382), 6);
chestIds.put(new InstancePoint(3307, 5382), 7);
chestIds.put(new InstancePoint(3312, 5382), 8);
chestIds.put(new InstancePoint(3317, 5382), 9);
chestIds.put(new InstancePoint(3319, 5382), 10);
chestIds.put(new InstancePoint(3304, 5383), 11);
chestIds.put(new InstancePoint(3305, 5383), 12);
chestIds.put(new InstancePoint(3307, 5383), 13);
chestIds.put(new InstancePoint(3310, 5383), 14);
chestIds.put(new InstancePoint(3315, 5383), 15);
chestIds.put(new InstancePoint(3320, 5383), 16);
chestIds.put(new InstancePoint(3300, 5384), 17);
chestIds.put(new InstancePoint(3309, 5384), 18);
chestIds.put(new InstancePoint(3311, 5384), 19);
chestIds.put(new InstancePoint(3313, 5384), 20);
chestIds.put(new InstancePoint(3317, 5384), 21);
chestIds.put(new InstancePoint(3318, 5384), 22);
chestIds.put(new InstancePoint(3302, 5385), 23);
chestIds.put(new InstancePoint(3306, 5385), 24);
chestIds.put(new InstancePoint(3310, 5385), 25);
chestIds.put(new InstancePoint(3313, 5385), 26);
chestIds.put(new InstancePoint(3320, 5385), 27);
chestIds.put(new InstancePoint(3302, 5386), 28);
chestIds.put(new InstancePoint(3305, 5386), 29);
chestIds.put(new InstancePoint(3316, 5386), 30);
chestIds.put(new InstancePoint(3321, 5386), 31);
chestIds.put(new InstancePoint(3300, 5387), 32);
chestIds.put(new InstancePoint(3308, 5387), 33);
chestIds.put(new InstancePoint(3314, 5387), 34);
chestIds.put(new InstancePoint(3317, 5387), 35);
chestIds.put(new InstancePoint(3301, 5388), 36);
chestIds.put(new InstancePoint(3306, 5388), 37);
chestIds.put(new InstancePoint(3312, 5388), 38);
chestIds.put(new InstancePoint(3322, 5388), 39);
chestIds.put(new InstancePoint(3309, 5389), 40);
chestIds.put(new InstancePoint(3311, 5389), 41);
chestIds.put(new InstancePoint(3313, 5389), 42);
chestIds.put(new InstancePoint(3316, 5389), 43);
chestIds.put(new InstancePoint(3320, 5389), 44);
chestIds.put(new InstancePoint(3300, 5390), 45);
chestIds.put(new InstancePoint(3303, 5390), 46);
chestIds.put(new InstancePoint(3304, 5390), 47);
chestIds.put(new InstancePoint(3312, 5390), 48);
chestIds.put(new InstancePoint(3320, 5390), 49);
chestIds.put(new InstancePoint(3307, 5391), 50);
chestIds.put(new InstancePoint(3310, 5391), 51);
chestIds.put(new InstancePoint(3317, 5391), 52);
chestIds.put(new InstancePoint(3318, 5391), 53);
chestIds.put(new InstancePoint(3323, 5391), 54);
chestIds.put(new InstancePoint(3301, 5392), 55);
chestIds.put(new InstancePoint(3303, 5392), 56);
chestIds.put(new InstancePoint(3309, 5392), 57);
chestIds.put(new InstancePoint(3314, 5392), 58);
chestIds.put(new InstancePoint(3322, 5392), 59);
chestIds.put(new InstancePoint(3305, 5393), 60);
chestIds.put(new InstancePoint(3307, 5393), 61);
chestIds.put(new InstancePoint(3316, 5393), 62);
chestIds.put(new InstancePoint(3309, 5394), 63);
chestIds.put(new InstancePoint(3312, 5394), 64);
chestIds.put(new InstancePoint(3322, 5394), 65);
chestIds.put(new InstancePoint(3310, 5379), 66);
chestIds.put(new Point(3308, 5378), 1);
chestIds.put(new Point(3305, 5379), 2);
chestIds.put(new Point(3307, 5379), 3);
chestIds.put(new Point(3304, 5381), 4);
chestIds.put(new Point(3310, 5381), 5);
chestIds.put(new Point(3302, 5382), 6);
chestIds.put(new Point(3307, 5382), 7);
chestIds.put(new Point(3312, 5382), 8);
chestIds.put(new Point(3317, 5382), 9);
chestIds.put(new Point(3319, 5382), 10);
chestIds.put(new Point(3304, 5383), 11);
chestIds.put(new Point(3305, 5383), 12);
chestIds.put(new Point(3307, 5383), 13);
chestIds.put(new Point(3310, 5383), 14);
chestIds.put(new Point(3315, 5383), 15);
chestIds.put(new Point(3320, 5383), 16);
chestIds.put(new Point(3300, 5384), 17);
chestIds.put(new Point(3309, 5384), 18);
chestIds.put(new Point(3311, 5384), 19);
chestIds.put(new Point(3313, 5384), 20);
chestIds.put(new Point(3317, 5384), 21);
chestIds.put(new Point(3318, 5384), 22);
chestIds.put(new Point(3302, 5385), 23);
chestIds.put(new Point(3306, 5385), 24);
chestIds.put(new Point(3310, 5385), 25);
chestIds.put(new Point(3313, 5385), 26);
chestIds.put(new Point(3320, 5385), 27);
chestIds.put(new Point(3302, 5386), 28);
chestIds.put(new Point(3305, 5386), 29);
chestIds.put(new Point(3316, 5386), 30);
chestIds.put(new Point(3321, 5386), 31);
chestIds.put(new Point(3300, 5387), 32);
chestIds.put(new Point(3308, 5387), 33);
chestIds.put(new Point(3314, 5387), 34);
chestIds.put(new Point(3317, 5387), 35);
chestIds.put(new Point(3301, 5388), 36);
chestIds.put(new Point(3306, 5388), 37);
chestIds.put(new Point(3312, 5388), 38);
chestIds.put(new Point(3322, 5388), 39);
chestIds.put(new Point(3309, 5389), 40);
chestIds.put(new Point(3311, 5389), 41);
chestIds.put(new Point(3313, 5389), 42);
chestIds.put(new Point(3316, 5389), 43);
chestIds.put(new Point(3320, 5389), 44);
chestIds.put(new Point(3300, 5390), 45);
chestIds.put(new Point(3303, 5390), 46);
chestIds.put(new Point(3304, 5390), 47);
chestIds.put(new Point(3312, 5390), 48);
chestIds.put(new Point(3320, 5390), 49);
chestIds.put(new Point(3307, 5391), 50);
chestIds.put(new Point(3310, 5391), 51);
chestIds.put(new Point(3317, 5391), 52);
chestIds.put(new Point(3318, 5391), 53);
chestIds.put(new Point(3323, 5391), 54);
chestIds.put(new Point(3301, 5392), 55);
chestIds.put(new Point(3303, 5392), 56);
chestIds.put(new Point(3309, 5392), 57);
chestIds.put(new Point(3314, 5392), 58);
chestIds.put(new Point(3322, 5392), 59);
chestIds.put(new Point(3305, 5393), 60);
chestIds.put(new Point(3307, 5393), 61);
chestIds.put(new Point(3316, 5393), 62);
chestIds.put(new Point(3309, 5394), 63);
chestIds.put(new Point(3312, 5394), 64);
chestIds.put(new Point(3322, 5394), 65);
chestIds.put(new Point(3310, 5379), 66);
break;
}
}
public void indentifyChest(ThievingChest chest)
@@ -256,5 +255,5 @@ public class ChestIdentifier
chest.setChestId(id);
}
private final Map<InstancePoint, Integer> chestIds;
private final Map<Point, Integer> chestIds;
}

View File

@@ -24,11 +24,13 @@
*/
package net.runelite.client.plugins.raidsthieving.BatSolver;
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Multimap;
import lombok.AccessLevel;
import lombok.Getter;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
import lombok.AccessLevel;
import lombok.Getter;
// Each Thieving room has 4 empty chests
// User-reported data shows these 4 come in groups,
@@ -38,113 +40,111 @@ import lombok.Getter;
class SolutionSet
{
static final SolutionSet[] SOLUTION_SETS =
{
new SolutionSet(ThievingRoomType.LEFT_TURN, 1, 16, 17, 55),
new SolutionSet(ThievingRoomType.LEFT_TURN, 1, 17, 38, 54),
new SolutionSet(ThievingRoomType.LEFT_TURN, 2, 7, 21, 37),
new SolutionSet(ThievingRoomType.LEFT_TURN, 3, 5, 19, 30),
new SolutionSet(ThievingRoomType.LEFT_TURN, 3, 11, 15, 40),
new SolutionSet(ThievingRoomType.LEFT_TURN, 4, 22, 27, 46),
new SolutionSet(ThievingRoomType.LEFT_TURN, 5, 9, 19, 45),
new SolutionSet(ThievingRoomType.LEFT_TURN, 6, 24, 26, 41),
new SolutionSet(ThievingRoomType.LEFT_TURN, 6, 26, 32, 52),
new SolutionSet(ThievingRoomType.LEFT_TURN, 7, 13, 44, 59),
new SolutionSet(ThievingRoomType.LEFT_TURN, 8, 14, 41, 43),
new SolutionSet(ThievingRoomType.LEFT_TURN, 8, 10, 28, 33),
new SolutionSet(ThievingRoomType.LEFT_TURN, 8, 31, 47, 50),
new SolutionSet(ThievingRoomType.LEFT_TURN, 10, 35, 54, 63),
new SolutionSet(ThievingRoomType.LEFT_TURN, 10, 30, 32, 59),
new SolutionSet(ThievingRoomType.LEFT_TURN, 12, 40, 53, 56),
new SolutionSet(ThievingRoomType.LEFT_TURN, 12, 13, 42, 54),
new SolutionSet(ThievingRoomType.LEFT_TURN, 13, 22, 27, 46),
new SolutionSet(ThievingRoomType.LEFT_TURN, 14, 18, 23, 51),
new SolutionSet(ThievingRoomType.LEFT_TURN, 15, 43, 44, 58),
new SolutionSet(ThievingRoomType.LEFT_TURN, 15, 16, 42, 45),
new SolutionSet(ThievingRoomType.LEFT_TURN, 20, 29, 45, 51),
new SolutionSet(ThievingRoomType.LEFT_TURN, 20, 25, 32, 34),
new SolutionSet(ThievingRoomType.LEFT_TURN, 20, 28, 51, 62),
new SolutionSet(ThievingRoomType.LEFT_TURN, 21, 39, 41, 58),
new SolutionSet(ThievingRoomType.LEFT_TURN, 22, 25, 54, 64),
new SolutionSet(ThievingRoomType.LEFT_TURN, 23, 31, 47, 55),
new SolutionSet(ThievingRoomType.LEFT_TURN, 23, 33, 37, 60),
new SolutionSet(ThievingRoomType.LEFT_TURN, 24, 34, 55),
new SolutionSet(ThievingRoomType.LEFT_TURN, 26, 50, 63, 27),
new SolutionSet(ThievingRoomType.LEFT_TURN, 29, 39, 41, 61),
new SolutionSet(ThievingRoomType.LEFT_TURN, 33, 46, 52, 57),
new SolutionSet(ThievingRoomType.LEFT_TURN, 34, 45, 49, 60),
new SolutionSet(ThievingRoomType.LEFT_TURN, 36, 40, 42, 62),
new SolutionSet(ThievingRoomType.LEFT_TURN, 37, 38, 51, 64),
new SolutionSet(ThievingRoomType.LEFT_TURN, 48, 53, 55, 56),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 1, 6, 28, 41),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 1, 42, 55, 60),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 2, 10, 31, 44),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 2, 33, 51, 68),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 3, 31, 43, 46),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 3, 5, 21, 48),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 4, 20, 24, 33),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 4, 38, 47),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 5, 21, 48),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 5, 17, 35, 63),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 7, 17, 45, 47),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 7, 37, 41, 52),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 8, 13, 40, 42),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 8, 20, 24, 30),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 9, 15, 23, 35),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 11, 13, 21, 50),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 11, 18, 37, 39),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 12, 14, 27, 34),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 14, 45, 67, 71),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 16, 22, 29, 32),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 18, 28, 31, 64),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 19, 21, 63, 69),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 20, 51, 68, 72),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 22, 29, 56, 61),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 23, 53, 66, 74),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 26, 35, 53, 59),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 27, 30, 55, 57),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 31, 58, 60, 73),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 34, 57, 58, 70),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 38, 56, 61, 70),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 40, 54, 65, 72),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 42, 46, 65),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 47, 49, 66, 67),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 48, 62, 69),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 9, 19, 32, 41),
new SolutionSet(ThievingRoomType.RIGHT_TURN, 16, 26, 36, 39),
new SolutionSet(ThievingRoomType.STRAIGHT, 1, 39, 43, 51),
new SolutionSet(ThievingRoomType.STRAIGHT, 2, 15, 20, 53),
new SolutionSet(ThievingRoomType.STRAIGHT, 3, 10, 42, 44),
new SolutionSet(ThievingRoomType.STRAIGHT, 4, 14, 38, 52),
new SolutionSet(ThievingRoomType.STRAIGHT, 5, 6, 35, 41),
new SolutionSet(ThievingRoomType.STRAIGHT, 7, 16, 34, 49),
new SolutionSet(ThievingRoomType.STRAIGHT, 9, 12, 26, 27),
new SolutionSet(ThievingRoomType.STRAIGHT, 13, 25, 30, 31),
new SolutionSet(ThievingRoomType.STRAIGHT, 15, 20, 53),
new SolutionSet(ThievingRoomType.STRAIGHT, 17, 24, 34, 58),
new SolutionSet(ThievingRoomType.STRAIGHT, 18, 23, 35, 57),
new SolutionSet(ThievingRoomType.STRAIGHT, 19, 26, 47, 65),
new SolutionSet(ThievingRoomType.STRAIGHT, 21, 33, 36, 61),
new SolutionSet(ThievingRoomType.STRAIGHT, 21, 54, 66),
new SolutionSet(ThievingRoomType.STRAIGHT, 22, 25, 46, 55),
new SolutionSet(ThievingRoomType.STRAIGHT, 24, 34, 58),
new SolutionSet(ThievingRoomType.STRAIGHT, 28, 40, 52, 62),
new SolutionSet(ThievingRoomType.STRAIGHT, 29, 41, 42, 63),
new SolutionSet(ThievingRoomType.STRAIGHT, 30, 32, 37, 64),
new SolutionSet(ThievingRoomType.STRAIGHT, 39, 43, 51),
new SolutionSet(ThievingRoomType.STRAIGHT, 43, 45, 50, 60),
new SolutionSet(ThievingRoomType.STRAIGHT, 51, 53, 56, 59)
};
static final Multimap<ThievingRoomType, SolutionSet> SOLUTION_SETS =
ImmutableMultimap.<ThievingRoomType, SolutionSet>builder()
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(1, 16, 17, 55))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(1, 17, 38, 54))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(2, 7, 21, 37))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(3, 5, 19, 30))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(3, 11, 15, 40))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(4, 22, 27, 46))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(5, 9, 19, 45))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(6, 24, 26, 41))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(6, 26, 32, 52))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(7, 13, 44, 59))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(8, 14, 41, 43))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(8, 10, 28, 33))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(8, 31, 47, 50))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(10, 35, 54, 63))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(10, 30, 32, 59))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(12, 40, 53, 56))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(12, 13, 42, 54))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(13, 22, 27, 46))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(14, 18, 23, 51))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(15, 43, 44, 58))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(15, 16, 42, 45))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(20, 29, 45, 51))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(20, 25, 32, 34))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(20, 28, 51, 62))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(21, 39, 41, 58))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(22, 25, 54, 64))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(23, 31, 47, 55))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(23, 33, 37, 60))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(24, 34, 55))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(26, 50, 63, 27))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(29, 39, 41, 61))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(33, 46, 52, 57))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(34, 45, 49, 60))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(36, 40, 42, 62))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(37, 38, 51, 64))
.put(ThievingRoomType.LEFT_TURN, new SolutionSet(48, 53, 55, 56))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(1, 6, 28, 41))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(1, 42, 55, 60))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(2, 10, 31, 44))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(2, 33, 51, 68))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(3, 31, 43, 46))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(3, 5, 21, 48))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(4, 20, 24, 33))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(4, 38, 47))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(5, 21, 48))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(5, 17, 35, 63))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(7, 17, 45, 47))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(7, 37, 41, 52))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(8, 13, 40, 42))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(8, 20, 24, 30))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(9, 15, 23, 35))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(11, 13, 21, 50))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(11, 18, 37, 39))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(12, 14, 27, 34))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(14, 45, 67, 71))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(16, 22, 29, 32))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(18, 28, 31, 64))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(19, 21, 63, 69))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(20, 51, 68, 72))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(22, 29, 56, 61))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(23, 53, 66, 74))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(26, 35, 53, 59))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(27, 30, 55, 57))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(31, 58, 60, 73))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(34, 57, 58, 70))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(38, 56, 61, 70))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(40, 54, 65, 72))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(42, 46, 65))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(47, 49, 66, 67))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(48, 62, 69))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(9, 19, 32, 41))
.put(ThievingRoomType.RIGHT_TURN, new SolutionSet(16, 26, 36, 39))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(1, 39, 43, 51))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(2, 15, 20, 53))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(3, 10, 42, 44))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(4, 14, 38, 52))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(5, 6, 35, 41))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(7, 16, 34, 49))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(9, 12, 26, 27))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(13, 25, 30, 31))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(15, 20, 53))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(17, 24, 34, 58))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(18, 23, 35, 57))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(19, 26, 47, 65))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(21, 33, 36, 61))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(21, 54, 66))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(22, 25, 46, 55))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(24, 34, 58))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(28, 40, 52, 62))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(29, 41, 42, 63))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(30, 32, 37, 64))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(39, 43, 51))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(43, 45, 50, 60))
.put(ThievingRoomType.STRAIGHT, new SolutionSet(51, 53, 56, 59))
.build();
SolutionSet(final ThievingRoomType type)
SolutionSet()
{
this.type = type;
emptyChests = new HashSet<>();
}
private SolutionSet(ThievingRoomType type, Integer... emptyChests)
private SolutionSet(final Integer... emptyChests)
{
this.type = type;
this.emptyChests = new HashSet<>(Arrays.asList(emptyChests));
}
@@ -158,9 +158,6 @@ class SolutionSet
return emptyChests.contains(chestId);
}
@Getter(AccessLevel.PACKAGE)
private ThievingRoomType type;
@Getter(AccessLevel.PACKAGE)
private Set<Integer> emptyChests;
}

View File

@@ -27,7 +27,7 @@ package net.runelite.client.plugins.raidsthieving.BatSolver;
// There are three distinct Thieving rooms, distinguished by the position of the entrance relative to the exit
// e.g. If you enter the room and must turn left to get to the exit and trough, this is a LEFT_TURN
import net.runelite.client.plugins.raidsthieving.InstancePoint;
import net.runelite.api.coords.WorldPoint;
public enum ThievingRoomType
{
@@ -44,7 +44,7 @@ public enum ThievingRoomType
this.y = y;
}
public static ThievingRoomType identifyByInstancePoint(InstancePoint point)
public static ThievingRoomType identifyByInstancePoint(WorldPoint point)
{
for (ThievingRoomType type : ThievingRoomType.values())
{
@@ -57,5 +57,4 @@ public enum ThievingRoomType
return null;
}
}

View File

@@ -24,12 +24,7 @@
*/
package net.runelite.client.plugins.raidsthieving;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.util.Map;
import java.util.Set;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.api.Perspective;
@@ -41,7 +36,11 @@ 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.components.ProgressPieComponent;
import static net.runelite.client.util.ColorUtil.setAlphaComponent;
import javax.inject.Inject;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.util.Map;
/**
* Represents the overlay that shows timers on traps that are placed by the
@@ -70,13 +69,6 @@ public class ChestOverlay extends Overlay
return null;
}
/**
* Updates the timer colors.
*/
public void updateConfig()
{
}
/**
* Iterates over all the traps that were placed by the local player, and
* draws a circle or a timer on the trap, depending on the trap state.
@@ -85,23 +77,24 @@ public class ChestOverlay extends Overlay
*/
private void drawChests(Graphics2D graphics)
{
for (Map.Entry<WorldPoint, ThievingChest> entry : plugin.getChests().entrySet())
{
ThievingChest chest = entry.getValue();
WorldPoint pos = entry.getKey();
if (chest != null)
{
if (!plugin.isBatsFound() && !chest.isEverOpened() && shouldDrawChest(pos))
{
Color drawColor = new Color(setAlphaComponent(plugin.getGetPotentialBatColor().getRGB(), getChestOpacity(pos)));
Color drawColor = new Color(plugin.getPotentialBatColor().getRed(),
plugin.getPotentialBatColor().getGreen(),
plugin.getPotentialBatColor().getBlue(),
getChestOpacity(pos));
drawCircleOnTrap(graphics, chest, drawColor);
}
if (chest.isPoison())
{
drawCircleOnTrap(graphics, chest, plugin.getGetPoisonTrapColor());
drawCircleOnTrap(graphics, chest, plugin.getPoisonTrapColor());
}
}
}
@@ -132,17 +125,18 @@ public class ChestOverlay extends Overlay
*/
private void drawCircleOnTrap(Graphics2D graphics, ThievingChest chest, Color fill)
{
if (chest.getLocalPoint().getPlane() != client.getPlane())
if (chest.getWorldPoint().getPlane() != client.getPlane())
{
return;
}
LocalPoint localLoc = LocalPoint.fromWorld(client, chest.getLocalPoint());
LocalPoint localLoc = LocalPoint.fromWorld(client, chest.getWorldPoint());
if (localLoc == null)
{
return;
}
Point loc = Perspective.localToCanvas(client, localLoc, chest.getLocalPoint().getPlane());
Point loc = Perspective.localToCanvas(client, localLoc, chest.getWorldPoint().getPlane());
ProgressPieComponent pie = new ProgressPieComponent();
pie.setFill(fill);
pie.setBorderColor(Color.BLACK);

View File

@@ -1,106 +0,0 @@
package net.runelite.client.plugins.raidsthieving;
import java.util.Objects;
import lombok.AccessLevel;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.Point;
import net.runelite.api.coords.WorldPoint;
/**
* Represents a point in the instance chunk, invariant of rotation.
*/
@Getter(AccessLevel.PACKAGE)
public class InstancePoint
{
private static final int CHUNK_SIZE = 8;
private static final double CHUNK_OFFSET = 3.5;
private InstancePoint(final int x, final int y, final int rot)
{
this.x = x;
this.y = y;
this.rot = rot;
}
public InstancePoint(final int x, final int y)
{
this.x = x;
this.y = y;
this.rot = 0;
}
static InstancePoint buildFromPoint(WorldPoint worldPoint, Client client)
{
Point point = new Point(worldPoint.getX(), worldPoint.getY());
Point base = new Point(client.getBaseX(), client.getBaseY());
int plane = worldPoint.getPlane();
int deltaX = point.getX() - base.getX();
int deltaY = point.getY() - base.getY();
int chunkIndexX = deltaX / CHUNK_SIZE;
int chunkIndexY = deltaY / CHUNK_SIZE;
int chunkData = client.getInstanceTemplateChunks()[plane][chunkIndexX][chunkIndexY];
int rotation = chunkData >> 1 & 0x3;
int y = (chunkData >> 3 & 0x7FF) * 8;
int x = (chunkData >> 14 & 0x3FF) * 8;
return buildFromTile(base, point, rotation, new Point(x, y));
}
private static InstancePoint buildFromTile(Point base, Point tile, int rot, Point chunkOrigin)
{
int deltaX = tile.getX() - base.getX();
int deltaY = tile.getY() - base.getY();
double chunkOffsetX = (deltaX % CHUNK_SIZE) - CHUNK_OFFSET;
double chunkOffsetY = (deltaY % CHUNK_SIZE) - CHUNK_OFFSET;
for (int i = 0; i < rot; i++)
{
double temp = chunkOffsetX;
chunkOffsetX = -chunkOffsetY;
chunkOffsetY = temp;
}
chunkOffsetX += CHUNK_OFFSET;
chunkOffsetY += CHUNK_OFFSET;
int invariantChunkOffsetX = (int) chunkOffsetX;
int invariantChunkOffsetY = (int) chunkOffsetY;
return new InstancePoint(
chunkOrigin.getX() + invariantChunkOffsetX,
chunkOrigin.getY() + invariantChunkOffsetY,
rot);
}
@Override
public boolean equals(Object o)
{
if (this == o)
{
return true;
}
if (o == null || getClass() != o.getClass())
{
return false;
}
InstancePoint that = (InstancePoint) o;
return x == that.x &&
y == that.y;
}
@Override
public int hashCode()
{
return Objects.hash(x, y);
}
@Getter(AccessLevel.PUBLIC)
private int x;
@Getter(AccessLevel.PUBLIC)
private int y;
private int rot;
}

View File

@@ -24,10 +24,10 @@
*/
package net.runelite.client.plugins.raidsthieving;
import java.awt.Color;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import java.awt.Color;
@ConfigGroup("raidsthievingplugin")
public interface RaidsThievingConfig extends Config
@@ -55,7 +55,7 @@ public interface RaidsThievingConfig extends Config
}
@ConfigItem(
position = 5,
position = 3,
keyName = "batNotify",
name = "Notify when found",
description = "Send notification if you see bats being found."

View File

@@ -1,35 +0,0 @@
/*
* Copyright (c) 2017, Tim Lehner <Timothy.Lehner.2011@live.rhul.ac.uk>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.raidsthieving;
class RaidsThievingConstants
{
static final int CLOSED_CHEST_ID = 29742;
static final int OPEN_EMPTY_CHEST = 29743;
static final int OPEN_FULL_CHEST_1 = 29744;
static final int OPEN_FULL_CHEST_2 = 29745;
static final int EMPTY_TROUGH = 29746;
public static final int[] STORAGE = {29769, 29770, 29771, 29772};
}

View File

@@ -26,18 +26,14 @@ package net.runelite.client.plugins.raidsthieving;
import com.google.inject.Provides;
import java.awt.Color;
import java.text.MessageFormat;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameObject;
import net.runelite.api.GraphicID;
import net.runelite.api.GraphicsObject;
import net.runelite.api.ObjectID;
import net.runelite.api.Varbits;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.ConfigChanged;
@@ -54,8 +50,11 @@ import net.runelite.client.plugins.raidsthieving.BatSolver.BatSolver;
import net.runelite.client.plugins.raidsthieving.BatSolver.ChestIdentifier;
import net.runelite.client.plugins.raidsthieving.BatSolver.ThievingRoomType;
import net.runelite.client.ui.overlay.OverlayManager;
import javax.inject.Inject;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;
@Slf4j
@PluginDescriptor(
name = "Raids Bat Finder",
description = "Tracks which chests need to be searched for bats and which poison",
@@ -68,45 +67,33 @@ public class RaidsThievingPlugin extends Plugin
{
@Inject
private Client client;
@Inject
private OverlayManager overlayManager;
@Inject
private ChestOverlay overlay;
@Inject
private Notifier notifier;
@Inject
private RaidsThievingConfig config;
@Inject
private EventBus eventBus;
@Getter(AccessLevel.PACKAGE)
private final Map<WorldPoint, ThievingChest> chests = new HashMap<>();
@Getter(AccessLevel.PACKAGE)
private Instant lastActionTime = Instant.ofEpochMilli(0);
private boolean inRaidChambers;
@Getter(AccessLevel.PACKAGE)
private boolean batsFound;
@Getter(AccessLevel.PACKAGE)
private BatSolver solver;
@Getter(AccessLevel.PACKAGE)
private ChestIdentifier mapper;
@Getter(AccessLevel.PACKAGE)
private Color getPotentialBatColor;
private Color potentialBatColor;
@Getter(AccessLevel.PACKAGE)
private Color getPoisonTrapColor;
private Color poisonTrapColor;
private boolean batFoundNotify;
private boolean inRaidChambers;
@Provides
RaidsThievingConfig provideConfig(ConfigManager configManager)
@@ -117,22 +104,21 @@ public class RaidsThievingPlugin extends Plugin
@Override
protected void startUp()
{
reset();
updateConfig();
addSubscriptions();
overlayManager.add(overlay);
overlay.updateConfig();
reset();
}
@Override
protected void shutDown() throws Exception
{
eventBus.unregister(this);
overlayManager.remove(overlay);
lastActionTime = Instant.ofEpochMilli(0);
chests.clear();
eventBus.unregister(this);
}
private void addSubscriptions()
@@ -146,12 +132,12 @@ public class RaidsThievingPlugin extends Plugin
private void onGameObjectSpawned(GameObjectSpawned event)
{
GameObject obj = event.getGameObject();
WorldPoint loc = obj.getWorldLocation();
InstancePoint absLoc = InstancePoint.buildFromPoint(loc, client);
WorldPoint worldLoc = obj.getWorldLocation();
WorldPoint instanceLoc = WorldPoint.fromLocalInstance(client, obj.getLocalLocation());
if (obj.getId() == RaidsThievingConstants.EMPTY_TROUGH)
if (obj.getId() == ObjectID.TROUGH_29746)
{
ThievingRoomType type = ThievingRoomType.identifyByInstancePoint(absLoc);
ThievingRoomType type = ThievingRoomType.identifyByInstancePoint(instanceLoc);
if (type != null)
{
@@ -162,25 +148,20 @@ public class RaidsThievingPlugin extends Plugin
mapper.indentifyChest(chest);
}
}
else
{
log.error(MessageFormat.format("Unable to identify room type with: {0} {1} {2} {3} {4}.",
loc.getX(), loc.getY(), absLoc.getX(), absLoc.getY(), absLoc.getRot()));
log.error("Please report this @https://github.com/runelite/runelite/pull/4914!");
}
}
if (obj.getId() == RaidsThievingConstants.CLOSED_CHEST_ID)
if (obj.getId() == ObjectID.CHEST_29742)
{
if (!chests.containsKey(loc))
if (!chests.containsKey(worldLoc))
{
ThievingChest chest = new ThievingChest(obj, absLoc);
ThievingChest chest = new ThievingChest(worldLoc, instanceLoc);
if (mapper != null)
{
mapper.indentifyChest(chest);
}
chests.put(loc, chest);
chests.put(worldLoc, chest);
}
else
{
@@ -188,12 +169,9 @@ public class RaidsThievingPlugin extends Plugin
}
}
if (obj.getId() == RaidsThievingConstants.OPEN_FULL_CHEST_1 ||
obj.getId() == RaidsThievingConstants.OPEN_FULL_CHEST_2)
if (obj.getId() == ObjectID.CHEST_29744 || obj.getId() == ObjectID.CHEST_29745)
{
ThievingChest chest = chests.get(obj.getWorldLocation());
// We found a chest that has grubs
log.info(MessageFormat.format("Found grubs at {0}, {1} chestId: {2}", loc.getX(), loc.getY(), chest.getChestId()));
if (solver != null && chest.getChestId() != -1)
{
chest.setEverOpened(true);
@@ -202,7 +180,7 @@ public class RaidsThievingPlugin extends Plugin
checkForBats();
}
if (obj.getId() == RaidsThievingConstants.OPEN_EMPTY_CHEST)
if (obj.getId() == ObjectID.CHEST_29743)
{
ThievingChest chest = chests.get(obj.getWorldLocation());
// We found a chest that could have poison
@@ -218,9 +196,8 @@ public class RaidsThievingPlugin extends Plugin
private void onGraphicsObjectCreated(GraphicsObjectCreated event)
{
GraphicsObject obj = event.getGraphicsObject();
if (obj.getId() == 184)
if (obj.getId() == GraphicID.POISON_SPLAT)
{
log.debug("Found poison splat");
WorldPoint loc = WorldPoint.fromLocal(client, obj.getLocation());
if (chests.get(loc) == null)
@@ -241,7 +218,6 @@ public class RaidsThievingPlugin extends Plugin
inRaidChambers = setting;
reset();
}
}
private void onConfigChanged(ConfigChanged event)
@@ -249,7 +225,6 @@ public class RaidsThievingPlugin extends Plugin
if (event.getGroup().equals("raidsthievingplugin"))
{
updateConfig();
overlay.updateConfig();
}
}
@@ -274,7 +249,7 @@ public class RaidsThievingPlugin extends Plugin
return total;
}
private boolean checkForBats()
private void checkForBats()
{
for (ThievingChest chest : chests.values())
{
@@ -285,10 +260,9 @@ public class RaidsThievingPlugin extends Plugin
{
notifier.notify("Bats have been found!");
}
return true;
return;
}
}
return false;
}
int getChestId(WorldPoint worldPoint)
@@ -298,9 +272,8 @@ public class RaidsThievingPlugin extends Plugin
private void updateConfig()
{
this.getPotentialBatColor = config.getPotentialBatColor();
this.getPoisonTrapColor = config.getPoisonTrapColor();
this.potentialBatColor = config.getPotentialBatColor();
this.poisonTrapColor = config.getPoisonTrapColor();
this.batFoundNotify = config.batFoundNotify();
}
}

View File

@@ -27,7 +27,7 @@ package net.runelite.client.plugins.raidsthieving;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import net.runelite.api.GameObject;
import net.runelite.api.Point;
import net.runelite.api.coords.WorldPoint;
/**
@@ -54,26 +54,27 @@ public class ThievingChest
@Setter(AccessLevel.PACKAGE)
private boolean poison;
@Setter(AccessLevel.PUBLIC)
private int chestId;
private final WorldPoint localPoint;
private final WorldPoint worldPoint;
@Getter(AccessLevel.PUBLIC)
private final InstancePoint instancePoint;
private final Point instancePoint;
/**
* Constructor for a ThievingChest object
*
* @param gameObject The gameobject thats corresponds with this trap.
* @param worldPoint The world location of the gameobject that corresponds with this trap.
* @param instancePoint The world location accounting for instances of the gameobject that corresponds with this trap.
*/
ThievingChest(GameObject gameObject, InstancePoint instancePoint)
ThievingChest(final WorldPoint worldPoint, final WorldPoint instancePoint)
{
this.everOpened = false;
this.poison = false;
this.empty = false;
localPoint = gameObject.getWorldLocation();
this.instancePoint = instancePoint;
this.worldPoint = worldPoint;
this.instancePoint = new Point(instancePoint.getX(), instancePoint.getY());
this.chestId = -1;
}