Merge branch 'master' into loot-tracker-reset
This commit is contained in:
@@ -20,7 +20,7 @@
|
|||||||
- [http-api](http-api/src/main/java/net/runelite/http/api) - API for runelite and runeliteplus
|
- [http-api](http-api/src/main/java/net/runelite/http/api) - API for runelite and runeliteplus
|
||||||
- [http-service](http-service/src/main/java/net/runelite/http/service) - Service for https://api.runelitepl.us
|
- [http-service](http-service/src/main/java/net/runelite/http/service) - Service for https://api.runelitepl.us
|
||||||
- [runelite-api](runelite-api/src/main/java/net/runelite/api) - RuneLite API, interfaces for accessing the client
|
- [runelite-api](runelite-api/src/main/java/net/runelite/api) - RuneLite API, interfaces for accessing the client
|
||||||
- [runelite-mixins](runelite-mixins/src/main/java/net/runelite) - Mixins which are injected into the injected client's classes
|
- [runelite-mixins](runelite-mixins/src/main/java/net/runelite) - Mixins which are injected into the vanilla client's classes
|
||||||
- [runescape-api](runescape-api/src/main/java/net/runelite) - Mappings correspond to these interfaces, runelite-api is a subset of this
|
- [runescape-api](runescape-api/src/main/java/net/runelite) - Mappings correspond to these interfaces, runelite-api is a subset of this
|
||||||
- [runelite-client](runelite-client/src/main/java/net/runelite/client) - Game client with plugins
|
- [runelite-client](runelite-client/src/main/java/net/runelite/client) - Game client with plugins
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,8 @@ public class RuneLiteAPI
|
|||||||
|
|
||||||
CLIENT = new OkHttpClient.Builder()
|
CLIENT = new OkHttpClient.Builder()
|
||||||
.pingInterval(30, TimeUnit.SECONDS)
|
.pingInterval(30, TimeUnit.SECONDS)
|
||||||
|
.connectTimeout(5655, TimeUnit.MILLISECONDS)
|
||||||
|
.writeTimeout(5655, TimeUnit.MILLISECONDS)
|
||||||
.addNetworkInterceptor(new Interceptor()
|
.addNetworkInterceptor(new Interceptor()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
@@ -119,6 +121,8 @@ public class RuneLiteAPI
|
|||||||
|
|
||||||
RLP_CLIENT = new OkHttpClient.Builder()
|
RLP_CLIENT = new OkHttpClient.Builder()
|
||||||
.pingInterval(30, TimeUnit.SECONDS)
|
.pingInterval(30, TimeUnit.SECONDS)
|
||||||
|
.writeTimeout(5655, TimeUnit.MILLISECONDS)
|
||||||
|
.connectTimeout(2655, TimeUnit.MILLISECONDS)
|
||||||
.addNetworkInterceptor(new Interceptor()
|
.addNetworkInterceptor(new Interceptor()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -0,0 +1,92 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, 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.http.service.animation;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import net.runelite.http.api.animation.AnimationKey;
|
||||||
|
import net.runelite.http.api.animation.AnimationRequest;
|
||||||
|
import net.runelite.http.service.util.exception.NotFoundException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import static org.springframework.web.bind.annotation.RequestMethod.POST;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/animation")
|
||||||
|
public class AnimationController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private AnimationEndpoint animationService;
|
||||||
|
|
||||||
|
@RequestMapping(method = POST)
|
||||||
|
public void submit(@RequestBody AnimationRequest animationRequest)
|
||||||
|
{
|
||||||
|
animationService.submit(animationRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping
|
||||||
|
public List<AnimationKey> get()
|
||||||
|
{
|
||||||
|
return animationService.get().stream()
|
||||||
|
.map(AnimationController::entryToKey)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/{npcid}")
|
||||||
|
public AnimationKey getRegion(@PathVariable int npcid)
|
||||||
|
{
|
||||||
|
AnimationEntry animationEntry = animationService.getNPC(npcid);
|
||||||
|
if (animationEntry == null)
|
||||||
|
{
|
||||||
|
throw new NotFoundException();
|
||||||
|
}
|
||||||
|
|
||||||
|
return entryToKey(animationEntry);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AnimationKey entryToKey(AnimationEntry xe)
|
||||||
|
{
|
||||||
|
AnimationKey animationKey = new AnimationKey();
|
||||||
|
animationKey.setNPCId(xe.getNPCId());
|
||||||
|
animationKey.setAnimations(new int[]
|
||||||
|
{
|
||||||
|
xe.getAnimations()[0],
|
||||||
|
xe.getAnimations()[1],
|
||||||
|
xe.getAnimations()[2],
|
||||||
|
xe.getAnimations()[3],
|
||||||
|
xe.getAnimations()[4],
|
||||||
|
xe.getAnimations()[5],
|
||||||
|
xe.getAnimations()[6],
|
||||||
|
xe.getAnimations()[7],
|
||||||
|
xe.getAnimations()[8],
|
||||||
|
xe.getAnimations()[9],
|
||||||
|
});
|
||||||
|
return animationKey;
|
||||||
|
}
|
||||||
|
}
|
||||||
2
pom.xml
2
pom.xml
@@ -49,7 +49,7 @@
|
|||||||
<mockito.version>1.10.19</mockito.version>
|
<mockito.version>1.10.19</mockito.version>
|
||||||
<sql2o.version>1.5.4</sql2o.version>
|
<sql2o.version>1.5.4</sql2o.version>
|
||||||
<minio.version>3.0.6</minio.version>
|
<minio.version>3.0.6</minio.version>
|
||||||
<okhttp3.version>3.7.0</okhttp3.version>
|
<okhttp3.version>4.0.0</okhttp3.version>
|
||||||
<zlika.reproducible.build.maven.plugin.version>0.7</zlika.reproducible.build.maven.plugin.version>
|
<zlika.reproducible.build.maven.plugin.version>0.7</zlika.reproducible.build.maven.plugin.version>
|
||||||
|
|
||||||
<maven.jar.plugin.version>3.0.2</maven.jar.plugin.version>
|
<maven.jar.plugin.version>3.0.2</maven.jar.plugin.version>
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import com.google.common.collect.ComparisonChain;
|
|||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Font;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@@ -66,6 +67,7 @@ import net.runelite.client.RuneLite;
|
|||||||
import static net.runelite.client.RuneLite.PROFILES_DIR;
|
import static net.runelite.client.RuneLite.PROFILES_DIR;
|
||||||
import net.runelite.client.eventbus.EventBus;
|
import net.runelite.client.eventbus.EventBus;
|
||||||
import net.runelite.client.util.ColorUtil;
|
import net.runelite.client.util.ColorUtil;
|
||||||
|
import net.runelite.client.ui.FontManager;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@@ -508,6 +510,10 @@ public class ConfigManager
|
|||||||
{
|
{
|
||||||
return Enum.valueOf((Class<? extends Enum>) type, str);
|
return Enum.valueOf((Class<? extends Enum>) type, str);
|
||||||
}
|
}
|
||||||
|
if (type == Font.class)
|
||||||
|
{
|
||||||
|
return FontManager.getFontOrDefault(FontManager.lookupFont(str));
|
||||||
|
}
|
||||||
if (type == Instant.class)
|
if (type == Instant.class)
|
||||||
{
|
{
|
||||||
return Instant.parse(str);
|
return Instant.parse(str);
|
||||||
@@ -564,6 +570,10 @@ public class ConfigManager
|
|||||||
{
|
{
|
||||||
return ((Enum) object).name();
|
return ((Enum) object).name();
|
||||||
}
|
}
|
||||||
|
if (object instanceof Font)
|
||||||
|
{
|
||||||
|
return FontManager.getFontName((Font)object);
|
||||||
|
}
|
||||||
if (object instanceof Dimension)
|
if (object instanceof Dimension)
|
||||||
{
|
{
|
||||||
Dimension d = (Dimension) object;
|
Dimension d = (Dimension) object;
|
||||||
|
|||||||
@@ -24,21 +24,18 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.config;
|
package net.runelite.client.config;
|
||||||
|
|
||||||
import java.awt.Font;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import net.runelite.client.ui.FontManager;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public enum FontType
|
public enum FontType
|
||||||
{
|
{
|
||||||
REGULAR("Regular", FontManager.getRunescapeFont()),
|
REGULAR("Regular"),
|
||||||
BOLD("Bold", FontManager.getRunescapeBoldFont()),
|
BOLD("Bold"),
|
||||||
SMALL("Small", FontManager.getRunescapeSmallFont());
|
SMALL("Small");
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Font font;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
|
|||||||
@@ -25,7 +25,9 @@
|
|||||||
package net.runelite.client.config;
|
package net.runelite.client.config;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Font;
|
||||||
import net.runelite.api.Constants;
|
import net.runelite.api.Constants;
|
||||||
|
import net.runelite.client.ui.FontManager;
|
||||||
|
|
||||||
@ConfigGroup("runelite")
|
@ConfigGroup("runelite")
|
||||||
public interface RuneLiteConfig extends Config
|
public interface RuneLiteConfig extends Config
|
||||||
@@ -207,6 +209,17 @@ public interface RuneLiteConfig extends Config
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "clientFont",
|
||||||
|
name = "Font",
|
||||||
|
description = "Configure what font is used for the client and runelite added overlays",
|
||||||
|
position = 29
|
||||||
|
)
|
||||||
|
default Font clientFont()
|
||||||
|
{
|
||||||
|
return FontManager.getRunescapeFont();
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "fontType",
|
keyName = "fontType",
|
||||||
name = "Dynamic Overlay Font",
|
name = "Dynamic Overlay Font",
|
||||||
|
|||||||
@@ -27,28 +27,34 @@ package net.runelite.client.menus;
|
|||||||
|
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
|
import com.google.common.collect.Iterables;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
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.atomic.AtomicInteger;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
|
import com.google.common.collect.Sets;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.MenuAction;
|
import net.runelite.api.MenuAction;
|
||||||
import static net.runelite.api.MenuAction.GAME_OBJECT_FIRST_OPTION;
|
import static net.runelite.api.MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET;
|
||||||
import static net.runelite.api.MenuAction.WIDGET_DEFAULT;
|
|
||||||
import net.runelite.api.MenuEntry;
|
import net.runelite.api.MenuEntry;
|
||||||
import net.runelite.api.NPCDefinition;
|
import net.runelite.api.NPCDefinition;
|
||||||
import net.runelite.api.events.ClientTick;
|
import net.runelite.api.events.BeforeRender;
|
||||||
import net.runelite.api.events.MenuEntryAdded;
|
import net.runelite.api.events.MenuEntryAdded;
|
||||||
|
import net.runelite.api.events.MenuOpened;
|
||||||
import net.runelite.api.events.MenuOptionClicked;
|
import net.runelite.api.events.MenuOptionClicked;
|
||||||
import net.runelite.api.events.NpcActionChanged;
|
import net.runelite.api.events.NpcActionChanged;
|
||||||
import net.runelite.api.events.PlayerMenuOptionClicked;
|
import net.runelite.api.events.PlayerMenuOptionClicked;
|
||||||
@@ -70,21 +76,9 @@ public class MenuManager
|
|||||||
private static final int IDX_UPPER = 8;
|
private static final int IDX_UPPER = 8;
|
||||||
static final Pattern LEVEL_PATTERN = Pattern.compile("\\(level-[0-9]*\\)");
|
static final Pattern LEVEL_PATTERN = Pattern.compile("\\(level-[0-9]*\\)");
|
||||||
|
|
||||||
private static MenuEntry CANCEL()
|
|
||||||
{
|
|
||||||
MenuEntry cancel = new MenuEntry();
|
|
||||||
cancel.setOption("Cancel");
|
|
||||||
cancel.setTarget("");
|
|
||||||
cancel.setIdentifier(0);
|
|
||||||
cancel.setType(MenuAction.CANCEL.getId());
|
|
||||||
cancel.setParam0(0);
|
|
||||||
cancel.setParam1(0);
|
|
||||||
|
|
||||||
return cancel;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final EventBus eventBus;
|
private final EventBus eventBus;
|
||||||
|
private final Prioritizer prioritizer;
|
||||||
|
|
||||||
//Maps the indexes that are being used to the menu option.
|
//Maps the indexes that are being used to the menu option.
|
||||||
private final Map<Integer, String> playerMenuIndexMap = new HashMap<>();
|
private final Map<Integer, String> playerMenuIndexMap = new HashMap<>();
|
||||||
@@ -95,15 +89,21 @@ public class MenuManager
|
|||||||
private final Set<ComparableEntry> priorityEntries = new HashSet<>();
|
private final Set<ComparableEntry> priorityEntries = new HashSet<>();
|
||||||
private final Set<MenuEntry> currentPriorityEntries = new HashSet<>();
|
private final Set<MenuEntry> currentPriorityEntries = new HashSet<>();
|
||||||
private final Set<ComparableEntry> hiddenEntries = new HashSet<>();
|
private final Set<ComparableEntry> hiddenEntries = new HashSet<>();
|
||||||
|
private final Set<MenuEntry> currentHiddenEntries = new HashSet<>();
|
||||||
private final Map<ComparableEntry, ComparableEntry> swaps = new HashMap<>();
|
private final Map<ComparableEntry, ComparableEntry> swaps = new HashMap<>();
|
||||||
private EntryTypeMapping originalType;
|
private final Map<ComparableEntry, MenuEntry> currentSwaps = new HashMap<>();
|
||||||
|
|
||||||
|
private final LinkedHashSet<MenuEntry> entries = Sets.newLinkedHashSet();
|
||||||
|
|
||||||
|
private MenuEntry leftClickEntry = null;
|
||||||
|
private int leftClickType = -1;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private MenuManager(Client client, EventBus eventBus)
|
private MenuManager(Client client, EventBus eventBus)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.eventBus = eventBus;
|
this.eventBus = eventBus;
|
||||||
|
this.prioritizer = new Prioritizer();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -143,6 +143,121 @@ public class MenuManager
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onMenuOpened(MenuOpened event)
|
||||||
|
{
|
||||||
|
currentPriorityEntries.clear();
|
||||||
|
currentHiddenEntries.clear();
|
||||||
|
|
||||||
|
// Need to reorder the list to normal, then rebuild with swaps
|
||||||
|
MenuEntry[] oldEntries = event.getMenuEntries();
|
||||||
|
|
||||||
|
for (MenuEntry entry : oldEntries)
|
||||||
|
{
|
||||||
|
if (entry == leftClickEntry)
|
||||||
|
{
|
||||||
|
entry.setType(leftClickType);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
leftClickEntry = null;
|
||||||
|
leftClickType = -1;
|
||||||
|
|
||||||
|
client.sortMenuEntries();
|
||||||
|
|
||||||
|
List<MenuEntry> newEntries = Lists.newArrayList(oldEntries);
|
||||||
|
|
||||||
|
boolean shouldDeprioritize = false;
|
||||||
|
|
||||||
|
prioritizer: for (MenuEntry entry : oldEntries)
|
||||||
|
{
|
||||||
|
// Remove hidden entries from menus
|
||||||
|
for (ComparableEntry p : hiddenEntries)
|
||||||
|
{
|
||||||
|
if (p.matches(entry))
|
||||||
|
{
|
||||||
|
newEntries.remove(entry);
|
||||||
|
continue prioritizer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ComparableEntry p : priorityEntries)
|
||||||
|
{
|
||||||
|
// Create list of priority entries, and remove from menus
|
||||||
|
if (p.matches(entry))
|
||||||
|
{
|
||||||
|
// Other entries need to be deprioritized if their types are lower than 1000
|
||||||
|
if (entry.getType() >= 1000 && !shouldDeprioritize)
|
||||||
|
{
|
||||||
|
shouldDeprioritize = true;
|
||||||
|
}
|
||||||
|
currentPriorityEntries.add(entry);
|
||||||
|
newEntries.remove(entry);
|
||||||
|
continue prioritizer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (newEntries.size() > 0)
|
||||||
|
{
|
||||||
|
// Swap first matching entry to top
|
||||||
|
for (ComparableEntry src : swaps.keySet())
|
||||||
|
{
|
||||||
|
if (!src.matches(entry))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
MenuEntry swapFrom = null;
|
||||||
|
|
||||||
|
ComparableEntry from = swaps.get(src);
|
||||||
|
|
||||||
|
for (MenuEntry e : newEntries)
|
||||||
|
{
|
||||||
|
if (from.matches(e))
|
||||||
|
{
|
||||||
|
swapFrom = e;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not need to swap with itself
|
||||||
|
if (swapFrom != null && swapFrom != entry)
|
||||||
|
{
|
||||||
|
// Deprioritize entries if the swaps are not in similar type groups
|
||||||
|
if ((swapFrom.getType() >= 1000 && entry.getType() < 1000) || (entry.getType() >= 1000 && swapFrom.getType() < 1000) && !shouldDeprioritize)
|
||||||
|
{
|
||||||
|
shouldDeprioritize = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
int indexFrom = newEntries.indexOf(swapFrom);
|
||||||
|
int indexTo = newEntries.indexOf(entry);
|
||||||
|
|
||||||
|
Collections.swap(newEntries, indexFrom, indexTo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldDeprioritize)
|
||||||
|
{
|
||||||
|
for (MenuEntry entry : newEntries)
|
||||||
|
{
|
||||||
|
if (entry.getType() <= MENU_ACTION_DEPRIORITIZE_OFFSET)
|
||||||
|
{
|
||||||
|
entry.setType(entry.getType() + MENU_ACTION_DEPRIORITIZE_OFFSET);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!priorityEntries.isEmpty())
|
||||||
|
{
|
||||||
|
newEntries.addAll(currentPriorityEntries);
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setMenuEntries(newEntries.toArray(new MenuEntry[0]));
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuEntryAdded(MenuEntryAdded event)
|
public void onMenuEntryAdded(MenuEntryAdded event)
|
||||||
{
|
{
|
||||||
@@ -167,116 +282,78 @@ public class MenuManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
private void onClientTick(ClientTick event)
|
public void onBeforeRender(BeforeRender event)
|
||||||
{
|
{
|
||||||
originalType = null;
|
leftClickEntry = null;
|
||||||
|
leftClickType = -1;
|
||||||
|
|
||||||
|
if (client.isMenuOpen())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
entries.clear();
|
||||||
|
|
||||||
|
entries.addAll(Arrays.asList(client.getMenuEntries()));
|
||||||
|
|
||||||
|
if (entries.size() < 2)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
currentPriorityEntries.clear();
|
currentPriorityEntries.clear();
|
||||||
client.sortMenuEntries();
|
currentHiddenEntries.clear();
|
||||||
|
currentSwaps.clear();
|
||||||
|
|
||||||
MenuEntry[] oldEntries = client.getMenuEntries();
|
prioritizer.prioritize();
|
||||||
List<MenuEntry> newEntries = Lists.newArrayList(oldEntries);
|
|
||||||
|
|
||||||
for (MenuEntry entry : oldEntries)
|
while (prioritizer.isRunning())
|
||||||
{
|
{
|
||||||
for (ComparableEntry p : priorityEntries)
|
// wait
|
||||||
{
|
|
||||||
if (p.matches(entry))
|
|
||||||
{
|
|
||||||
currentPriorityEntries.add(entry);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If there are entries we want to prioritize, we have to remove the rest
|
entries.removeAll(currentHiddenEntries);
|
||||||
if (!currentPriorityEntries.isEmpty() && !client.isMenuOpen())
|
|
||||||
{
|
|
||||||
newEntries.retainAll(currentPriorityEntries);
|
|
||||||
|
|
||||||
// This is because players existing changes walk-here target
|
|
||||||
// so without this we lose track of em
|
|
||||||
if (newEntries.size() != currentPriorityEntries.size())
|
|
||||||
{
|
|
||||||
for (MenuEntry e : currentPriorityEntries)
|
|
||||||
{
|
|
||||||
if (newEntries.contains(e))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (MenuEntry e2 : client.getMenuEntries())
|
for (MenuEntry entry : currentPriorityEntries)
|
||||||
{
|
{
|
||||||
if (e.getType() == e2.getType())
|
if (entries.contains(entry))
|
||||||
{
|
{
|
||||||
e.setTarget(e2.getTarget());
|
leftClickEntry = entry;
|
||||||
newEntries.add(e);
|
leftClickType = entry.getType();
|
||||||
}
|
entries.remove(leftClickEntry);
|
||||||
}
|
leftClickEntry.setType(MenuAction.WIDGET_DEFAULT.getId());
|
||||||
}
|
entries.add(leftClickEntry);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isHidden = false;
|
|
||||||
for (ComparableEntry p : hiddenEntries)
|
|
||||||
{
|
|
||||||
if (p.matches(entry))
|
|
||||||
{
|
|
||||||
isHidden = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isHidden)
|
|
||||||
|
if (leftClickEntry == null)
|
||||||
{
|
{
|
||||||
newEntries.remove(entry);
|
MenuEntry first = Iterables.getLast(entries);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!currentPriorityEntries.isEmpty() && !client.isMenuOpen())
|
for (ComparableEntry swap : currentSwaps.keySet())
|
||||||
{
|
{
|
||||||
newEntries.add(0, CANCEL());
|
if (swap.matches(first))
|
||||||
}
|
|
||||||
|
|
||||||
MenuEntry leftClickEntry = newEntries.get(newEntries.size() - 1);
|
|
||||||
|
|
||||||
for (ComparableEntry src : swaps.keySet())
|
|
||||||
{
|
{
|
||||||
if (!src.matches(leftClickEntry))
|
leftClickEntry = currentSwaps.get(swap);
|
||||||
{
|
leftClickType = leftClickEntry.getType();
|
||||||
continue;
|
entries.remove(leftClickEntry);
|
||||||
}
|
leftClickEntry.setType(MenuAction.WIDGET_DEFAULT.getId());
|
||||||
|
entries.add(leftClickEntry);
|
||||||
ComparableEntry tgt = swaps.get(src);
|
|
||||||
|
|
||||||
for (int i = newEntries.size() - 2; i > 0; i--)
|
|
||||||
{
|
|
||||||
MenuEntry e = newEntries.get(i);
|
|
||||||
|
|
||||||
if (tgt.matches(e))
|
|
||||||
{
|
|
||||||
newEntries.set(newEntries.size() - 1, e);
|
|
||||||
newEntries.set(i, leftClickEntry);
|
|
||||||
|
|
||||||
int type = e.getType();
|
|
||||||
|
|
||||||
if (type >= 1000)
|
|
||||||
{
|
|
||||||
int newType = getLeftClickType(type);
|
|
||||||
if (newType != -1 && newType != type)
|
|
||||||
{
|
|
||||||
MenuEntry original = MenuEntry.copy(e);
|
|
||||||
e.setType(newType);
|
|
||||||
originalType = new EntryTypeMapping(new ComparableEntry(leftClickEntry), original);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
client.setMenuEntries(newEntries.toArray(new MenuEntry[0]));
|
client.setMenuEntries(entries.toArray(new MenuEntry[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void addPlayerMenuItem(String menuText)
|
public void addPlayerMenuItem(String menuText)
|
||||||
{
|
{
|
||||||
Preconditions.checkNotNull(menuText);
|
Preconditions.checkNotNull(menuText);
|
||||||
@@ -338,24 +415,6 @@ public class MenuManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getLeftClickType(int oldType)
|
|
||||||
{
|
|
||||||
if (oldType > 2000)
|
|
||||||
{
|
|
||||||
oldType -= 2000;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (MenuAction.of(oldType))
|
|
||||||
{
|
|
||||||
case GAME_OBJECT_FIFTH_OPTION:
|
|
||||||
return GAME_OBJECT_FIRST_OPTION.getId();
|
|
||||||
case EXAMINE_ITEM_BANK_EQ:
|
|
||||||
return WIDGET_DEFAULT.getId();
|
|
||||||
default:
|
|
||||||
return oldType;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addNpcOption(NPCDefinition composition, String npcOption)
|
private void addNpcOption(NPCDefinition composition, String npcOption)
|
||||||
{
|
{
|
||||||
String[] actions = composition.getActions();
|
String[] actions = composition.getActions();
|
||||||
@@ -399,21 +458,11 @@ public class MenuManager
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuOptionClicked(MenuOptionClicked event)
|
public void onMenuOptionClicked(MenuOptionClicked event)
|
||||||
{
|
{
|
||||||
// Type is changed in check
|
if (leftClickEntry != null && leftClickType != -1)
|
||||||
if (originalType != null && originalType.check(event))
|
|
||||||
{
|
{
|
||||||
event.consume();
|
leftClickEntry.setType(leftClickType);
|
||||||
|
event.setMenuEntry(leftClickEntry);
|
||||||
client.invokeMenuAction(
|
leftClickEntry = null;
|
||||||
event.getActionParam0(),
|
|
||||||
event.getActionParam1(),
|
|
||||||
event.getType(),
|
|
||||||
event.getIdentifier(),
|
|
||||||
"do not edit",
|
|
||||||
event.getTarget(),
|
|
||||||
client.getMouseCanvasPosition().getX(),
|
|
||||||
client.getMouseCanvasPosition().getY()
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getMenuAction() != MenuAction.RUNELITE)
|
if (event.getMenuAction() != MenuAction.RUNELITE)
|
||||||
@@ -740,23 +789,115 @@ public class MenuManager
|
|||||||
hiddenEntries.remove(entry);
|
hiddenEntries.remove(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
@AllArgsConstructor
|
private class Prioritizer
|
||||||
private class EntryTypeMapping
|
|
||||||
{
|
{
|
||||||
private final ComparableEntry comparable;
|
private MenuEntry[] entries;
|
||||||
private final MenuEntry target;
|
private AtomicInteger state = new AtomicInteger(0);
|
||||||
|
|
||||||
private boolean check(MenuOptionClicked event)
|
boolean isRunning()
|
||||||
{
|
{
|
||||||
MenuEntry entry = event.getMenuEntry();
|
return state.get() != 0;
|
||||||
|
|
||||||
if (event.getTarget().equals("do not edit") || !comparable.matches(entry))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setMenuEntry(target);
|
void prioritize()
|
||||||
return true;
|
{
|
||||||
|
if (state.get() != 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
entries = client.getMenuEntries();
|
||||||
|
|
||||||
|
state.set(3);
|
||||||
|
|
||||||
|
if (!hiddenEntries.isEmpty())
|
||||||
|
{
|
||||||
|
hiddenFinder.run();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!priorityEntries.isEmpty())
|
||||||
|
{
|
||||||
|
priorityFinder.run();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state.decrementAndGet();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!swaps.isEmpty())
|
||||||
|
{
|
||||||
|
swapFinder.run();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
state.decrementAndGet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Thread hiddenFinder = new Thread()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Arrays.stream(entries).parallel().forEach(entry ->
|
||||||
|
{
|
||||||
|
for (ComparableEntry p : hiddenEntries)
|
||||||
|
{
|
||||||
|
if (p.matches(entry))
|
||||||
|
{
|
||||||
|
currentHiddenEntries.add(entry);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
state.decrementAndGet();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private Thread priorityFinder = new Thread()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Arrays.stream(entries).parallel().forEach(entry ->
|
||||||
|
{
|
||||||
|
for (ComparableEntry p : priorityEntries)
|
||||||
|
{
|
||||||
|
if (p.matches(entry))
|
||||||
|
{
|
||||||
|
currentPriorityEntries.add(entry);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
state.decrementAndGet();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
private Thread swapFinder = new Thread()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
Arrays.stream(entries).parallel().forEach(entry ->
|
||||||
|
{
|
||||||
|
for (Map.Entry<ComparableEntry, ComparableEntry> p : swaps.entrySet())
|
||||||
|
{
|
||||||
|
if (p.getValue().matches(entry))
|
||||||
|
{
|
||||||
|
currentSwaps.put(p.getKey(), entry);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
state.decrementAndGet();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ public class BarrowsBrotherSlainOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
final boolean brotherSlain = client.getVar(brother.getKilledVarbit()) > 0;
|
final boolean brotherSlain = client.getVar(brother.getKilledVarbit()) > 0;
|
||||||
String slain = brotherSlain ? "\u2713" : "\u2717";
|
String slain = brotherSlain ? "\u2713" : "\u2717";
|
||||||
tableComponent.addRow(brother.getName(), ColorUtil.prependColorTag(slain, brotherSlain ? Color.RED : Color.GREEN));
|
tableComponent.addRow(brother.getName(), ColorUtil.prependColorTag(slain, brotherSlain ? Color.GREEN : Color.RED));
|
||||||
}
|
}
|
||||||
|
|
||||||
float rewardPercent = client.getVar(Varbits.BARROWS_REWARD_POTENTIAL) / 10.0f;
|
float rewardPercent = client.getVar(Varbits.BARROWS_REWARD_POTENTIAL) / 10.0f;
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public interface ChatTranslationConfig extends Config
|
|||||||
name = "Show 'Translate' menu option",
|
name = "Show 'Translate' menu option",
|
||||||
description = "Adds 'Translate' to the right-click menu in the Chatbox.",
|
description = "Adds 'Translate' to the right-click menu in the Chatbox.",
|
||||||
position = 0,
|
position = 0,
|
||||||
group = "Public Chat Translation"
|
group = "Chat Translation"
|
||||||
)
|
)
|
||||||
default boolean translateOptionVisable()
|
default boolean translateOptionVisable()
|
||||||
{
|
{
|
||||||
@@ -23,9 +23,9 @@ public interface ChatTranslationConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "publicChat",
|
keyName = "publicChat",
|
||||||
name = "Translate incoming Messages",
|
name = "Translate incoming Messages",
|
||||||
description = "Would you like to Translate Public Chat?",
|
description = "Would you like to Translate Chat?",
|
||||||
position = 1,
|
position = 1,
|
||||||
group = "Public Chat Translation",
|
group = "Chat Translation",
|
||||||
hidden = true,
|
hidden = true,
|
||||||
unhide = "translateOptionVisable"
|
unhide = "translateOptionVisable"
|
||||||
)
|
)
|
||||||
@@ -37,9 +37,9 @@ public interface ChatTranslationConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "playerNames",
|
keyName = "playerNames",
|
||||||
name = "Translated Player list:",
|
name = "Translated Player list:",
|
||||||
description = "Players you add to this list will be Translated in Public chat.",
|
description = "Players you add to this list will be Translated in chat.",
|
||||||
position = 2,
|
position = 2,
|
||||||
group = "Public Chat Translation",
|
group = "Chat Translation",
|
||||||
hidden = true,
|
hidden = true,
|
||||||
unhide = "translateOptionVisable"
|
unhide = "translateOptionVisable"
|
||||||
)
|
)
|
||||||
@@ -53,7 +53,7 @@ public interface ChatTranslationConfig extends Config
|
|||||||
name = "Target Language",
|
name = "Target Language",
|
||||||
description = "Language to translate messages too.",
|
description = "Language to translate messages too.",
|
||||||
position = 2,
|
position = 2,
|
||||||
group = "Public Chat Translation",
|
group = "Chat Translation",
|
||||||
hidden = true,
|
hidden = true,
|
||||||
unhide = "publicChat"
|
unhide = "publicChat"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -180,6 +180,7 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
|||||||
{
|
{
|
||||||
case PUBLICCHAT:
|
case PUBLICCHAT:
|
||||||
case MODCHAT:
|
case MODCHAT:
|
||||||
|
case FRIENDSCHAT:
|
||||||
if (!config.publicChat())
|
if (!config.publicChat())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -237,11 +238,24 @@ public class ChatTranslationPlugin extends Plugin implements KeyListener
|
|||||||
{
|
{
|
||||||
if (event.getKeyCode() == 0xA)
|
if (event.getKeyCode() == 0xA)
|
||||||
{
|
{
|
||||||
event.consume();
|
|
||||||
|
|
||||||
Translator translator = new Translator();
|
Translator translator = new Translator();
|
||||||
String message = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT);
|
String message = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT);
|
||||||
|
|
||||||
|
if (message.startsWith("/"))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, translator.translate("auto", config.playerTargetLanguage().toString(), message));
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.consume();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//Automatically check language of message and translate to selected language.
|
//Automatically check language of message and translate to selected language.
|
||||||
|
|||||||
@@ -36,8 +36,10 @@ import java.awt.Rectangle;
|
|||||||
import java.awt.geom.Area;
|
import java.awt.geom.Area;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -98,7 +100,6 @@ import net.runelite.client.ui.overlay.OverlayUtil;
|
|||||||
import net.runelite.client.ui.overlay.components.TextComponent;
|
import net.runelite.client.ui.overlay.components.TextComponent;
|
||||||
import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager;
|
import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager;
|
||||||
import net.runelite.client.util.ImageUtil;
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.ItemUtil;
|
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
@@ -225,9 +226,9 @@ public class ClueScrollPlugin extends Plugin
|
|||||||
@Subscribe
|
@Subscribe
|
||||||
public void onMenuOptionClicked(final MenuOptionClicked event)
|
public void onMenuOptionClicked(final MenuOptionClicked event)
|
||||||
{
|
{
|
||||||
if (event.getOption() != null && event.getOption().equals("Read"))
|
if (event.getMenuAction() != null && event.getMenuAction().equals("Read"))
|
||||||
{
|
{
|
||||||
final ItemDefinition itemComposition = itemManager.getItemDefinition(event.getIdentifier());
|
final ItemDefinition itemComposition = itemManager.getItemDefinition(event.hashCode());
|
||||||
|
|
||||||
if (itemComposition != null && itemComposition.getName().startsWith("Clue scroll"))
|
if (itemComposition != null && itemComposition.getName().startsWith("Clue scroll"))
|
||||||
{
|
{
|
||||||
@@ -256,8 +257,10 @@ public class ClueScrollPlugin extends Plugin
|
|||||||
// Check if item was removed from inventory
|
// Check if item was removed from inventory
|
||||||
if (clue != null && clueItemId != null)
|
if (clue != null && clueItemId != null)
|
||||||
{
|
{
|
||||||
|
final Stream<Item> items = Arrays.stream(event.getItemContainer().getItems());
|
||||||
|
|
||||||
// Check if clue was removed from inventory
|
// Check if clue was removed from inventory
|
||||||
if (!ItemUtil.containsItemId(event.getItemContainer().getItems(), clueItemId))
|
if (items.noneMatch(item -> itemManager.getItemDefinition(item.getId()).getId() == clueItemId))
|
||||||
{
|
{
|
||||||
resetClue(true);
|
resetClue(true);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -322,7 +322,6 @@ public class HotColdClue extends ClueScroll implements LocationClueScroll, Locat
|
|||||||
{
|
{
|
||||||
isBeginner = false;
|
isBeginner = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
log.warn("Hot cold solver could not be initialized, clue type is unknown; text: {}, npc: {}, solution: {}",
|
log.warn("Hot cold solver could not be initialized, clue type is unknown; text: {}, npc: {}, solution: {}",
|
||||||
|
|||||||
@@ -28,12 +28,15 @@ import java.awt.Dimension;
|
|||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.InventoryID;
|
import net.runelite.api.InventoryID;
|
||||||
|
import net.runelite.api.Item;
|
||||||
import static net.runelite.api.ItemID.TORN_CLUE_SCROLL_PART_1;
|
import static net.runelite.api.ItemID.TORN_CLUE_SCROLL_PART_1;
|
||||||
import static net.runelite.api.ItemID.TORN_CLUE_SCROLL_PART_2;
|
import static net.runelite.api.ItemID.TORN_CLUE_SCROLL_PART_2;
|
||||||
import static net.runelite.api.ItemID.TORN_CLUE_SCROLL_PART_3;
|
import static net.runelite.api.ItemID.TORN_CLUE_SCROLL_PART_3;
|
||||||
@@ -45,7 +48,6 @@ import net.runelite.client.plugins.cluescrolls.ClueScrollPlugin;
|
|||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
import net.runelite.client.util.ItemUtil;
|
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -125,19 +127,21 @@ public class ThreeStepCrypticClue extends ClueScroll implements TextClueScroll,
|
|||||||
if (event.getItemContainer() == client.getItemContainer(InventoryID.INVENTORY))
|
if (event.getItemContainer() == client.getItemContainer(InventoryID.INVENTORY))
|
||||||
{
|
{
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
success |= checkForPart(event, TORN_CLUE_SCROLL_PART_1, 0);
|
success |= checkForPart(event, itemManager, TORN_CLUE_SCROLL_PART_1, 0);
|
||||||
success |= checkForPart(event, TORN_CLUE_SCROLL_PART_2, 1);
|
success |= checkForPart(event, itemManager, TORN_CLUE_SCROLL_PART_2, 1);
|
||||||
success |= checkForPart(event, TORN_CLUE_SCROLL_PART_3, 2);
|
success |= checkForPart(event, itemManager, TORN_CLUE_SCROLL_PART_3, 2);
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean checkForPart(final ItemContainerChanged event, int clueScrollPart, int index)
|
private boolean checkForPart(final ItemContainerChanged event, ItemManager itemManager, int clueScrollPart, int index)
|
||||||
{
|
{
|
||||||
|
final Stream<Item> items = Arrays.stream(event.getItemContainer().getItems());
|
||||||
|
|
||||||
// If we have the part then that step is done
|
// If we have the part then that step is done
|
||||||
if (ItemUtil.containsItemId(event.getItemContainer().getItems(), clueScrollPart))
|
if (items.anyMatch(item -> itemManager.getItemDefinition(item.getId()).getId() == clueScrollPart))
|
||||||
{
|
{
|
||||||
final Map.Entry<CrypticClue, Boolean> entry = clueSteps.get(index);
|
final Map.Entry<CrypticClue, Boolean> entry = clueSteps.get(index);
|
||||||
|
|
||||||
|
|||||||
@@ -25,33 +25,7 @@
|
|||||||
package net.runelite.client.plugins.cluescrolls.clues.emote;
|
package net.runelite.client.plugins.cluescrolls.clues.emote;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import static net.runelite.api.SpriteID.EMOTE_ANGRY;
|
import static net.runelite.api.SpriteID.*;
|
||||||
import static net.runelite.api.SpriteID.EMOTE_BECKON;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_BLOW_KISS;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_BOW;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_CHEER;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_CLAP;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_CRY;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_DANCE;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_FLAP;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_GOBLIN_SALUTE;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_HEADBANG;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_JIG;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_JUMP_FOR_JOY;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_LAUGH;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_NO;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_PANIC;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_PUSH_UP;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_RASPBERRY;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_SALUTE;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_SHRUG;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_SLAP_HEAD;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_SPIN;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_STOMP;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_THINK;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_WAVE;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_YAWN;
|
|
||||||
import static net.runelite.api.SpriteID.EMOTE_YES;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum Emote
|
public enum Emote
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import java.awt.Dimension;
|
|||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
import java.awt.Insets;
|
import java.awt.Insets;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.Font;
|
||||||
import java.awt.event.FocusAdapter;
|
import java.awt.event.FocusAdapter;
|
||||||
import java.awt.event.FocusEvent;
|
import java.awt.event.FocusEvent;
|
||||||
import java.awt.event.ItemEvent;
|
import java.awt.event.ItemEvent;
|
||||||
@@ -99,6 +100,7 @@ import net.runelite.client.plugins.PluginManager;
|
|||||||
import net.runelite.client.plugins.PluginType;
|
import net.runelite.client.plugins.PluginType;
|
||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
import net.runelite.client.ui.DynamicGridLayout;
|
import net.runelite.client.ui.DynamicGridLayout;
|
||||||
|
import net.runelite.client.ui.FontManager;
|
||||||
import net.runelite.client.ui.PluginPanel;
|
import net.runelite.client.ui.PluginPanel;
|
||||||
import net.runelite.client.ui.components.ComboBoxListRenderer;
|
import net.runelite.client.ui.components.ComboBoxListRenderer;
|
||||||
import net.runelite.client.ui.components.IconButton;
|
import net.runelite.client.ui.components.IconButton;
|
||||||
@@ -999,6 +1001,36 @@ public class ConfigPanel extends PluginPanel
|
|||||||
item.add(button, BorderLayout.EAST);
|
item.add(button, BorderLayout.EAST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cid.getType() == Font.class)
|
||||||
|
{
|
||||||
|
JComboBox box = new JComboBox(FontManager.getAvailableFontNames());
|
||||||
|
box.setPreferredSize(new Dimension(150, 25));
|
||||||
|
box.setRenderer(new ComboBoxListRenderer());
|
||||||
|
box.setForeground(Color.WHITE);
|
||||||
|
box.setFocusable(false);
|
||||||
|
String currentlyConfigured = configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName());
|
||||||
|
if (FontManager.lookupFont(currentlyConfigured) != null)
|
||||||
|
{
|
||||||
|
box.setSelectedItem(currentlyConfigured);
|
||||||
|
box.setToolTipText(currentlyConfigured);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
log.debug("Selected font wasn't found on this system, resetting font back to runescape regular");
|
||||||
|
configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), FontManager.getRunescapeFont());
|
||||||
|
}
|
||||||
|
box.addItemListener(e ->
|
||||||
|
{
|
||||||
|
if (e.getStateChange() == ItemEvent.SELECTED && box.getSelectedItem() != null)
|
||||||
|
{
|
||||||
|
final Font selected = FontManager.lookupFont(box.getSelectedItem().toString());
|
||||||
|
configManager.setConfiguration(cd.getGroup().value(), cid.getItem().keyName(), selected);
|
||||||
|
box.setToolTipText(box.getSelectedItem().toString());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
item.add(box, BorderLayout.EAST);
|
||||||
|
}
|
||||||
|
|
||||||
mainPanel.add(item);
|
mainPanel.add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,8 +43,10 @@ import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
|||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
import net.runelite.client.ui.overlay.components.ComponentConstants;
|
import net.runelite.client.ui.overlay.components.ComponentConstants;
|
||||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.table.TableAlignment;
|
||||||
|
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||||
|
import net.runelite.client.util.ColorUtil;
|
||||||
|
|
||||||
class CorpDamageOverlay extends Overlay
|
class CorpDamageOverlay extends Overlay
|
||||||
{
|
{
|
||||||
@@ -90,6 +92,8 @@ class CorpDamageOverlay extends Overlay
|
|||||||
int damageForKill = players != 0 ? totalDamage / players : 0;
|
int damageForKill = players != 0 ? totalDamage / players : 0;
|
||||||
|
|
||||||
panelComponent.getChildren().clear();
|
panelComponent.getChildren().clear();
|
||||||
|
TableComponent tableComponent = new TableComponent();
|
||||||
|
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
|
||||||
|
|
||||||
NPC core = corpPlugin.getCore();
|
NPC core = corpPlugin.getCore();
|
||||||
if (core != null)
|
if (core != null)
|
||||||
@@ -114,27 +118,17 @@ class CorpDamageOverlay extends Overlay
|
|||||||
int textWidth = Math.max(ComponentConstants.STANDARD_WIDTH, fontMetrics.stringWidth(text));
|
int textWidth = Math.max(ComponentConstants.STANDARD_WIDTH, fontMetrics.stringWidth(text));
|
||||||
|
|
||||||
panelComponent.setPreferredSize(new Dimension(textWidth, 0));
|
panelComponent.setPreferredSize(new Dimension(textWidth, 0));
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
tableComponent.addRow(ColorUtil.prependColorTag(text, Color.RED), "");
|
||||||
.left(text)
|
|
||||||
.leftColor(Color.RED)
|
|
||||||
.build());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.showDamage())
|
if (config.showDamage())
|
||||||
{
|
{
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
tableComponent.addRow("Your damage", ColorUtil.prependColorTag(Integer.toString(myDamage), damageForKill > 0 && myDamage >= damageForKill ? Color.GREEN : Color.RED));
|
||||||
.left("Your damage")
|
tableComponent.addRow("Total damage:", Integer.toString(totalDamage));
|
||||||
.right(Integer.toString(myDamage))
|
|
||||||
.rightColor(damageForKill > 0 && myDamage >= damageForKill ? Color.GREEN : Color.RED)
|
|
||||||
.build());
|
|
||||||
|
|
||||||
panelComponent.getChildren().add(LineComponent.builder()
|
|
||||||
.left("Total damage")
|
|
||||||
.right(Integer.toString(totalDamage))
|
|
||||||
.build());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(tableComponent);
|
||||||
return panelComponent.render(graphics);
|
return panelComponent.render(graphics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.devtools;
|
|||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
|
||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Polygon;
|
import java.awt.Polygon;
|
||||||
@@ -63,7 +62,6 @@ import net.runelite.api.coords.LocalPoint;
|
|||||||
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.api.widgets.WidgetItem;
|
import net.runelite.api.widgets.WidgetItem;
|
||||||
import net.runelite.client.ui.FontManager;
|
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
@@ -77,7 +75,6 @@ class DevToolsOverlay extends Overlay
|
|||||||
private static final int ITEM_EMPTY = 6512;
|
private static final int ITEM_EMPTY = 6512;
|
||||||
private static final int ITEM_FILLED = 20594;
|
private static final int ITEM_FILLED = 20594;
|
||||||
|
|
||||||
private static final Font FONT = FontManager.getRunescapeFont().deriveFont(Font.BOLD, 16);
|
|
||||||
private static final Color RED = new Color(221, 44, 0);
|
private static final Color RED = new Color(221, 44, 0);
|
||||||
private static final Color GREEN = new Color(0, 200, 83);
|
private static final Color GREEN = new Color(0, 200, 83);
|
||||||
private static final Color TURQOISE = new Color(0, 200, 157);
|
private static final Color TURQOISE = new Color(0, 200, 157);
|
||||||
@@ -115,7 +112,6 @@ class DevToolsOverlay extends Overlay
|
|||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
{
|
{
|
||||||
graphics.setFont(FONT);
|
|
||||||
|
|
||||||
if (plugin.getPlayers().isActive())
|
if (plugin.getPlayers().isActive())
|
||||||
{
|
{
|
||||||
@@ -398,7 +394,7 @@ class DevToolsOverlay extends Overlay
|
|||||||
Rectangle2D textBounds = fm.getStringBounds(idText, graphics);
|
Rectangle2D textBounds = fm.getStringBounds(idText, graphics);
|
||||||
|
|
||||||
int textX = (int) (slotBounds.getX() + (slotBounds.getWidth() / 2) - (textBounds.getWidth() / 2));
|
int textX = (int) (slotBounds.getX() + (slotBounds.getWidth() / 2) - (textBounds.getWidth() / 2));
|
||||||
int textY = (int) (slotBounds.getY() + (slotBounds.getHeight() / 2) + (textBounds.getHeight() / 2));
|
int textY = (int) (slotBounds.getY() + (slotBounds.getHeight() / 2) + (fm.getHeight() / 2) - fm.getMaxDescent());
|
||||||
|
|
||||||
graphics.setColor(new Color(255, 255, 255, 65));
|
graphics.setColor(new Color(255, 255, 255, 65));
|
||||||
graphics.fill(slotBounds);
|
graphics.fill(slotBounds);
|
||||||
@@ -540,7 +536,7 @@ class DevToolsOverlay extends Overlay
|
|||||||
Rectangle2D textBounds = fm.getStringBounds(text, graphics);
|
Rectangle2D textBounds = fm.getStringBounds(text, graphics);
|
||||||
|
|
||||||
int textX = (int) (bounds.getX() + (bounds.getWidth() / 2) - (textBounds.getWidth() / 2));
|
int textX = (int) (bounds.getX() + (bounds.getWidth() / 2) - (textBounds.getWidth() / 2));
|
||||||
int textY = (int) (bounds.getY() + (bounds.getHeight() / 2) + (textBounds.getHeight() / 2));
|
int textY = (int) (bounds.getY() + (bounds.getHeight() / 2) + (fm.getHeight() / 2) - fm.getMaxDescent());
|
||||||
|
|
||||||
graphics.setColor(Color.BLACK);
|
graphics.setColor(Color.BLACK);
|
||||||
graphics.drawString(text, textX + 1, textY + 1);
|
graphics.drawString(text, textX + 1, textY + 1);
|
||||||
|
|||||||
@@ -193,7 +193,7 @@ class VarInspector extends JFrame
|
|||||||
{
|
{
|
||||||
lastTick = tick;
|
lastTick = tick;
|
||||||
JLabel header = new JLabel("Tick " + tick);
|
JLabel header = new JLabel("Tick " + tick);
|
||||||
header.setFont(FontManager.getRunescapeSmallFont());
|
header.setFont(FontManager.getSmallFont(getFont()));
|
||||||
header.setBorder(new CompoundBorder(
|
header.setBorder(new CompoundBorder(
|
||||||
BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.LIGHT_GRAY_COLOR),
|
BorderFactory.createMatteBorder(0, 0, 1, 0, ColorScheme.LIGHT_GRAY_COLOR),
|
||||||
BorderFactory.createEmptyBorder(3, 6, 0, 0)
|
BorderFactory.createEmptyBorder(3, 6, 0, 0)
|
||||||
|
|||||||
@@ -221,14 +221,14 @@ class FeedPanel extends PluginPanel
|
|||||||
Color darkerForeground = UIManager.getColor("Label.foreground").darker();
|
Color darkerForeground = UIManager.getColor("Label.foreground").darker();
|
||||||
|
|
||||||
JLabel titleLabel = new JLabel(item.getTitle());
|
JLabel titleLabel = new JLabel(item.getTitle());
|
||||||
titleLabel.setFont(FontManager.getRunescapeSmallFont());
|
titleLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
titleLabel.setBackground(null);
|
titleLabel.setBackground(null);
|
||||||
titleLabel.setForeground(darkerForeground);
|
titleLabel.setForeground(darkerForeground);
|
||||||
titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - TIME_WIDTH, 0));
|
titleLabel.setPreferredSize(new Dimension(CONTENT_WIDTH - TIME_WIDTH, 0));
|
||||||
|
|
||||||
Duration duration = Duration.between(Instant.ofEpochMilli(item.getTimestamp()), Instant.now());
|
Duration duration = Duration.between(Instant.ofEpochMilli(item.getTimestamp()), Instant.now());
|
||||||
JLabel timeLabel = new JLabel(durationToString(duration));
|
JLabel timeLabel = new JLabel(durationToString(duration));
|
||||||
timeLabel.setFont(FontManager.getRunescapeSmallFont());
|
timeLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
timeLabel.setForeground(darkerForeground);
|
timeLabel.setForeground(darkerForeground);
|
||||||
|
|
||||||
titleAndTime.add(titleLabel, BorderLayout.WEST);
|
titleAndTime.add(titleLabel, BorderLayout.WEST);
|
||||||
@@ -237,9 +237,9 @@ class FeedPanel extends PluginPanel
|
|||||||
JPanel content = new JPanel(new BorderLayout());
|
JPanel content = new JPanel(new BorderLayout());
|
||||||
content.setBackground(null);
|
content.setBackground(null);
|
||||||
|
|
||||||
JLabel contentLabel = new JLabel(lineBreakText(item.getContent(), FontManager.getRunescapeSmallFont()));
|
JLabel contentLabel = new JLabel(lineBreakText(item.getContent(), FontManager.getSmallFont(getFont())));
|
||||||
contentLabel.setBorder(new EmptyBorder(2, 0, 0, 0));
|
contentLabel.setBorder(new EmptyBorder(2, 0, 0, 0));
|
||||||
contentLabel.setFont(FontManager.getRunescapeSmallFont());
|
contentLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
contentLabel.setForeground(darkerForeground);
|
contentLabel.setForeground(darkerForeground);
|
||||||
|
|
||||||
content.add(contentLabel, BorderLayout.CENTER);
|
content.add(contentLabel, BorderLayout.CENTER);
|
||||||
|
|||||||
@@ -74,4 +74,26 @@ public interface GrandExchangeConfig extends Config
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 5,
|
||||||
|
keyName = "showTotal",
|
||||||
|
name = "Show grand exchange total",
|
||||||
|
description = "Show grand exchange total"
|
||||||
|
)
|
||||||
|
default boolean showTotal()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 6,
|
||||||
|
keyName = "showExact",
|
||||||
|
name = "Show exact total value",
|
||||||
|
description = "Show exact total value"
|
||||||
|
)
|
||||||
|
default boolean showExact()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,11 +131,11 @@ public class GrandExchangeOfferSlot extends JPanel
|
|||||||
|
|
||||||
itemName.setForeground(Color.WHITE);
|
itemName.setForeground(Color.WHITE);
|
||||||
itemName.setVerticalAlignment(JLabel.BOTTOM);
|
itemName.setVerticalAlignment(JLabel.BOTTOM);
|
||||||
itemName.setFont(FontManager.getRunescapeSmallFont());
|
itemName.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
offerInfo.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
offerInfo.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||||
offerInfo.setVerticalAlignment(JLabel.TOP);
|
offerInfo.setVerticalAlignment(JLabel.TOP);
|
||||||
offerInfo.setFont(FontManager.getRunescapeSmallFont());
|
offerInfo.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
JLabel switchFaceViewIcon = new JLabel();
|
JLabel switchFaceViewIcon = new JLabel();
|
||||||
switchFaceViewIcon.setIcon(RIGHT_ARROW_ICON);
|
switchFaceViewIcon.setIcon(RIGHT_ARROW_ICON);
|
||||||
@@ -162,11 +162,11 @@ public class GrandExchangeOfferSlot extends JPanel
|
|||||||
|
|
||||||
itemPrice.setForeground(Color.WHITE);
|
itemPrice.setForeground(Color.WHITE);
|
||||||
itemPrice.setVerticalAlignment(JLabel.BOTTOM);
|
itemPrice.setVerticalAlignment(JLabel.BOTTOM);
|
||||||
itemPrice.setFont(FontManager.getRunescapeSmallFont());
|
itemPrice.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
offerSpent.setForeground(Color.WHITE);
|
offerSpent.setForeground(Color.WHITE);
|
||||||
offerSpent.setVerticalAlignment(JLabel.TOP);
|
offerSpent.setVerticalAlignment(JLabel.TOP);
|
||||||
offerSpent.setFont(FontManager.getRunescapeSmallFont());
|
offerSpent.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
JLabel switchDetailsViewIcon = new JLabel();
|
JLabel switchDetailsViewIcon = new JLabel();
|
||||||
switchDetailsViewIcon.setIcon(LEFT_ARROW_ICON);
|
switchDetailsViewIcon.setIcon(LEFT_ARROW_ICON);
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ import net.runelite.api.events.GameTick;
|
|||||||
import net.runelite.api.events.GrandExchangeOfferChanged;
|
import net.runelite.api.events.GrandExchangeOfferChanged;
|
||||||
import net.runelite.api.events.MenuEntryAdded;
|
import net.runelite.api.events.MenuEntryAdded;
|
||||||
import net.runelite.api.events.WidgetLoaded;
|
import net.runelite.api.events.WidgetLoaded;
|
||||||
|
import net.runelite.api.events.ScriptCallbackEvent;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetID;
|
import net.runelite.api.widgets.WidgetID;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
@@ -428,6 +429,49 @@ public class GrandExchangePlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||||
|
{
|
||||||
|
if (!event.getEventName().equals("setGETitle") || !config.showTotal())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
long total = 0;
|
||||||
|
GrandExchangeOffer[] offers = client.getGrandExchangeOffers();
|
||||||
|
for (GrandExchangeOffer offer : offers)
|
||||||
|
{
|
||||||
|
if (offer != null)
|
||||||
|
{
|
||||||
|
total += offer.getPrice() * offer.getTotalQuantity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (total == 0L)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
StringBuilder titleBuilder = new StringBuilder(" (");
|
||||||
|
|
||||||
|
if (config.showExact())
|
||||||
|
{
|
||||||
|
titleBuilder.append(StackFormatter.formatNumber(total));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
titleBuilder.append(StackFormatter.quantityToStackSize(total));
|
||||||
|
}
|
||||||
|
|
||||||
|
titleBuilder.append(')');
|
||||||
|
|
||||||
|
// Append to title
|
||||||
|
String[] stringStack = client.getStringStack();
|
||||||
|
int stringStackSize = client.getStringStackSize();
|
||||||
|
|
||||||
|
stringStack[stringStackSize - 1] += titleBuilder.toString();
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onGameTick(GameTick event)
|
public void onGameTick(GameTick event)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,6 +26,7 @@
|
|||||||
package net.runelite.client.plugins.grounditems;
|
package net.runelite.client.plugins.grounditems;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import net.runelite.client.config.Alpha;
|
||||||
import net.runelite.client.config.Config;
|
import net.runelite.client.config.Config;
|
||||||
import net.runelite.client.config.ConfigGroup;
|
import net.runelite.client.config.ConfigGroup;
|
||||||
import net.runelite.client.config.ConfigItem;
|
import net.runelite.client.config.ConfigItem;
|
||||||
@@ -57,6 +58,7 @@ public interface GroundItemsConfig extends Config
|
|||||||
position = 2,
|
position = 2,
|
||||||
parent = "colorsStub"
|
parent = "colorsStub"
|
||||||
)
|
)
|
||||||
|
@Alpha
|
||||||
default Color defaultColor()
|
default Color defaultColor()
|
||||||
{
|
{
|
||||||
return Color.WHITE;
|
return Color.WHITE;
|
||||||
@@ -69,6 +71,7 @@ public interface GroundItemsConfig extends Config
|
|||||||
position = 3,
|
position = 3,
|
||||||
parent = "colorsStub"
|
parent = "colorsStub"
|
||||||
)
|
)
|
||||||
|
@Alpha
|
||||||
default Color highlightedColor()
|
default Color highlightedColor()
|
||||||
{
|
{
|
||||||
return Color.decode("#AA00FF");
|
return Color.decode("#AA00FF");
|
||||||
@@ -81,6 +84,7 @@ public interface GroundItemsConfig extends Config
|
|||||||
position = 4,
|
position = 4,
|
||||||
parent = "colorsStub"
|
parent = "colorsStub"
|
||||||
)
|
)
|
||||||
|
@Alpha
|
||||||
default Color hiddenColor()
|
default Color hiddenColor()
|
||||||
{
|
{
|
||||||
return Color.GRAY;
|
return Color.GRAY;
|
||||||
@@ -319,6 +323,7 @@ public interface GroundItemsConfig extends Config
|
|||||||
position = 23,
|
position = 23,
|
||||||
parent = "lowValueStub"
|
parent = "lowValueStub"
|
||||||
)
|
)
|
||||||
|
@Alpha
|
||||||
default Color lowValueColor()
|
default Color lowValueColor()
|
||||||
{
|
{
|
||||||
return Color.decode("#66B2FF");
|
return Color.decode("#66B2FF");
|
||||||
@@ -366,6 +371,7 @@ public interface GroundItemsConfig extends Config
|
|||||||
position = 27,
|
position = 27,
|
||||||
parent = "mediumValueStub"
|
parent = "mediumValueStub"
|
||||||
)
|
)
|
||||||
|
@Alpha
|
||||||
default Color mediumValueColor()
|
default Color mediumValueColor()
|
||||||
{
|
{
|
||||||
return Color.decode("#99FF99");
|
return Color.decode("#99FF99");
|
||||||
@@ -413,6 +419,7 @@ public interface GroundItemsConfig extends Config
|
|||||||
position = 31,
|
position = 31,
|
||||||
parent = "highValueStub"
|
parent = "highValueStub"
|
||||||
)
|
)
|
||||||
|
@Alpha
|
||||||
default Color highValueColor()
|
default Color highValueColor()
|
||||||
{
|
{
|
||||||
return Color.decode("#FF9600");
|
return Color.decode("#FF9600");
|
||||||
@@ -460,6 +467,7 @@ public interface GroundItemsConfig extends Config
|
|||||||
position = 35,
|
position = 35,
|
||||||
parent = "insaneValueStub"
|
parent = "insaneValueStub"
|
||||||
)
|
)
|
||||||
|
@Alpha
|
||||||
default Color insaneValueColor()
|
default Color insaneValueColor()
|
||||||
{
|
{
|
||||||
return Color.decode("#FF66B2");
|
return Color.decode("#FF66B2");
|
||||||
@@ -618,4 +626,16 @@ public interface GroundItemsConfig extends Config
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Alpha
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "bordercolor",
|
||||||
|
name = "Border color",
|
||||||
|
description = "Change the border color",
|
||||||
|
position = 49
|
||||||
|
)
|
||||||
|
default Color bordercolor()
|
||||||
|
{
|
||||||
|
return new Color(0, 0, 0, 150);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -109,8 +109,6 @@ public class GroundItemsOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final FontMetrics fm = graphics.getFontMetrics();
|
|
||||||
final Player player = client.getLocalPlayer();
|
final Player player = client.getLocalPlayer();
|
||||||
|
|
||||||
if (player == null || client.getViewportWidget() == null)
|
if (player == null || client.getViewportWidget() == null)
|
||||||
@@ -118,6 +116,8 @@ public class GroundItemsOverlay extends Overlay
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final FontMetrics fm = graphics.getFontMetrics();
|
||||||
|
|
||||||
offsetMap.clear();
|
offsetMap.clear();
|
||||||
final LocalPoint localLocation = player.getLocalLocation();
|
final LocalPoint localLocation = player.getLocalLocation();
|
||||||
final Point mousePos = client.getMouseCanvasPosition();
|
final Point mousePos = client.getMouseCanvasPosition();
|
||||||
@@ -319,14 +319,14 @@ public class GroundItemsOverlay extends Overlay
|
|||||||
|
|
||||||
// Item bounds
|
// Item bounds
|
||||||
int x = textX - 2;
|
int x = textX - 2;
|
||||||
int y = textY - stringHeight - 2;
|
int y = textY - stringHeight - 2 + fm.getMaxDescent();
|
||||||
int width = stringWidth + 4;
|
int width = stringWidth + 4;
|
||||||
int height = stringHeight + 4;
|
int height = stringHeight + 4;
|
||||||
final Rectangle itemBounds = new Rectangle(x, y, width, height);
|
final Rectangle itemBounds = new Rectangle(x, y, width, height);
|
||||||
|
|
||||||
// Hidden box
|
// Hidden box
|
||||||
x += width + 2;
|
x += width + 2;
|
||||||
y = textY - (RECTANGLE_SIZE + stringHeight) / 2;
|
y = textY - (fm.getMaxAscent() + RECTANGLE_SIZE) / 2;
|
||||||
width = height = RECTANGLE_SIZE;
|
width = height = RECTANGLE_SIZE;
|
||||||
final Rectangle itemHiddenBox = new Rectangle(x, y, width, height);
|
final Rectangle itemHiddenBox = new Rectangle(x, y, width, height);
|
||||||
|
|
||||||
@@ -376,7 +376,8 @@ public class GroundItemsOverlay extends Overlay
|
|||||||
|
|
||||||
if (config.toggleOutline())
|
if (config.toggleOutline())
|
||||||
{
|
{
|
||||||
graphics.setColor(Color.BLACK);
|
final Color bordercolor = config.bordercolor();
|
||||||
|
graphics.setColor(bordercolor);
|
||||||
graphics.drawString(itemString, textX + 1, textY + 1);
|
graphics.drawString(itemString, textX + 1, textY + 1);
|
||||||
graphics.drawString(itemString, textX - 1, textY - 1);
|
graphics.drawString(itemString, textX - 1, textY - 1);
|
||||||
graphics.drawString(itemString, textX - 1, textY + 1);
|
graphics.drawString(itemString, textX - 1, textY + 1);
|
||||||
@@ -388,7 +389,6 @@ public class GroundItemsOverlay extends Overlay
|
|||||||
textComponent.setPosition(new java.awt.Point(textX, textY));
|
textComponent.setPosition(new java.awt.Point(textX, textY));
|
||||||
textComponent.render(graphics);
|
textComponent.render(graphics);
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -124,6 +124,7 @@ public class GroundItemsPlugin extends Plugin
|
|||||||
private static final int EXAMINE_ITEM = MenuAction.EXAMINE_ITEM_GROUND.getId();
|
private static final int EXAMINE_ITEM = MenuAction.EXAMINE_ITEM_GROUND.getId();
|
||||||
private static final int WALK = MenuAction.WALK.getId();
|
private static final int WALK = MenuAction.WALK.getId();
|
||||||
|
|
||||||
|
|
||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
@Setter(AccessLevel.PACKAGE)
|
@Setter(AccessLevel.PACKAGE)
|
||||||
private Map.Entry<Rectangle, GroundItem> textBoxBounds;
|
private Map.Entry<Rectangle, GroundItem> textBoxBounds;
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ public class HiscorePanel extends PluginPanel
|
|||||||
private JPanel makeSkillPanel(HiscoreSkill skill)
|
private JPanel makeSkillPanel(HiscoreSkill skill)
|
||||||
{
|
{
|
||||||
JLabel label = new JLabel();
|
JLabel label = new JLabel();
|
||||||
label.setFont(FontManager.getRunescapeSmallFont());
|
label.setFont(FontManager.getSmallFont(getFont()));
|
||||||
label.setText("--");
|
label.setText("--");
|
||||||
|
|
||||||
String skillName = (skill == null ? "combat" : skill.getName().toLowerCase());
|
String skillName = (skill == null ? "combat" : skill.getName().toLowerCase());
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ public class InfoPanel extends PluginPanel
|
|||||||
versionPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
versionPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||||
versionPanel.setLayout(new GridLayout(0, 1));
|
versionPanel.setLayout(new GridLayout(0, 1));
|
||||||
|
|
||||||
final Font smallFont = FontManager.getRunescapeSmallFont();
|
final Font smallFont = FontManager.getSmallFont(getFont());
|
||||||
|
|
||||||
JLabel version = new JLabel(htmlLabel("RuneLite version: ", runeLiteProperties.getVersion()));
|
JLabel version = new JLabel(htmlLabel("RuneLite version: ", runeLiteProperties.getVersion()));
|
||||||
version.setFont(smallFont);
|
version.setFont(smallFont);
|
||||||
@@ -191,7 +191,7 @@ public class InfoPanel extends PluginPanel
|
|||||||
/**
|
/**
|
||||||
* Builds a link panel with a given icon, text and url to redirect to.
|
* Builds a link panel with a given icon, text and url to redirect to.
|
||||||
*/
|
*/
|
||||||
private static JPanel buildLinkPanel(ImageIcon icon, String topText, String bottomText, String url)
|
private JPanel buildLinkPanel(ImageIcon icon, String topText, String bottomText, String url)
|
||||||
{
|
{
|
||||||
return buildLinkPanel(icon, topText, bottomText, () -> LinkBrowser.browse(url));
|
return buildLinkPanel(icon, topText, bottomText, () -> LinkBrowser.browse(url));
|
||||||
}
|
}
|
||||||
@@ -199,7 +199,7 @@ public class InfoPanel extends PluginPanel
|
|||||||
/**
|
/**
|
||||||
* Builds a link panel with a given icon, text and callable to call.
|
* Builds a link panel with a given icon, text and callable to call.
|
||||||
*/
|
*/
|
||||||
private static JPanel buildLinkPanel(ImageIcon icon, String topText, String bottomText, Runnable callback)
|
private JPanel buildLinkPanel(ImageIcon icon, String topText, String bottomText, Runnable callback)
|
||||||
{
|
{
|
||||||
JPanel container = new JPanel();
|
JPanel container = new JPanel();
|
||||||
container.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
container.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
@@ -253,11 +253,11 @@ public class InfoPanel extends PluginPanel
|
|||||||
|
|
||||||
JLabel topLine = new JLabel(topText);
|
JLabel topLine = new JLabel(topText);
|
||||||
topLine.setForeground(Color.WHITE);
|
topLine.setForeground(Color.WHITE);
|
||||||
topLine.setFont(FontManager.getRunescapeSmallFont());
|
topLine.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
JLabel bottomLine = new JLabel(bottomText);
|
JLabel bottomLine = new JLabel(bottomText);
|
||||||
bottomLine.setForeground(Color.WHITE);
|
bottomLine.setForeground(Color.WHITE);
|
||||||
bottomLine.setFont(FontManager.getRunescapeSmallFont());
|
bottomLine.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
textContainer.add(topLine);
|
textContainer.add(topLine);
|
||||||
textContainer.add(bottomLine);
|
textContainer.add(bottomLine);
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.inventorygrid;
|
package net.runelite.client.plugins.inventorygrid;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import net.runelite.client.config.Alpha;
|
||||||
import net.runelite.client.config.Config;
|
import net.runelite.client.config.Config;
|
||||||
import net.runelite.client.config.ConfigGroup;
|
import net.runelite.client.config.ConfigGroup;
|
||||||
import net.runelite.client.config.ConfigItem;
|
import net.runelite.client.config.ConfigItem;
|
||||||
@@ -35,7 +37,8 @@ public interface InventoryGridConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showItem",
|
keyName = "showItem",
|
||||||
name = "Show item",
|
name = "Show item",
|
||||||
description = "Show a preview of the item in the new slot"
|
description = "Show a preview of the item in the new slot",
|
||||||
|
position = 1
|
||||||
)
|
)
|
||||||
default boolean showItem()
|
default boolean showItem()
|
||||||
{
|
{
|
||||||
@@ -45,7 +48,8 @@ public interface InventoryGridConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showGrid",
|
keyName = "showGrid",
|
||||||
name = "Show grid",
|
name = "Show grid",
|
||||||
description = "Show a grid on the inventory while dragging"
|
description = "Show a grid on the inventory while dragging",
|
||||||
|
position = 2
|
||||||
)
|
)
|
||||||
default boolean showGrid()
|
default boolean showGrid()
|
||||||
{
|
{
|
||||||
@@ -55,7 +59,8 @@ public interface InventoryGridConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showHighlight",
|
keyName = "showHighlight",
|
||||||
name = "Highlight background",
|
name = "Highlight background",
|
||||||
description = "Show a green background highlight on the new slot"
|
description = "Show a background highlight on the new slot",
|
||||||
|
position = 3
|
||||||
)
|
)
|
||||||
default boolean showHighlight()
|
default boolean showHighlight()
|
||||||
{
|
{
|
||||||
@@ -65,11 +70,36 @@ public interface InventoryGridConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "dragDelay",
|
keyName = "dragDelay",
|
||||||
name = "Drag Delay",
|
name = "Drag Delay",
|
||||||
description = "Time in ms to wait after item press before showing grid"
|
description = "Time in ms to wait after item press before showing grid",
|
||||||
|
position = 4
|
||||||
)
|
)
|
||||||
@Range(min = 100)
|
@Range(min = 100)
|
||||||
default int dragDelay()
|
default int dragDelay()
|
||||||
{
|
{
|
||||||
return 100;
|
return 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Alpha
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "gridColor",
|
||||||
|
name = "Grid color",
|
||||||
|
description = "The color of the grid",
|
||||||
|
position = 5
|
||||||
|
)
|
||||||
|
default Color gridColor()
|
||||||
|
{
|
||||||
|
return new Color(255, 255, 255, 45);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Alpha
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "highlightColor",
|
||||||
|
name = "Highlight color",
|
||||||
|
description = "The color of the new inventory slot highlight",
|
||||||
|
position = 6
|
||||||
|
)
|
||||||
|
default Color highlightColor()
|
||||||
|
{
|
||||||
|
return new Color(0, 255, 0, 45);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,6 @@ package net.runelite.client.plugins.inventorygrid;
|
|||||||
|
|
||||||
import com.google.inject.Inject;
|
import com.google.inject.Inject;
|
||||||
import java.awt.AlphaComposite;
|
import java.awt.AlphaComposite;
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
@@ -47,9 +46,6 @@ class InventoryGridOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
private static final int INVENTORY_SIZE = 28;
|
private static final int INVENTORY_SIZE = 28;
|
||||||
|
|
||||||
private static final Color HIGHLIGHT = new Color(0, 255, 0, 45);
|
|
||||||
private static final Color GRID = new Color(255, 255, 255, 45);
|
|
||||||
|
|
||||||
private final InventoryGridConfig config;
|
private final InventoryGridConfig config;
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final ItemManager itemManager;
|
private final ItemManager itemManager;
|
||||||
@@ -101,12 +97,12 @@ class InventoryGridOverlay extends Overlay
|
|||||||
|
|
||||||
if (config.showHighlight() && inBounds)
|
if (config.showHighlight() && inBounds)
|
||||||
{
|
{
|
||||||
graphics.setColor(HIGHLIGHT);
|
graphics.setColor(config.highlightColor());
|
||||||
graphics.fill(bounds);
|
graphics.fill(bounds);
|
||||||
}
|
}
|
||||||
else if (config.showGrid())
|
else if (config.showGrid())
|
||||||
{
|
{
|
||||||
graphics.setColor(GRID);
|
graphics.setColor(config.gridColor());
|
||||||
graphics.fill(bounds);
|
graphics.fill(bounds);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,33 +183,11 @@ public interface ItemChargeConfig extends Config
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
keyName = "showBasketCharges",
|
|
||||||
name = "Show Basket Charges",
|
|
||||||
description = "Configures if fruit basket item charge is shown",
|
|
||||||
position = 13
|
|
||||||
)
|
|
||||||
default boolean showBasketCharges()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
keyName = "showSackCharges",
|
|
||||||
name = "Show Sack Charges",
|
|
||||||
description = "Configures if sack item charge is shown",
|
|
||||||
position = 14
|
|
||||||
)
|
|
||||||
default boolean showSackCharges()
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showAbyssalBraceletCharges",
|
keyName = "showAbyssalBraceletCharges",
|
||||||
name = "Show Abyssal Bracelet Charges",
|
name = "Show Abyssal Bracelet Charges",
|
||||||
description = "Configures if abyssal bracelet item charge is shown",
|
description = "Configures if abyssal bracelet item charge is shown",
|
||||||
position = 15
|
position = 13
|
||||||
)
|
)
|
||||||
default boolean showAbyssalBraceletCharges()
|
default boolean showAbyssalBraceletCharges()
|
||||||
{
|
{
|
||||||
@@ -220,7 +198,7 @@ public interface ItemChargeConfig extends Config
|
|||||||
keyName = "recoilNotification",
|
keyName = "recoilNotification",
|
||||||
name = "Ring of Recoil Notification",
|
name = "Ring of Recoil Notification",
|
||||||
description = "Configures if the ring of recoil breaking notification is shown",
|
description = "Configures if the ring of recoil breaking notification is shown",
|
||||||
position = 16
|
position = 14
|
||||||
)
|
)
|
||||||
default boolean recoilNotification()
|
default boolean recoilNotification()
|
||||||
{
|
{
|
||||||
@@ -231,7 +209,7 @@ public interface ItemChargeConfig extends Config
|
|||||||
keyName = "showBindingNecklaceCharges",
|
keyName = "showBindingNecklaceCharges",
|
||||||
name = "Show Binding Necklace Charges",
|
name = "Show Binding Necklace Charges",
|
||||||
description = "Configures if binding necklace item charge is shown",
|
description = "Configures if binding necklace item charge is shown",
|
||||||
position = 17
|
position = 15
|
||||||
)
|
)
|
||||||
default boolean showBindingNecklaceCharges()
|
default boolean showBindingNecklaceCharges()
|
||||||
{
|
{
|
||||||
@@ -260,7 +238,7 @@ public interface ItemChargeConfig extends Config
|
|||||||
keyName = "bindingNotification",
|
keyName = "bindingNotification",
|
||||||
name = "Binding Necklace Notification",
|
name = "Binding Necklace Notification",
|
||||||
description = "Configures if the binding necklace breaking notification is shown",
|
description = "Configures if the binding necklace breaking notification is shown",
|
||||||
position = 18
|
position = 16
|
||||||
)
|
)
|
||||||
default boolean bindingNotification()
|
default boolean bindingNotification()
|
||||||
{
|
{
|
||||||
@@ -271,7 +249,7 @@ public interface ItemChargeConfig extends Config
|
|||||||
keyName = "showExplorerRingCharges",
|
keyName = "showExplorerRingCharges",
|
||||||
name = "Show Explorer's Ring Alch Charges",
|
name = "Show Explorer's Ring Alch Charges",
|
||||||
description = "Configures if explorer's ring alchemy charges are shown",
|
description = "Configures if explorer's ring alchemy charges are shown",
|
||||||
position = 19
|
position = 17
|
||||||
)
|
)
|
||||||
default boolean showExplorerRingCharges()
|
default boolean showExplorerRingCharges()
|
||||||
{
|
{
|
||||||
@@ -300,7 +278,7 @@ public interface ItemChargeConfig extends Config
|
|||||||
keyName = "showInfoboxes",
|
keyName = "showInfoboxes",
|
||||||
name = "Show Infoboxes",
|
name = "Show Infoboxes",
|
||||||
description = "Configures whether to show an infobox equipped charge items",
|
description = "Configures whether to show an infobox equipped charge items",
|
||||||
position = 20
|
position = 18
|
||||||
)
|
)
|
||||||
default boolean showInfoboxes()
|
default boolean showInfoboxes()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,8 +38,6 @@ import static net.runelite.client.plugins.itemcharges.ItemChargeType.IMPBOX;
|
|||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.TELEPORT;
|
import static net.runelite.client.plugins.itemcharges.ItemChargeType.TELEPORT;
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERCAN;
|
import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERCAN;
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERSKIN;
|
import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERSKIN;
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.FRUIT_BASKET;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.SACK;
|
|
||||||
import net.runelite.client.ui.FontManager;
|
import net.runelite.client.ui.FontManager;
|
||||||
import net.runelite.client.ui.overlay.WidgetItemOverlay;
|
import net.runelite.client.ui.overlay.WidgetItemOverlay;
|
||||||
import net.runelite.client.ui.overlay.components.TextComponent;
|
import net.runelite.client.ui.overlay.components.TextComponent;
|
||||||
@@ -154,8 +152,6 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
|||||||
|| (type == WATERCAN && !config.showWateringCanCharges())
|
|| (type == WATERCAN && !config.showWateringCanCharges())
|
||||||
|| (type == WATERSKIN && !config.showWaterskinCharges())
|
|| (type == WATERSKIN && !config.showWaterskinCharges())
|
||||||
|| (type == BELLOWS && !config.showBellowCharges())
|
|| (type == BELLOWS && !config.showBellowCharges())
|
||||||
|| (type == FRUIT_BASKET && !config.showBasketCharges())
|
|
||||||
|| (type == SACK && !config.showSackCharges())
|
|
||||||
|| (type == ABYSSAL_BRACELET && !config.showAbyssalBraceletCharges()))
|
|| (type == ABYSSAL_BRACELET && !config.showAbyssalBraceletCharges()))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@@ -166,7 +162,7 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
|||||||
|
|
||||||
final Rectangle bounds = itemWidget.getCanvasBounds();
|
final Rectangle bounds = itemWidget.getCanvasBounds();
|
||||||
final TextComponent textComponent = new TextComponent();
|
final TextComponent textComponent = new TextComponent();
|
||||||
textComponent.setPosition(new Point(bounds.x - 1, bounds.y + 15));
|
textComponent.setPosition(new Point(bounds.x, bounds.y + 1 + graphics.getFontMetrics().getMaxAscent() - graphics.getFontMetrics().getMaxDescent()));
|
||||||
textComponent.setText(charges < 0 ? "?" : String.valueOf(charges));
|
textComponent.setText(charges < 0 ? "?" : String.valueOf(charges));
|
||||||
textComponent.setColor(itemChargePlugin.getColor(charges));
|
textComponent.setColor(itemChargePlugin.getColor(charges));
|
||||||
textComponent.render(graphics);
|
textComponent.render(graphics);
|
||||||
@@ -176,7 +172,6 @@ class ItemChargeOverlay extends WidgetItemOverlay
|
|||||||
{
|
{
|
||||||
return config.showTeleportCharges() || config.showDodgyCount() || config.showFungicideCharges()
|
return config.showTeleportCharges() || config.showDodgyCount() || config.showFungicideCharges()
|
||||||
|| config.showImpCharges() || config.showWateringCanCharges() || config.showWaterskinCharges()
|
|| config.showImpCharges() || config.showWateringCanCharges() || config.showWaterskinCharges()
|
||||||
|| config.showBellowCharges() || config.showBasketCharges() || config.showSackCharges()
|
|| config.showBellowCharges() || config.showAbyssalBraceletCharges() || config.showExplorerRingCharges();
|
||||||
|| config.showAbyssalBraceletCharges() || config.showExplorerRingCharges();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -37,7 +37,5 @@ enum ItemChargeType
|
|||||||
BRACELET_OF_SLAUGHTER,
|
BRACELET_OF_SLAUGHTER,
|
||||||
EXPEDITIOUS_BRACELET,
|
EXPEDITIOUS_BRACELET,
|
||||||
BINDING_NECKLACE,
|
BINDING_NECKLACE,
|
||||||
EXPLORER_RING,
|
EXPLORER_RING
|
||||||
FRUIT_BASKET,
|
|
||||||
SACK
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,8 +29,133 @@ import java.util.Map;
|
|||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import static net.runelite.api.ItemID.ABYSSAL_BRACELET1;
|
||||||
import static net.runelite.api.ItemID.*;
|
import static net.runelite.api.ItemID.ABYSSAL_BRACELET2;
|
||||||
|
import static net.runelite.api.ItemID.ABYSSAL_BRACELET3;
|
||||||
|
import static net.runelite.api.ItemID.ABYSSAL_BRACELET4;
|
||||||
|
import static net.runelite.api.ItemID.ABYSSAL_BRACELET5;
|
||||||
|
import static net.runelite.api.ItemID.AMULET_OF_GLORY1;
|
||||||
|
import static net.runelite.api.ItemID.AMULET_OF_GLORY2;
|
||||||
|
import static net.runelite.api.ItemID.AMULET_OF_GLORY3;
|
||||||
|
import static net.runelite.api.ItemID.AMULET_OF_GLORY4;
|
||||||
|
import static net.runelite.api.ItemID.AMULET_OF_GLORY5;
|
||||||
|
import static net.runelite.api.ItemID.AMULET_OF_GLORY6;
|
||||||
|
import static net.runelite.api.ItemID.AMULET_OF_GLORY_T1;
|
||||||
|
import static net.runelite.api.ItemID.AMULET_OF_GLORY_T2;
|
||||||
|
import static net.runelite.api.ItemID.AMULET_OF_GLORY_T3;
|
||||||
|
import static net.runelite.api.ItemID.AMULET_OF_GLORY_T4;
|
||||||
|
import static net.runelite.api.ItemID.AMULET_OF_GLORY_T5;
|
||||||
|
import static net.runelite.api.ItemID.AMULET_OF_GLORY_T6;
|
||||||
|
import static net.runelite.api.ItemID.BURNING_AMULET1;
|
||||||
|
import static net.runelite.api.ItemID.BURNING_AMULET2;
|
||||||
|
import static net.runelite.api.ItemID.BURNING_AMULET3;
|
||||||
|
import static net.runelite.api.ItemID.BURNING_AMULET4;
|
||||||
|
import static net.runelite.api.ItemID.BURNING_AMULET5;
|
||||||
|
import static net.runelite.api.ItemID.COMBAT_BRACELET1;
|
||||||
|
import static net.runelite.api.ItemID.COMBAT_BRACELET2;
|
||||||
|
import static net.runelite.api.ItemID.COMBAT_BRACELET3;
|
||||||
|
import static net.runelite.api.ItemID.COMBAT_BRACELET4;
|
||||||
|
import static net.runelite.api.ItemID.COMBAT_BRACELET5;
|
||||||
|
import static net.runelite.api.ItemID.COMBAT_BRACELET6;
|
||||||
|
import static net.runelite.api.ItemID.DIGSITE_PENDANT_1;
|
||||||
|
import static net.runelite.api.ItemID.DIGSITE_PENDANT_2;
|
||||||
|
import static net.runelite.api.ItemID.DIGSITE_PENDANT_3;
|
||||||
|
import static net.runelite.api.ItemID.DIGSITE_PENDANT_4;
|
||||||
|
import static net.runelite.api.ItemID.DIGSITE_PENDANT_5;
|
||||||
|
import static net.runelite.api.ItemID.ENCHANTED_LYRE1;
|
||||||
|
import static net.runelite.api.ItemID.ENCHANTED_LYRE2;
|
||||||
|
import static net.runelite.api.ItemID.ENCHANTED_LYRE3;
|
||||||
|
import static net.runelite.api.ItemID.ENCHANTED_LYRE4;
|
||||||
|
import static net.runelite.api.ItemID.ENCHANTED_LYRE5;
|
||||||
|
import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_0;
|
||||||
|
import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_1;
|
||||||
|
import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_10;
|
||||||
|
import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_2;
|
||||||
|
import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_3;
|
||||||
|
import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_4;
|
||||||
|
import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_5;
|
||||||
|
import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_6;
|
||||||
|
import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_7;
|
||||||
|
import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_8;
|
||||||
|
import static net.runelite.api.ItemID.FUNGICIDE_SPRAY_9;
|
||||||
|
import static net.runelite.api.ItemID.GAMES_NECKLACE1;
|
||||||
|
import static net.runelite.api.ItemID.GAMES_NECKLACE2;
|
||||||
|
import static net.runelite.api.ItemID.GAMES_NECKLACE3;
|
||||||
|
import static net.runelite.api.ItemID.GAMES_NECKLACE4;
|
||||||
|
import static net.runelite.api.ItemID.GAMES_NECKLACE5;
|
||||||
|
import static net.runelite.api.ItemID.GAMES_NECKLACE6;
|
||||||
|
import static net.runelite.api.ItemID.GAMES_NECKLACE7;
|
||||||
|
import static net.runelite.api.ItemID.GAMES_NECKLACE8;
|
||||||
|
import static net.runelite.api.ItemID.IMPINABOX1;
|
||||||
|
import static net.runelite.api.ItemID.IMPINABOX2;
|
||||||
|
import static net.runelite.api.ItemID.NECKLACE_OF_PASSAGE1;
|
||||||
|
import static net.runelite.api.ItemID.NECKLACE_OF_PASSAGE2;
|
||||||
|
import static net.runelite.api.ItemID.NECKLACE_OF_PASSAGE3;
|
||||||
|
import static net.runelite.api.ItemID.NECKLACE_OF_PASSAGE4;
|
||||||
|
import static net.runelite.api.ItemID.NECKLACE_OF_PASSAGE5;
|
||||||
|
import static net.runelite.api.ItemID.OGRE_BELLOWS;
|
||||||
|
import static net.runelite.api.ItemID.OGRE_BELLOWS_1;
|
||||||
|
import static net.runelite.api.ItemID.OGRE_BELLOWS_2;
|
||||||
|
import static net.runelite.api.ItemID.OGRE_BELLOWS_3;
|
||||||
|
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_1;
|
||||||
|
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_2;
|
||||||
|
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_3;
|
||||||
|
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_4;
|
||||||
|
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_5;
|
||||||
|
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_6;
|
||||||
|
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_7;
|
||||||
|
import static net.runelite.api.ItemID.PHARAOHS_SCEPTRE_8;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_DUELING1;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_DUELING2;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_DUELING3;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_DUELING4;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_DUELING5;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_DUELING6;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_DUELING7;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_DUELING8;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_RETURNING1;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_RETURNING2;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_RETURNING3;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_RETURNING4;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_RETURNING5;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_WEALTH_1;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_WEALTH_2;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_WEALTH_3;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_WEALTH_4;
|
||||||
|
import static net.runelite.api.ItemID.RING_OF_WEALTH_5;
|
||||||
|
import static net.runelite.api.ItemID.SKILLS_NECKLACE1;
|
||||||
|
import static net.runelite.api.ItemID.SKILLS_NECKLACE2;
|
||||||
|
import static net.runelite.api.ItemID.SKILLS_NECKLACE3;
|
||||||
|
import static net.runelite.api.ItemID.SKILLS_NECKLACE4;
|
||||||
|
import static net.runelite.api.ItemID.SKILLS_NECKLACE5;
|
||||||
|
import static net.runelite.api.ItemID.SKILLS_NECKLACE6;
|
||||||
|
import static net.runelite.api.ItemID.SLAYER_RING_1;
|
||||||
|
import static net.runelite.api.ItemID.SLAYER_RING_2;
|
||||||
|
import static net.runelite.api.ItemID.SLAYER_RING_3;
|
||||||
|
import static net.runelite.api.ItemID.SLAYER_RING_4;
|
||||||
|
import static net.runelite.api.ItemID.SLAYER_RING_5;
|
||||||
|
import static net.runelite.api.ItemID.SLAYER_RING_6;
|
||||||
|
import static net.runelite.api.ItemID.SLAYER_RING_7;
|
||||||
|
import static net.runelite.api.ItemID.SLAYER_RING_8;
|
||||||
|
import static net.runelite.api.ItemID.TELEPORT_CRYSTAL_1;
|
||||||
|
import static net.runelite.api.ItemID.TELEPORT_CRYSTAL_2;
|
||||||
|
import static net.runelite.api.ItemID.TELEPORT_CRYSTAL_3;
|
||||||
|
import static net.runelite.api.ItemID.TELEPORT_CRYSTAL_4;
|
||||||
|
import static net.runelite.api.ItemID.TELEPORT_CRYSTAL_5;
|
||||||
|
import static net.runelite.api.ItemID.WATERING_CAN;
|
||||||
|
import static net.runelite.api.ItemID.WATERING_CAN1;
|
||||||
|
import static net.runelite.api.ItemID.WATERING_CAN2;
|
||||||
|
import static net.runelite.api.ItemID.WATERING_CAN3;
|
||||||
|
import static net.runelite.api.ItemID.WATERING_CAN4;
|
||||||
|
import static net.runelite.api.ItemID.WATERING_CAN5;
|
||||||
|
import static net.runelite.api.ItemID.WATERING_CAN6;
|
||||||
|
import static net.runelite.api.ItemID.WATERING_CAN7;
|
||||||
|
import static net.runelite.api.ItemID.WATERING_CAN8;
|
||||||
|
import static net.runelite.api.ItemID.WATERSKIN0;
|
||||||
|
import static net.runelite.api.ItemID.WATERSKIN1;
|
||||||
|
import static net.runelite.api.ItemID.WATERSKIN2;
|
||||||
|
import static net.runelite.api.ItemID.WATERSKIN3;
|
||||||
|
import static net.runelite.api.ItemID.WATERSKIN4;
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.ABYSSAL_BRACELET;
|
import static net.runelite.client.plugins.itemcharges.ItemChargeType.ABYSSAL_BRACELET;
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.BELLOWS;
|
import static net.runelite.client.plugins.itemcharges.ItemChargeType.BELLOWS;
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.FUNGICIDE_SPRAY;
|
import static net.runelite.client.plugins.itemcharges.ItemChargeType.FUNGICIDE_SPRAY;
|
||||||
@@ -38,8 +163,6 @@ import static net.runelite.client.plugins.itemcharges.ItemChargeType.IMPBOX;
|
|||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.TELEPORT;
|
import static net.runelite.client.plugins.itemcharges.ItemChargeType.TELEPORT;
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERCAN;
|
import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERCAN;
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERSKIN;
|
import static net.runelite.client.plugins.itemcharges.ItemChargeType.WATERSKIN;
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.FRUIT_BASKET;
|
|
||||||
import static net.runelite.client.plugins.itemcharges.ItemChargeType.SACK;
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Getter
|
@Getter
|
||||||
@@ -50,31 +173,6 @@ enum ItemWithCharge
|
|||||||
ABRACE3(ABYSSAL_BRACELET, ABYSSAL_BRACELET3, 3),
|
ABRACE3(ABYSSAL_BRACELET, ABYSSAL_BRACELET3, 3),
|
||||||
ABRACE4(ABYSSAL_BRACELET, ABYSSAL_BRACELET4, 4),
|
ABRACE4(ABYSSAL_BRACELET, ABYSSAL_BRACELET4, 4),
|
||||||
ABRACE5(ABYSSAL_BRACELET, ABYSSAL_BRACELET5, 5),
|
ABRACE5(ABYSSAL_BRACELET, ABYSSAL_BRACELET5, 5),
|
||||||
BASKET_APPLES1(FRUIT_BASKET, APPLES1, 1),
|
|
||||||
BASKET_APPLES2(FRUIT_BASKET, APPLES2, 2),
|
|
||||||
BASKET_APPLES3(FRUIT_BASKET, APPLES3, 3),
|
|
||||||
BASKET_APPLES4(FRUIT_BASKET, APPLES4, 4),
|
|
||||||
BASKET_APPLES5(FRUIT_BASKET, APPLES5, 5),
|
|
||||||
BASKET_BANANAS1(FRUIT_BASKET, BANANAS1, 1),
|
|
||||||
BASKET_BANANAS2(FRUIT_BASKET, BANANAS2, 2),
|
|
||||||
BASKET_BANANAS3(FRUIT_BASKET, BANANAS3, 3),
|
|
||||||
BASKET_BANANAS4(FRUIT_BASKET, BANANAS4, 4),
|
|
||||||
BASKET_BANANAS5(FRUIT_BASKET, BANANAS5, 5),
|
|
||||||
BASKET_ORANGES1(FRUIT_BASKET, ORANGES1, 1),
|
|
||||||
BASKET_ORANGES2(FRUIT_BASKET, ORANGES2, 2),
|
|
||||||
BASKET_ORANGES3(FRUIT_BASKET, ORANGES3, 3),
|
|
||||||
BASKET_ORANGES4(FRUIT_BASKET, ORANGES4, 4),
|
|
||||||
BASKET_ORANGES5(FRUIT_BASKET, ORANGES5, 5),
|
|
||||||
BASKET_STRAWBERRIES1(FRUIT_BASKET, STRAWBERRIES1, 1),
|
|
||||||
BASKET_STRAWBERRIES2(FRUIT_BASKET, STRAWBERRIES2, 2),
|
|
||||||
BASKET_STRAWBERRIES3(FRUIT_BASKET, STRAWBERRIES3, 3),
|
|
||||||
BASKET_STRAWBERRIES4(FRUIT_BASKET, STRAWBERRIES4, 4),
|
|
||||||
BASKET_STRAWBERRIES5(FRUIT_BASKET, STRAWBERRIES5, 5),
|
|
||||||
BASKET_TOMATOES1(FRUIT_BASKET, TOMATOES1, 1),
|
|
||||||
BASKET_TOMATOES2(FRUIT_BASKET, TOMATOES2, 2),
|
|
||||||
BASKET_TOMATOES3(FRUIT_BASKET, TOMATOES3, 3),
|
|
||||||
BASKET_TOMATOES4(FRUIT_BASKET, TOMATOES4, 4),
|
|
||||||
BASKET_TOMATOES5(FRUIT_BASKET, TOMATOES5, 5),
|
|
||||||
BELLOWS0(BELLOWS, OGRE_BELLOWS, 0),
|
BELLOWS0(BELLOWS, OGRE_BELLOWS, 0),
|
||||||
BELLOWS1(BELLOWS, OGRE_BELLOWS_1, 1),
|
BELLOWS1(BELLOWS, OGRE_BELLOWS_1, 1),
|
||||||
BELLOWS2(BELLOWS, OGRE_BELLOWS_2, 2),
|
BELLOWS2(BELLOWS, OGRE_BELLOWS_2, 2),
|
||||||
@@ -172,36 +270,6 @@ enum ItemWithCharge
|
|||||||
ROW3(TELEPORT, RING_OF_WEALTH_3, 3),
|
ROW3(TELEPORT, RING_OF_WEALTH_3, 3),
|
||||||
ROW4(TELEPORT, RING_OF_WEALTH_4, 4),
|
ROW4(TELEPORT, RING_OF_WEALTH_4, 4),
|
||||||
ROW5(TELEPORT, RING_OF_WEALTH_5, 5),
|
ROW5(TELEPORT, RING_OF_WEALTH_5, 5),
|
||||||
SACK_CABBAGES1(SACK, CABBAGES1, 1),
|
|
||||||
SACK_CABBAGES2(SACK, CABBAGES2, 2),
|
|
||||||
SACK_CABBAGES3(SACK, CABBAGES3, 3),
|
|
||||||
SACK_CABBAGES4(SACK, CABBAGES4, 4),
|
|
||||||
SACK_CABBAGES5(SACK, CABBAGES5, 5),
|
|
||||||
SACK_CABBAGES6(SACK, CABBAGES6, 6),
|
|
||||||
SACK_CABBAGES7(SACK, CABBAGES7, 7),
|
|
||||||
SACK_CABBAGES8(SACK, CABBAGES8, 8),
|
|
||||||
SACK_CABBAGES9(SACK, CABBAGES9, 9),
|
|
||||||
SACK_CABBAGES10(SACK, CABBAGES10, 10),
|
|
||||||
SACK_ONIONS1(SACK, ONIONS1, 1),
|
|
||||||
SACK_ONIONS2(SACK, ONIONS2, 2),
|
|
||||||
SACK_ONIONS3(SACK, ONIONS3, 3),
|
|
||||||
SACK_ONIONS4(SACK, ONIONS4, 4),
|
|
||||||
SACK_ONIONS5(SACK, ONIONS5, 5),
|
|
||||||
SACK_ONIONS6(SACK, ONIONS6, 6),
|
|
||||||
SACK_ONIONS7(SACK, ONIONS7, 7),
|
|
||||||
SACK_ONIONS8(SACK, ONIONS8, 8),
|
|
||||||
SACK_ONIONS9(SACK, ONIONS9, 9),
|
|
||||||
SACK_ONIONS10(SACK, ONIONS10, 10),
|
|
||||||
SACK_POTATOES1(SACK, POTATOES1, 1),
|
|
||||||
SACK_POTATOES2(SACK, POTATOES2, 2),
|
|
||||||
SACK_POTATOES3(SACK, POTATOES3, 3),
|
|
||||||
SACK_POTATOES4(SACK, POTATOES4, 4),
|
|
||||||
SACK_POTATOES5(SACK, POTATOES5, 5),
|
|
||||||
SACK_POTATOES6(SACK, POTATOES6, 6),
|
|
||||||
SACK_POTATOES7(SACK, POTATOES7, 7),
|
|
||||||
SACK_POTATOES8(SACK, POTATOES8, 8),
|
|
||||||
SACK_POTATOES9(SACK, POTATOES9, 9),
|
|
||||||
SACK_POTATOES10(SACK, POTATOES10, 10),
|
|
||||||
SKILLS1(TELEPORT, SKILLS_NECKLACE1, 1),
|
SKILLS1(TELEPORT, SKILLS_NECKLACE1, 1),
|
||||||
SKILLS2(TELEPORT, SKILLS_NECKLACE2, 2),
|
SKILLS2(TELEPORT, SKILLS_NECKLACE2, 2),
|
||||||
SKILLS3(TELEPORT, SKILLS_NECKLACE3, 3),
|
SKILLS3(TELEPORT, SKILLS_NECKLACE3, 3),
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ class BookPanel extends JPanel
|
|||||||
JLabel image = new JLabel();
|
JLabel image = new JLabel();
|
||||||
b.getIcon().addTo(image);
|
b.getIcon().addTo(image);
|
||||||
JLabel name = new JLabel(b.getShortName());
|
JLabel name = new JLabel(b.getShortName());
|
||||||
location.setFont(FontManager.getRunescapeSmallFont());
|
location.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
layout.setVerticalGroup(layout.createParallelGroup()
|
layout.setVerticalGroup(layout.createParallelGroup()
|
||||||
.addComponent(image)
|
.addComponent(image)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Jordan Atwood <nightfirecat@protonmail.com>
|
* Copyright (c) 2019, gazivodag <https://github.com/gazivodag>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -10,7 +10,6 @@
|
|||||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
* this list of conditions and the following disclaimer in the documentation
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
* and/or other materials provided with the distribution.
|
* and/or other materials provided with the distribution.
|
||||||
*
|
|
||||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
* 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
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
@@ -22,29 +21,49 @@
|
|||||||
* (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.cluescrolls.clues.hotcold;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
package net.runelite.client.plugins.lootingbagviewer;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class BeginnerHotColdLocationTest
|
import net.runelite.client.config.Config;
|
||||||
|
import net.runelite.client.config.ConfigGroup;
|
||||||
|
import net.runelite.client.config.ConfigItem;
|
||||||
|
import net.runelite.client.config.Stub;
|
||||||
|
|
||||||
|
@ConfigGroup("lootingbagviewer")
|
||||||
|
public interface LootingBagViewerConfig extends Config
|
||||||
{
|
{
|
||||||
private static final Set<HotColdLocation> BEGINNER_HOT_COLD_LOCATIONS = Arrays.stream(HotColdLocation.values())
|
@ConfigItem(
|
||||||
.filter(HotColdLocation::isBeginnerClue)
|
keyName = "overlayStub",
|
||||||
.collect(Collectors.toSet());
|
name = "Overlays",
|
||||||
private static final int EXPECTED_DIMENSION_SIZE = 7;
|
description = "",
|
||||||
|
position = 0
|
||||||
@Test
|
)
|
||||||
public void beginnerHotColdLocationAreaTest()
|
default Stub overlayStub()
|
||||||
{
|
{
|
||||||
|
return new Stub();
|
||||||
|
}
|
||||||
|
|
||||||
for (final HotColdLocation location : BEGINNER_HOT_COLD_LOCATIONS)
|
@ConfigItem(
|
||||||
|
keyName = "renderViewer",
|
||||||
|
name = "Render Viewer",
|
||||||
|
description = "Shows second inventory on screen with looting bag items.",
|
||||||
|
position = 1,
|
||||||
|
parent = "overlayStub"
|
||||||
|
)
|
||||||
|
default boolean renderViewer()
|
||||||
{
|
{
|
||||||
assertEquals(EXPECTED_DIMENSION_SIZE, location.getRect().height);
|
return true;
|
||||||
assertEquals(EXPECTED_DIMENSION_SIZE, location.getRect().width);
|
}
|
||||||
}
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "renderLootingBag",
|
||||||
|
name = "Render Looting Bag Worth",
|
||||||
|
description = "Shows current amount of GP over the looting bag.",
|
||||||
|
position = 2,
|
||||||
|
parent = "overlayStub"
|
||||||
|
)
|
||||||
|
default boolean renderLootingBag()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018 AWPH-I
|
* Copyright (c) 2018 AWPH-I
|
||||||
|
* Copyright (c) 2019, gazivodag <https://github.com/gazivodag>
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@@ -25,7 +26,19 @@
|
|||||||
|
|
||||||
package net.runelite.client.plugins.lootingbagviewer;
|
package net.runelite.client.plugins.lootingbagviewer;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import com.google.inject.Provides;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.events.ConfigChanged;
|
||||||
|
import net.runelite.api.events.WidgetHiddenChanged;
|
||||||
|
import net.runelite.api.widgets.Widget;
|
||||||
|
import net.runelite.client.callback.ClientThread;
|
||||||
|
import net.runelite.client.config.ConfigManager;
|
||||||
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.plugins.PluginType;
|
import net.runelite.client.plugins.PluginType;
|
||||||
@@ -38,24 +51,125 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
|||||||
type = PluginType.PVP,
|
type = PluginType.PVP,
|
||||||
enabledByDefault = false
|
enabledByDefault = false
|
||||||
)
|
)
|
||||||
|
/**
|
||||||
|
* TODO: Remember current looting bag value when client restarts
|
||||||
|
* TODO: Write an event for picking up an item (with opened looting bag) and add its price to the current looting bag value
|
||||||
|
* TODO: Write something to capture adding items to a looting bag and add its price to the current looting bag value
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
public class LootingBagViewerPlugin extends Plugin
|
public class LootingBagViewerPlugin extends Plugin
|
||||||
{
|
{
|
||||||
@Inject
|
@Inject
|
||||||
private net.runelite.client.plugins.lootingbagviewer.LootingBagViewerOverlay overlay;
|
private Client client;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ClientThread clientThread;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private LootingBagViewerOverlay overlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private LootingBagViewerWidgetOverlay widgetOverlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private OverlayManager overlayManager;
|
private OverlayManager overlayManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private LootingBagViewerConfig config;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
private int valueToShow = -1;
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
LootingBagViewerConfig getConfig(ConfigManager configManager)
|
||||||
|
{
|
||||||
|
return configManager.getConfig(LootingBagViewerConfig.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startUp()
|
public void startUp()
|
||||||
|
{
|
||||||
|
if (config.renderViewer())
|
||||||
{
|
{
|
||||||
overlayManager.add(overlay);
|
overlayManager.add(overlay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (config.renderLootingBag())
|
||||||
|
{
|
||||||
|
overlayManager.add(widgetOverlay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutDown()
|
public void shutDown()
|
||||||
|
{
|
||||||
|
overlayManager.remove(overlay);
|
||||||
|
overlayManager.remove(widgetOverlay);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onConfigChanged(ConfigChanged configChanged)
|
||||||
|
{
|
||||||
|
if (configChanged.getKey().equals("renderViewer"))
|
||||||
|
{
|
||||||
|
if (Boolean.parseBoolean(configChanged.getNewValue()))
|
||||||
|
{
|
||||||
|
overlayManager.add(overlay);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
overlayManager.remove(overlay);
|
overlayManager.remove(overlay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (configChanged.getKey().equals("renderLootingBag"))
|
||||||
|
{
|
||||||
|
if (Boolean.parseBoolean(configChanged.getNewValue()))
|
||||||
|
{
|
||||||
|
overlayManager.add(widgetOverlay);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
overlayManager.remove(widgetOverlay);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param widgetHiddenChanged
|
||||||
|
*/
|
||||||
|
@Subscribe
|
||||||
|
public void onWidgetHiddenChanged(WidgetHiddenChanged widgetHiddenChanged)
|
||||||
|
{
|
||||||
|
Widget widget = widgetHiddenChanged.getWidget();
|
||||||
|
if (widget.getParentId() == 5308416 && !widget.isHidden())
|
||||||
|
{
|
||||||
|
clientThread.invokeLater(() ->
|
||||||
|
{
|
||||||
|
Widget value = client.getWidget(81, 6);
|
||||||
|
log.debug("val: {}", value.getText());
|
||||||
|
|
||||||
|
if (!Strings.isNullOrEmpty(value.getText()))
|
||||||
|
{
|
||||||
|
if (value.getText().equals("Value: -"))
|
||||||
|
{
|
||||||
|
setValueToShow(-1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
String str = value.getText();
|
||||||
|
str = str.replace("Bag value: ", "")
|
||||||
|
.replace("Value: ", "")
|
||||||
|
.replace(" coins", "")
|
||||||
|
.replace(",", "");
|
||||||
|
|
||||||
|
int val = Integer.parseInt(str);
|
||||||
|
setValueToShow(Math.round(val) / 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019, gazivodag <https://github.com/gazivodag>
|
||||||
|
* 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.lootingbagviewer;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.ItemID;
|
||||||
|
import net.runelite.api.Point;
|
||||||
|
import net.runelite.api.widgets.WidgetItem;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||||
|
import net.runelite.client.ui.overlay.WidgetItemOverlay;
|
||||||
|
|
||||||
|
public class LootingBagViewerWidgetOverlay extends WidgetItemOverlay
|
||||||
|
{
|
||||||
|
private Client client;
|
||||||
|
private LootingBagViewerPlugin plugin;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
LootingBagViewerWidgetOverlay(Client client, LootingBagViewerPlugin plugin)
|
||||||
|
{
|
||||||
|
this.client = client;
|
||||||
|
this.plugin = plugin;
|
||||||
|
showOnInventory();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void renderItemOverlay(Graphics2D graphics, int itemId, WidgetItem itemWidget)
|
||||||
|
{
|
||||||
|
if (plugin.getValueToShow() != -1)
|
||||||
|
{
|
||||||
|
switch (itemId)
|
||||||
|
{
|
||||||
|
case ItemID.LOOTING_BAG:
|
||||||
|
case ItemID.LOOTING_BAG_22586:
|
||||||
|
Point point = new Point(itemWidget.getCanvasLocation().getX() + lineX(plugin.getValueToShow()), itemWidget.getCanvasLocation().getY() + 25);
|
||||||
|
OverlayUtil.renderTextLocation(graphics, point, (plugin.getValueToShow() + "K"), Color.WHITE);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To align 16k (gp) or 4213k (gp) correctly between the looting bag without looking off
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private static int lineX(int lootingBagValue)
|
||||||
|
{
|
||||||
|
switch ((int) (Math.log10(lootingBagValue) + 1))
|
||||||
|
{
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
return 8;
|
||||||
|
case 3:
|
||||||
|
case 4:
|
||||||
|
return 6;
|
||||||
|
default:
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -96,12 +96,12 @@ class LootTrackerBox extends JPanel
|
|||||||
logTitle.setBackground(ColorScheme.DARKER_GRAY_COLOR.darker());
|
logTitle.setBackground(ColorScheme.DARKER_GRAY_COLOR.darker());
|
||||||
|
|
||||||
final JLabel titleLabel = new JLabel(Text.removeTags(id));
|
final JLabel titleLabel = new JLabel(Text.removeTags(id));
|
||||||
titleLabel.setFont(FontManager.getRunescapeSmallFont());
|
titleLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
titleLabel.setForeground(Color.WHITE);
|
titleLabel.setForeground(Color.WHITE);
|
||||||
|
|
||||||
logTitle.add(titleLabel, BorderLayout.WEST);
|
logTitle.add(titleLabel, BorderLayout.WEST);
|
||||||
|
|
||||||
subTitleLabel.setFont(FontManager.getRunescapeSmallFont());
|
subTitleLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
subTitleLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
subTitleLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||||
logTitle.add(subTitleLabel, BorderLayout.CENTER);
|
logTitle.add(subTitleLabel, BorderLayout.CENTER);
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ class LootTrackerBox extends JPanel
|
|||||||
subTitleLabel.setText(subtitle);
|
subTitleLabel.setText(subtitle);
|
||||||
}
|
}
|
||||||
|
|
||||||
priceLabel.setFont(FontManager.getRunescapeSmallFont());
|
priceLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
priceLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
priceLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||||
logTitle.add(priceLabel, BorderLayout.EAST);
|
logTitle.add(priceLabel, BorderLayout.EAST);
|
||||||
|
|
||||||
|
|||||||
@@ -348,8 +348,8 @@ class LootTrackerPanel extends PluginPanel
|
|||||||
overallInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
overallInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
overallInfo.setLayout(new GridLayout(2, 1));
|
overallInfo.setLayout(new GridLayout(2, 1));
|
||||||
overallInfo.setBorder(new EmptyBorder(2, 10, 2, 0));
|
overallInfo.setBorder(new EmptyBorder(2, 10, 2, 0));
|
||||||
overallKillsLabel.setFont(FontManager.getRunescapeSmallFont());
|
overallKillsLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
overallGpLabel.setFont(FontManager.getRunescapeSmallFont());
|
overallGpLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
overallInfo.add(overallKillsLabel);
|
overallInfo.add(overallKillsLabel);
|
||||||
overallInfo.add(overallGpLabel);
|
overallInfo.add(overallGpLabel);
|
||||||
overallPanel.add(overallIcon, BorderLayout.WEST);
|
overallPanel.add(overallIcon, BorderLayout.WEST);
|
||||||
|
|||||||
@@ -1671,7 +1671,8 @@ default CharterOption charterOption()
|
|||||||
keyName = "removeFreezePlayerToB",
|
keyName = "removeFreezePlayerToB",
|
||||||
name = "Remove freeze in ToB",
|
name = "Remove freeze in ToB",
|
||||||
description = "Removes the freeze option for ice barrage, ice blitz, entangle etc. in ToB",
|
description = "Removes the freeze option for ice barrage, ice blitz, entangle etc. in ToB",
|
||||||
position = 0
|
position = 0,
|
||||||
|
group = "PVM"
|
||||||
)
|
)
|
||||||
|
|
||||||
default boolean getRemoveFreezePlayerToB()
|
default boolean getRemoveFreezePlayerToB()
|
||||||
@@ -1683,7 +1684,8 @@ default CharterOption charterOption()
|
|||||||
keyName = "removeFreezePlayerCoX",
|
keyName = "removeFreezePlayerCoX",
|
||||||
name = "Remove freeze in CoX",
|
name = "Remove freeze in CoX",
|
||||||
description = "Removes the freeze option for ice barrage, ice blitz, entangle etc. in CoX",
|
description = "Removes the freeze option for ice barrage, ice blitz, entangle etc. in CoX",
|
||||||
position = 1
|
position = 1,
|
||||||
|
group = "PVM"
|
||||||
)
|
)
|
||||||
|
|
||||||
default boolean getRemoveFreezePlayerCoX()
|
default boolean getRemoveFreezePlayerCoX()
|
||||||
|
|||||||
@@ -1044,10 +1044,21 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
swap(client, "stun", option, target, true);
|
swap(client, "stun", option, target, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (config.swapTravel() && (option.equals("pass") || option.equals("open")))
|
else if (config.swapTravel() && option.equals("pass") && target.equals("energy barrier"))
|
||||||
{
|
{
|
||||||
swap(client, "pay-toll", option, target, false);
|
swap(client, "pay-toll(2-ecto)", option, target, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if (config.swapTravel() && option.equals("open") && target.equals("gate"))
|
||||||
|
{
|
||||||
|
swap(client, "pay-toll(10gp)", option, target, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (config.swapHardWoodGrove() && option.equals("open") && target.equals("hardwood grove doors"))
|
||||||
|
{
|
||||||
|
swap(client, "quick-pay(100)", option, target, true);
|
||||||
|
}
|
||||||
|
|
||||||
else if (config.swapTravel() && option.equals("inspect") && target.equals("trapdoor"))
|
else if (config.swapTravel() && option.equals("inspect") && target.equals("trapdoor"))
|
||||||
{
|
{
|
||||||
swap(client, "travel", option, target, true);
|
swap(client, "travel", option, target, true);
|
||||||
@@ -1160,7 +1171,6 @@ public class MenuEntrySwapperPlugin extends Plugin
|
|||||||
else if (config.swapQuick() && option.equals("pass"))
|
else if (config.swapQuick() && option.equals("pass"))
|
||||||
{
|
{
|
||||||
swap(client, "quick-pass", option, target, true);
|
swap(client, "quick-pass", option, target, true);
|
||||||
swap(client, "quick pass", option, target, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (config.swapQuick() && option.equals("open"))
|
else if (config.swapQuick() && option.equals("open"))
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ class MiningOverlay extends Overlay
|
|||||||
private static final int ORE_VEIN_MIN_RESPAWN_TIME = 90;
|
private static final int ORE_VEIN_MIN_RESPAWN_TIME = 90;
|
||||||
private static final float ORE_VEIN_RANDOM_PERCENT_THRESHOLD = (float) ORE_VEIN_MIN_RESPAWN_TIME / ORE_VEIN_MAX_RESPAWN_TIME;
|
private static final float ORE_VEIN_RANDOM_PERCENT_THRESHOLD = (float) ORE_VEIN_MIN_RESPAWN_TIME / ORE_VEIN_MAX_RESPAWN_TIME;
|
||||||
private static final Color DARK_GREEN = new Color(0, 100, 0);
|
private static final Color DARK_GREEN = new Color(0, 100, 0);
|
||||||
|
private static final int MOTHERLODE_UPPER_FLOOR_HEIGHT = -500;
|
||||||
|
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final MiningPlugin plugin;
|
private final MiningPlugin plugin;
|
||||||
@@ -95,8 +96,17 @@ class MiningOverlay extends Overlay
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rock rock = rockRespawn.getRock();
|
||||||
|
|
||||||
|
// Only draw timer for veins on the same level in motherlode mine
|
||||||
|
LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
|
||||||
|
if (rock == Rock.ORE_VEIN && isUpstairsMotherlode(localLocation) != isUpstairsMotherlode(loc))
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Recolour pie on motherlode veins during the portion of the timer where they may respawn
|
// Recolour pie on motherlode veins during the portion of the timer where they may respawn
|
||||||
if (rockRespawn.getRock() == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD)
|
if (rock == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD)
|
||||||
{
|
{
|
||||||
pieFillColor = Color.GREEN;
|
pieFillColor = Color.GREEN;
|
||||||
pieBorderColor = DARK_GREEN;
|
pieBorderColor = DARK_GREEN;
|
||||||
@@ -111,4 +121,19 @@ class MiningOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the given point is "upstairs" in the mlm.
|
||||||
|
* The upper floor is actually on z=0.
|
||||||
|
*
|
||||||
|
* This method assumes that the given point is already in the mlm
|
||||||
|
* and is not meaningful when outside the mlm.
|
||||||
|
*
|
||||||
|
* @param localPoint the LocalPoint to be tested
|
||||||
|
* @return true if localPoint is at same height as mlm upper floor
|
||||||
|
*/
|
||||||
|
private boolean isUpstairsMotherlode(LocalPoint localPoint)
|
||||||
|
{
|
||||||
|
return Perspective.getTileHeight(client, localPoint, 0) < MOTHERLODE_UPPER_FLOOR_HEIGHT;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class MTAInventoryOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
if (room.inside())
|
if (room.inside())
|
||||||
{
|
{
|
||||||
graphics.setFont(FontManager.getRunescapeBoldFont());
|
graphics.setFont(FontManager.getSmallFont(graphics.getFont()));
|
||||||
room.over(graphics);
|
room.over(graphics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class MTASceneOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
if (room.inside())
|
if (room.inside())
|
||||||
{
|
{
|
||||||
graphics.setFont(FontManager.getRunescapeFont());
|
graphics.setFont(FontManager.getSmallFont(graphics.getFont()));
|
||||||
room.under(graphics);
|
room.under(graphics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,13 +36,24 @@ public interface NightmareZoneConfig extends Config
|
|||||||
keyName = "moveoverlay",
|
keyName = "moveoverlay",
|
||||||
name = "Override NMZ overlay",
|
name = "Override NMZ overlay",
|
||||||
description = "Overrides the overlay so it doesn't conflict with other RuneLite plugins",
|
description = "Overrides the overlay so it doesn't conflict with other RuneLite plugins",
|
||||||
position = 1
|
position = 0
|
||||||
)
|
)
|
||||||
default boolean moveOverlay()
|
default boolean moveOverlay()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "showtotalpoints",
|
||||||
|
name = "total points NMZ overlay",
|
||||||
|
description = "shows total points to overlay",
|
||||||
|
position = 1
|
||||||
|
)
|
||||||
|
default boolean showtotalpoints()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "powersurgenotification",
|
keyName = "powersurgenotification",
|
||||||
name = "Power surge notification",
|
name = "Power surge notification",
|
||||||
|
|||||||
@@ -107,7 +107,13 @@ class NightmareZoneOverlay extends Overlay
|
|||||||
TableComponent tableComponent = new TableComponent();
|
TableComponent tableComponent = new TableComponent();
|
||||||
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
|
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
|
||||||
tableComponent.addRow("Points:", StackFormatter.formatNumber(client.getVar(Varbits.NMZ_POINTS)));
|
tableComponent.addRow("Points:", StackFormatter.formatNumber(client.getVar(Varbits.NMZ_POINTS)));
|
||||||
|
|
||||||
|
if (config.showtotalpoints())
|
||||||
|
{
|
||||||
tableComponent.addRow("Total:", StackFormatter.formatNumber(client.getVar(VarPlayer.NMZ_REWARD_POINTS) + client.getVar(Varbits.NMZ_POINTS)));
|
tableComponent.addRow("Total:", StackFormatter.formatNumber(client.getVar(VarPlayer.NMZ_REWARD_POINTS) + client.getVar(Varbits.NMZ_POINTS)));
|
||||||
|
}
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(tableComponent);
|
||||||
|
|
||||||
return panelComponent.render(graphics);
|
return panelComponent.render(graphics);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -584,7 +584,16 @@ public class NpcIndicatorsPlugin extends Plugin
|
|||||||
|
|
||||||
if (mn.getDiedOnTick() != -1)
|
if (mn.getDiedOnTick() != -1)
|
||||||
{
|
{
|
||||||
mn.setRespawnTime(client.getTickCount() + 1 - mn.getDiedOnTick());
|
final int respawnTime = client.getTickCount() + 1 - mn.getDiedOnTick();
|
||||||
|
|
||||||
|
// By killing a monster and leaving the area before seeing it again, an erroneously lengthy
|
||||||
|
// respawn time can be recorded. Thus, if the respawn time is already set and is greater than
|
||||||
|
// the observed time, assume that the lower observed respawn time is correct.
|
||||||
|
if (mn.getRespawnTime() == -1 || respawnTime < mn.getRespawnTime())
|
||||||
|
{
|
||||||
|
mn.setRespawnTime(respawnTime);
|
||||||
|
}
|
||||||
|
|
||||||
mn.setDiedOnTick(-1);
|
mn.setDiedOnTick(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ package net.runelite.client.plugins.prayer;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
@@ -35,11 +36,13 @@ import net.runelite.api.Perspective;
|
|||||||
import net.runelite.api.Player;
|
import net.runelite.api.Player;
|
||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
|
import net.runelite.api.SpriteID;
|
||||||
import net.runelite.api.coords.LocalPoint;
|
import net.runelite.api.coords.LocalPoint;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
|
import net.runelite.client.util.ImageUtil;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
class PrayerBarOverlay extends Overlay
|
class PrayerBarOverlay extends Overlay
|
||||||
@@ -48,6 +51,9 @@ class PrayerBarOverlay extends Overlay
|
|||||||
private static final Color BAR_BG_COLOR = Color.black;
|
private static final Color BAR_BG_COLOR = Color.black;
|
||||||
private static final Color FLICK_HELP_COLOR = Color.white;
|
private static final Color FLICK_HELP_COLOR = Color.white;
|
||||||
private static final Dimension PRAYER_BAR_SIZE = new Dimension(30, 5);
|
private static final Dimension PRAYER_BAR_SIZE = new Dimension(30, 5);
|
||||||
|
private static final int HD_PRAYER_BAR_PADDING = 1;
|
||||||
|
private static final BufferedImage HD_FRONT_BAR = ImageUtil.getResourceStreamFromClass(PrayerPlugin.class, "front.png");
|
||||||
|
private static final BufferedImage HD_BACK_BAR = ImageUtil.getResourceStreamFromClass(PrayerPlugin.class, "back.png");
|
||||||
|
|
||||||
private final Client client;
|
private final Client client;
|
||||||
private final PrayerConfig config;
|
private final PrayerConfig config;
|
||||||
@@ -79,12 +85,44 @@ class PrayerBarOverlay extends Overlay
|
|||||||
final LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
|
final LocalPoint localLocation = client.getLocalPlayer().getLocalLocation();
|
||||||
final Point canvasPoint = Perspective.localToCanvas(client, localLocation, client.getPlane(), height);
|
final Point canvasPoint = Perspective.localToCanvas(client, localLocation, client.getPlane(), height);
|
||||||
|
|
||||||
|
final float ratio = (float) client.getBoostedSkillLevel(Skill.PRAYER) / client.getRealSkillLevel(Skill.PRAYER);
|
||||||
|
|
||||||
|
// Draw HD bar
|
||||||
|
if (client.getSpriteOverrides().containsKey(SpriteID.HEALTHBAR_DEFAULT_FRONT_30PX))
|
||||||
|
{
|
||||||
|
final int barWidth = HD_FRONT_BAR.getWidth();
|
||||||
|
final int barHeight = HD_FRONT_BAR.getHeight();
|
||||||
|
final int barX = canvasPoint.getX() - barWidth / 2;
|
||||||
|
final int barY = canvasPoint.getY();
|
||||||
|
|
||||||
|
// Include padding so the bar doesn't show empty at very low prayer values
|
||||||
|
final int progressFill = (int) Math.ceil(Math.max(HD_PRAYER_BAR_PADDING * 2, Math.min((barWidth * ratio), barWidth)));
|
||||||
|
|
||||||
|
graphics.drawImage(HD_BACK_BAR, barX, barY, barWidth, barHeight, null);
|
||||||
|
// Use a sub-image to create the same effect the HD Health Bar has
|
||||||
|
graphics.drawImage(HD_FRONT_BAR.getSubimage(0, 0, progressFill, barHeight), barX, barY, progressFill, barHeight, null);
|
||||||
|
|
||||||
|
if ((plugin.isPrayersActive() || config.prayerFlickAlwaysOn())
|
||||||
|
&& (config.prayerFlickLocation().equals(PrayerFlickLocation.PRAYER_BAR)
|
||||||
|
|| config.prayerFlickLocation().equals(PrayerFlickLocation.BOTH)))
|
||||||
|
{
|
||||||
|
final double t = plugin.getTickProgress();
|
||||||
|
final int halfBarWidth = (barWidth / 2) - HD_PRAYER_BAR_PADDING;
|
||||||
|
|
||||||
|
final int xOffset = (int) (-Math.cos(t) * halfBarWidth) + ((barWidth / 2) - halfBarWidth);
|
||||||
|
|
||||||
|
graphics.setColor(FLICK_HELP_COLOR);
|
||||||
|
graphics.fillRect(barX + xOffset + HD_PRAYER_BAR_PADDING, barY + HD_PRAYER_BAR_PADDING, 1, barHeight - HD_PRAYER_BAR_PADDING * 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Dimension(barWidth, barHeight);
|
||||||
|
}
|
||||||
|
|
||||||
// Draw bar
|
// Draw bar
|
||||||
final int barX = canvasPoint.getX() - 15;
|
final int barX = canvasPoint.getX() - 15;
|
||||||
final int barY = canvasPoint.getY();
|
final int barY = canvasPoint.getY();
|
||||||
final int barWidth = PRAYER_BAR_SIZE.width;
|
final int barWidth = PRAYER_BAR_SIZE.width;
|
||||||
final int barHeight = PRAYER_BAR_SIZE.height;
|
final int barHeight = PRAYER_BAR_SIZE.height;
|
||||||
final float ratio = (float) client.getBoostedSkillLevel(Skill.PRAYER) / client.getRealSkillLevel(Skill.PRAYER);
|
|
||||||
|
|
||||||
// Restricted by the width to prevent the bar from being too long while you are boosted above your real prayer level.
|
// Restricted by the width to prevent the bar from being too long while you are boosted above your real prayer level.
|
||||||
final int progressFill = (int) Math.ceil(Math.min((barWidth * ratio), barWidth));
|
final int progressFill = (int) Math.ceil(Math.min((barWidth * ratio), barWidth));
|
||||||
@@ -100,7 +138,7 @@ class PrayerBarOverlay extends Overlay
|
|||||||
{
|
{
|
||||||
double t = plugin.getTickProgress();
|
double t = plugin.getTickProgress();
|
||||||
|
|
||||||
int xOffset = (int) (-Math.cos(t) * barWidth / 2) + barWidth / 2;
|
final int xOffset = (int) (-Math.cos(t) * barWidth / 2) + barWidth / 2;
|
||||||
|
|
||||||
graphics.setColor(FLICK_HELP_COLOR);
|
graphics.setColor(FLICK_HELP_COLOR);
|
||||||
graphics.fillRect(barX + xOffset, barY, 1, barHeight);
|
graphics.fillRect(barX + xOffset, barY, 1, barHeight);
|
||||||
|
|||||||
@@ -88,6 +88,10 @@ public class RunepouchOverlay extends WidgetItemOverlay
|
|||||||
Point location = itemWidget.getCanvasLocation();
|
Point location = itemWidget.getCanvasLocation();
|
||||||
StringBuilder tooltipBuilder = new StringBuilder();
|
StringBuilder tooltipBuilder = new StringBuilder();
|
||||||
|
|
||||||
|
// location.getY() + graphics.getFontMetrics().getMaxAscent() - graphics.getFontMetrics().getMaxDescent()
|
||||||
|
// this will draw the character exactly on the border
|
||||||
|
int yLocation = location.getY() + 1 +
|
||||||
|
graphics.getFontMetrics().getMaxAscent() - graphics.getFontMetrics().getMaxDescent();
|
||||||
for (int i = 0; i < AMOUNT_VARBITS.length; i++)
|
for (int i = 0; i < AMOUNT_VARBITS.length; i++)
|
||||||
{
|
{
|
||||||
Varbits amountVarbit = AMOUNT_VARBITS[i];
|
Varbits amountVarbit = AMOUNT_VARBITS[i];
|
||||||
@@ -117,9 +121,18 @@ public class RunepouchOverlay extends WidgetItemOverlay
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// the reason this is not split up in maxascent and maxdescent to equal the height of the text like it should
|
||||||
|
// be is because numbers (afaik) dont use font descent so a 1 pixel seperator should be good and give
|
||||||
|
// consistent results across fonts
|
||||||
|
int yOffset = (1 + (graphics.getFontMetrics().getMaxAscent()) * i);
|
||||||
|
|
||||||
graphics.setColor(Color.black);
|
graphics.setColor(Color.black);
|
||||||
|
graphics.drawString("" + formatNumber(amount), location.getX() + (config.showIcons() ? 13 : 6),
|
||||||
|
yLocation + yOffset);
|
||||||
|
|
||||||
|
graphics.setColor(config.fontColor());
|
||||||
graphics.drawString("" + formatNumber(amount), location.getX() + (config.showIcons() ? 12 : 5),
|
graphics.drawString("" + formatNumber(amount), location.getX() + (config.showIcons() ? 12 : 5),
|
||||||
location.getY() + 13 + (graphics.getFontMetrics().getHeight() - 1) * i);
|
yLocation + yOffset);
|
||||||
|
|
||||||
graphics.setColor(config.fontColor());
|
graphics.setColor(config.fontColor());
|
||||||
graphics.drawString("" + formatNumber(amount), location.getX() + (config.showIcons() ? 11 : 4),
|
graphics.drawString("" + formatNumber(amount), location.getX() + (config.showIcons() ? 11 : 4),
|
||||||
@@ -134,7 +147,13 @@ public class RunepouchOverlay extends WidgetItemOverlay
|
|||||||
if (image != null)
|
if (image != null)
|
||||||
{
|
{
|
||||||
OverlayUtil.renderImageLocation(graphics,
|
OverlayUtil.renderImageLocation(graphics,
|
||||||
new Point(location.getX() - 1, location.getY() + graphics.getFontMetrics().getHeight() * i - 1),
|
//TODO :: SEE WHAT ONE IS RIGHT?
|
||||||
|
//new Point(location.getX() - 1, location.getY() + graphics.getFontMetrics().getMaxAscent() * i - 1),
|
||||||
|
//image);
|
||||||
|
//or
|
||||||
|
//new Point(location.getX(), location.getY() + (1 + graphics.getFontMetrics().getMaxAscent()) * i),
|
||||||
|
//image);
|
||||||
|
new Point(location.getX(), location.getY() + (1 + graphics.getFontMetrics().getMaxAscent()) * i),
|
||||||
image);
|
image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ public class ScreenMarkerCreationPanel extends JPanel
|
|||||||
setBorder(new EmptyBorder(8, 8, 8, 8));
|
setBorder(new EmptyBorder(8, 8, 8, 8));
|
||||||
setLayout(new BorderLayout());
|
setLayout(new BorderLayout());
|
||||||
|
|
||||||
instructionsLabel.setFont(FontManager.getRunescapeSmallFont());
|
instructionsLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
instructionsLabel.setForeground(Color.WHITE);
|
instructionsLabel.setForeground(Color.WHITE);
|
||||||
|
|
||||||
JPanel actionsContainer = new JPanel(new GridLayout(1, 2, 8, 0));
|
JPanel actionsContainer = new JPanel(new GridLayout(1, 2, 8, 0));
|
||||||
|
|||||||
@@ -29,8 +29,6 @@ import java.awt.BorderLayout;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.FlowLayout;
|
import java.awt.FlowLayout;
|
||||||
import java.awt.event.KeyAdapter;
|
|
||||||
import java.awt.event.KeyEvent;
|
|
||||||
import java.awt.event.MouseAdapter;
|
import java.awt.event.MouseAdapter;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.WindowAdapter;
|
import java.awt.event.WindowAdapter;
|
||||||
@@ -164,14 +162,19 @@ class ScreenMarkerPanel extends JPanel
|
|||||||
nameActions.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
nameActions.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
|
|
||||||
save.setVisible(false);
|
save.setVisible(false);
|
||||||
save.setFont(FontManager.getRunescapeSmallFont());
|
save.setFont(FontManager.getSmallFont(getFont()));
|
||||||
save.setForeground(ColorScheme.PROGRESS_COMPLETE_COLOR);
|
save.setForeground(ColorScheme.PROGRESS_COMPLETE_COLOR);
|
||||||
save.addMouseListener(new MouseAdapter()
|
save.addMouseListener(new MouseAdapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent mouseEvent)
|
public void mousePressed(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
save();
|
marker.getMarker().setName(nameInput.getText());
|
||||||
|
plugin.updateConfig();
|
||||||
|
|
||||||
|
nameInput.setEditable(false);
|
||||||
|
updateNameActions(false);
|
||||||
|
requestFocusInWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -188,14 +191,17 @@ class ScreenMarkerPanel extends JPanel
|
|||||||
});
|
});
|
||||||
|
|
||||||
cancel.setVisible(false);
|
cancel.setVisible(false);
|
||||||
cancel.setFont(FontManager.getRunescapeSmallFont());
|
cancel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
cancel.setForeground(ColorScheme.PROGRESS_ERROR_COLOR);
|
cancel.setForeground(ColorScheme.PROGRESS_ERROR_COLOR);
|
||||||
cancel.addMouseListener(new MouseAdapter()
|
cancel.addMouseListener(new MouseAdapter()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent mouseEvent)
|
public void mousePressed(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
cancel();
|
nameInput.setEditable(false);
|
||||||
|
nameInput.setText(marker.getMarker().getName());
|
||||||
|
updateNameActions(false);
|
||||||
|
requestFocusInWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -211,7 +217,7 @@ class ScreenMarkerPanel extends JPanel
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
rename.setFont(FontManager.getRunescapeSmallFont());
|
rename.setFont(FontManager.getSmallFont(getFont()));
|
||||||
rename.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker());
|
rename.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker());
|
||||||
rename.addMouseListener(new MouseAdapter()
|
rename.addMouseListener(new MouseAdapter()
|
||||||
{
|
{
|
||||||
@@ -246,35 +252,6 @@ class ScreenMarkerPanel extends JPanel
|
|||||||
nameInput.setPreferredSize(new Dimension(0, 24));
|
nameInput.setPreferredSize(new Dimension(0, 24));
|
||||||
nameInput.getTextField().setForeground(Color.WHITE);
|
nameInput.getTextField().setForeground(Color.WHITE);
|
||||||
nameInput.getTextField().setBorder(new EmptyBorder(0, 8, 0, 0));
|
nameInput.getTextField().setBorder(new EmptyBorder(0, 8, 0, 0));
|
||||||
nameInput.addKeyListener(new KeyAdapter()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void keyPressed(KeyEvent e)
|
|
||||||
{
|
|
||||||
if (e.getKeyCode() == KeyEvent.VK_ENTER)
|
|
||||||
{
|
|
||||||
save();
|
|
||||||
}
|
|
||||||
else if (e.getKeyCode() == KeyEvent.VK_ESCAPE)
|
|
||||||
{
|
|
||||||
cancel();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
nameInput.getTextField().addMouseListener(new MouseAdapter()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void mouseEntered(MouseEvent mouseEvent)
|
|
||||||
{
|
|
||||||
preview(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mouseExited(MouseEvent mouseEvent)
|
|
||||||
{
|
|
||||||
preview(false);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
nameWrapper.add(nameInput, BorderLayout.CENTER);
|
nameWrapper.add(nameInput, BorderLayout.CENTER);
|
||||||
nameWrapper.add(nameActions, BorderLayout.EAST);
|
nameWrapper.add(nameActions, BorderLayout.EAST);
|
||||||
@@ -382,7 +359,10 @@ class ScreenMarkerPanel extends JPanel
|
|||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent mouseEvent)
|
public void mousePressed(MouseEvent mouseEvent)
|
||||||
{
|
{
|
||||||
toggle(!visible);
|
visible = !visible;
|
||||||
|
marker.getMarker().setVisible(visible);
|
||||||
|
plugin.updateConfig();
|
||||||
|
updateVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -444,42 +424,6 @@ class ScreenMarkerPanel extends JPanel
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void preview(boolean on)
|
|
||||||
{
|
|
||||||
if (visible)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
marker.getMarker().setVisible(on);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void toggle(boolean on)
|
|
||||||
{
|
|
||||||
visible = on;
|
|
||||||
marker.getMarker().setVisible(visible);
|
|
||||||
plugin.updateConfig();
|
|
||||||
updateVisibility();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void save()
|
|
||||||
{
|
|
||||||
marker.getMarker().setName(nameInput.getText());
|
|
||||||
plugin.updateConfig();
|
|
||||||
|
|
||||||
nameInput.setEditable(false);
|
|
||||||
updateNameActions(false);
|
|
||||||
requestFocusInWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cancel()
|
|
||||||
{
|
|
||||||
nameInput.setEditable(false);
|
|
||||||
nameInput.setText(marker.getMarker().getName());
|
|
||||||
updateNameActions(false);
|
|
||||||
requestFocusInWindow();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateNameActions(boolean saveAndCancel)
|
private void updateNameActions(boolean saveAndCancel)
|
||||||
{
|
{
|
||||||
save.setVisible(saveAndCancel);
|
save.setVisible(saveAndCancel);
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ class SkillCalculator extends JPanel
|
|||||||
JCheckBox uiCheckbox = new JCheckBox();
|
JCheckBox uiCheckbox = new JCheckBox();
|
||||||
|
|
||||||
uiLabel.setForeground(Color.WHITE);
|
uiLabel.setForeground(Color.WHITE);
|
||||||
uiLabel.setFont(FontManager.getRunescapeSmallFont());
|
uiLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
uiOption.setBorder(BorderFactory.createEmptyBorder(3, 7, 3, 0));
|
uiOption.setBorder(BorderFactory.createEmptyBorder(3, 7, 3, 0));
|
||||||
uiOption.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
uiOption.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class UIActionSlot extends JPanel
|
|||||||
uiLabelName.setForeground(Color.WHITE);
|
uiLabelName.setForeground(Color.WHITE);
|
||||||
|
|
||||||
uiLabelActions = new JShadowedLabel("Unknown");
|
uiLabelActions = new JShadowedLabel("Unknown");
|
||||||
uiLabelActions.setFont(FontManager.getRunescapeSmallFont());
|
uiLabelActions.setFont(FontManager.getSmallFont(getFont()));
|
||||||
uiLabelActions.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
uiLabelActions.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||||
|
|
||||||
uiInfo.add(uiLabelName);
|
uiInfo.add(uiLabelName);
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class UICalculatorInputArea extends JPanel
|
|||||||
uiInput.setHoverBackgroundColor(ColorScheme.DARK_GRAY_HOVER_COLOR);
|
uiInput.setHoverBackgroundColor(ColorScheme.DARK_GRAY_HOVER_COLOR);
|
||||||
uiInput.setBorder(new EmptyBorder(5, 7, 5, 7));
|
uiInput.setBorder(new EmptyBorder(5, 7, 5, 7));
|
||||||
|
|
||||||
uiLabel.setFont(FontManager.getRunescapeSmallFont());
|
uiLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
uiLabel.setBorder(new EmptyBorder(0, 0, 4, 0));
|
uiLabel.setBorder(new EmptyBorder(0, 0, 4, 0));
|
||||||
uiLabel.setForeground(Color.WHITE);
|
uiLabel.setForeground(Color.WHITE);
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ class UICombinedActionSlot extends JPanel
|
|||||||
uiLabelTitle.setForeground(Color.WHITE);
|
uiLabelTitle.setForeground(Color.WHITE);
|
||||||
|
|
||||||
uiLabelActions = new JShadowedLabel("Shift-click to select multiple");
|
uiLabelActions = new JShadowedLabel("Shift-click to select multiple");
|
||||||
uiLabelActions.setFont(FontManager.getRunescapeSmallFont());
|
uiLabelActions.setFont(FontManager.getSmallFont(getFont()));
|
||||||
uiLabelActions.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
uiLabelActions.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||||
|
|
||||||
uiInfo.add(uiLabelTitle);
|
uiInfo.add(uiLabelTitle);
|
||||||
|
|||||||
@@ -117,7 +117,7 @@ class SlayerOverlay extends WidgetItemOverlay
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
graphics.setFont(FontManager.getRunescapeSmallFont());
|
graphics.setFont(FontManager.getSmallFont(graphics.getFont()));
|
||||||
|
|
||||||
final Rectangle bounds = itemWidget.getCanvasBounds();
|
final Rectangle bounds = itemWidget.getCanvasBounds();
|
||||||
final TextComponent textComponent = new TextComponent();
|
final TextComponent textComponent = new TextComponent();
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ package net.runelite.client.plugins.timers;
|
|||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Actor;
|
import net.runelite.api.Actor;
|
||||||
@@ -126,13 +127,10 @@ public class TimersPlugin extends Plugin
|
|||||||
private static final String CANNON_REPAIR_MESSAGE = "You repair your cannon, restoring it to working order.";
|
private static final String CANNON_REPAIR_MESSAGE = "You repair your cannon, restoring it to working order.";
|
||||||
private static final String CHARGE_EXPIRED_MESSAGE = "<col=ef1020>Your magical charge fades away.</col>";
|
private static final String CHARGE_EXPIRED_MESSAGE = "<col=ef1020>Your magical charge fades away.</col>";
|
||||||
private static final String CHARGE_MESSAGE = "<col=ef1020>You feel charged with magic power.</col>";
|
private static final String CHARGE_MESSAGE = "<col=ef1020>You feel charged with magic power.</col>";
|
||||||
private static final String DEADMAN_HALF_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you. It will expire in 1 minute, 15 seconds.</col>";
|
|
||||||
private static final String EXTENDED_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended antifire potion.";
|
private static final String EXTENDED_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended antifire potion.";
|
||||||
private static final String EXTENDED_SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended super antifire potion.";
|
private static final String EXTENDED_SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended super antifire potion.";
|
||||||
private static final String FROZEN_MESSAGE = "<col=ef1020>You have been frozen!</col>";
|
private static final String FROZEN_MESSAGE = "<col=ef1020>You have been frozen!</col>";
|
||||||
private static final String FULL_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you. It will expire in 5 minutes, 0 seconds.</col>";
|
|
||||||
private static final String GOD_WARS_ALTAR_MESSAGE = "you recharge your prayer.";
|
private static final String GOD_WARS_ALTAR_MESSAGE = "you recharge your prayer.";
|
||||||
private static final String HALF_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you. It will expire in 2 minutes, 30 seconds.</col>";
|
|
||||||
private static final String IMBUED_HEART_READY_MESSAGE = "<col=ef1020>Your imbued heart has regained its magical power.</col>";
|
private static final String IMBUED_HEART_READY_MESSAGE = "<col=ef1020>Your imbued heart has regained its magical power.</col>";
|
||||||
private static final String IMBUED_HEART_NOTREADY_MESSAGE = "The heart is still drained of its power.";
|
private static final String IMBUED_HEART_NOTREADY_MESSAGE = "The heart is still drained of its power.";
|
||||||
private static final String MAGIC_IMBUE_EXPIRED_MESSAGE = "Your Magic Imbue charge has ended.";
|
private static final String MAGIC_IMBUE_EXPIRED_MESSAGE = "Your Magic Imbue charge has ended.";
|
||||||
@@ -147,6 +145,10 @@ public class TimersPlugin extends Plugin
|
|||||||
private static final int VENOM_VALUE_CUTOFF = -40; // Antivenom < -40 =< Antipoison < 0
|
private static final int VENOM_VALUE_CUTOFF = -40; // Antivenom < -40 =< Antipoison < 0
|
||||||
private static final int POISON_TICK_LENGTH = 30;
|
private static final int POISON_TICK_LENGTH = 30;
|
||||||
|
|
||||||
|
private static final Pattern DEADMAN_HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+). It will expire in 1 minute, 15 seconds.</col>");
|
||||||
|
private static final Pattern FULL_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+). It will expire in 5 minutes, 0 seconds.</col>");
|
||||||
|
private static final Pattern HALF_TELEBLOCK_PATTERN = Pattern.compile("<col=4f006f>A Tele Block spell has been cast on you by (.+). It will expire in 2 minutes, 30 seconds.</col>");
|
||||||
|
|
||||||
private TimerTimer freezeTimer;
|
private TimerTimer freezeTimer;
|
||||||
private int freezeTime = -1; // time frozen, in game ticks
|
private int freezeTime = -1; // time frozen, in game ticks
|
||||||
|
|
||||||
@@ -537,12 +539,13 @@ public class TimersPlugin extends Plugin
|
|||||||
removeGameTimer(MAGICIMBUE);
|
removeGameTimer(MAGICIMBUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.showTeleblock() && event.getMessage().equals(FULL_TELEBLOCK_MESSAGE))
|
if (config.showTeleblock())
|
||||||
|
{
|
||||||
|
if (FULL_TELEBLOCK_PATTERN.matcher(event.getMessage()).find())
|
||||||
{
|
{
|
||||||
createGameTimer(FULLTB);
|
createGameTimer(FULLTB);
|
||||||
}
|
}
|
||||||
|
else if (HALF_TELEBLOCK_PATTERN.matcher(event.getMessage()).find())
|
||||||
if (config.showTeleblock() && event.getMessage().equals(HALF_TELEBLOCK_MESSAGE))
|
|
||||||
{
|
{
|
||||||
if (client.getWorldType().contains(WorldType.DEADMAN)
|
if (client.getWorldType().contains(WorldType.DEADMAN)
|
||||||
&& !client.getWorldType().contains(WorldType.SEASONAL_DEADMAN)
|
&& !client.getWorldType().contains(WorldType.SEASONAL_DEADMAN)
|
||||||
@@ -555,11 +558,11 @@ public class TimersPlugin extends Plugin
|
|||||||
createGameTimer(HALFTB);
|
createGameTimer(HALFTB);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (DEADMAN_HALF_TELEBLOCK_PATTERN.matcher(event.getMessage()).find())
|
||||||
if (config.showTeleblock() && event.getMessage().equals(DEADMAN_HALF_TELEBLOCK_MESSAGE))
|
|
||||||
{
|
{
|
||||||
createGameTimer(DMM_HALFTB);
|
createGameTimer(DMM_HALFTB);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (config.showAntiFire() && event.getMessage().contains(SUPER_ANTIFIRE_DRINK_MESSAGE))
|
if (config.showAntiFire() && event.getMessage().contains(SUPER_ANTIFIRE_DRINK_MESSAGE))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -106,11 +106,11 @@ class OverviewItemPanel extends JPanel
|
|||||||
|
|
||||||
JLabel titleLabel = new JLabel(title);
|
JLabel titleLabel = new JLabel(title);
|
||||||
titleLabel.setForeground(Color.WHITE);
|
titleLabel.setForeground(Color.WHITE);
|
||||||
titleLabel.setFont(FontManager.getRunescapeSmallFont());
|
titleLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
statusLabel = new JLabel();
|
statusLabel = new JLabel();
|
||||||
statusLabel.setForeground(Color.GRAY);
|
statusLabel.setForeground(Color.GRAY);
|
||||||
statusLabel.setFont(FontManager.getRunescapeSmallFont());
|
statusLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
textContainer.add(titleLabel);
|
textContainer.add(titleLabel);
|
||||||
textContainer.add(statusLabel);
|
textContainer.add(statusLabel);
|
||||||
|
|||||||
@@ -67,10 +67,10 @@ public class TimeablePanel<T> extends JPanel
|
|||||||
infoPanel.setBorder(new EmptyBorder(4, 4, 4, 0));
|
infoPanel.setBorder(new EmptyBorder(4, 4, 4, 0));
|
||||||
|
|
||||||
final JLabel location = new JShadowedLabel(title);
|
final JLabel location = new JShadowedLabel(title);
|
||||||
location.setFont(FontManager.getRunescapeSmallFont());
|
location.setFont(FontManager.getSmallFont(getFont()));
|
||||||
location.setForeground(Color.WHITE);
|
location.setForeground(Color.WHITE);
|
||||||
|
|
||||||
estimate.setFont(FontManager.getRunescapeSmallFont());
|
estimate.setFont(FontManager.getSmallFont(getFont()));
|
||||||
estimate.setForeground(Color.GRAY);
|
estimate.setForeground(Color.GRAY);
|
||||||
|
|
||||||
infoPanel.add(location);
|
infoPanel.add(location);
|
||||||
|
|||||||
@@ -40,6 +40,7 @@ import net.runelite.client.plugins.timetracking.TimeTrackingPlugin;
|
|||||||
import net.runelite.client.ui.ColorScheme;
|
import net.runelite.client.ui.ColorScheme;
|
||||||
import net.runelite.client.ui.DynamicGridLayout;
|
import net.runelite.client.ui.DynamicGridLayout;
|
||||||
import net.runelite.client.ui.FontManager;
|
import net.runelite.client.ui.FontManager;
|
||||||
|
import net.runelite.client.ui.PluginPanel;
|
||||||
import net.runelite.client.ui.components.IconButton;
|
import net.runelite.client.ui.components.IconButton;
|
||||||
import net.runelite.client.ui.components.shadowlabel.JShadowedLabel;
|
import net.runelite.client.ui.components.shadowlabel.JShadowedLabel;
|
||||||
import net.runelite.client.util.ImageUtil;
|
import net.runelite.client.util.ImageUtil;
|
||||||
@@ -97,6 +98,13 @@ public class ClockTabPanel extends TabContentPanel
|
|||||||
rebuild();
|
rebuild();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The max panel width is 225 but the + sign gets cut off at 225 so we set it at 223
|
||||||
|
@Override
|
||||||
|
public Dimension getPreferredSize()
|
||||||
|
{
|
||||||
|
return new Dimension(PluginPanel.PANEL_WIDTH - 2, super.getPreferredSize().height);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears and recreates the components of this panel.
|
* Clears and recreates the components of this panel.
|
||||||
* This should be done whenever a clock is added or removed.
|
* This should be done whenever a clock is added or removed.
|
||||||
@@ -147,7 +155,7 @@ public class ClockTabPanel extends TabContentPanel
|
|||||||
|
|
||||||
JLabel headerLabel = new JLabel(title);
|
JLabel headerLabel = new JLabel(title);
|
||||||
headerLabel.setForeground(Color.WHITE);
|
headerLabel.setForeground(Color.WHITE);
|
||||||
headerLabel.setFont(FontManager.getRunescapeSmallFont());
|
headerLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
panel.add(headerLabel, BorderLayout.CENTER);
|
panel.add(headerLabel, BorderLayout.CENTER);
|
||||||
|
|
||||||
IconButton addButton = new IconButton(ADD_ICON, ADD_ICON_HOVER);
|
IconButton addButton = new IconButton(ADD_ICON, ADD_ICON_HOVER);
|
||||||
@@ -167,7 +175,7 @@ public class ClockTabPanel extends TabContentPanel
|
|||||||
|
|
||||||
JLabel infoLabel = new JShadowedLabel(text);
|
JLabel infoLabel = new JShadowedLabel(text);
|
||||||
infoLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker());
|
infoLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR.darker());
|
||||||
infoLabel.setFont(FontManager.getRunescapeSmallFont());
|
infoLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
panel.add(infoLabel);
|
panel.add(infoLabel);
|
||||||
|
|
||||||
return panel;
|
return panel;
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ class StopwatchPanel extends ClockPanel
|
|||||||
private JLabel createSmallLabel(String text)
|
private JLabel createSmallLabel(String text)
|
||||||
{
|
{
|
||||||
JLabel label = new JLabel(text, SwingConstants.CENTER);
|
JLabel label = new JLabel(text, SwingConstants.CENTER);
|
||||||
label.setFont(FontManager.getRunescapeSmallFont());
|
label.setFont(FontManager.getSmallFont(getFont()));
|
||||||
label.setForeground(LAP_DATA_COLOR);
|
label.setForeground(LAP_DATA_COLOR);
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ public class FarmingTabPanel extends TabContentPanel
|
|||||||
groupLabel.setBorder(new EmptyBorder(15, 0, 0, 0));
|
groupLabel.setBorder(new EmptyBorder(15, 0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
groupLabel.setFont(FontManager.getRunescapeSmallFont());
|
groupLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
add(groupLabel, c);
|
add(groupLabel, c);
|
||||||
c.gridy++;
|
c.gridy++;
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ class WorldTableHeader extends JPanel
|
|||||||
});
|
});
|
||||||
|
|
||||||
textLabel.setText(title);
|
textLabel.setText(title);
|
||||||
textLabel.setFont(FontManager.getRunescapeSmallFont());
|
textLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
final JMenuItem refresh = new JMenuItem("Refresh worlds");
|
final JMenuItem refresh = new JMenuItem("Refresh worlds");
|
||||||
refresh.addActionListener(e ->
|
refresh.addActionListener(e ->
|
||||||
|
|||||||
@@ -271,7 +271,7 @@ class WorldTableRow extends JPanel
|
|||||||
column.setBorder(new EmptyBorder(0, 5, 0, 5));
|
column.setBorder(new EmptyBorder(0, 5, 0, 5));
|
||||||
|
|
||||||
playerCountField = new JLabel(world.getPlayers() + "");
|
playerCountField = new JLabel(world.getPlayers() + "");
|
||||||
playerCountField.setFont(FontManager.getRunescapeSmallFont());
|
playerCountField.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
column.add(playerCountField, BorderLayout.WEST);
|
column.add(playerCountField, BorderLayout.WEST);
|
||||||
|
|
||||||
@@ -300,7 +300,7 @@ class WorldTableRow extends JPanel
|
|||||||
column.setBorder(new EmptyBorder(0, 5, 0, 5));
|
column.setBorder(new EmptyBorder(0, 5, 0, 5));
|
||||||
|
|
||||||
activityField = new JLabel(world.getActivity());
|
activityField = new JLabel(world.getActivity());
|
||||||
activityField.setFont(FontManager.getRunescapeSmallFont());
|
activityField.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
column.add(activityField, BorderLayout.WEST);
|
column.add(activityField, BorderLayout.WEST);
|
||||||
|
|
||||||
|
|||||||
@@ -49,7 +49,8 @@ enum QuestStartLocation
|
|||||||
THE_RESTLESS_GHOST(Quest.THE_RESTLESS_GHOST, new WorldPoint(3240, 3210, 0)),
|
THE_RESTLESS_GHOST(Quest.THE_RESTLESS_GHOST, new WorldPoint(3240, 3210, 0)),
|
||||||
RUNE_MYSTERIES(Quest.RUNE_MYSTERIES, new WorldPoint(3210, 3220, 0)),
|
RUNE_MYSTERIES(Quest.RUNE_MYSTERIES, new WorldPoint(3210, 3220, 0)),
|
||||||
SHEEP_SHEARER(Quest.SHEEP_SHEARER, new WorldPoint(3190, 3272, 0)),
|
SHEEP_SHEARER(Quest.SHEEP_SHEARER, new WorldPoint(3190, 3272, 0)),
|
||||||
SHIELD_OF_ARRAV(Quest.SHIELD_OF_ARRAV, new WorldPoint(3208, 3495, 0)),
|
SHIELD_OF_ARRAV_PHOENIX_GANG(Quest.SHIELD_OF_ARRAV, new WorldPoint(3208, 3495, 0)),
|
||||||
|
SHIELD_OF_ARRAV_BLACK_ARM_GANG(Quest.SHIELD_OF_ARRAV, new WorldPoint(3208, 3392, 0)),
|
||||||
VAMPIRE_SLAYER(Quest.VAMPIRE_SLAYER, new WorldPoint(3096, 3266, 0)),
|
VAMPIRE_SLAYER(Quest.VAMPIRE_SLAYER, new WorldPoint(3096, 3266, 0)),
|
||||||
WITCHS_POTION(Quest.WITCHS_POTION, new WorldPoint(2967, 3203, 0)),
|
WITCHS_POTION(Quest.WITCHS_POTION, new WorldPoint(2967, 3203, 0)),
|
||||||
X_MARKS_THE_SPOT(Quest.X_MARKS_THE_SPOT, new WorldPoint(3227, 3242, 0)),
|
X_MARKS_THE_SPOT(Quest.X_MARKS_THE_SPOT, new WorldPoint(3227, 3242, 0)),
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ public class XpGlobesOverlay extends Overlay
|
|||||||
|
|
||||||
final FontMetrics metrics = graphics.getFontMetrics();
|
final FontMetrics metrics = graphics.getFontMetrics();
|
||||||
int drawX = x + (config.xpOrbSize() / 2) - (metrics.stringWidth(progress) / 2);
|
int drawX = x + (config.xpOrbSize() / 2) - (metrics.stringWidth(progress) / 2);
|
||||||
int drawY = y + (config.xpOrbSize() / 2) + (metrics.getHeight() / 2);
|
int drawY = y + (config.xpOrbSize() / 2) + (metrics.getHeight() / 2) - metrics.getMaxDescent();
|
||||||
|
|
||||||
OverlayUtil.renderTextLocation(graphics, new Point(drawX, drawY), progress, Color.WHITE);
|
OverlayUtil.renderTextLocation(graphics, new Point(drawX, drawY), progress, Color.WHITE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -175,10 +175,10 @@ class XpInfoBox extends JPanel
|
|||||||
statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||||
statsPanel.setBorder(new EmptyBorder(6, 5, 0, 2));
|
statsPanel.setBorder(new EmptyBorder(6, 5, 0, 2));
|
||||||
|
|
||||||
expGained.setFont(FontManager.getRunescapeSmallFont());
|
expGained.setFont(FontManager.getSmallFont(getFont()));
|
||||||
expHour.setFont(FontManager.getRunescapeSmallFont());
|
expHour.setFont(FontManager.getSmallFont(getFont()));
|
||||||
expLeft.setFont(FontManager.getRunescapeSmallFont());
|
expLeft.setFont(FontManager.getSmallFont(getFont()));
|
||||||
actionsLeft.setFont(FontManager.getRunescapeSmallFont());
|
actionsLeft.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
statsPanel.add(expGained);
|
statsPanel.add(expGained);
|
||||||
statsPanel.add(expLeft);
|
statsPanel.add(expLeft);
|
||||||
|
|||||||
@@ -113,8 +113,8 @@ class XpPanel extends PluginPanel
|
|||||||
overallInfo.setLayout(new GridLayout(2, 1));
|
overallInfo.setLayout(new GridLayout(2, 1));
|
||||||
overallInfo.setBorder(new EmptyBorder(0, 10, 0, 0));
|
overallInfo.setBorder(new EmptyBorder(0, 10, 0, 0));
|
||||||
|
|
||||||
overallExpGained.setFont(FontManager.getRunescapeSmallFont());
|
overallExpGained.setFont(FontManager.getSmallFont(getFont()));
|
||||||
overallExpHour.setFont(FontManager.getRunescapeSmallFont());
|
overallExpHour.setFont(FontManager.getSmallFont(getFont()));
|
||||||
|
|
||||||
overallInfo.add(overallExpGained);
|
overallInfo.add(overallExpGained);
|
||||||
overallInfo.add(overallExpHour);
|
overallInfo.add(overallExpHour);
|
||||||
|
|||||||
@@ -24,11 +24,18 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.ui;
|
package net.runelite.client.ui;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableBiMap;
|
||||||
|
import java.awt.Canvas;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.FontFormatException;
|
import java.awt.FontFormatException;
|
||||||
import java.awt.GraphicsEnvironment;
|
import java.awt.GraphicsEnvironment;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import javax.swing.text.StyleContext;
|
import lombok.Getter;
|
||||||
|
import net.runelite.client.config.FontType;
|
||||||
|
|
||||||
public class FontManager
|
public class FontManager
|
||||||
{
|
{
|
||||||
@@ -36,37 +43,59 @@ public class FontManager
|
|||||||
private static final Font runescapeSmallFont;
|
private static final Font runescapeSmallFont;
|
||||||
private static final Font runescapeBoldFont;
|
private static final Font runescapeBoldFont;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static class CachedFont
|
||||||
|
{
|
||||||
|
private final Font reg;
|
||||||
|
private final Font small;
|
||||||
|
private final Font bold;
|
||||||
|
|
||||||
|
private CachedFont(Font f)
|
||||||
|
{
|
||||||
|
reg = f.deriveFont(14.0f);
|
||||||
|
small = getFontOffCorrectSize(f);
|
||||||
|
bold = f.deriveFont(Font.BOLD, 14.0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static final ImmutableBiMap<String, Font> fontMap;
|
||||||
|
private static final HashMap<Font, CachedFont> derivedFontMap = new HashMap<>();
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Font font = Font.createFont(Font.TRUETYPE_FONT,
|
runescapeFont = Font.createFont(Font.TRUETYPE_FONT,
|
||||||
FontManager.class.getResourceAsStream("runescape.ttf"))
|
FontManager.class.getResourceAsStream("runescape.ttf"))
|
||||||
.deriveFont(Font.PLAIN, 16);
|
.deriveFont(Font.PLAIN, 16);
|
||||||
ge.registerFont(font);
|
|
||||||
|
|
||||||
runescapeFont = StyleContext.getDefaultStyleContext()
|
runescapeSmallFont = Font.createFont(Font.TRUETYPE_FONT,
|
||||||
.getFont(font.getName(), Font.PLAIN, 16);
|
|
||||||
ge.registerFont(runescapeFont);
|
|
||||||
|
|
||||||
Font smallFont = Font.createFont(Font.TRUETYPE_FONT,
|
|
||||||
FontManager.class.getResourceAsStream("runescape_small.ttf"))
|
FontManager.class.getResourceAsStream("runescape_small.ttf"))
|
||||||
.deriveFont(Font.PLAIN, 16);
|
.deriveFont(Font.PLAIN, 16);
|
||||||
ge.registerFont(smallFont);
|
|
||||||
|
|
||||||
runescapeSmallFont = StyleContext.getDefaultStyleContext()
|
runescapeBoldFont = Font.createFont(Font.TRUETYPE_FONT,
|
||||||
.getFont(smallFont.getName(), Font.PLAIN, 16);
|
|
||||||
ge.registerFont(runescapeSmallFont);
|
|
||||||
|
|
||||||
Font boldFont = Font.createFont(Font.TRUETYPE_FONT,
|
|
||||||
FontManager.class.getResourceAsStream("runescape_bold.ttf"))
|
FontManager.class.getResourceAsStream("runescape_bold.ttf"))
|
||||||
.deriveFont(Font.PLAIN, 16);
|
.deriveFont(Font.PLAIN, 16);
|
||||||
ge.registerFont(boldFont);
|
|
||||||
|
|
||||||
runescapeBoldFont = StyleContext.getDefaultStyleContext()
|
final LinkedHashMap<String, Font> _fontMap = new LinkedHashMap<>();
|
||||||
.getFont(boldFont.getName(), Font.PLAIN, 16);
|
_fontMap.put("Runescape", runescapeFont);
|
||||||
|
|
||||||
|
// Get all available fonts on the system
|
||||||
|
Font[] availableFonts = ge.getAllFonts();
|
||||||
|
// build bidirectional map
|
||||||
|
Arrays.stream(availableFonts).sorted(Comparator.comparing(Font::getFontName)).forEach(f ->
|
||||||
|
{
|
||||||
|
if (!_fontMap.containsKey(f.getFontName()))
|
||||||
|
{
|
||||||
|
_fontMap.put(f.getFontName(), f);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
fontMap = ImmutableBiMap.copyOf(_fontMap);
|
||||||
|
|
||||||
|
ge.registerFont(runescapeFont);
|
||||||
|
ge.registerFont(runescapeSmallFont);
|
||||||
ge.registerFont(runescapeBoldFont);
|
ge.registerFont(runescapeBoldFont);
|
||||||
}
|
}
|
||||||
catch (FontFormatException ex)
|
catch (FontFormatException ex)
|
||||||
@@ -79,6 +108,25 @@ public class FontManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Font getFontOffCorrectSize(Font f)
|
||||||
|
{
|
||||||
|
// Size of the font is already set
|
||||||
|
if (f.getSize2D() > 1)
|
||||||
|
{
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Dummy canvas for font metrics
|
||||||
|
Canvas c = new Canvas();
|
||||||
|
|
||||||
|
f = f.deriveFont(12f);
|
||||||
|
if (c.getFontMetrics(f).getMaxAscent() > 11)
|
||||||
|
{
|
||||||
|
f = f.deriveFont(11f);
|
||||||
|
}
|
||||||
|
return f;
|
||||||
|
}
|
||||||
|
|
||||||
public static Font getRunescapeFont()
|
public static Font getRunescapeFont()
|
||||||
{
|
{
|
||||||
return runescapeFont;
|
return runescapeFont;
|
||||||
@@ -93,4 +141,93 @@ public class FontManager
|
|||||||
{
|
{
|
||||||
return runescapeBoldFont;
|
return runescapeBoldFont;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static boolean isRunescapeFont(Font f)
|
||||||
|
{
|
||||||
|
return f.equals(runescapeFont) || f.equals(runescapeSmallFont) || f.equals(runescapeBoldFont);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Font getSmallFont(Font f)
|
||||||
|
{
|
||||||
|
if (isRunescapeFont(f))
|
||||||
|
{
|
||||||
|
return runescapeSmallFont;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (derivedFontMap.containsKey(f))
|
||||||
|
{
|
||||||
|
return derivedFontMap.get(f).getSmall();
|
||||||
|
}
|
||||||
|
|
||||||
|
// cache and return
|
||||||
|
CachedFont cachedFont = new CachedFont(f);
|
||||||
|
derivedFontMap.put(f, cachedFont);
|
||||||
|
return cachedFont.getSmall();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Font getFontFromType(Font f, FontType type)
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case SMALL:
|
||||||
|
return getSmallFont(f);
|
||||||
|
case BOLD:
|
||||||
|
if (isRunescapeFont(f))
|
||||||
|
{
|
||||||
|
return runescapeBoldFont;
|
||||||
|
}
|
||||||
|
if (derivedFontMap.containsKey(f))
|
||||||
|
{
|
||||||
|
return derivedFontMap.get(f).getBold();
|
||||||
|
}
|
||||||
|
|
||||||
|
// cache and return
|
||||||
|
CachedFont cachedBoldFont = new CachedFont(f);
|
||||||
|
derivedFontMap.put(f, cachedBoldFont);
|
||||||
|
return cachedBoldFont.getBold();
|
||||||
|
default: //in this case regular
|
||||||
|
if (isRunescapeFont(f))
|
||||||
|
{
|
||||||
|
return runescapeFont;
|
||||||
|
}
|
||||||
|
if (derivedFontMap.containsKey(f))
|
||||||
|
{
|
||||||
|
return derivedFontMap.get(f).getReg();
|
||||||
|
}
|
||||||
|
|
||||||
|
// cache and return
|
||||||
|
CachedFont cachedFont = new CachedFont(f);
|
||||||
|
derivedFontMap.put(f, cachedFont);
|
||||||
|
return cachedFont.getReg();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Font lookupFont(String fontName)
|
||||||
|
{
|
||||||
|
return fontMap.get(fontName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getFontName(Font font)
|
||||||
|
{
|
||||||
|
return fontMap.inverse().get(font);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String[] getAvailableFontNames()
|
||||||
|
{
|
||||||
|
return fontMap.keySet().toArray(new String[fontMap.keySet().size()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isAvailable(Font font)
|
||||||
|
{
|
||||||
|
return fontMap.containsKey(font.getFontName());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Font getFontOrDefault(Font font)
|
||||||
|
{
|
||||||
|
if (font == null || !fontMap.containsKey(font.getFontName()))
|
||||||
|
{
|
||||||
|
return getRunescapeFont();
|
||||||
|
}
|
||||||
|
return getFontOffCorrectSize(font);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -52,7 +52,7 @@ public class PluginErrorPanel extends JPanel
|
|||||||
noResultsTitle.setForeground(Color.WHITE);
|
noResultsTitle.setForeground(Color.WHITE);
|
||||||
noResultsTitle.setHorizontalAlignment(SwingConstants.CENTER);
|
noResultsTitle.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
|
||||||
noResultsDescription.setFont(FontManager.getRunescapeSmallFont());
|
noResultsDescription.setFont(FontManager.getSmallFont(getFont()));
|
||||||
noResultsDescription.setForeground(Color.GRAY);
|
noResultsDescription.setForeground(Color.GRAY);
|
||||||
noResultsDescription.setHorizontalAlignment(SwingConstants.CENTER);
|
noResultsDescription.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
|
||||||
|
|||||||
@@ -69,18 +69,26 @@ public class ProgressBar extends DimmableJPanel
|
|||||||
|
|
||||||
setPreferredSize(new Dimension(100, 16));
|
setPreferredSize(new Dimension(100, 16));
|
||||||
|
|
||||||
leftLabel.setFont(FontManager.getRunescapeSmallFont());
|
int topIndent = 0;
|
||||||
|
if (getFont().equals(FontManager.getRunescapeSmallFont())
|
||||||
|
|| getFont().equals(FontManager.getRunescapeFont())
|
||||||
|
|| getFont().equals(FontManager.getRunescapeBoldFont()))
|
||||||
|
{
|
||||||
|
topIndent = 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
leftLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
leftLabel.setForeground(Color.WHITE);
|
leftLabel.setForeground(Color.WHITE);
|
||||||
leftLabel.setBorder(new EmptyBorder(2, 5, 0, 0));
|
leftLabel.setBorder(new EmptyBorder(topIndent, 5, 0, 0));
|
||||||
|
|
||||||
rightLabel.setFont(FontManager.getRunescapeSmallFont());
|
rightLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
rightLabel.setForeground(Color.WHITE);
|
rightLabel.setForeground(Color.WHITE);
|
||||||
rightLabel.setBorder(new EmptyBorder(2, 0, 0, 5));
|
rightLabel.setBorder(new EmptyBorder(topIndent, 0, 0, 5));
|
||||||
|
|
||||||
centerLabel.setFont(FontManager.getRunescapeSmallFont());
|
centerLabel.setFont(FontManager.getSmallFont(getFont()));
|
||||||
centerLabel.setForeground(Color.WHITE);
|
centerLabel.setForeground(Color.WHITE);
|
||||||
centerLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
centerLabel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
centerLabel.setBorder(new EmptyBorder(2, 0, 0, 0));
|
centerLabel.setBorder(new EmptyBorder(topIndent, 0, 0, 0));
|
||||||
|
|
||||||
// Adds components to be automatically redrawn when paintComponents is called
|
// Adds components to be automatically redrawn when paintComponents is called
|
||||||
add(leftLabel, BorderLayout.WEST);
|
add(leftLabel, BorderLayout.WEST);
|
||||||
|
|||||||
@@ -25,7 +25,11 @@
|
|||||||
package net.runelite.client.ui.components.shadowlabel;
|
package net.runelite.client.ui.components.shadowlabel;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.Toolkit;
|
||||||
|
import java.util.Map;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -61,4 +65,17 @@ public class JShadowedLabel extends JLabel
|
|||||||
revalidate();
|
revalidate();
|
||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void paint(Graphics g)
|
||||||
|
{
|
||||||
|
// Set font rendering properties like the OS's font rendering
|
||||||
|
Toolkit tk = Toolkit.getDefaultToolkit();
|
||||||
|
Map desktopHints = (Map)(tk.getDesktopProperty("awt.font.desktophints"));
|
||||||
|
if (desktopHints != null)
|
||||||
|
{
|
||||||
|
((Graphics2D)g).addRenderingHints(desktopHints);
|
||||||
|
}
|
||||||
|
super.paint(g);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,9 +30,11 @@ import java.awt.Dimension;
|
|||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
|
import java.awt.Toolkit;
|
||||||
import java.awt.event.KeyEvent;
|
import java.awt.event.KeyEvent;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
@@ -53,6 +55,7 @@ import net.runelite.client.input.MouseAdapter;
|
|||||||
import net.runelite.client.input.MouseManager;
|
import net.runelite.client.input.MouseManager;
|
||||||
import net.runelite.client.ui.JagexColors;
|
import net.runelite.client.ui.JagexColors;
|
||||||
import net.runelite.client.util.ColorUtil;
|
import net.runelite.client.util.ColorUtil;
|
||||||
|
import net.runelite.client.ui.FontManager;
|
||||||
import net.runelite.client.util.MiscUtils;
|
import net.runelite.client.util.MiscUtils;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
@@ -165,6 +168,14 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Set font rendering properties like the OS's font rendering
|
||||||
|
Toolkit tk = Toolkit.getDefaultToolkit();
|
||||||
|
Map desktopHints = (Map)(tk.getDesktopProperty("awt.font.desktophints"));
|
||||||
|
if (desktopHints != null)
|
||||||
|
{
|
||||||
|
graphics.addRenderingHints(desktopHints);
|
||||||
|
}
|
||||||
|
|
||||||
if (shouldInvalidateBounds())
|
if (shouldInvalidateBounds())
|
||||||
{
|
{
|
||||||
snapCorners = buildSnapCorners();
|
snapCorners = buildSnapCorners();
|
||||||
@@ -446,15 +457,15 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
|
|||||||
// Set font based on configuration
|
// Set font based on configuration
|
||||||
if (position == OverlayPosition.DYNAMIC || position == OverlayPosition.DETACHED)
|
if (position == OverlayPosition.DYNAMIC || position == OverlayPosition.DETACHED)
|
||||||
{
|
{
|
||||||
subGraphics.setFont(runeLiteConfig.fontType().getFont());
|
subGraphics.setFont(FontManager.getFontFromType(runeLiteConfig.clientFont(), runeLiteConfig.fontType()));
|
||||||
}
|
}
|
||||||
else if (position == OverlayPosition.TOOLTIP)
|
else if (position == OverlayPosition.TOOLTIP)
|
||||||
{
|
{
|
||||||
subGraphics.setFont(runeLiteConfig.tooltipFontType().getFont());
|
subGraphics.setFont(FontManager.getFontFromType(runeLiteConfig.clientFont(), runeLiteConfig.tooltipFontType()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
subGraphics.setFont(runeLiteConfig.interfaceFontType().getFont());
|
subGraphics.setFont(FontManager.getFontFromType(runeLiteConfig.clientFont(), runeLiteConfig.interfaceFontType()));
|
||||||
}
|
}
|
||||||
|
|
||||||
subGraphics.translate(point.x, point.y);
|
subGraphics.translate(point.x, point.y);
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ import net.runelite.client.ui.FontManager;
|
|||||||
@Setter
|
@Setter
|
||||||
public class InfoBoxComponent implements LayoutableRenderableEntity
|
public class InfoBoxComponent implements LayoutableRenderableEntity
|
||||||
{
|
{
|
||||||
private static final int SEPARATOR = 3;
|
private static final int SEPARATOR = 2;
|
||||||
private static final int DEFAULT_SIZE = 32;
|
private static final int DEFAULT_SIZE = 32;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -63,7 +63,14 @@ public class InfoBoxComponent implements LayoutableRenderableEntity
|
|||||||
return new Dimension();
|
return new Dimension();
|
||||||
}
|
}
|
||||||
|
|
||||||
graphics.setFont(getSize() < DEFAULT_SIZE ? FontManager.getRunescapeSmallFont() : FontManager.getRunescapeFont());
|
if (graphics.getFont().equals(FontManager.getRunescapeFont()) && getSize() > DEFAULT_SIZE)
|
||||||
|
{
|
||||||
|
graphics.setFont(FontManager.getRunescapeFont());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
graphics.setFont(FontManager.getSmallFont(graphics.getFont()));
|
||||||
|
}
|
||||||
|
|
||||||
final int baseX = preferredLocation.x;
|
final int baseX = preferredLocation.x;
|
||||||
final int baseY = preferredLocation.y;
|
final int baseY = preferredLocation.y;
|
||||||
@@ -92,7 +99,7 @@ public class InfoBoxComponent implements LayoutableRenderableEntity
|
|||||||
final TextComponent textComponent = new TextComponent();
|
final TextComponent textComponent = new TextComponent();
|
||||||
textComponent.setColor(color);
|
textComponent.setColor(color);
|
||||||
textComponent.setText(text);
|
textComponent.setText(text);
|
||||||
textComponent.setPosition(new Point(baseX + ((size - metrics.stringWidth(text)) / 2), baseY + size - SEPARATOR));
|
textComponent.setPosition(new Point(baseX + ((size - metrics.stringWidth(text)) / 2), baseY + size - metrics.getMaxDescent() - SEPARATOR));
|
||||||
textComponent.render(graphics);
|
textComponent.render(graphics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class LineComponent implements LayoutableRenderableEntity
|
|||||||
|
|
||||||
final FontMetrics metrics = graphics.getFontMetrics();
|
final FontMetrics metrics = graphics.getFontMetrics();
|
||||||
final int baseX = preferredLocation.x;
|
final int baseX = preferredLocation.x;
|
||||||
final int baseY = preferredLocation.y + metrics.getHeight();
|
final int baseY = preferredLocation.y;
|
||||||
int x = baseX;
|
int x = baseX;
|
||||||
int y = baseY;
|
int y = baseY;
|
||||||
final int leftFullWidth = getLineWidth(left, metrics);
|
final int leftFullWidth = getLineWidth(left, metrics);
|
||||||
@@ -92,6 +92,7 @@ public class LineComponent implements LayoutableRenderableEntity
|
|||||||
|
|
||||||
for (int i = 0; i < lineCount; i++)
|
for (int i = 0; i < lineCount; i++)
|
||||||
{
|
{
|
||||||
|
y += metrics.getMaxAscent();
|
||||||
String leftText = "";
|
String leftText = "";
|
||||||
String rightText = "";
|
String rightText = "";
|
||||||
|
|
||||||
@@ -116,7 +117,7 @@ public class LineComponent implements LayoutableRenderableEntity
|
|||||||
rightLineComponent.setText(rightText);
|
rightLineComponent.setText(rightText);
|
||||||
rightLineComponent.setColor(rightColor);
|
rightLineComponent.setColor(rightColor);
|
||||||
rightLineComponent.render(graphics);
|
rightLineComponent.render(graphics);
|
||||||
y += metrics.getHeight();
|
y += metrics.getMaxDescent();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Dimension dimension = new Dimension(preferredSize.width, y - baseY);
|
final Dimension dimension = new Dimension(preferredSize.width, y - baseY);
|
||||||
@@ -124,6 +125,7 @@ public class LineComponent implements LayoutableRenderableEntity
|
|||||||
bounds.setSize(dimension);
|
bounds.setSize(dimension);
|
||||||
return dimension;
|
return dimension;
|
||||||
}
|
}
|
||||||
|
y += metrics.getMaxAscent();
|
||||||
|
|
||||||
final TextComponent leftLineComponent = new TextComponent();
|
final TextComponent leftLineComponent = new TextComponent();
|
||||||
leftLineComponent.setPosition(new Point(x, y));
|
leftLineComponent.setPosition(new Point(x, y));
|
||||||
@@ -136,7 +138,7 @@ public class LineComponent implements LayoutableRenderableEntity
|
|||||||
rightLineComponent.setText(right);
|
rightLineComponent.setText(right);
|
||||||
rightLineComponent.setColor(rightColor);
|
rightLineComponent.setColor(rightColor);
|
||||||
rightLineComponent.render(graphics);
|
rightLineComponent.render(graphics);
|
||||||
y += metrics.getHeight();
|
y += metrics.getMaxDescent();
|
||||||
|
|
||||||
final Dimension dimension = new Dimension(preferredSize.width, y - baseY);
|
final Dimension dimension = new Dimension(preferredSize.width, y - baseY);
|
||||||
bounds.setLocation(preferredLocation);
|
bounds.setLocation(preferredLocation);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public class ProgressBarComponent implements LayoutableRenderableEntity
|
|||||||
final int width = preferredSize.width;
|
final int width = preferredSize.width;
|
||||||
final int height = Math.max(preferredSize.height, 16);
|
final int height = Math.max(preferredSize.height, 16);
|
||||||
final int progressTextX = barX + (width - metrics.stringWidth(textToWrite)) / 2;
|
final int progressTextX = barX + (width - metrics.stringWidth(textToWrite)) / 2;
|
||||||
final int progressTextY = barY + ((height - metrics.getHeight()) / 2) + metrics.getHeight();
|
final int progressTextY = barY + ((height - metrics.getHeight()) / 2) + metrics.getMaxAscent();
|
||||||
final int progressFill = (int) (width * Math.min(1, pc));
|
final int progressFill = (int) (width * Math.min(1, pc));
|
||||||
|
|
||||||
// Draw bar
|
// Draw bar
|
||||||
|
|||||||
@@ -24,11 +24,15 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.ui.overlay.components;
|
package net.runelite.client.ui.overlay.components;
|
||||||
|
|
||||||
|
import java.awt.AlphaComposite;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
import java.awt.Composite;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.awt.Point;
|
import java.awt.Point;
|
||||||
|
import java.awt.Shape;
|
||||||
|
import java.awt.font.GlyphVector;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.runelite.client.ui.overlay.RenderableEntity;
|
import net.runelite.client.ui.overlay.RenderableEntity;
|
||||||
@@ -43,6 +47,7 @@ public class TextComponent implements RenderableEntity
|
|||||||
private String text;
|
private String text;
|
||||||
private Point position = new Point();
|
private Point position = new Point();
|
||||||
private Color color = Color.WHITE;
|
private Color color = Color.WHITE;
|
||||||
|
private Color borderColor = Color.BLACK;
|
||||||
|
|
||||||
public static String textWithoutColTags(String text)
|
public static String textWithoutColTags(String text)
|
||||||
{
|
{
|
||||||
@@ -64,28 +69,43 @@ public class TextComponent implements RenderableEntity
|
|||||||
final String textWithoutCol = textWithoutColTags(textSplitOnCol);
|
final String textWithoutCol = textWithoutColTags(textSplitOnCol);
|
||||||
final String colColor = textSplitOnCol.substring(textSplitOnCol.indexOf("=") + 1, textSplitOnCol.indexOf(">"));
|
final String colColor = textSplitOnCol.substring(textSplitOnCol.indexOf("=") + 1, textSplitOnCol.indexOf(">"));
|
||||||
|
|
||||||
// shadow
|
renderText(graphics, x, position.y, textWithoutCol, Color.decode("#" + colColor), borderColor);
|
||||||
graphics.setColor(Color.BLACK);
|
|
||||||
graphics.drawString(textWithoutCol, x + 1, position.y + 1);
|
|
||||||
|
|
||||||
// actual text
|
|
||||||
graphics.setColor(Color.decode("#" + colColor));
|
|
||||||
graphics.drawString(textWithoutCol, x, position.y);
|
|
||||||
|
|
||||||
x += fontMetrics.stringWidth(textWithoutCol);
|
x += fontMetrics.stringWidth(textWithoutCol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// shadow
|
renderText(graphics, position.x, position.y, text, color, borderColor);
|
||||||
graphics.setColor(Color.BLACK);
|
|
||||||
graphics.drawString(text, position.x + 1, position.y + 1);
|
|
||||||
|
|
||||||
// actual text
|
|
||||||
graphics.setColor(color);
|
|
||||||
graphics.drawString(text, position.x, position.y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Dimension(fontMetrics.stringWidth(text), fontMetrics.getHeight());
|
return new Dimension(fontMetrics.stringWidth(text), fontMetrics.getHeight());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void renderText(Graphics2D graphics, int x, int y, String text, Color color, Color border)
|
||||||
|
{
|
||||||
|
// remember previous composite
|
||||||
|
Composite originalComposite = graphics.getComposite();
|
||||||
|
|
||||||
|
// create a vector of the text
|
||||||
|
GlyphVector vector = graphics.getFont().createGlyphVector(graphics.getFontRenderContext(), text);
|
||||||
|
|
||||||
|
// compute the text shape
|
||||||
|
Shape stroke = vector.getOutline(x + 1, y + 1);
|
||||||
|
Shape shape = vector.getOutline(x, y);
|
||||||
|
|
||||||
|
// draw text border
|
||||||
|
graphics.setColor(border);
|
||||||
|
graphics.fill(stroke);
|
||||||
|
|
||||||
|
// replace the pixels instead of overlaying
|
||||||
|
graphics.setComposite(AlphaComposite.Src);
|
||||||
|
|
||||||
|
// draw actual text
|
||||||
|
graphics.setColor(color);
|
||||||
|
graphics.fill(shape);
|
||||||
|
|
||||||
|
// reset composite to original
|
||||||
|
graphics.setComposite(originalComposite);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class TitleComponent implements LayoutableRenderableEntity
|
|||||||
titleComponent.setColor(color);
|
titleComponent.setColor(color);
|
||||||
titleComponent.setPosition(new Point(
|
titleComponent.setPosition(new Point(
|
||||||
baseX + ((preferredSize.width - metrics.stringWidth(text)) / 2),
|
baseX + ((preferredSize.width - metrics.stringWidth(text)) / 2),
|
||||||
baseY + metrics.getHeight()));
|
baseY + metrics.getMaxAscent()));
|
||||||
final Dimension rendered = titleComponent.render(graphics);
|
final Dimension rendered = titleComponent.render(graphics);
|
||||||
final Dimension dimension = new Dimension(preferredSize.width, rendered.height);
|
final Dimension dimension = new Dimension(preferredSize.width, rendered.height);
|
||||||
bounds.setLocation(preferredLocation);
|
bounds.setLocation(preferredLocation);
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ public class TooltipComponent implements RenderableEntity
|
|||||||
textComponent.setColor(nextColor);
|
textComponent.setColor(nextColor);
|
||||||
String text = line.substring(begin, j);
|
String text = line.substring(begin, j);
|
||||||
textComponent.setText(text);
|
textComponent.setText(text);
|
||||||
textComponent.setPosition(new Point(lineX, textY + (i + 1) * textHeight - textDescent));
|
textComponent.setPosition(new Point(lineX, textY + (i + 1) * metrics.getMaxAscent() + i * metrics.getMaxDescent()));
|
||||||
textComponent.render(graphics);
|
textComponent.render(graphics);
|
||||||
|
|
||||||
lineX += metrics.stringWidth(text);
|
lineX += metrics.stringWidth(text);
|
||||||
@@ -141,7 +141,7 @@ public class TooltipComponent implements RenderableEntity
|
|||||||
textComponent.setColor(nextColor);
|
textComponent.setColor(nextColor);
|
||||||
String text = line.substring(begin, j + 1);
|
String text = line.substring(begin, j + 1);
|
||||||
textComponent.setText(text);
|
textComponent.setText(text);
|
||||||
textComponent.setPosition(new Point(lineX, textY + (i + 1) * textHeight - textDescent));
|
textComponent.setPosition(new Point(lineX, textY + (i + 1) * metrics.getMaxAscent() + i * metrics.getMaxDescent()));
|
||||||
textComponent.render(graphics);
|
textComponent.render(graphics);
|
||||||
|
|
||||||
lineX += metrics.stringWidth(text);
|
lineX += metrics.stringWidth(text);
|
||||||
@@ -155,7 +155,7 @@ public class TooltipComponent implements RenderableEntity
|
|||||||
final TextComponent textComponent = new TextComponent();
|
final TextComponent textComponent = new TextComponent();
|
||||||
textComponent.setColor(nextColor);
|
textComponent.setColor(nextColor);
|
||||||
textComponent.setText(line.substring(begin));
|
textComponent.setText(line.substring(begin));
|
||||||
textComponent.setPosition(new Point(lineX, textY + (i + 1) * textHeight - textDescent));
|
textComponent.setPosition(new Point(lineX, textY + (i + 1) * metrics.getMaxAscent() + i * metrics.getMaxDescent()));
|
||||||
textComponent.render(graphics);
|
textComponent.render(graphics);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ public class WorldMapOverlay extends Overlay
|
|||||||
graphics.setColor(JagexColors.TOOLTIP_BORDER);
|
graphics.setColor(JagexColors.TOOLTIP_BORDER);
|
||||||
graphics.drawRect((int) tooltipRect.getX(), (int) tooltipRect.getY(), (int) tooltipRect.getWidth(), (int) tooltipRect.getHeight());
|
graphics.drawRect((int) tooltipRect.getX(), (int) tooltipRect.getY(), (int) tooltipRect.getWidth(), (int) tooltipRect.getHeight());
|
||||||
graphics.setColor(JagexColors.TOOLTIP_TEXT);
|
graphics.setColor(JagexColors.TOOLTIP_TEXT);
|
||||||
graphics.drawString(tooltip, drawPoint.getX(), drawPoint.getY() + height);
|
graphics.drawString(tooltip, drawPoint.getX(), drawPoint.getY() + fm.getMaxAscent());
|
||||||
}
|
}
|
||||||
|
|
||||||
private Point clipToRectangle(Point drawPoint, Rectangle mapDisplayRectangle)
|
private Point clipToRectangle(Point drawPoint, Rectangle mapDisplayRectangle)
|
||||||
|
|||||||
@@ -309,6 +309,8 @@ public class SwingUtil
|
|||||||
// Use substance look and feel
|
// Use substance look and feel
|
||||||
SwingUtil.setTheme(new SubstanceRuneLiteLookAndFeel());
|
SwingUtil.setTheme(new SubstanceRuneLiteLookAndFeel());
|
||||||
// Use custom UI font
|
// Use custom UI font
|
||||||
|
//TODO : SUPPORT CUSTOM FONT?
|
||||||
|
//SwingUtil.setFont(FontManager.getFontOrDefault(config.clientFont()));
|
||||||
SwingUtil.setFont(FontManager.getRunescapeFont());
|
SwingUtil.setFont(FontManager.getRunescapeFont());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 358 B |
Binary file not shown.
|
After Width: | Height: | Size: 437 B |
1
runelite-client/src/main/scripts/GELayout.hash
Normal file
1
runelite-client/src/main/scripts/GELayout.hash
Normal file
@@ -0,0 +1 @@
|
|||||||
|
03E202EADA91DB0D5EE9B98E360685149F29B10A1C565B9BE65C2A50BD262BC3
|
||||||
101
runelite-client/src/main/scripts/GELayout.rs2asm
Normal file
101
runelite-client/src/main/scripts/GELayout.rs2asm
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
.id 806
|
||||||
|
.int_stack_count 7
|
||||||
|
.string_stack_count 0
|
||||||
|
.int_var_count 9
|
||||||
|
.string_var_count 0
|
||||||
|
iload 6
|
||||||
|
invoke 41
|
||||||
|
get_varbit 4439
|
||||||
|
iconst 1
|
||||||
|
sub
|
||||||
|
istore 7
|
||||||
|
iconst 105
|
||||||
|
iconst 118
|
||||||
|
iconst 150
|
||||||
|
iload 7
|
||||||
|
enum
|
||||||
|
istore 8
|
||||||
|
iload 8
|
||||||
|
iconst -1
|
||||||
|
if_icmpeq LABEL16
|
||||||
|
jump LABEL37
|
||||||
|
LABEL16:
|
||||||
|
iconst 1
|
||||||
|
iload 2
|
||||||
|
if_sethide
|
||||||
|
iconst 0
|
||||||
|
iload 3
|
||||||
|
if_sethide
|
||||||
|
iconst 1
|
||||||
|
iload 4
|
||||||
|
if_sethide
|
||||||
|
iconst 1
|
||||||
|
iload 5
|
||||||
|
if_sethide
|
||||||
|
iload 0
|
||||||
|
iload 1
|
||||||
|
cc_find
|
||||||
|
iconst 1
|
||||||
|
if_icmpeq LABEL34
|
||||||
|
jump LABEL36
|
||||||
|
LABEL34:
|
||||||
|
sconst "Grand Exchange"
|
||||||
|
sconst "setGETitle" ;
|
||||||
|
runelite_callback ;
|
||||||
|
cc_settext
|
||||||
|
LABEL36:
|
||||||
|
return
|
||||||
|
LABEL37:
|
||||||
|
iconst 0
|
||||||
|
iload 2
|
||||||
|
if_sethide
|
||||||
|
iconst 0
|
||||||
|
iload 2
|
||||||
|
if_settrans
|
||||||
|
iload 7
|
||||||
|
stockmarket_isofferempty
|
||||||
|
iconst 1
|
||||||
|
if_icmpeq LABEL48
|
||||||
|
jump LABEL66
|
||||||
|
LABEL48:
|
||||||
|
iconst 1
|
||||||
|
iload 3
|
||||||
|
if_sethide
|
||||||
|
iconst 1
|
||||||
|
iload 4
|
||||||
|
if_sethide
|
||||||
|
iconst 0
|
||||||
|
iload 5
|
||||||
|
if_sethide
|
||||||
|
iload 0
|
||||||
|
iload 1
|
||||||
|
cc_find
|
||||||
|
iconst 1
|
||||||
|
if_icmpeq LABEL63
|
||||||
|
jump LABEL65
|
||||||
|
LABEL63:
|
||||||
|
sconst "Grand Exchange: Set up offer"
|
||||||
|
cc_settext
|
||||||
|
LABEL65:
|
||||||
|
return
|
||||||
|
LABEL66:
|
||||||
|
iconst 1
|
||||||
|
iload 3
|
||||||
|
if_sethide
|
||||||
|
iconst 0
|
||||||
|
iload 4
|
||||||
|
if_sethide
|
||||||
|
iconst 1
|
||||||
|
iload 5
|
||||||
|
if_sethide
|
||||||
|
iload 0
|
||||||
|
iload 1
|
||||||
|
cc_find
|
||||||
|
iconst 1
|
||||||
|
if_icmpeq LABEL81
|
||||||
|
jump LABEL83
|
||||||
|
LABEL81:
|
||||||
|
sconst "Grand Exchange: Offer status"
|
||||||
|
cc_settext
|
||||||
|
LABEL83:
|
||||||
|
return
|
||||||
@@ -1,259 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, Jordan Atwood <nightfirecat@protonmail.com>
|
|
||||||
* 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.cluescrolls.clues.hotcold;
|
|
||||||
|
|
||||||
import com.google.common.collect.Sets;
|
|
||||||
import java.awt.Rectangle;
|
|
||||||
import java.util.EnumSet;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import static junit.framework.TestCase.assertTrue;
|
|
||||||
import net.runelite.api.coords.WorldPoint;
|
|
||||||
import static net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdSolver.isFirstPointCloser;
|
|
||||||
import static net.runelite.client.plugins.cluescrolls.clues.hotcold.HotColdSolver.isFirstPointCloserRect;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertFalse;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class HotColdSolverTest
|
|
||||||
{
|
|
||||||
private static final String RESPONSE_TEXT_ICE_COLD_COLDER = "The device is ice cold, but colder than last time.";
|
|
||||||
private static final String RESPONSE_TEXT_VERY_COLD_WARMER = "The device is very cold, and warmer than last time.";
|
|
||||||
private static final String RESPONSE_TEXT_COLD = "The device is cold.";
|
|
||||||
private static final String RESPONSE_TEXT_COLD_COLDER = "The device is cold, but colder than last time.";
|
|
||||||
private static final String RESPONSE_TEXT_COLD_WARMER = "The device is cold, and warmer than last time.";
|
|
||||||
private static final String RESPONSE_TEXT_COLD_SAME_TEMP = "The device is cold, and the same temperature as last time.";
|
|
||||||
private static final String RESPONSE_TEXT_VERY_HOT = "The device is very hot.";
|
|
||||||
private static final String RESPONSE_TEXT_VERY_HOT_COLDER = "The device is very hot, but colder than last time.";
|
|
||||||
private static final String RESPONSE_TEXT_VERY_HOT_WARMER = "The device is very hot, and warmer than last time.";
|
|
||||||
private static final String RESPONSE_TEXT_VERY_HOT_SAME_TEMP = "The device is very hot, and the same temperature as last time.";
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testOneStepSolution()
|
|
||||||
{
|
|
||||||
final Set<HotColdLocation> foundLocation = Sets.immutableEnumSet(HotColdLocation.KARAMJA_KHARAZI_NE);
|
|
||||||
|
|
||||||
testSolver(createHotColdSolver(), new WorldPoint(2852, 2992, 0), RESPONSE_TEXT_VERY_HOT, foundLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testIgnoreStartingTemperatureDifference()
|
|
||||||
{
|
|
||||||
final WorldPoint testedPoint = new WorldPoint(2852, 2992, 0);
|
|
||||||
final Set<HotColdLocation> foundLocations = Sets.immutableEnumSet(HotColdLocation.KARAMJA_KHARAZI_NE);
|
|
||||||
|
|
||||||
testSolver(createHotColdSolver(), testedPoint, RESPONSE_TEXT_VERY_HOT, foundLocations);
|
|
||||||
testSolver(createHotColdSolver(), testedPoint, RESPONSE_TEXT_VERY_HOT_COLDER, foundLocations);
|
|
||||||
testSolver(createHotColdSolver(), testedPoint, RESPONSE_TEXT_VERY_HOT_WARMER, foundLocations);
|
|
||||||
testSolver(createHotColdSolver(), testedPoint, RESPONSE_TEXT_VERY_HOT_SAME_TEMP, foundLocations);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSameTempNoChanges()
|
|
||||||
{
|
|
||||||
final HotColdSolver solver = createHotColdSolver();
|
|
||||||
final WorldPoint testedPoint = new WorldPoint(2851, 2955, 0);
|
|
||||||
final Set<HotColdLocation> foundLocations = Sets.immutableEnumSet(
|
|
||||||
HotColdLocation.KARAMJA_KHARAZI_NE,
|
|
||||||
HotColdLocation.KARAMJA_KHARAZI_SW);
|
|
||||||
|
|
||||||
testSolver(solver, testedPoint, RESPONSE_TEXT_VERY_HOT, foundLocations);
|
|
||||||
testSolver(solver, testedPoint, RESPONSE_TEXT_VERY_HOT_SAME_TEMP, foundLocations);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testNoChangesAfterSolutionFound()
|
|
||||||
{
|
|
||||||
final HotColdSolver solver = createHotColdSolver();
|
|
||||||
final Set<HotColdLocation> intermediateFoundLocations = Sets.immutableEnumSet(
|
|
||||||
HotColdLocation.KARAMJA_KHARAZI_NE,
|
|
||||||
HotColdLocation.KARAMJA_KHARAZI_SW);
|
|
||||||
final Set<HotColdLocation> finalLocation = Sets.immutableEnumSet(HotColdLocation.KARAMJA_KHARAZI_NE);
|
|
||||||
|
|
||||||
testSolver(solver, new WorldPoint(2851, 2955, 0), RESPONSE_TEXT_VERY_HOT, intermediateFoundLocations);
|
|
||||||
testSolver(solver, new WorldPoint(2852, 2955, 0), RESPONSE_TEXT_VERY_HOT_WARMER, finalLocation);
|
|
||||||
testSolver(solver, new WorldPoint(2851, 2955, 0), RESPONSE_TEXT_VERY_HOT_COLDER, finalLocation);
|
|
||||||
testSolver(solver, new WorldPoint(2465, 3495, 0), RESPONSE_TEXT_ICE_COLD_COLDER, finalLocation);
|
|
||||||
testSolver(solver, new WorldPoint(3056, 3291, 0), RESPONSE_TEXT_VERY_COLD_WARMER, finalLocation);
|
|
||||||
testSolver(solver, new WorldPoint(2571, 2956, 0), RESPONSE_TEXT_VERY_COLD_WARMER, finalLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testNarrowToFindSolutions()
|
|
||||||
{
|
|
||||||
final HotColdSolver solver = createHotColdSolver();
|
|
||||||
final Set<HotColdLocation> firstLocationsSet = Sets.immutableEnumSet(
|
|
||||||
HotColdLocation.FELDIP_HILLS_GNOME_GLITER,
|
|
||||||
HotColdLocation.FELDIP_HILLS_RED_CHIN,
|
|
||||||
HotColdLocation.KARAMJA_KHARAZI_NE,
|
|
||||||
HotColdLocation.KARAMJA_CRASH_ISLAND);
|
|
||||||
final Set<HotColdLocation> secondLocationsSet = firstLocationsSet.stream()
|
|
||||||
.filter(location -> location != HotColdLocation.FELDIP_HILLS_RED_CHIN)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
final Set<HotColdLocation> thirdLocationSet = secondLocationsSet.stream()
|
|
||||||
.filter(location -> location != HotColdLocation.FELDIP_HILLS_GNOME_GLITER)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
final Set<HotColdLocation> finalLocation = thirdLocationSet.stream()
|
|
||||||
.filter(location -> location != HotColdLocation.KARAMJA_CRASH_ISLAND)
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
|
|
||||||
testSolver(solver, new WorldPoint(2711, 2803, 0), RESPONSE_TEXT_COLD, firstLocationsSet);
|
|
||||||
testSolver(solver, new WorldPoint(2711, 2802, 0), RESPONSE_TEXT_COLD_SAME_TEMP, firstLocationsSet);
|
|
||||||
testSolver(solver, new WorldPoint(2716, 2802, 0), RESPONSE_TEXT_COLD_WARMER, secondLocationsSet);
|
|
||||||
testSolver(solver, new WorldPoint(2739, 2808, 0), RESPONSE_TEXT_COLD_WARMER, thirdLocationSet);
|
|
||||||
testSolver(solver, new WorldPoint(2810, 2757, 0), RESPONSE_TEXT_COLD_COLDER, finalLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testSomewhatDistantLocations()
|
|
||||||
{
|
|
||||||
// Activate device on Ape Atoll when solution point is HotColdLocation.KARAMJA_KHARAZI_NE
|
|
||||||
testSolver(createHotColdSolver(), new WorldPoint(2723, 2743, 0), RESPONSE_TEXT_COLD,
|
|
||||||
Sets.immutableEnumSet(
|
|
||||||
HotColdLocation.KARAMJA_KHARAZI_NE,
|
|
||||||
HotColdLocation.KARAMJA_KHARAZI_SW,
|
|
||||||
HotColdLocation.KARAMJA_CRASH_ISLAND,
|
|
||||||
HotColdLocation.FELDIP_HILLS_SW,
|
|
||||||
HotColdLocation.FELDIP_HILLS_RANTZ,
|
|
||||||
HotColdLocation.FELDIP_HILLS_RED_CHIN,
|
|
||||||
HotColdLocation.FELDIP_HILLS_SE));
|
|
||||||
|
|
||||||
// Activate device near fairy ring DKP when solution point is HotColdLocation.KARAMJA_KHARAZI_NE
|
|
||||||
testSolver(createHotColdSolver(), new WorldPoint(2900, 3111, 0), RESPONSE_TEXT_COLD,
|
|
||||||
Sets.immutableEnumSet(
|
|
||||||
HotColdLocation.KARAMJA_WEST_BRIMHAVEN,
|
|
||||||
HotColdLocation.KARAMJA_KHARAZI_NE,
|
|
||||||
HotColdLocation.ASGARNIA_COW,
|
|
||||||
HotColdLocation.ASGARNIA_CRAFT_GUILD,
|
|
||||||
HotColdLocation.KANDARIN_WITCHHAVEN,
|
|
||||||
HotColdLocation.MISTHALIN_DRAYNOR_BANK));
|
|
||||||
|
|
||||||
// Activate device on Mudskipper Point when solution point is HotColdLocation.KARAMJA_KHARAZI_NE
|
|
||||||
testSolver(createHotColdSolver(), new WorldPoint(2985, 3106, 0), RESPONSE_TEXT_COLD,
|
|
||||||
Sets.immutableEnumSet(
|
|
||||||
HotColdLocation.KARAMJA_BRIMHAVEN_FRUIT_TREE,
|
|
||||||
HotColdLocation.KARAMJA_KHARAZI_NE,
|
|
||||||
HotColdLocation.ASGARNIA_COW,
|
|
||||||
HotColdLocation.ASGARNIA_CRAFT_GUILD,
|
|
||||||
HotColdLocation.MISTHALIN_LUMBRIDGE_2,
|
|
||||||
HotColdLocation.DESERT_BEDABIN_CAMP));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testIsFirstPointCloserRect()
|
|
||||||
{
|
|
||||||
assertFalse(isFirstPointCloserRect(new WorldPoint(0, 0, 0), new WorldPoint(0, 0, 0), new Rectangle(0, 0, 1, 1)));
|
|
||||||
assertFalse(isFirstPointCloserRect(new WorldPoint(1, 0, 0), new WorldPoint(5, 0, 0), new Rectangle(2, 1, 5, 5)));
|
|
||||||
assertFalse(isFirstPointCloserRect(new WorldPoint(1, 0, 0), new WorldPoint(0, 0, 0), new Rectangle(2, 0, 1, 2)));
|
|
||||||
assertFalse(isFirstPointCloserRect(new WorldPoint(0, 0, 0), new WorldPoint(1, 1, 1), new Rectangle(2, 2, 2, 2)));
|
|
||||||
assertFalse(isFirstPointCloserRect(new WorldPoint(0, 0, 0), new WorldPoint(4, 4, 4), new Rectangle(1, 1, 2, 2)));
|
|
||||||
assertFalse(isFirstPointCloserRect(new WorldPoint(3, 2, 0), new WorldPoint(1, 5, 0), new Rectangle(0, 0, 4, 4)));
|
|
||||||
|
|
||||||
assertTrue(isFirstPointCloserRect(new WorldPoint(1, 1, 0), new WorldPoint(0, 1, 0), new Rectangle(2, 0, 3, 2)));
|
|
||||||
assertTrue(isFirstPointCloserRect(new WorldPoint(4, 4, 0), new WorldPoint(1, 1, 0), new Rectangle(3, 3, 2, 2)));
|
|
||||||
assertTrue(isFirstPointCloserRect(new WorldPoint(3, 2, 0), new WorldPoint(7, 0, 0), new Rectangle(1, 3, 4, 2)));
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testIsFirstPointCloser()
|
|
||||||
{
|
|
||||||
assertFalse(isFirstPointCloser(new WorldPoint(0, 0, 0), new WorldPoint(0, 0, 0), new WorldPoint(0, 0, 0)));
|
|
||||||
assertFalse(isFirstPointCloser(new WorldPoint(0, 0, 0), new WorldPoint(0, 0, 1), new WorldPoint(0, 0, 0)));
|
|
||||||
assertFalse(isFirstPointCloser(new WorldPoint(1, 0, 0), new WorldPoint(0, 0, 0), new WorldPoint(1, 1, 0)));
|
|
||||||
assertFalse(isFirstPointCloser(new WorldPoint(2, 2, 0), new WorldPoint(0, 0, 0), new WorldPoint(1, 1, 0)));
|
|
||||||
|
|
||||||
assertTrue(isFirstPointCloser(new WorldPoint(1, 0, 0), new WorldPoint(0, 0, 0), new WorldPoint(2, 0, 0)));
|
|
||||||
assertTrue(isFirstPointCloser(new WorldPoint(1, 1, 0), new WorldPoint(1, 0, 0), new WorldPoint(2, 2, 0)));
|
|
||||||
assertTrue(isFirstPointCloser(new WorldPoint(1, 1, 1), new WorldPoint(0, 1, 0), new WorldPoint(1, 1, 0)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Tests a hot-cold solver by signalling a test point, temperature, and temperature change to it and asserting the
|
|
||||||
* resulting possible location set is equal to that of a given set of expected locations.
|
|
||||||
*
|
|
||||||
* @param solver The hot-cold solver to signal to.
|
|
||||||
* <br>
|
|
||||||
* Note: This will mutate the passed solver, which is helpful for testing
|
|
||||||
* multiple sequential steps.
|
|
||||||
* @param testPoint The {@link WorldPoint} where the signal occurs.
|
|
||||||
* @param deviceResponse The string containing the temperature and temperature change which is
|
|
||||||
* given when the hot-cold checking device is activated.
|
|
||||||
* @param expectedRemainingPossibleLocations A {@link Set} of {@link HotColdLocation}s which is expected to be
|
|
||||||
* given by {@link HotColdSolver#getPossibleLocations()} after it receives
|
|
||||||
* the signal formed by the other given arguments.
|
|
||||||
*/
|
|
||||||
private static void testSolver(final HotColdSolver solver, final WorldPoint testPoint, final String deviceResponse, final Set<HotColdLocation> expectedRemainingPossibleLocations)
|
|
||||||
{
|
|
||||||
final HotColdTemperature temperature = HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, deviceResponse);
|
|
||||||
final HotColdTemperatureChange temperatureChange = HotColdTemperatureChange.of(deviceResponse);
|
|
||||||
|
|
||||||
assertNotNull(temperature);
|
|
||||||
assertEquals(expectedRemainingPossibleLocations, solver.signal(testPoint, temperature, temperatureChange));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return A hot-cold solver with a starting set of master hot-cold locations nearby the KARAMJA_KHARAZI_NE
|
|
||||||
* location. {@link HotColdLocation#values()} is not used as it may change with future game updates, and
|
|
||||||
* such changes would break this test suite.
|
|
||||||
*/
|
|
||||||
private static HotColdSolver createHotColdSolver()
|
|
||||||
{
|
|
||||||
final Set<HotColdLocation> hotColdLocations = EnumSet.of(
|
|
||||||
HotColdLocation.KARAMJA_KHARAZI_NE,
|
|
||||||
HotColdLocation.KARAMJA_KHARAZI_SW,
|
|
||||||
HotColdLocation.KARAMJA_GLIDER,
|
|
||||||
HotColdLocation.KARAMJA_MUSA_POINT,
|
|
||||||
HotColdLocation.KARAMJA_BRIMHAVEN_FRUIT_TREE,
|
|
||||||
HotColdLocation.KARAMJA_WEST_BRIMHAVEN,
|
|
||||||
HotColdLocation.KARAMJA_CRASH_ISLAND,
|
|
||||||
HotColdLocation.DESERT_BEDABIN_CAMP,
|
|
||||||
HotColdLocation.DESERT_MENAPHOS_GATE,
|
|
||||||
HotColdLocation.DESERT_POLLNIVNEACH,
|
|
||||||
HotColdLocation.DESERT_SHANTY,
|
|
||||||
HotColdLocation.MISTHALIN_LUMBRIDGE,
|
|
||||||
HotColdLocation.MISTHALIN_LUMBRIDGE_2,
|
|
||||||
HotColdLocation.MISTHALIN_DRAYNOR_BANK,
|
|
||||||
HotColdLocation.ASGARNIA_COW,
|
|
||||||
HotColdLocation.ASGARNIA_PARTY_ROOM,
|
|
||||||
HotColdLocation.ASGARNIA_CRAFT_GUILD,
|
|
||||||
HotColdLocation.ASGARNIA_RIMMINGTON,
|
|
||||||
HotColdLocation.ASGARNIA_MUDSKIPPER,
|
|
||||||
HotColdLocation.KANDARIN_WITCHHAVEN,
|
|
||||||
HotColdLocation.KANDARIN_NECRO_TOWER,
|
|
||||||
HotColdLocation.KANDARIN_FIGHT_ARENA,
|
|
||||||
HotColdLocation.KANDARIN_TREE_GNOME_VILLAGE,
|
|
||||||
HotColdLocation.FELDIP_HILLS_GNOME_GLITER,
|
|
||||||
HotColdLocation.FELDIP_HILLS_JIGGIG,
|
|
||||||
HotColdLocation.FELDIP_HILLS_RANTZ,
|
|
||||||
HotColdLocation.FELDIP_HILLS_RED_CHIN,
|
|
||||||
HotColdLocation.FELDIP_HILLS_SE,
|
|
||||||
HotColdLocation.FELDIP_HILLS_SOUTH,
|
|
||||||
HotColdLocation.FELDIP_HILLS_SW
|
|
||||||
);
|
|
||||||
return new HotColdSolver(hotColdLocations);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, Jordan Atwood <nightfirecat@protonmail.com>
|
|
||||||
* 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.cluescrolls.clues.hotcold;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertNull;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class HotColdTemperatureChangeTest
|
|
||||||
{
|
|
||||||
private static final String[] VALID_MESSAGES = {
|
|
||||||
"The device is warm, and warmer than last time.",
|
|
||||||
"The device is cold, but colder than last time.",
|
|
||||||
"The device is very hot, and the same temperature as last time.",
|
|
||||||
};
|
|
||||||
private static final String[] INVALID_MESSAGES = {
|
|
||||||
"The device is cold.",
|
|
||||||
"The device is ice cold.",
|
|
||||||
"The device is very cold.",
|
|
||||||
"The device is hot.",
|
|
||||||
"The device is incredibly hot.",
|
|
||||||
"The device is an octopus, and is wetter than last time",
|
|
||||||
"foobar",
|
|
||||||
"a q p w",
|
|
||||||
"My feet are cold, I should put them in some lukewarm water, or run hot water over them.",
|
|
||||||
"and warmer than and colder than and the same temperature",
|
|
||||||
};
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testValidTemperatureChangeMessages()
|
|
||||||
{
|
|
||||||
for (final String message : VALID_MESSAGES)
|
|
||||||
{
|
|
||||||
assertNotNull(message, HotColdTemperatureChange.of(message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testInvalidTemperatureChangeMessages()
|
|
||||||
{
|
|
||||||
for (final String message : INVALID_MESSAGES)
|
|
||||||
{
|
|
||||||
assertNull(message, HotColdTemperatureChange.of(message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, Jordan Atwood <nightfirecat@protonmail.com>
|
|
||||||
* 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.cluescrolls.clues.hotcold;
|
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
import static org.junit.Assert.assertNull;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class HotColdTemperatureTest
|
|
||||||
{
|
|
||||||
private static final String[] VALID_MESSAGES = {
|
|
||||||
"The device is warm, and warmer than last time.",
|
|
||||||
"The device is visibly shaking and burns to the touch. This must be the spot.",
|
|
||||||
"The device is cold.",
|
|
||||||
"The device is ice cold.",
|
|
||||||
"The device is very cold.",
|
|
||||||
"The device is hot.",
|
|
||||||
"The device is incredibly hot.",
|
|
||||||
};
|
|
||||||
private static final String[] INVALID_MESSAGES = {
|
|
||||||
"The device is an octopus, and is wetter than last time.",
|
|
||||||
"foobar",
|
|
||||||
"a q p w",
|
|
||||||
"My feet are cold, I should put them in some lukewarm water, or run hot water over them.",
|
|
||||||
};
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testValidTemperatureMessages()
|
|
||||||
{
|
|
||||||
for (final String message : VALID_MESSAGES)
|
|
||||||
{
|
|
||||||
assertNotNull(message, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES, message));
|
|
||||||
assertNotNull(message, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testInvalidTemperatureMessages()
|
|
||||||
{
|
|
||||||
for (final String message : INVALID_MESSAGES)
|
|
||||||
{
|
|
||||||
assertNull(message, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.BEGINNER_HOT_COLD_TEMPERATURES, message));
|
|
||||||
assertNull(message, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, message));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testAmbiguousTemperatureMessages()
|
|
||||||
{
|
|
||||||
assertEquals(HotColdTemperature.ICE_COLD, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, "The device is ice cold."));
|
|
||||||
assertEquals(HotColdTemperature.VERY_COLD, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, "The device is very cold."));
|
|
||||||
assertEquals(HotColdTemperature.VERY_HOT, HotColdTemperature.getFromTemperatureSet(HotColdTemperature.MASTER_HOT_COLD_TEMPERATURES, "The device is very hot."));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019, Jordan Atwood <nightfirecat@protonmail.com>
|
|
||||||
* 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.cluescrolls.clues.hotcold;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
import static org.junit.Assert.assertEquals;
|
|
||||||
import org.junit.Test;
|
|
||||||
|
|
||||||
public class MasterHotColdLocationTest
|
|
||||||
{
|
|
||||||
private static final Set<HotColdLocation> MASTER_HOT_COLD_LOCATIONS = Arrays.stream(HotColdLocation.values())
|
|
||||||
.filter(l -> !l.isBeginnerClue())
|
|
||||||
.collect(Collectors.toSet());
|
|
||||||
private static final int EXPECTED_DIMENSION_SIZE = 9;
|
|
||||||
|
|
||||||
@Test
|
|
||||||
public void beginnerHotColdLocationAreaTest()
|
|
||||||
{
|
|
||||||
for (final HotColdLocation location : MASTER_HOT_COLD_LOCATIONS)
|
|
||||||
{
|
|
||||||
assertEquals(EXPECTED_DIMENSION_SIZE, location.getRect().height);
|
|
||||||
assertEquals(EXPECTED_DIMENSION_SIZE, location.getRect().width);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,140 @@
|
|||||||
|
/*
|
||||||
|
* 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.timers;
|
||||||
|
|
||||||
|
import com.google.inject.Guice;
|
||||||
|
import com.google.inject.Inject;
|
||||||
|
import com.google.inject.testing.fieldbinder.Bind;
|
||||||
|
import com.google.inject.testing.fieldbinder.BoundFieldModule;
|
||||||
|
import java.util.EnumSet;
|
||||||
|
import net.runelite.api.ChatMessageType;
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.WorldType;
|
||||||
|
import net.runelite.api.events.ChatMessage;
|
||||||
|
import net.runelite.client.game.ItemManager;
|
||||||
|
import net.runelite.client.game.SpriteManager;
|
||||||
|
import net.runelite.client.ui.overlay.infobox.InfoBox;
|
||||||
|
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.mockito.ArgumentCaptor;
|
||||||
|
import org.mockito.Mock;
|
||||||
|
import static org.mockito.Mockito.verify;
|
||||||
|
import static org.mockito.Mockito.when;
|
||||||
|
import org.mockito.runners.MockitoJUnitRunner;
|
||||||
|
|
||||||
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
|
public class TimersPluginTest
|
||||||
|
{
|
||||||
|
private static final String DMM_HALF_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you by Runelite. It will expire in 1 minute, 15 seconds.</col>";
|
||||||
|
private static final String FULL_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you by Runelite. It will expire in 5 minutes, 0 seconds.</col>";
|
||||||
|
private static final String HALF_TELEBLOCK_MESSAGE = "<col=4f006f>A Tele Block spell has been cast on you by Runelite. It will expire in 2 minutes, 30 seconds.</col>";
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private TimersPlugin timersPlugin;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private TimersConfig timersConfig;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private Client client;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private ItemManager itemManager;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private SpriteManager spriteManager;
|
||||||
|
|
||||||
|
@Mock
|
||||||
|
@Bind
|
||||||
|
private InfoBoxManager infoBoxManager;
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void before()
|
||||||
|
{
|
||||||
|
Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testHalfTeleblock()
|
||||||
|
{
|
||||||
|
when(timersConfig.showTeleblock()).thenReturn(true);
|
||||||
|
when(client.getWorldType()).thenReturn(EnumSet.of(WorldType.MEMBERS));
|
||||||
|
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", HALF_TELEBLOCK_MESSAGE, "", 0);
|
||||||
|
timersPlugin.onChatMessage(chatMessage);
|
||||||
|
|
||||||
|
ArgumentCaptor<InfoBox> captor = ArgumentCaptor.forClass(InfoBox.class);
|
||||||
|
verify(infoBoxManager).addInfoBox(captor.capture());
|
||||||
|
TimerTimer infoBox = (TimerTimer) captor.getValue();
|
||||||
|
assertEquals(GameTimer.HALFTB, infoBox.getTimer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testFullTeleblock()
|
||||||
|
{
|
||||||
|
when(timersConfig.showTeleblock()).thenReturn(true);
|
||||||
|
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", FULL_TELEBLOCK_MESSAGE, "", 0);
|
||||||
|
timersPlugin.onChatMessage(chatMessage);
|
||||||
|
|
||||||
|
ArgumentCaptor<InfoBox> captor = ArgumentCaptor.forClass(InfoBox.class);
|
||||||
|
verify(infoBoxManager).addInfoBox(captor.capture());
|
||||||
|
TimerTimer infoBox = (TimerTimer) captor.getValue();
|
||||||
|
assertEquals(GameTimer.FULLTB, infoBox.getTimer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDmmHalfTb()
|
||||||
|
{
|
||||||
|
when(timersConfig.showTeleblock()).thenReturn(true);
|
||||||
|
when(client.getWorldType()).thenReturn(EnumSet.of(WorldType.DEADMAN));
|
||||||
|
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", DMM_HALF_TELEBLOCK_MESSAGE, "", 0);
|
||||||
|
timersPlugin.onChatMessage(chatMessage);
|
||||||
|
|
||||||
|
ArgumentCaptor<InfoBox> captor = ArgumentCaptor.forClass(InfoBox.class);
|
||||||
|
verify(infoBoxManager).addInfoBox(captor.capture());
|
||||||
|
TimerTimer infoBox = (TimerTimer) captor.getValue();
|
||||||
|
assertEquals(GameTimer.DMM_HALFTB, infoBox.getTimer());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testDmmFullTb()
|
||||||
|
{
|
||||||
|
when(timersConfig.showTeleblock()).thenReturn(true);
|
||||||
|
when(client.getWorldType()).thenReturn(EnumSet.of(WorldType.DEADMAN));
|
||||||
|
ChatMessage chatMessage = new ChatMessage(null, ChatMessageType.SPAM, "", HALF_TELEBLOCK_MESSAGE, "", 0);
|
||||||
|
timersPlugin.onChatMessage(chatMessage);
|
||||||
|
|
||||||
|
ArgumentCaptor<InfoBox> captor = ArgumentCaptor.forClass(InfoBox.class);
|
||||||
|
verify(infoBoxManager).addInfoBox(captor.capture());
|
||||||
|
TimerTimer infoBox = (TimerTimer) captor.getValue();
|
||||||
|
assertEquals(GameTimer.DMM_FULLTB, infoBox.getTimer());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,31 +25,22 @@
|
|||||||
package net.runelite.client.ui.overlay.components;
|
package net.runelite.client.ui.overlay.components;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.FontMetrics;
|
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import static org.mockito.Matchers.anyInt;
|
|
||||||
import static org.mockito.Matchers.eq;
|
|
||||||
import org.mockito.Mock;
|
|
||||||
import static org.mockito.Mockito.atLeastOnce;
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
import static org.mockito.Mockito.times;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
|
||||||
public class TextComponentTest
|
public class TextComponentTest
|
||||||
{
|
{
|
||||||
@Mock
|
|
||||||
private Graphics2D graphics;
|
private Graphics2D graphics;
|
||||||
|
private BufferedImage dest;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before()
|
public void before()
|
||||||
{
|
{
|
||||||
when(graphics.getFontMetrics()).thenReturn(mock(FontMetrics.class));
|
dest = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
|
||||||
|
graphics = (Graphics2D) dest.getGraphics();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -59,8 +50,6 @@ public class TextComponentTest
|
|||||||
textComponent.setText("test");
|
textComponent.setText("test");
|
||||||
textComponent.setColor(Color.RED);
|
textComponent.setColor(Color.RED);
|
||||||
textComponent.render(graphics);
|
textComponent.render(graphics);
|
||||||
verify(graphics, times(2)).drawString(eq("test"), anyInt(), anyInt());
|
|
||||||
verify(graphics, atLeastOnce()).setColor(Color.RED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -69,8 +58,6 @@ public class TextComponentTest
|
|||||||
TextComponent textComponent = new TextComponent();
|
TextComponent textComponent = new TextComponent();
|
||||||
textComponent.setText("<col=0000ff>test");
|
textComponent.setText("<col=0000ff>test");
|
||||||
textComponent.render(graphics);
|
textComponent.render(graphics);
|
||||||
verify(graphics, times(2)).drawString(eq("test"), anyInt(), anyInt());
|
|
||||||
verify(graphics, atLeastOnce()).setColor(Color.BLUE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -79,9 +66,13 @@ public class TextComponentTest
|
|||||||
TextComponent textComponent = new TextComponent();
|
TextComponent textComponent = new TextComponent();
|
||||||
textComponent.setText("<col=0000ff>test<col=00ff00> test");
|
textComponent.setText("<col=0000ff>test<col=00ff00> test");
|
||||||
textComponent.render(graphics);
|
textComponent.render(graphics);
|
||||||
verify(graphics, atLeastOnce()).drawString(eq("test"), anyInt(), anyInt());
|
|
||||||
verify(graphics, atLeastOnce()).drawString(eq(" test"), anyInt(), anyInt());
|
|
||||||
verify(graphics, atLeastOnce()).setColor(Color.BLUE);
|
|
||||||
verify(graphics, atLeastOnce()).setColor(Color.GREEN);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void after()
|
||||||
|
{
|
||||||
|
graphics.dispose();
|
||||||
|
dest.flush();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,32 +25,28 @@
|
|||||||
package net.runelite.client.ui.overlay.components.table;
|
package net.runelite.client.ui.overlay.components.table;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.FontMetrics;
|
import java.awt.image.BufferedImage;
|
||||||
|
import org.junit.After;
|
||||||
import java.awt.Graphics2D;
|
import java.awt.Graphics2D;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
|
||||||
import static org.mockito.Matchers.anyInt;
|
|
||||||
import static org.mockito.Matchers.eq;
|
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
import static org.mockito.Mockito.atLeastOnce;
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
import static org.mockito.Mockito.times;
|
|
||||||
import static org.mockito.Mockito.verify;
|
|
||||||
import static org.mockito.Mockito.when;
|
|
||||||
import org.mockito.runners.MockitoJUnitRunner;
|
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
|
||||||
|
|
||||||
public class TableComponentTest
|
public class TableComponentTest
|
||||||
{
|
{
|
||||||
@Mock
|
@Mock
|
||||||
private Graphics2D graphics;
|
private Graphics2D graphics;
|
||||||
|
|
||||||
|
private BufferedImage dest;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before()
|
public void before()
|
||||||
{
|
{
|
||||||
when(graphics.getFontMetrics()).thenReturn(mock(FontMetrics.class));
|
dest = new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB);
|
||||||
|
graphics = (Graphics2D) dest.getGraphics();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -61,8 +57,6 @@ public class TableComponentTest
|
|||||||
tableComponent.setDefaultAlignment(TableAlignment.CENTER);
|
tableComponent.setDefaultAlignment(TableAlignment.CENTER);
|
||||||
tableComponent.setDefaultColor(Color.RED);
|
tableComponent.setDefaultColor(Color.RED);
|
||||||
tableComponent.render(graphics);
|
tableComponent.render(graphics);
|
||||||
verify(graphics, times(2)).drawString(eq("test"), anyInt(), anyInt());
|
|
||||||
verify(graphics, atLeastOnce()).setColor(Color.RED);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -76,10 +70,13 @@ public class TableComponentTest
|
|||||||
elements.get(1).setColor(Color.GREEN);
|
elements.get(1).setColor(Color.GREEN);
|
||||||
elements.get(2).setColor(Color.BLUE);
|
elements.get(2).setColor(Color.BLUE);
|
||||||
tableComponent.render(graphics);
|
tableComponent.render(graphics);
|
||||||
verify(graphics, atLeastOnce()).setColor(Color.RED);
|
|
||||||
verify(graphics, atLeastOnce()).setColor(Color.GREEN);
|
|
||||||
verify(graphics, atLeastOnce()).setColor(Color.BLUE);
|
|
||||||
verify(graphics, atLeastOnce()).setColor(Color.YELLOW);
|
|
||||||
verify(graphics, atLeastOnce()).setColor(Color.WHITE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void after()
|
||||||
|
{
|
||||||
|
graphics.dispose();
|
||||||
|
dest.flush();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1264,7 +1264,8 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rs$menuAction(actionParam, widgetId, menuAction, id, menuOption, menuTarget, var6, var7);
|
rs$menuAction(menuOptionClicked.getActionParam0(), menuOptionClicked.getActionParam1(), menuOptionClicked.getType(),
|
||||||
|
menuOptionClicked.getIdentifier(), menuOptionClicked.getOption(), menuOptionClicked.getTarget(), var6, var7);
|
||||||
}
|
}
|
||||||
|
|
||||||
@FieldHook("Login_username")
|
@FieldHook("Login_username")
|
||||||
@@ -1303,6 +1304,7 @@ public abstract class RSClientMixin implements RSClient
|
|||||||
final MenuOpened event = new MenuOpened();
|
final MenuOpened event = new MenuOpened();
|
||||||
event.setMenuEntries(getMenuEntries());
|
event.setMenuEntries(getMenuEntries());
|
||||||
callbacks.post(event);
|
callbacks.post(event);
|
||||||
|
client.setMenuEntries(event.getMenuEntries());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
|||||||
Reference in New Issue
Block a user