Merge remote-tracking branch 'runelite/master' into upstream-0203
This commit is contained in:
@@ -11770,5 +11770,6 @@ public final class ItemID
|
||||
public static final int DHAROKS_GREATAXE_25516 = 25516;
|
||||
public static final int VOLATILE_NIGHTMARE_STAFF_25517 = 25517;
|
||||
public static final int ANCESTRAL_HAT_25518 = 25518;
|
||||
public static final int JALREKJAD = 25519;
|
||||
/* This file is automatically generated. Do not edit. */
|
||||
}
|
||||
@@ -8972,5 +8972,11 @@ public final class NpcID
|
||||
public static final int UNICORN1337KILR = 10609;
|
||||
public static final int BOB_10610 = 10610;
|
||||
public static final int BOB_10611 = 10611;
|
||||
public static final int JALREKJAD = 10620;
|
||||
public static final int TZHAARKETRAK = 10621;
|
||||
public static final int TZHAARKETRAK_10622 = 10622;
|
||||
public static final int JALTOKJAD_10623 = 10623;
|
||||
public static final int YTHURKOT_10624 = 10624;
|
||||
public static final int JALREKJAD_10625 = 10625;
|
||||
/* This file is automatically generated. Do not edit. */
|
||||
}
|
||||
|
||||
@@ -13538,5 +13538,6 @@ public final class NullItemID
|
||||
public static final int NULL_25483 = 25483;
|
||||
public static final int NULL_25501 = 25501;
|
||||
public static final int NULL_25503 = 25503;
|
||||
public static final int NULL_25520 = 25520;
|
||||
/* This file is automatically generated. Do not edit. */
|
||||
}
|
||||
|
||||
@@ -1631,5 +1631,6 @@ public final class NullNpcID
|
||||
public static final int NULL_10617 = 10617;
|
||||
public static final int NULL_10618 = 10618;
|
||||
public static final int NULL_10619 = 10619;
|
||||
public static final int NULL_10626 = 10626;
|
||||
/* This file is automatically generated. Do not edit. */
|
||||
}
|
||||
|
||||
@@ -20059,6 +20059,7 @@ public final class NullObjectID
|
||||
public static final int NULL_41010 = 41010;
|
||||
public static final int NULL_41011 = 41011;
|
||||
public static final int NULL_41012 = 41012;
|
||||
public static final int NULL_41014 = 41014;
|
||||
public static final int NULL_41022 = 41022;
|
||||
public static final int NULL_41191 = 41191;
|
||||
public static final int NULL_41192 = 41192;
|
||||
|
||||
@@ -20940,6 +20940,7 @@ public final class ObjectID
|
||||
public static final int CAGED_MONKEY_SHEEP = 40971;
|
||||
public static final int FIREWORKS = 40972;
|
||||
public static final int POST_40982 = 40982;
|
||||
public static final int SCOREBOARD_41013 = 41013;
|
||||
public static final int POTION_OF_POWER_TABLE_41023 = 41023;
|
||||
public static final int PEDESTAL_SPACE = 41024;
|
||||
public static final int PEDESTAL_SPACE_41025 = 41025;
|
||||
|
||||
@@ -376,7 +376,7 @@ public class Perspective
|
||||
*/
|
||||
public static Polygon getCanvasTilePoly(@Nonnull Client client, @Nonnull LocalPoint localLocation, int zOffset)
|
||||
{
|
||||
return getCanvasTileAreaPoly(client, localLocation, 1, 1, zOffset);
|
||||
return getCanvasTileAreaPoly(client, localLocation, 1, 1, client.getPlane(), zOffset);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -389,7 +389,7 @@ public class Perspective
|
||||
*/
|
||||
public static Polygon getCanvasTileAreaPoly(@Nonnull Client client, @Nonnull LocalPoint localLocation, int size)
|
||||
{
|
||||
return getCanvasTileAreaPoly(client, localLocation, size, size, 0);
|
||||
return getCanvasTileAreaPoly(client, localLocation, size, size, client.getPlane(), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -399,6 +399,7 @@ public class Perspective
|
||||
* @param localLocation the center location of the AoE
|
||||
* @param sizeX the size of the area in tiles on the x axis
|
||||
* @param sizeY the size of the area in tiles on the y axis
|
||||
* @param plane the plane of the area
|
||||
* @param zOffset offset from ground plane
|
||||
* @return a polygon representing the tiles in the area
|
||||
*/
|
||||
@@ -407,10 +408,9 @@ public class Perspective
|
||||
@Nonnull LocalPoint localLocation,
|
||||
int sizeX,
|
||||
int sizeY,
|
||||
int plane,
|
||||
int zOffset)
|
||||
{
|
||||
final int plane = client.getPlane();
|
||||
|
||||
final int swX = localLocation.getX() - (sizeX * LOCAL_TILE_SIZE / 2);
|
||||
final int swY = localLocation.getY() - (sizeY * LOCAL_TILE_SIZE / 2);
|
||||
|
||||
|
||||
@@ -205,7 +205,7 @@ public enum Quest
|
||||
|
||||
public QuestState getState(Client client)
|
||||
{
|
||||
client.runScript(ScriptID.QUESTLIST_PROGRESS, id);
|
||||
client.runScript(ScriptID.QUEST_STATUS_GET, id);
|
||||
switch (client.getIntStack()[0])
|
||||
{
|
||||
case 2:
|
||||
|
||||
@@ -150,7 +150,7 @@ public final class ScriptID
|
||||
* </ul>
|
||||
*/
|
||||
@ScriptArguments(integer = 1)
|
||||
public static final int QUESTLIST_PROGRESS = 2267;
|
||||
public static final int QUEST_STATUS_GET = 4029;
|
||||
|
||||
/**
|
||||
* Updates the Diary/Quest interface's scrollbar
|
||||
|
||||
+24
-38
@@ -27,10 +27,12 @@ package net.runelite.client.plugins.chatcommands;
|
||||
|
||||
import com.google.common.annotations.VisibleForTesting;
|
||||
import com.google.common.base.MoreObjects;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.inject.Provides;
|
||||
import java.io.IOException;
|
||||
import java.util.EnumSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -91,16 +93,13 @@ import org.apache.commons.text.WordUtils;
|
||||
@Slf4j
|
||||
public class ChatCommandsPlugin extends Plugin
|
||||
{
|
||||
private static final Pattern KILLCOUNT_PATTERN = Pattern.compile("Your (.+) (?:kill|harvest|lap|completion) count is: <col=ff0000>(\\d+)</col>");
|
||||
private static final Pattern RAIDS_PATTERN = Pattern.compile("Your completed (.+) count is: <col=ff0000>(\\d+)</col>");
|
||||
private static final Pattern KILLCOUNT_PATTERN = Pattern.compile("Your (?:completion count for |subdued |completed )?(.+?) (?:(?:kill|harvest|lap|completion) )?(?:count )?is: <col=ff0000>(\\d+)</col>");
|
||||
private static final String COX_TEAM_SIZES = "(?:\\d+(?:\\+|-\\d+)? players|Solo)";
|
||||
private static final Pattern RAIDS_PB_PATTERN = Pattern.compile("<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>" + COX_TEAM_SIZES + "</col> Duration:</col> <col=ff0000>(?<pb>[0-9:]+)</col> \\(new personal best\\)</col>");
|
||||
private static final Pattern RAIDS_DURATION_PATTERN = Pattern.compile("<col=ef20ff>Congratulations - your raid is complete!</col><br>Team size: <col=ff0000>" + COX_TEAM_SIZES + "</col> Duration:</col> <col=ff0000>[0-9:]+</col> Personal best: </col><col=ff0000>(?<pb>[0-9:]+)</col>");
|
||||
private static final Pattern TOB_WAVE_PB_PATTERN = Pattern.compile("^.*Theatre of Blood wave completion time: <col=ff0000>(?<pb>[0-9:]+)</col> \\(Personal best!\\)");
|
||||
private static final Pattern TOB_WAVE_DURATION_PATTERN = Pattern.compile("^.*Theatre of Blood wave completion time: <col=ff0000>[0-9:]+</col><br></col>Personal best: (?<pb>[0-9:]+)");
|
||||
private static final Pattern WINTERTODT_PATTERN = Pattern.compile("Your subdued Wintertodt count is: <col=ff0000>(\\d+)</col>");
|
||||
private static final Pattern BARROWS_PATTERN = Pattern.compile("Your Barrows chest count is: <col=ff0000>(\\d+)</col>");
|
||||
private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("(?i)^(?:Fight |Lap |Challenge |Corrupted challenge )?duration: <col=ff0000>[0-9:]+</col>\\. Personal best: (?<pb>[0-9:]+)");
|
||||
private static final Pattern KILL_DURATION_PATTERN = Pattern.compile("(?i)^(?:Fight |Lap |Challenge |Corrupted challenge )?duration: <col=ff0000>[0-9:]+</col>\\. Personal best: (?:<col=ff0000>)?(?<pb>[0-9:]+)");
|
||||
private static final Pattern NEW_PB_PATTERN = Pattern.compile("(?i)^(?:Fight |Lap |Challenge |Corrupted challenge )?duration: <col=ff0000>(?<pb>[0-9:]+)</col> \\(new personal best\\)");
|
||||
private static final Pattern DUEL_ARENA_WINS_PATTERN = Pattern.compile("You (were defeated|won)! You have(?: now)? won (\\d+) duels?");
|
||||
private static final Pattern DUEL_ARENA_LOSSES_PATTERN = Pattern.compile("You have(?: now)? lost (\\d+) duels?");
|
||||
@@ -132,6 +131,10 @@ public class ChatCommandsPlugin extends Plugin
|
||||
@VisibleForTesting
|
||||
static final int ADV_LOG_EXPLOITS_TEXT_INDEX = 1;
|
||||
|
||||
private static final Map<String, String> KILLCOUNT_RENAMES = ImmutableMap.of(
|
||||
"Barrows chest", "Barrows Chests"
|
||||
);
|
||||
|
||||
private boolean bossLogLoaded;
|
||||
private boolean advLogLoaded;
|
||||
private boolean scrollInterfaceLoaded;
|
||||
@@ -273,6 +276,8 @@ public class ChatCommandsPlugin extends Plugin
|
||||
String boss = matcher.group(1);
|
||||
int kc = Integer.parseInt(matcher.group(2));
|
||||
|
||||
boss = KILLCOUNT_RENAMES.getOrDefault(boss, boss);
|
||||
|
||||
setKc(boss, kc);
|
||||
// We either already have the pb, or need to remember the boss for the upcoming pb
|
||||
if (lastPb > -1)
|
||||
@@ -289,31 +294,6 @@ public class ChatCommandsPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
matcher = WINTERTODT_PATTERN.matcher(message);
|
||||
if (matcher.find())
|
||||
{
|
||||
int kc = Integer.parseInt(matcher.group(1));
|
||||
|
||||
setKc("Wintertodt", kc);
|
||||
}
|
||||
|
||||
matcher = RAIDS_PATTERN.matcher(message);
|
||||
if (matcher.find())
|
||||
{
|
||||
String boss = matcher.group(1);
|
||||
int kc = Integer.parseInt(matcher.group(2));
|
||||
|
||||
setKc(boss, kc);
|
||||
if (lastPb > -1)
|
||||
{
|
||||
setPb(boss, lastPb);
|
||||
lastPb = -1;
|
||||
}
|
||||
lastBossKill = boss;
|
||||
lastBossTime = client.getTickCount();
|
||||
return;
|
||||
}
|
||||
|
||||
matcher = DUEL_ARENA_WINS_PATTERN.matcher(message);
|
||||
if (matcher.find())
|
||||
{
|
||||
@@ -351,14 +331,6 @@ public class ChatCommandsPlugin extends Plugin
|
||||
setKc("Duel Arena Losses", losses);
|
||||
}
|
||||
|
||||
matcher = BARROWS_PATTERN.matcher(message);
|
||||
if (matcher.find())
|
||||
{
|
||||
int kc = Integer.parseInt(matcher.group(1));
|
||||
|
||||
setKc("Barrows Chests", kc);
|
||||
}
|
||||
|
||||
matcher = KILL_DURATION_PATTERN.matcher(message);
|
||||
if (matcher.find())
|
||||
{
|
||||
@@ -1859,6 +1831,20 @@ public class ChatCommandsPlugin extends Plugin
|
||||
case "wildy agility":
|
||||
return "Wilderness Agility";
|
||||
|
||||
// Jad challenge
|
||||
case "jad 1":
|
||||
return "TzHaar-Ket-Rak's First Challenge";
|
||||
case "jad 2":
|
||||
return "TzHaar-Ket-Rak's Second Challenge";
|
||||
case "jad 3":
|
||||
return "TzHaar-Ket-Rak's Third Challenge";
|
||||
case "jad 4":
|
||||
return "TzHaar-Ket-Rak's Fourth Challenge";
|
||||
case "jad 5":
|
||||
return "TzHaar-Ket-Rak's Fifth Challenge";
|
||||
case "jad 6":
|
||||
return "TzHaar-Ket-Rak's Sixth Challenge";
|
||||
|
||||
default:
|
||||
return WordUtils.capitalize(boss);
|
||||
}
|
||||
|
||||
+26
@@ -660,4 +660,30 @@ public class ChatCommandsPluginTest
|
||||
verify(configManager).setRSProfileConfiguration("personalbest", "tztok-jad", 21 * 60 + 58);
|
||||
verify(configManager).setRSProfileConfiguration("killcount", "tztok-jad", 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJadChallengeNewPb()
|
||||
{
|
||||
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completion count for TzHaar-Ket-Rak's First Challenge is: <col=ff0000>1</col>.", null, 0);
|
||||
chatCommandsPlugin.onChatMessage(chatMessage);
|
||||
|
||||
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Challenge duration: <col=ff0000>1:46</col> (new personal best)", null, 0);
|
||||
chatCommandsPlugin.onChatMessage(chatMessage);
|
||||
|
||||
verify(configManager).setRSProfileConfiguration("killcount", "TzHaar-Ket-Rak's First Challenge".toLowerCase(), 1);
|
||||
verify(configManager).setRSProfileConfiguration("personalbest", "TzHaar-Ket-Rak's First Challenge".toLowerCase(), 60 + 46);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testJadChallengeNoPb()
|
||||
{
|
||||
ChatMessage chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Your completion count for TzHaar-Ket-Rak's First Challenge is: <col=ff0000>3</col>.", null, 0);
|
||||
chatCommandsPlugin.onChatMessage(chatMessage);
|
||||
|
||||
chatMessage = new ChatMessage(null, GAMEMESSAGE, "", "Challenge duration: <col=ff0000>1:10</col>. Personal best: <col=ff0000>0:59</col>", null, 0);
|
||||
chatCommandsPlugin.onChatMessage(chatMessage);
|
||||
|
||||
verify(configManager).setRSProfileConfiguration("killcount", "TzHaar-Ket-Rak's First Challenge".toLowerCase(), 3);
|
||||
verify(configManager).setRSProfileConfiguration("personalbest", "TzHaar-Ket-Rak's First Challenge".toLowerCase(), 59);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user