client: revert raid changes for now
This commit is contained in:
@@ -29,7 +29,7 @@ object ProjectVersions {
|
|||||||
const val launcherVersion = "2.0.4"
|
const val launcherVersion = "2.0.4"
|
||||||
const val rlVersion = "1.5.41-SNAPSHOT"
|
const val rlVersion = "1.5.41-SNAPSHOT"
|
||||||
|
|
||||||
const val openosrsVersion = "2.1.12.0.0-SNAPSHOT"
|
const val openosrsVersion = "2.1.12.0"
|
||||||
|
|
||||||
const val rsversion = 185
|
const val rsversion = 185
|
||||||
const val cacheversion = 165
|
const val cacheversion = 165
|
||||||
|
|||||||
@@ -61,8 +61,18 @@ public class Raid
|
|||||||
|
|
||||||
if (room == null)
|
if (room == null)
|
||||||
{
|
{
|
||||||
RoomType type = RoomType.fromCode(layout.getRoomAt(i).getSymbol());
|
RaidRoom.Type type = RaidRoom.Type.fromCode(layout.getRoomAt(i).getSymbol());
|
||||||
room = type.getUnsolvedRoom();
|
room = new RaidRoom(null, type);
|
||||||
|
|
||||||
|
if (type == RaidRoom.Type.COMBAT)
|
||||||
|
{
|
||||||
|
room.setBoss(RaidRoom.Boss.UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (type == RaidRoom.Type.PUZZLE)
|
||||||
|
{
|
||||||
|
room.setPuzzle(RaidRoom.Puzzle.UNKNOWN);
|
||||||
|
}
|
||||||
|
|
||||||
setRoom(room, i);
|
setRoom(room, i);
|
||||||
}
|
}
|
||||||
@@ -93,7 +103,7 @@ public class Raid
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rooms[room.getPosition()].getType() == RoomType.COMBAT)
|
if (rooms[room.getPosition()].getType() == RaidRoom.Type.COMBAT)
|
||||||
{
|
{
|
||||||
combatRooms.add(rooms[room.getPosition()]);
|
combatRooms.add(rooms[room.getPosition()]);
|
||||||
}
|
}
|
||||||
@@ -102,6 +112,11 @@ public class Raid
|
|||||||
return combatRooms.toArray(new RaidRoom[0]);
|
return combatRooms.toArray(new RaidRoom[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String getRotationString()
|
||||||
|
{
|
||||||
|
return Joiner.on(",").join(Arrays.stream(getCombatRooms()).map(r -> r.getBoss().getName()).toArray());
|
||||||
|
}
|
||||||
|
|
||||||
private RaidRoom[] getAllRooms()
|
private RaidRoom[] getAllRooms()
|
||||||
{
|
{
|
||||||
List<RaidRoom> getAllRooms = new ArrayList<>();
|
List<RaidRoom> getAllRooms = new ArrayList<>();
|
||||||
@@ -152,7 +167,7 @@ public class Raid
|
|||||||
final int position = r.getPosition();
|
final int position = r.getPosition();
|
||||||
final RaidRoom room = getRoom(position);
|
final RaidRoom room = getRoom(position);
|
||||||
|
|
||||||
if (room == null)
|
if (room == null || !(room.getType() == RaidRoom.Type.COMBAT || room.getType() == RaidRoom.Type.PUZZLE))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -160,8 +175,26 @@ public class Raid
|
|||||||
switch (room.getType())
|
switch (room.getType())
|
||||||
{
|
{
|
||||||
case PUZZLE:
|
case PUZZLE:
|
||||||
|
final RaidRoom.Puzzle puzzle = room.getPuzzle();
|
||||||
|
sb.append(puzzle.getName());
|
||||||
|
|
||||||
|
if (puzzle == RaidRoom.Puzzle.UNKNOWN)
|
||||||
|
{
|
||||||
|
sb.append(" (puzzle)");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append(", ");
|
||||||
|
break;
|
||||||
case COMBAT:
|
case COMBAT:
|
||||||
sb.append(room.getName()).append(", ");
|
final RaidRoom.Boss boss = room.getBoss();
|
||||||
|
sb.append(boss.getName());
|
||||||
|
|
||||||
|
if (boss == RaidRoom.Boss.UNKNOWN)
|
||||||
|
{
|
||||||
|
sb.append(" (combat)");
|
||||||
|
}
|
||||||
|
|
||||||
|
sb.append(", ");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -169,4 +202,4 @@ public class Raid
|
|||||||
final String roomsString = sb.toString();
|
final String roomsString = sb.toString();
|
||||||
return roomsString.substring(0, roomsString.length() - 2);
|
return roomsString.substring(0, roomsString.length() - 2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -24,37 +24,139 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.raids;
|
package net.runelite.client.plugins.raids;
|
||||||
|
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.Setter;
|
||||||
|
import net.runelite.api.Tile;
|
||||||
|
|
||||||
@RequiredArgsConstructor
|
public class RaidRoom
|
||||||
@Getter
|
|
||||||
enum RaidRoom
|
|
||||||
{
|
{
|
||||||
START("Start", RoomType.START),
|
|
||||||
END("End", RoomType.END),
|
|
||||||
SCAVENGERS("Scavengers", RoomType.SCAVENGERS),
|
|
||||||
FARMING("Farming", RoomType.FARMING),
|
|
||||||
EMPTY("Empty", RoomType.EMPTY),
|
|
||||||
|
|
||||||
TEKTON("Tekton", RoomType.COMBAT),
|
|
||||||
MUTTADILES("Muttadiles", RoomType.COMBAT),
|
|
||||||
GUARDIANS("Guardians", RoomType.COMBAT),
|
|
||||||
VESPULA("Vespula", RoomType.COMBAT),
|
|
||||||
SHAMANS("Shamans", RoomType.COMBAT),
|
|
||||||
VASA("Vasa", RoomType.COMBAT),
|
|
||||||
VANGUARDS("Vanguards", RoomType.COMBAT),
|
|
||||||
MYSTICS("Mystics", RoomType.COMBAT),
|
|
||||||
UNKNOWN_COMBAT("Unknown (combat)", RoomType.COMBAT),
|
|
||||||
|
|
||||||
CRABS("Crabs", RoomType.PUZZLE),
|
|
||||||
ICE_DEMON("Ice Demon", RoomType.PUZZLE),
|
|
||||||
TIGHTROPE("Tightrope", RoomType.PUZZLE),
|
|
||||||
THIEVING("Thieving", RoomType.PUZZLE),
|
|
||||||
UNKNOWN_PUZZLE("Unknown (puzzle)", RoomType.PUZZLE);
|
|
||||||
|
|
||||||
static final int ROOM_MAX_SIZE = 32;
|
static final int ROOM_MAX_SIZE = 32;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
private final Tile base;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
@Setter(AccessLevel.PACKAGE)
|
||||||
|
private Type type;
|
||||||
|
@Getter(AccessLevel.PUBLIC)
|
||||||
|
@Setter(AccessLevel.PUBLIC)
|
||||||
|
private Boss boss;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
@Setter(AccessLevel.PACKAGE)
|
||||||
|
private Puzzle puzzle;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
@Setter(AccessLevel.PACKAGE)
|
||||||
|
private RaidRoom previousRoom;
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
@Setter(AccessLevel.PACKAGE)
|
||||||
|
private RaidRoom nextRoom;
|
||||||
|
|
||||||
private final String name;
|
RaidRoom(final Tile base, final Type type)
|
||||||
private final RoomType type;
|
{
|
||||||
|
this.base = base;
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case COMBAT:
|
||||||
|
return " " + type.getName() + " - " + boss.getName();
|
||||||
|
|
||||||
|
case PUZZLE:
|
||||||
|
return " " + type.getName() + " - " + puzzle.getName();
|
||||||
|
|
||||||
|
default:
|
||||||
|
return " " + type.getName();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum Type
|
||||||
|
{
|
||||||
|
START("Start", "#"),
|
||||||
|
END("End", "¤"),
|
||||||
|
SCAVENGERS("Scavengers", "S"),
|
||||||
|
FARMING("Farming", "F"),
|
||||||
|
COMBAT("Combat", "C"),
|
||||||
|
PUZZLE("Puzzle", "P"),
|
||||||
|
EMPTY("Empty", " ");
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final String code;
|
||||||
|
|
||||||
|
public static Type fromCode(char code)
|
||||||
|
{
|
||||||
|
for (Type type : Type.values())
|
||||||
|
{
|
||||||
|
if (type.getCode().equalsIgnoreCase(String.valueOf(code)))
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Type.EMPTY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum Boss
|
||||||
|
{
|
||||||
|
TEKTON("Tekton"),
|
||||||
|
MUTTADILES("Muttadiles"),
|
||||||
|
GUARDIANS("Guardians"),
|
||||||
|
VESPULA("Vespula"),
|
||||||
|
SHAMANS("Shamans"),
|
||||||
|
VASA("Vasa"),
|
||||||
|
VANGUARDS("Vanguards"),
|
||||||
|
MYSTICS("Mystics"),
|
||||||
|
UNKNOWN("Unknown");
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public static Boss fromString(String name)
|
||||||
|
{
|
||||||
|
for (Boss boss : Boss.values())
|
||||||
|
{
|
||||||
|
if (boss.getName().equalsIgnoreCase(name))
|
||||||
|
{
|
||||||
|
return boss;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum Puzzle
|
||||||
|
{
|
||||||
|
CRABS("Crabs"),
|
||||||
|
ICE_DEMON("Ice Demon"),
|
||||||
|
TIGHTROPE("Tightrope"),
|
||||||
|
THIEVING("Thieving"),
|
||||||
|
UNKNOWN("Unknown");
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
public static Puzzle fromString(String name)
|
||||||
|
{
|
||||||
|
for (Puzzle puzzle : Puzzle.values())
|
||||||
|
{
|
||||||
|
if (puzzle.getName().equalsIgnoreCase(name))
|
||||||
|
{
|
||||||
|
return puzzle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,7 @@ import java.awt.image.BufferedImage;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
@@ -43,7 +44,6 @@ import net.runelite.api.Client;
|
|||||||
import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY;
|
import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY;
|
||||||
import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG;
|
import static net.runelite.api.MenuOpcode.RUNELITE_OVERLAY_CONFIG;
|
||||||
import net.runelite.api.SpriteID;
|
import net.runelite.api.SpriteID;
|
||||||
import net.runelite.api.util.Text;
|
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.game.SpriteManager;
|
import net.runelite.client.game.SpriteManager;
|
||||||
@@ -62,6 +62,7 @@ import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
|||||||
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||||
import net.runelite.client.util.ColorUtil;
|
import net.runelite.client.util.ColorUtil;
|
||||||
import net.runelite.client.util.ImageUtil;
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
import net.runelite.api.util.Text;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public class RaidsOverlay extends Overlay
|
public class RaidsOverlay extends Overlay
|
||||||
@@ -164,6 +165,7 @@ public class RaidsOverlay extends Overlay
|
|||||||
boolean vanguards = false;
|
boolean vanguards = false;
|
||||||
boolean unknownCombat = false;
|
boolean unknownCombat = false;
|
||||||
String puzzles = "";
|
String puzzles = "";
|
||||||
|
String roomName;
|
||||||
for (Room layoutRoom : plugin.getRaid().getLayout().getRooms())
|
for (Room layoutRoom : plugin.getRaid().getLayout().getRooms())
|
||||||
{
|
{
|
||||||
int position = layoutRoom.getPosition();
|
int position = layoutRoom.getPosition();
|
||||||
@@ -178,20 +180,36 @@ public class RaidsOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
case COMBAT:
|
case COMBAT:
|
||||||
combatCount++;
|
combatCount++;
|
||||||
|
roomName = room.getBoss().getName();
|
||||||
vanguards = room == RaidRoom.VANGUARDS;
|
switch (Objects.requireNonNull(RaidRoom.Boss.fromString(roomName)))
|
||||||
unknownCombat = room == RaidRoom.UNKNOWN_COMBAT;
|
{
|
||||||
|
case VANGUARDS:
|
||||||
|
vanguards = true;
|
||||||
|
break;
|
||||||
|
case UNKNOWN:
|
||||||
|
unknownCombat = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PUZZLE:
|
case PUZZLE:
|
||||||
crabs = room == RaidRoom.CRABS;
|
roomName = room.getPuzzle().getName();
|
||||||
iceDemon = room == RaidRoom.ICE_DEMON;
|
switch (Objects.requireNonNull(RaidRoom.Puzzle.fromString(roomName)))
|
||||||
thieving = room == RaidRoom.THIEVING;
|
|
||||||
tightrope = room == RaidRoom.TIGHTROPE;
|
|
||||||
|
|
||||||
if (iceDemon)
|
|
||||||
{
|
{
|
||||||
iceRooms.add(roomCount);
|
case CRABS:
|
||||||
|
crabs = true;
|
||||||
|
break;
|
||||||
|
case ICE_DEMON:
|
||||||
|
iceDemon = true;
|
||||||
|
iceRooms.add(roomCount);
|
||||||
|
break;
|
||||||
|
case THIEVING:
|
||||||
|
thieving = true;
|
||||||
|
break;
|
||||||
|
case TIGHTROPE:
|
||||||
|
tightrope = true;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case SCAVENGERS:
|
case SCAVENGERS:
|
||||||
scavRooms.add(roomCount);
|
scavRooms.add(roomCount);
|
||||||
break;
|
break;
|
||||||
@@ -298,17 +316,17 @@ public class RaidsOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
case COMBAT:
|
case COMBAT:
|
||||||
bossCount++;
|
bossCount++;
|
||||||
if (plugin.getRoomWhitelist().contains(room.getName().toLowerCase()))
|
if (plugin.getRoomWhitelist().contains(room.getBoss().getName().toLowerCase()))
|
||||||
{
|
{
|
||||||
color = Color.GREEN;
|
color = Color.GREEN;
|
||||||
}
|
}
|
||||||
else if (plugin.getRoomBlacklist().contains(room.getName().toLowerCase())
|
else if (plugin.getRoomBlacklist().contains(room.getBoss().getName().toLowerCase())
|
||||||
|| plugin.isEnableRotationWhitelist() && bossCount > bossMatches)
|
|| plugin.isEnableRotationWhitelist() && bossCount > bossMatches)
|
||||||
{
|
{
|
||||||
color = Color.RED;
|
color = Color.RED;
|
||||||
}
|
}
|
||||||
|
|
||||||
String bossName = room.getName();
|
String bossName = room.getBoss().getName();
|
||||||
String bossNameLC = bossName.toLowerCase();
|
String bossNameLC = bossName.toLowerCase();
|
||||||
if (plugin.isShowRecommendedItems() && plugin.getRecommendedItemsList().get(bossNameLC) != null)
|
if (plugin.isShowRecommendedItems() && plugin.getRecommendedItemsList().get(bossNameLC) != null)
|
||||||
{
|
{
|
||||||
@@ -320,7 +338,7 @@ public class RaidsOverlay extends Overlay
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case PUZZLE:
|
case PUZZLE:
|
||||||
String puzzleName = room.getName();
|
String puzzleName = room.getPuzzle().getName();
|
||||||
String puzzleNameLC = puzzleName.toLowerCase();
|
String puzzleNameLC = puzzleName.toLowerCase();
|
||||||
if (plugin.getRecommendedItemsList().get(puzzleNameLC) != null)
|
if (plugin.getRecommendedItemsList().get(puzzleNameLC) != null)
|
||||||
{
|
{
|
||||||
@@ -451,4 +469,4 @@ public class RaidsOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
return ImageUtil.resizeCanvas(bim, SMALL_ICON_SIZE, SMALL_ICON_SIZE);
|
return ImageUtil.resizeCanvas(bim, SMALL_ICON_SIZE, SMALL_ICON_SIZE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -25,27 +25,22 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.raids;
|
package net.runelite.client.plugins.raids;
|
||||||
|
|
||||||
import com.google.common.base.Joiner;
|
|
||||||
import com.google.common.collect.ImmutableSet;
|
import com.google.common.collect.ImmutableSet;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.inject.Binder;
|
import com.google.inject.Binder;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.IOException;
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
@@ -57,7 +52,6 @@ import net.runelite.api.GameState;
|
|||||||
import net.runelite.api.InstanceTemplates;
|
import net.runelite.api.InstanceTemplates;
|
||||||
import net.runelite.api.ItemID;
|
import net.runelite.api.ItemID;
|
||||||
import net.runelite.api.MenuOpcode;
|
import net.runelite.api.MenuOpcode;
|
||||||
import net.runelite.api.MessageNode;
|
|
||||||
import net.runelite.api.NullObjectID;
|
import net.runelite.api.NullObjectID;
|
||||||
import static net.runelite.api.Perspective.SCENE_SIZE;
|
import static net.runelite.api.Perspective.SCENE_SIZE;
|
||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
@@ -71,19 +65,15 @@ import net.runelite.api.events.ChatMessage;
|
|||||||
import net.runelite.api.events.ClientTick;
|
import net.runelite.api.events.ClientTick;
|
||||||
import net.runelite.api.events.VarbitChanged;
|
import net.runelite.api.events.VarbitChanged;
|
||||||
import net.runelite.api.events.WidgetHiddenChanged;
|
import net.runelite.api.events.WidgetHiddenChanged;
|
||||||
import net.runelite.api.util.Text;
|
|
||||||
import static net.runelite.api.util.Text.sanitize;
|
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
import net.runelite.client.chat.ChatColorType;
|
import net.runelite.client.chat.ChatColorType;
|
||||||
import net.runelite.client.chat.ChatCommandManager;
|
|
||||||
import net.runelite.client.chat.ChatMessageBuilder;
|
import net.runelite.client.chat.ChatMessageBuilder;
|
||||||
import net.runelite.client.chat.ChatMessageManager;
|
import net.runelite.client.chat.ChatMessageManager;
|
||||||
import net.runelite.client.chat.QueuedMessage;
|
import net.runelite.client.chat.QueuedMessage;
|
||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import net.runelite.client.events.ChatInput;
|
|
||||||
import net.runelite.client.events.ConfigChanged;
|
import net.runelite.client.events.ConfigChanged;
|
||||||
import net.runelite.client.events.OverlayMenuClicked;
|
import net.runelite.client.events.OverlayMenuClicked;
|
||||||
import net.runelite.client.game.ItemManager;
|
import net.runelite.client.game.ItemManager;
|
||||||
@@ -93,6 +83,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
|||||||
import net.runelite.client.plugins.PluginType;
|
import net.runelite.client.plugins.PluginType;
|
||||||
import net.runelite.client.plugins.raids.solver.Layout;
|
import net.runelite.client.plugins.raids.solver.Layout;
|
||||||
import net.runelite.client.plugins.raids.solver.LayoutSolver;
|
import net.runelite.client.plugins.raids.solver.LayoutSolver;
|
||||||
|
import net.runelite.client.plugins.raids.solver.RotationSolver;
|
||||||
import net.runelite.client.ui.ClientToolbar;
|
import net.runelite.client.ui.ClientToolbar;
|
||||||
import net.runelite.client.ui.NavigationButton;
|
import net.runelite.client.ui.NavigationButton;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
@@ -102,14 +93,13 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
|||||||
import net.runelite.client.ui.overlay.tooltip.Tooltip;
|
import net.runelite.client.ui.overlay.tooltip.Tooltip;
|
||||||
import net.runelite.client.ui.overlay.tooltip.TooltipManager;
|
import net.runelite.client.ui.overlay.tooltip.TooltipManager;
|
||||||
import net.runelite.client.util.ImageUtil;
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
import net.runelite.api.util.Text;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import static org.apache.commons.lang3.StringUtils.containsIgnoreCase;
|
||||||
import net.runelite.client.ws.PartyMember;
|
import net.runelite.client.ws.PartyMember;
|
||||||
import net.runelite.client.ws.PartyService;
|
import net.runelite.client.ws.PartyService;
|
||||||
import net.runelite.client.ws.WSClient;
|
import net.runelite.client.ws.WSClient;
|
||||||
import net.runelite.http.api.chat.ChatClient;
|
|
||||||
import net.runelite.http.api.chat.LayoutRoom;
|
|
||||||
import net.runelite.http.api.ws.messages.party.PartyChatMessage;
|
import net.runelite.http.api.ws.messages.party.PartyChatMessage;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import static org.apache.commons.lang3.StringUtils.containsIgnoreCase;
|
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "CoX Scouter",
|
name = "CoX Scouter",
|
||||||
@@ -130,7 +120,6 @@ public class RaidsPlugin extends Plugin
|
|||||||
private static final String RAID_COMPLETE_MESSAGE = "Congratulations - your raid is complete!";
|
private static final String RAID_COMPLETE_MESSAGE = "Congratulations - your raid is complete!";
|
||||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("###.##");
|
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("###.##");
|
||||||
private static final Pattern ROTATION_REGEX = Pattern.compile("\\[(.*?)]");
|
private static final Pattern ROTATION_REGEX = Pattern.compile("\\[(.*?)]");
|
||||||
private static final String LAYOUT_COMMAND = "!layout";
|
|
||||||
private static final Pattern RAID_COMPLETE_REGEX = Pattern.compile("Congratulations - your raid is complete! Duration: ([0-9:]+)");
|
private static final Pattern RAID_COMPLETE_REGEX = Pattern.compile("Congratulations - your raid is complete! Duration: ([0-9:]+)");
|
||||||
private static final ImmutableSet<String> GOOD_CRABS_FIRST = ImmutableSet.of(
|
private static final ImmutableSet<String> GOOD_CRABS_FIRST = ImmutableSet.of(
|
||||||
"FSCCP.PCSCF - #WNWSWN#ESEENW", //both good crabs
|
"FSCCP.PCSCF - #WNWSWN#ESEENW", //both good crabs
|
||||||
@@ -167,75 +156,52 @@ public class RaidsPlugin extends Plugin
|
|||||||
"SCFPC.CSPCF - #WSWWNE#WSEENE" //good crabs first rare crabs second
|
"SCFPC.CSPCF - #WSWWNE#WSEENE" //good crabs first rare crabs second
|
||||||
);
|
);
|
||||||
private static final Pattern PUZZLES = Pattern.compile("Puzzle - (\\w+)");
|
private static final Pattern PUZZLES = Pattern.compile("Puzzle - (\\w+)");
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private ChatMessageManager chatMessageManager;
|
private ChatMessageManager chatMessageManager;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private InfoBoxManager infoBoxManager;
|
private InfoBoxManager infoBoxManager;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private RaidsConfig config;
|
private RaidsConfig config;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private RaidsOverlay overlay;
|
private RaidsOverlay overlay;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private RaidsPointsOverlay pointsOverlay;
|
private RaidsPointsOverlay pointsOverlay;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private RaidsPartyOverlay partyOverlay;
|
private RaidsPartyOverlay partyOverlay;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private LayoutSolver layoutSolver;
|
private LayoutSolver layoutSolver;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private SpriteManager spriteManager;
|
private SpriteManager spriteManager;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private ClientThread clientThread;
|
private ClientThread clientThread;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private TooltipManager tooltipManager;
|
private TooltipManager tooltipManager;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private ClientToolbar clientToolbar;
|
private ClientToolbar clientToolbar;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private ItemManager itemManager;
|
private ItemManager itemManager;
|
||||||
|
|
||||||
@Getter(AccessLevel.NONE)
|
@Getter(AccessLevel.NONE)
|
||||||
@Inject
|
@Inject
|
||||||
private EventBus eventBus;
|
private EventBus eventBus;
|
||||||
|
private boolean raidStarted;
|
||||||
@Inject
|
|
||||||
private ChatCommandManager chatCommandManager;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ChatClient chatClient;
|
|
||||||
|
|
||||||
@Inject
|
|
||||||
private ScheduledExecutorService scheduledExecutorService;
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private PartyService party;
|
private PartyService party;
|
||||||
@@ -307,7 +273,6 @@ public class RaidsPlugin extends Plugin
|
|||||||
private List<String> startingPartyMembers = new ArrayList<>();
|
private List<String> startingPartyMembers = new ArrayList<>();
|
||||||
private Map<String, List<Integer>> recommendedItemsList = new HashMap<>();
|
private Map<String, List<Integer>> recommendedItemsList = new HashMap<>();
|
||||||
private Set<String> missingPartyMembers = new HashSet<>();
|
private Set<String> missingPartyMembers = new HashSet<>();
|
||||||
private boolean raidStarted;
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
RaidsConfig provideConfig(ConfigManager configManager)
|
RaidsConfig provideConfig(ConfigManager configManager)
|
||||||
@@ -335,7 +300,6 @@ public class RaidsPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
updateLists();
|
updateLists();
|
||||||
clientThread.invokeLater(() -> checkRaidPresence(true));
|
clientThread.invokeLater(() -> checkRaidPresence(true));
|
||||||
chatCommandManager.registerCommandAsync(LAYOUT_COMMAND, this::lookupRaid, this::submitRaid);
|
|
||||||
widgetOverlay = overlayManager.getWidgetOverlay(WidgetInfo.RAIDS_POINTS_INFOBOX);
|
widgetOverlay = overlayManager.getWidgetOverlay(WidgetInfo.RAIDS_POINTS_INFOBOX);
|
||||||
RaidsPanel panel = injector.getInstance(RaidsPanel.class);
|
RaidsPanel panel = injector.getInstance(RaidsPanel.class);
|
||||||
panel.init();
|
panel.init();
|
||||||
@@ -354,7 +318,6 @@ public class RaidsPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
eventBus.unregister(this);
|
eventBus.unregister(this);
|
||||||
|
|
||||||
chatCommandManager.unregisterCommand(LAYOUT_COMMAND);
|
|
||||||
overlayManager.remove(overlay);
|
overlayManager.remove(overlay);
|
||||||
overlayManager.remove(pointsOverlay);
|
overlayManager.remove(pointsOverlay);
|
||||||
clientToolbar.removeNavigation(navButton);
|
clientToolbar.removeNavigation(navButton);
|
||||||
@@ -759,11 +722,11 @@ public class RaidsPlugin extends Plugin
|
|||||||
final String rooms = getRaid().toRoomString();
|
final String rooms = getRaid().toRoomString();
|
||||||
final String raidData = "[" + layout + "]: " + rooms;
|
final String raidData = "[" + layout + "]: " + rooms;
|
||||||
layoutMessage = new ChatMessageBuilder()
|
layoutMessage = new ChatMessageBuilder()
|
||||||
.append(ChatColorType.HIGHLIGHT)
|
.append(ChatColorType.HIGHLIGHT)
|
||||||
.append("Layout: ")
|
.append("Layout: ")
|
||||||
.append(ChatColorType.NORMAL)
|
.append(ChatColorType.NORMAL)
|
||||||
.append(raidData)
|
.append(raidData)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
final PartyMember localMember = party.getLocalMember();
|
final PartyMember localMember = party.getLocalMember();
|
||||||
if (party.getMembers().isEmpty() || localMember == null)
|
if (party.getMembers().isEmpty() || localMember == null)
|
||||||
@@ -907,13 +870,39 @@ public class RaidsPlugin extends Plugin
|
|||||||
|
|
||||||
int getRotationMatches()
|
int getRotationMatches()
|
||||||
{
|
{
|
||||||
RaidRoom[] combatRooms = raid.getCombatRooms();
|
String rotation = raid.getRotationString().toLowerCase();
|
||||||
String rotation = Arrays.stream(combatRooms)
|
List<String> bosses = Text.fromCSV(rotation);
|
||||||
.map(RaidRoom::getName)
|
|
||||||
.map(String::toLowerCase)
|
|
||||||
.collect(Collectors.joining(","));
|
|
||||||
|
|
||||||
return rotationWhitelist.contains(rotation) ? combatRooms.length : 0;
|
if (rotationWhitelist.contains(rotation))
|
||||||
|
{
|
||||||
|
return bosses.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
for (String whitelisted : rotationWhitelist)
|
||||||
|
{
|
||||||
|
int matches = 0;
|
||||||
|
List<String> whitelistedBosses = Text.fromCSV(whitelisted);
|
||||||
|
|
||||||
|
for (int i = 0; i < whitelistedBosses.size(); i++)
|
||||||
|
{
|
||||||
|
if (i < bosses.size() && whitelistedBosses.get(i).equals(bosses.get(i)))
|
||||||
|
{
|
||||||
|
matches++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
matches = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (matches >= 2)
|
||||||
|
{
|
||||||
|
return matches;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Point findLobbyBase()
|
private Point findLobbyBase()
|
||||||
@@ -1017,153 +1006,98 @@ public class RaidsPlugin extends Plugin
|
|||||||
|
|
||||||
private RaidRoom determineRoom(Tile base)
|
private RaidRoom determineRoom(Tile base)
|
||||||
{
|
{
|
||||||
|
RaidRoom room = new RaidRoom(base, RaidRoom.Type.EMPTY);
|
||||||
int chunkData = client.getInstanceTemplateChunks()[base.getPlane()][(base.getSceneLocation().getX()) / 8][base.getSceneLocation().getY() / 8];
|
int chunkData = client.getInstanceTemplateChunks()[base.getPlane()][(base.getSceneLocation().getX()) / 8][base.getSceneLocation().getY() / 8];
|
||||||
InstanceTemplates template = InstanceTemplates.findMatch(chunkData);
|
InstanceTemplates template = InstanceTemplates.findMatch(chunkData);
|
||||||
|
|
||||||
if (template == null)
|
if (template == null)
|
||||||
{
|
{
|
||||||
return RaidRoom.EMPTY;
|
return room;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (template)
|
switch (template)
|
||||||
{
|
{
|
||||||
case RAIDS_LOBBY:
|
case RAIDS_LOBBY:
|
||||||
case RAIDS_START:
|
case RAIDS_START:
|
||||||
return RaidRoom.START;
|
room.setType(RaidRoom.Type.START);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_END:
|
case RAIDS_END:
|
||||||
return RaidRoom.END;
|
room.setType(RaidRoom.Type.END);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_SCAVENGERS:
|
case RAIDS_SCAVENGERS:
|
||||||
case RAIDS_SCAVENGERS2:
|
case RAIDS_SCAVENGERS2:
|
||||||
return RaidRoom.SCAVENGERS;
|
room.setType(RaidRoom.Type.SCAVENGERS);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_SHAMANS:
|
case RAIDS_SHAMANS:
|
||||||
return RaidRoom.SHAMANS;
|
room.setType(RaidRoom.Type.COMBAT);
|
||||||
|
room.setBoss(RaidRoom.Boss.SHAMANS);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_VASA:
|
case RAIDS_VASA:
|
||||||
return RaidRoom.VASA;
|
room.setType(RaidRoom.Type.COMBAT);
|
||||||
|
room.setBoss(RaidRoom.Boss.VASA);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_VANGUARDS:
|
case RAIDS_VANGUARDS:
|
||||||
return RaidRoom.VANGUARDS;
|
room.setType(RaidRoom.Type.COMBAT);
|
||||||
|
room.setBoss(RaidRoom.Boss.VANGUARDS);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_ICE_DEMON:
|
case RAIDS_ICE_DEMON:
|
||||||
return RaidRoom.ICE_DEMON;
|
room.setType(RaidRoom.Type.PUZZLE);
|
||||||
|
room.setPuzzle(RaidRoom.Puzzle.ICE_DEMON);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_THIEVING:
|
case RAIDS_THIEVING:
|
||||||
return RaidRoom.THIEVING;
|
room.setType(RaidRoom.Type.PUZZLE);
|
||||||
|
room.setPuzzle(RaidRoom.Puzzle.THIEVING);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_FARMING:
|
case RAIDS_FARMING:
|
||||||
case RAIDS_FARMING2:
|
case RAIDS_FARMING2:
|
||||||
return RaidRoom.FARMING;
|
room.setType(RaidRoom.Type.FARMING);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_MUTTADILES:
|
case RAIDS_MUTTADILES:
|
||||||
return RaidRoom.MUTTADILES;
|
room.setType(RaidRoom.Type.COMBAT);
|
||||||
|
room.setBoss(RaidRoom.Boss.MUTTADILES);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_MYSTICS:
|
case RAIDS_MYSTICS:
|
||||||
return RaidRoom.MYSTICS;
|
room.setType(RaidRoom.Type.COMBAT);
|
||||||
|
room.setBoss(RaidRoom.Boss.MYSTICS);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_TEKTON:
|
case RAIDS_TEKTON:
|
||||||
return RaidRoom.TEKTON;
|
room.setType(RaidRoom.Type.COMBAT);
|
||||||
|
room.setBoss(RaidRoom.Boss.TEKTON);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_TIGHTROPE:
|
case RAIDS_TIGHTROPE:
|
||||||
return RaidRoom.TIGHTROPE;
|
room.setType(RaidRoom.Type.PUZZLE);
|
||||||
|
room.setPuzzle(RaidRoom.Puzzle.TIGHTROPE);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_GUARDIANS:
|
case RAIDS_GUARDIANS:
|
||||||
return RaidRoom.GUARDIANS;
|
room.setType(RaidRoom.Type.COMBAT);
|
||||||
|
room.setBoss(RaidRoom.Boss.GUARDIANS);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_CRABS:
|
case RAIDS_CRABS:
|
||||||
return RaidRoom.CRABS;
|
room.setType(RaidRoom.Type.PUZZLE);
|
||||||
|
room.setPuzzle(RaidRoom.Puzzle.CRABS);
|
||||||
|
break;
|
||||||
|
|
||||||
case RAIDS_VESPULA:
|
case RAIDS_VESPULA:
|
||||||
return RaidRoom.VESPULA;
|
room.setType(RaidRoom.Type.COMBAT);
|
||||||
|
room.setBoss(RaidRoom.Boss.VESPULA);
|
||||||
default:
|
break;
|
||||||
return RaidRoom.EMPTY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void lookupRaid(ChatMessage chatMessage, String s)
|
|
||||||
{
|
|
||||||
ChatMessageType type = chatMessage.getType();
|
|
||||||
|
|
||||||
final String player;
|
|
||||||
if (type.equals(ChatMessageType.PRIVATECHATOUT))
|
|
||||||
{
|
|
||||||
player = client.getLocalPlayer().getName();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
player = sanitize(chatMessage.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LayoutRoom[] layout;
|
return room;
|
||||||
try
|
|
||||||
{
|
|
||||||
layout = chatClient.getLayout(player);
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
log.debug("unable to lookup layout", ex);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (layout == null || layout.length == 0)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String layoutMessage = Joiner.on(", ").join(Arrays.stream(layout)
|
|
||||||
.map(l -> RaidRoom.valueOf(l.name()))
|
|
||||||
.filter(room -> room.getType() == RoomType.COMBAT || room.getType() == RoomType.PUZZLE)
|
|
||||||
.map(RaidRoom::getName)
|
|
||||||
.toArray());
|
|
||||||
|
|
||||||
String response = new ChatMessageBuilder()
|
|
||||||
.append(ChatColorType.HIGHLIGHT)
|
|
||||||
.append("Layout: ")
|
|
||||||
.append(ChatColorType.NORMAL)
|
|
||||||
.append(layoutMessage)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
log.debug("Setting response {}", response);
|
|
||||||
final MessageNode messageNode = chatMessage.getMessageNode();
|
|
||||||
messageNode.setRuneLiteFormatMessage(response);
|
|
||||||
chatMessageManager.update(messageNode);
|
|
||||||
client.refreshChat();
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean submitRaid(ChatInput chatInput, String s)
|
|
||||||
{
|
|
||||||
if (raid == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final String playerName = client.getLocalPlayer().getName();
|
|
||||||
RaidRoom[] rooms = raid.getRooms();
|
|
||||||
|
|
||||||
LayoutRoom[] layoutRooms = Arrays.stream(rooms)
|
|
||||||
.map(room -> LayoutRoom.valueOf(room.name()))
|
|
||||||
.toArray(LayoutRoom[]::new);
|
|
||||||
|
|
||||||
scheduledExecutorService.execute(() ->
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
chatClient.submitLayout(playerName, layoutRooms);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
log.warn("unable to submit layout", ex);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
chatInput.resume();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void reset()
|
public void reset()
|
||||||
@@ -1313,9 +1247,7 @@ public class RaidsPlugin extends Plugin
|
|||||||
|
|
||||||
String recordRaid()
|
String recordRaid()
|
||||||
{
|
{
|
||||||
RaidRoom[] combatRooms = raid.getCombatRooms();
|
if (raid.getRotationString().equalsIgnoreCase("vasa,tekton,vespula")
|
||||||
|
|
||||||
if (combatRooms[0] == RaidRoom.VASA && combatRooms[2] == RaidRoom.TEKTON && combatRooms[3] == RaidRoom.VESPULA
|
|
||||||
&& containsIgnoreCase(raid.getFullRotationString(), "crabs")
|
&& containsIgnoreCase(raid.getFullRotationString(), "crabs")
|
||||||
&& containsIgnoreCase(raid.getFullRotationString(), "tightrope")
|
&& containsIgnoreCase(raid.getFullRotationString(), "tightrope")
|
||||||
&& goodCrabs != null)
|
&& goodCrabs != null)
|
||||||
@@ -1365,4 +1297,4 @@ public class RaidsPlugin extends Plugin
|
|||||||
this.hideUnknownCombat = config.hideUnknownCombat();
|
this.hideUnknownCombat = config.hideUnknownCombat();
|
||||||
this.partyDisplay = config.partyDisplay();
|
this.partyDisplay = config.partyDisplay();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2018, Kamiel
|
|
||||||
* Copyright (c) 2019, Adam <Adam@sigterm.info>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package net.runelite.client.plugins.raids;
|
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
|
||||||
@Getter
|
|
||||||
enum RoomType
|
|
||||||
{
|
|
||||||
START("Start", '#'),
|
|
||||||
END("End", '¤'),
|
|
||||||
SCAVENGERS("Scavengers", 'S'),
|
|
||||||
FARMING("Farming", 'F'),
|
|
||||||
EMPTY("Empty", ' '),
|
|
||||||
COMBAT("Combat", 'C'),
|
|
||||||
PUZZLE("Puzzle", 'P');
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
private final char code;
|
|
||||||
|
|
||||||
RaidRoom getUnsolvedRoom()
|
|
||||||
{
|
|
||||||
switch (this)
|
|
||||||
{
|
|
||||||
case START:
|
|
||||||
return RaidRoom.START;
|
|
||||||
case END:
|
|
||||||
return RaidRoom.END;
|
|
||||||
case SCAVENGERS:
|
|
||||||
return RaidRoom.SCAVENGERS;
|
|
||||||
case FARMING:
|
|
||||||
return RaidRoom.FARMING;
|
|
||||||
case COMBAT:
|
|
||||||
return RaidRoom.UNKNOWN_COMBAT;
|
|
||||||
case PUZZLE:
|
|
||||||
return RaidRoom.UNKNOWN_PUZZLE;
|
|
||||||
case EMPTY:
|
|
||||||
default:
|
|
||||||
return RaidRoom.EMPTY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static RoomType fromCode(char code)
|
|
||||||
{
|
|
||||||
for (RoomType type : values())
|
|
||||||
{
|
|
||||||
if (type.getCode() == code)
|
|
||||||
{
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return EMPTY;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,45 +22,39 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.raids;
|
package net.runelite.client.plugins.raids.solver;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.GUARDIANS;
|
import net.runelite.client.plugins.raids.RaidRoom;
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.MUTTADILES;
|
import net.runelite.client.plugins.raids.RaidRoom.Boss;
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.MYSTICS;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.SHAMANS;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.TEKTON;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.UNKNOWN_COMBAT;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.VANGUARDS;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.VASA;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.VESPULA;
|
|
||||||
|
|
||||||
class RotationSolver
|
public class RotationSolver
|
||||||
{
|
{
|
||||||
private static final List[] ROTATIONS =
|
private static final Rotation[] ROTATIONS =
|
||||||
{
|
{
|
||||||
Arrays.asList(TEKTON, VASA, GUARDIANS, MYSTICS, SHAMANS, MUTTADILES, VANGUARDS, VESPULA),
|
new Rotation<>(Arrays.asList(Boss.TEKTON, Boss.VASA, Boss.GUARDIANS, Boss.MYSTICS, Boss.SHAMANS, Boss.MUTTADILES, Boss.VANGUARDS, Boss.VESPULA)),
|
||||||
Arrays.asList(TEKTON, MUTTADILES, GUARDIANS, VESPULA, SHAMANS, VASA, VANGUARDS, MYSTICS),
|
new Rotation<>(Arrays.asList(Boss.TEKTON, Boss.MUTTADILES, Boss.GUARDIANS, Boss.VESPULA, Boss.SHAMANS, Boss.VASA, Boss.VANGUARDS, Boss.MYSTICS)),
|
||||||
Arrays.asList(VESPULA, VANGUARDS, MUTTADILES, SHAMANS, MYSTICS, GUARDIANS, VASA, TEKTON),
|
new Rotation<>(Arrays.asList(Boss.VESPULA, Boss.VANGUARDS, Boss.MUTTADILES, Boss.SHAMANS, Boss.MYSTICS, Boss.GUARDIANS, Boss.VASA, Boss.TEKTON)),
|
||||||
Arrays.asList(MYSTICS, VANGUARDS, VASA, SHAMANS, VESPULA, GUARDIANS, MUTTADILES, TEKTON)
|
new Rotation<>(Arrays.asList(Boss.MYSTICS, Boss.VANGUARDS, Boss.VASA, Boss.SHAMANS, Boss.VESPULA, Boss.GUARDIANS, Boss.MUTTADILES, Boss.TEKTON))
|
||||||
};
|
};
|
||||||
|
|
||||||
static boolean solve(RaidRoom[] rooms)
|
public static void solve(RaidRoom[] rooms)
|
||||||
{
|
{
|
||||||
if (rooms == null)
|
if (rooms == null)
|
||||||
{
|
{
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<RaidRoom> match = null;
|
Rotation match = null;
|
||||||
Integer start = null;
|
Integer start = null;
|
||||||
Integer index = null;
|
Integer index = null;
|
||||||
int known = 0;
|
int known = 0;
|
||||||
|
|
||||||
for (int i = 0; i < rooms.length; i++)
|
for (int i = 0; i < rooms.length; i++)
|
||||||
{
|
{
|
||||||
if (rooms[i] == null || rooms[i].getType() != RoomType.COMBAT || rooms[i] == UNKNOWN_COMBAT)
|
if (rooms[i] == null || rooms[i].getBoss() == null || rooms[i].getBoss() == Boss.UNKNOWN)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -75,37 +69,37 @@ class RotationSolver
|
|||||||
|
|
||||||
if (known < 2)
|
if (known < 2)
|
||||||
{
|
{
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (known == rooms.length)
|
if (known == rooms.length)
|
||||||
{
|
{
|
||||||
return true;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (List rotation : ROTATIONS)
|
for (Rotation rotation : ROTATIONS)
|
||||||
{
|
{
|
||||||
COMPARE:
|
COMPARE:
|
||||||
for (int i = 0; i < rotation.size(); i++)
|
for (int i = 0; i < rotation.size(); i++)
|
||||||
{
|
{
|
||||||
if (rooms[start] == rotation.get(i))
|
if (rooms[start].getBoss() == rotation.get(i))
|
||||||
{
|
{
|
||||||
for (int j = start + 1; j < rooms.length; j++)
|
for (int j = start + 1; j < rooms.length; j++)
|
||||||
{
|
{
|
||||||
if (rooms[j].getType() != RoomType.COMBAT || rooms[j] == UNKNOWN_COMBAT)
|
if (rooms[j].getBoss() == null || rooms[j].getBoss() == Boss.UNKNOWN)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rooms[j] != rotation.get((i + j - start) % rotation.size()))
|
if (rooms[j].getBoss() != rotation.get(i + j - start))
|
||||||
{
|
{
|
||||||
break COMPARE;
|
break COMPARE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (match != null && match != rotation)
|
if (match != null && match.equals(rotation))
|
||||||
{
|
{
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
index = i - start;
|
index = i - start;
|
||||||
@@ -116,7 +110,7 @@ class RotationSolver
|
|||||||
|
|
||||||
if (match == null)
|
if (match == null)
|
||||||
{
|
{
|
||||||
return false;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < rooms.length; i++)
|
for (int i = 0; i < rooms.length; i++)
|
||||||
@@ -126,12 +120,30 @@ class RotationSolver
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rooms[i].getType() != RoomType.COMBAT || rooms[i] == UNKNOWN_COMBAT)
|
if (rooms[i].getBoss() == null || rooms[i].getBoss() == Boss.UNKNOWN)
|
||||||
{
|
{
|
||||||
rooms[i] = match.get((index + i) % match.size());
|
rooms[i].setBoss((Boss) match.get(index + i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
}
|
||||||
|
|
||||||
|
private static class Rotation<E> extends ArrayList<E>
|
||||||
|
{
|
||||||
|
Rotation(final Collection<? extends E> bosses)
|
||||||
|
{
|
||||||
|
super(bosses);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public E get(int index)
|
||||||
|
{
|
||||||
|
if (index < 0)
|
||||||
|
{
|
||||||
|
index = index + size();
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.get(index % size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, Adam <Adam@sigterm.info>
|
|
||||||
* All rights reserved.
|
|
||||||
*
|
|
||||||
* Redistribution and use in source and binary forms, with or without
|
|
||||||
* modification, are permitted provided that the following conditions are met:
|
|
||||||
*
|
|
||||||
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
||||||
* list of conditions and the following disclaimer.
|
|
||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
|
||||||
* and/or other materials provided with the distribution.
|
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
||||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
|
||||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
|
||||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
|
||||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
|
||||||
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
*/
|
|
||||||
package net.runelite.client.plugins.raids;
|
|
||||||
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.GUARDIANS;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.MUTTADILES;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.MYSTICS;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.SHAMANS;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.TEKTON;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.UNKNOWN_COMBAT;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.VANGUARDS;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.VASA;
|
|
||||||
import static net.runelite.client.plugins.raids.RaidRoom.VESPULA;
|
|
||||||
import static org.junit.Assert.assertArrayEquals;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class RotationSolverTest
|
|
||||||
{
|
|
||||||
@Test
|
|
||||||
public void testSolve1()
|
|
||||||
{
|
|
||||||
RaidRoom[] rooms = new RaidRoom[]{VESPULA, UNKNOWN_COMBAT, UNKNOWN_COMBAT, VANGUARDS};
|
|
||||||
RotationSolver.solve(rooms);
|
|
||||||
assertArrayEquals(new RaidRoom[]{VESPULA, SHAMANS, VASA, VANGUARDS}, rooms);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSolve2()
|
|
||||||
{
|
|
||||||
RaidRoom[] rooms = new RaidRoom[]{UNKNOWN_COMBAT, UNKNOWN_COMBAT, MUTTADILES, TEKTON};
|
|
||||||
RotationSolver.solve(rooms);
|
|
||||||
assertArrayEquals(new RaidRoom[]{VESPULA, GUARDIANS, MUTTADILES, TEKTON}, rooms);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSolve3()
|
|
||||||
{
|
|
||||||
RaidRoom[] rooms = new RaidRoom[]{TEKTON, UNKNOWN_COMBAT, GUARDIANS, MYSTICS};
|
|
||||||
RotationSolver.solve(rooms);
|
|
||||||
assertArrayEquals(new RaidRoom[]{TEKTON, VASA, GUARDIANS, MYSTICS}, rooms);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSolve4()
|
|
||||||
{
|
|
||||||
RaidRoom[] rooms = new RaidRoom[]{VASA, UNKNOWN_COMBAT, UNKNOWN_COMBAT, GUARDIANS};
|
|
||||||
RotationSolver.solve(rooms);
|
|
||||||
assertArrayEquals(new RaidRoom[]{VASA, SHAMANS, VESPULA, GUARDIANS}, rooms);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user