Merge branch 'master' of https://github.com/runelite/runelite into raids_party_display

This commit is contained in:
bjornenalfa
2019-03-14 13:19:30 +01:00
72 changed files with 4228 additions and 3730 deletions

View File

@@ -99,6 +99,9 @@ public class ConfigManager
public final void switchSession(AccountSession session)
{
// Ensure existing config is saved
sendConfig();
if (session == null)
{
this.session = null;
@@ -315,7 +318,7 @@ public class ConfigManager
}
}
private synchronized void saveToFile(final File propertiesFile) throws IOException
private void saveToFile(final File propertiesFile) throws IOException
{
propertiesFile.getParentFile().mkdirs();
@@ -392,19 +395,6 @@ public class ConfigManager
pendingChanges.put(groupName + "." + key, value);
}
Runnable task = () ->
{
try
{
saveToFile(propertiesFile);
}
catch (IOException ex)
{
log.warn("unable to save configuration file", ex);
}
};
executor.execute(task);
ConfigChanged configChanged = new ConfigChanged();
configChanged.setGroup(groupName);
configChanged.setKey(key);
@@ -435,19 +425,6 @@ public class ConfigManager
pendingChanges.put(groupName + "." + key, null);
}
Runnable task = () ->
{
try
{
saveToFile(propertiesFile);
}
catch (IOException ex)
{
log.warn("unable to save configuration file", ex);
}
};
executor.execute(task);
ConfigChanged configChanged = new ConfigChanged();
configChanged.setGroup(groupName);
configChanged.setKey(key);
@@ -653,6 +630,7 @@ public class ConfigManager
public void sendConfig()
{
boolean changed;
synchronized (pendingChanges)
{
if (client != null)
@@ -672,7 +650,20 @@ public class ConfigManager
}
}
}
changed = !pendingChanges.isEmpty();
pendingChanges.clear();
}
if (changed)
{
try
{
saveToFile(propertiesFile);
}
catch (IOException ex)
{
log.warn("unable to save configuration file", ex);
}
}
}
}

View File

@@ -1,158 +0,0 @@
/*
* Copyright (c) 2018 Abex
* 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.game;
import com.google.inject.Inject;
import com.google.inject.Singleton;
import java.util.function.Consumer;
import lombok.Getter;
import net.runelite.api.Client;
import net.runelite.api.ScriptID;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
@Singleton
public class ChatboxInputManager
{
public static final int NO_LIMIT = Integer.MAX_VALUE;
private final Client client;
private final ClientThread clientThread;
private Consumer<String> done;
private Consumer<String> changed;
private int characterLimit = NO_LIMIT;
@Getter
private boolean open = false;
@Inject
public ChatboxInputManager(Client client, ClientThread clientThread, EventBus eventBus)
{
this.client = client;
this.clientThread = clientThread;
eventBus.register(this);
}
/**
* Opens a RuneScape-style chatbox input
*
* @param text Text to show at the top of the window
* @param defaul Default text in the editable field
* @param done Callback when the text box has been exited, called with "" on esc
*/
public void openInputWindow(String text, String defaul, Consumer<String> done)
{
openInputWindow(text, defaul, NO_LIMIT, done);
}
public void openInputWindow(String text, String defaul, int characterLimit, Consumer<String> done)
{
openInputWindow(text, defaul, characterLimit, null, done);
}
public void openInputWindow(String text, String defaul, int characterLimit, Consumer<String> changed, Consumer<String> done)
{
this.done = done;
this.changed = changed;
this.characterLimit = characterLimit;
this.open = true;
clientThread.invoke(() -> client.runScript(
ScriptID.RUNELITE_CHATBOX_INPUT_INIT,
text,
defaul
));
}
/**
* Closes the RuneScape-style chatbox input
*/
public void closeInputWindow()
{
if (!this.open)
{
return;
}
this.open = false;
clientThread.invoke(() -> client.runScript(
ScriptID.RESET_CHATBOX_INPUT,
1,
1
));
}
@Subscribe
public void onScriptCallbackEvent(ScriptCallbackEvent ev)
{
// This replaces script 74 and most of 112
if ("chatboxInputHandler".equals(ev.getEventName()))
{
int intStackSize = client.getIntStackSize();
int stringStackSize = client.getStringStackSize();
int typedKey = client.getIntStack()[--intStackSize];
String str = client.getStringStack()[--stringStackSize];
boolean isDone = false;
switch (typedKey)
{
case 27: // Escape
str = "";
// fallthrough
case '\n':
this.open = false;
isDone = true;
break;
case '\b':
if (!str.isEmpty())
{
str = str.substring(0, str.length() - 1);
}
break;
default:
// If we wanted to do numbers only, we could add a limit here
if (typedKey >= 32 && (str.length() < characterLimit))
{
str += Character.toString((char) typedKey);
}
}
if (changed != null)
{
changed.accept(str);
}
if (isDone && done != null)
{
done.accept(str);
}
client.getStringStack()[stringStackSize++] = str;
client.getIntStack()[intStackSize++] = isDone ? 1 : 0;
client.setIntStackSize(intStackSize);
client.setStringStackSize(stringStackSize);
}
}
}

View File

@@ -195,7 +195,7 @@ public enum ItemMapping
BLACK_MASK, BLACK_MASK_I, BLACK_MASK_1, BLACK_MASK_1_I, BLACK_MASK_2, BLACK_MASK_2_I, BLACK_MASK_3, BLACK_MASK_3_I, BLACK_MASK_4, BLACK_MASK_4_I, BLACK_MASK_5,
BLACK_MASK_5_I, BLACK_MASK_6, BLACK_MASK_6_I, BLACK_MASK_7, BLACK_MASK_7_I, BLACK_MASK_8, BLACK_MASK_8_I, BLACK_MASK_9, BLACK_MASK_9_I, BLACK_MASK_10_I,
SLAYER_HELMET, SLAYER_HELMET_I, BLACK_SLAYER_HELMET, BLACK_SLAYER_HELMET_I, PURPLE_SLAYER_HELMET, PURPLE_SLAYER_HELMET_I, RED_SLAYER_HELMET, RED_SLAYER_HELMET_I,
GREEN_SLAYER_HELMET, GREEN_SLAYER_HELMET_I, TURQUOISE_SLAYER_HELMET, TURQUOISE_SLAYER_HELMET_I),
GREEN_SLAYER_HELMET, GREEN_SLAYER_HELMET_I, TURQUOISE_SLAYER_HELMET, TURQUOISE_SLAYER_HELMET_I, HYDRA_SLAYER_HELMET, HYDRA_SLAYER_HELMET_I),
// Pharaoh's Sceptres
ITEM_PHARAOHS_SCEPTRE_1(PHARAOHS_SCEPTRE, PHARAOHS_SCEPTRE_1),

View File

@@ -366,6 +366,11 @@ public class ChatCommandsPlugin extends Plugin
return;
}
if (message.length() <= KILLCOUNT_COMMAND_STRING.length())
{
return;
}
ChatMessageType type = chatMessage.getType();
String search = message.substring(KILLCOUNT_COMMAND_STRING.length() + 1);
@@ -483,6 +488,11 @@ public class ChatCommandsPlugin extends Plugin
return;
}
if (message.length() <= PB_COMMAND.length())
{
return;
}
ChatMessageType type = chatMessage.getType();
String search = message.substring(PB_COMMAND.length() + 1);
@@ -574,6 +584,11 @@ public class ChatCommandsPlugin extends Plugin
return;
}
if (message.length() <= PRICE_COMMAND_STRING.length())
{
return;
}
MessageNode messageNode = chatMessage.getMessageNode();
String search = message.substring(PRICE_COMMAND_STRING.length() + 1);
@@ -637,6 +652,11 @@ public class ChatCommandsPlugin extends Plugin
}
else
{
if (message.length() <= LEVEL_COMMAND_STRING.length())
{
return;
}
search = message.substring(LEVEL_COMMAND_STRING.length() + 1);
}

View File

@@ -167,7 +167,7 @@ public class FriendNotesPlugin extends Plugin
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() && event.getOption().equals("Message"))
{
// Friends have color tags
setHoveredFriend(Text.removeTags(event.getTarget()));
setHoveredFriend(Text.toJagexName(Text.removeTags(event.getTarget())));
// Build "Add Note" or "Edit Note" menu entry
final MenuEntry addNote = new MenuEntry();
@@ -197,13 +197,13 @@ public class FriendNotesPlugin extends Plugin
return;
}
//Friends have color tags
final String sanitizedTarget = Text.removeTags(event.getMenuTarget());
// Handle clicks on "Add Note" or "Edit Note"
if (event.getMenuOption().equals(ADD_NOTE) || event.getMenuOption().equals(EDIT_NOTE))
{
event.consume();
//Friends have color tags
final String sanitizedTarget = Text.toJagexName(Text.removeTags(event.getMenuTarget()));
final String note = getFriendNote(sanitizedTarget);
// Open the new chatbox input dialog
@@ -234,7 +234,16 @@ public class FriendNotesPlugin extends Plugin
{
// Migrate a friend's note to their new display name
final Friend friend = (Friend) nameable;
migrateFriendNote(friend.getName(), friend.getPrevName());
String name = friend.getName();
String prevName = friend.getPrevName();
if (prevName != null)
{
migrateFriendNote(
Text.toJagexName(name),
Text.toJagexName(prevName)
);
}
}
}
@@ -242,7 +251,7 @@ public class FriendNotesPlugin extends Plugin
public void onRemovedFriend(RemovedFriend event)
{
// Delete a friend's note if they are removed
final String displayName = event.getName();
final String displayName = Text.toJagexName(event.getName());
log.debug("Remove friend: '{}'", displayName);
setFriendNote(displayName, null);
}

View File

@@ -52,6 +52,16 @@ public interface ItemStatConfig extends Config
return true;
}
@ConfigItem(
keyName = "geStats",
name = "Enable GE item information",
description = "Shows an item information panel when buying items in the GE"
)
default boolean geStats()
{
return true;
}
@ConfigItem(
keyName = "relative",
name = "Show Relative",

View File

@@ -24,13 +24,46 @@
*/
package net.runelite.client.plugins.itemstats;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import com.google.inject.Binder;
import com.google.inject.Inject;
import com.google.inject.Provides;
import java.awt.FontMetrics;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.runelite.api.Client;
import net.runelite.api.FontID;
import net.runelite.api.InventoryID;
import net.runelite.api.Item;
import net.runelite.api.ItemContainer;
import net.runelite.api.ItemID;
import net.runelite.api.SpriteID;
import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.api.events.ConfigChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.api.events.VarbitChanged;
import net.runelite.api.widgets.JavaScriptCallback;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.api.widgets.WidgetTextAlignment;
import net.runelite.api.widgets.WidgetType;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.JagexColors;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.StackFormatter;
import net.runelite.http.api.item.ItemEquipmentStats;
import net.runelite.http.api.item.ItemStats;
@PluginDescriptor(
name = "Item Stats",
@@ -39,12 +72,30 @@ import net.runelite.client.ui.overlay.OverlayManager;
)
public class ItemStatPlugin extends Plugin
{
private static final int ORANGE_TEXT = JagexColors.DARK_ORANGE_INTERFACE_TEXT.getRGB();
private static final int YELLOW_TEXT = JagexColors.YELLOW_INTERFACE_TEXT.getRGB();
private static final int TEXT_HEIGHT = 11;
@Inject
private OverlayManager overlayManager;
@Inject
private ItemStatOverlay overlay;
@Inject
private Client client;
@Inject
private ItemManager itemManager;
@Inject
private ItemStatConfig config;
@Inject
private ClientThread clientThread;
private Widget itemInformationTitle;
@Provides
ItemStatConfig getConfig(ConfigManager configManager)
{
@@ -67,5 +118,319 @@ public class ItemStatPlugin extends Plugin
protected void shutDown() throws Exception
{
overlayManager.remove(overlay);
clientThread.invokeLater(this::resetGEInventory);
}
@Subscribe
public void onConfigChanged(ConfigChanged event)
{
if (event.getKey().equals("geStats"))
{
clientThread.invokeLater(this::resetGEInventory);
}
}
@Subscribe
public void onGameTick(GameTick event)
{
if (itemInformationTitle != null && config.geStats()
&& client.getWidget(WidgetInfo.GRAND_EXCHANGE_WINDOW_CONTAINER) == null)
{
resetGEInventory();
}
}
@Subscribe
public void onVarbitChanged(VarbitChanged event)
{
if (client.getVar(VarPlayer.CURRENT_GE_ITEM) == -1 && config.geStats())
{
resetGEInventory();
}
}
@Subscribe
public void onScriptCallbackEvent(ScriptCallbackEvent event)
{
if (event.getEventName().equals("geBuilt") && config.geStats())
{
int currentGeItem = client.getVar(VarPlayer.CURRENT_GE_ITEM);
if (currentGeItem != -1 && client.getVar(Varbits.GE_OFFER_CREATION_TYPE) == 0)
{
createItemInformation(currentGeItem);
}
}
}
private void createItemInformation(int id)
{
final ItemStats itemStats = itemManager.getItemStats(id, false);
if (itemStats == null || !itemStats.isEquipable())
{
return;
}
final ItemEquipmentStats equipmentStats = itemStats.getEquipment();
if (equipmentStats == null)
{
return;
}
final Widget geInv = client.getWidget(WidgetInfo.GRAND_EXCHANGE_INVENTORY_ITEMS_CONTAINER);
if (geInv == null)
{
return;
}
final Widget invContainer = getInventoryContainer();
if (invContainer == null)
{
return;
}
invContainer.deleteAllChildren();
geInv.setHidden(true);
int yPos = 0;
final FontMetrics smallFM = client.getCanvas().getFontMetrics(FontManager.getRunescapeSmallFont());
// HEADER
itemInformationTitle = createText(invContainer, "Item Information", FontID.BOLD_12, ORANGE_TEXT,
8, 8, invContainer.getWidth(), 16);
itemInformationTitle.setYTextAlignment(WidgetTextAlignment.CENTER);
Widget closeButton = invContainer.createChild(-1, WidgetType.GRAPHIC);
closeButton.setOriginalY(8);
closeButton.setOriginalX(invContainer.getWidth() - 24);
closeButton.setOriginalHeight(16);
closeButton.setOriginalWidth(16);
closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL);
closeButton.setAction(0, "Close");
closeButton.setOnMouseOverListener((JavaScriptCallback) (ev) ->
{
closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL_HOVERED);
});
closeButton.setOnMouseLeaveListener((JavaScriptCallback) (ev) ->
{
closeButton.setSpriteId(SpriteID.BOTTOM_LINE_MODE_WINDOW_CLOSE_BUTTON_SMALL);
});
closeButton.setOnOpListener((JavaScriptCallback) (ev) -> resetGEInventory());
closeButton.setHasListener(true);
closeButton.revalidate();
yPos += 15;
createSeparator(invContainer, yPos);
// ICON AND TITLE
yPos += 25;
Widget icon = invContainer.createChild(-1, WidgetType.GRAPHIC);
icon.setOriginalX(8);
icon.setOriginalY(yPos);
icon.setOriginalWidth(36);
icon.setOriginalHeight(32);
icon.setItemId(id);
icon.setItemQuantityMode(0);
icon.setBorderType(1);
icon.revalidate();
Widget itemName = createText(invContainer, itemManager.getItemComposition(id).getName(), FontID.PLAIN_12, ORANGE_TEXT,
50, yPos, invContainer.getWidth() - 40, 30);
itemName.setYTextAlignment(WidgetTextAlignment.CENTER);
yPos += 20;
createSeparator(invContainer, yPos);
// STATS HEADER
yPos += 25;
createText(invContainer, "Attack", FontID.PLAIN_11, ORANGE_TEXT, 5, yPos, 50, -1);
int defenceXPos = invContainer.getWidth() - (smallFM.stringWidth("Defence") + 5);
createText(invContainer, "Defence", FontID.PLAIN_11, ORANGE_TEXT, defenceXPos, yPos, 50, -1);
// STYLE BONUSES
final Set<String> stats = ImmutableSet.of(
"Stab",
"Slash",
"Crush",
"Magic",
"Ranged"
);
final List<Integer> attackStats = ImmutableList.of(
equipmentStats.getAstab(),
equipmentStats.getAslash(),
equipmentStats.getAcrush(),
equipmentStats.getAmagic(),
equipmentStats.getArange()
);
final List<Integer> defenceStats = ImmutableList.of(
equipmentStats.getDstab(),
equipmentStats.getDslash(),
equipmentStats.getDcrush(),
equipmentStats.getDmagic(),
equipmentStats.getDrange()
);
int index = 0;
for (final String stat : stats)
{
yPos += TEXT_HEIGHT + 2;
// Style label
final Widget styleText = createText(invContainer, stat, FontID.PLAIN_11, ORANGE_TEXT,
0, yPos, invContainer.getWidth(), -1);
styleText.setXTextAlignment(WidgetTextAlignment.CENTER);
// Attack bonus
createText(invContainer, attackStats.get(index).toString(), FontID.PLAIN_11, YELLOW_TEXT,
5, yPos, 50, -1);
// Defence bonus
final int defenceX = invContainer.getWidth() - (smallFM.stringWidth(defenceStats.get(index).toString()) + 5);
createText(invContainer, defenceStats.get(index).toString(), FontID.PLAIN_11, YELLOW_TEXT,
defenceX, yPos, 50, -1);
index++;
}
// MISC BONUSES
yPos += TEXT_HEIGHT + 8;
final Map<String, Integer> miscStats = ImmutableMap.of(
"Strength", equipmentStats.getStr(),
"Ranged Strength", equipmentStats.getRstr(),
"Magic Damage", equipmentStats.getMdmg(),
"Prayer Bonus", equipmentStats.getPrayer()
);
for (final Map.Entry<String, Integer> miscStat : miscStats.entrySet())
{
final String name = miscStat.getKey();
final String value = miscStat.getValue().toString();
// Stat label
createText(invContainer, name, FontID.PLAIN_11, ORANGE_TEXT, 5, yPos, 50, -1);
// Stat bonus
int valueXPos = invContainer.getWidth() - (smallFM.stringWidth(value) + 5);
createText(invContainer, value, FontID.PLAIN_11, YELLOW_TEXT, valueXPos, yPos, 50, -1);
yPos += TEXT_HEIGHT + 2;
}
// COINS
createSeparator(invContainer, invContainer.getHeight() - 40);
final String coinText = "You have " + StackFormatter.quantityToRSStackSize(getCurrentGP())
+ (getCurrentGP() == 1 ? " coin." : " coins.");
final Widget coinWidget = createText(invContainer, coinText, FontID.PLAIN_12, ORANGE_TEXT,
0, invContainer.getHeight() - 18, invContainer.getWidth(), -1);
coinWidget.setXTextAlignment(WidgetTextAlignment.CENTER);
}
private static Widget createText(Widget parent, String text, int fontId, int textColor,
int x, int y, int width, int height)
{
final Widget widget = parent.createChild(-1, WidgetType.TEXT);
widget.setText(text);
widget.setFontId(fontId);
widget.setTextColor(textColor);
widget.setTextShadowed(true);
widget.setOriginalHeight(height == -1 ? TEXT_HEIGHT : height);
widget.setOriginalWidth(width);
widget.setOriginalY(y);
widget.setOriginalX(x);
widget.revalidate();
return widget;
}
private static void createSeparator(Widget parent, int y)
{
Widget separator = parent.createChild(-1, WidgetType.GRAPHIC);
separator.setOriginalWidth(parent.getWidth());
separator.setOriginalY(y);
separator.setOriginalHeight(32);
separator.setSpriteId(SpriteID.UNKNOWN_BORDER_EDGE_HORIZONTAL_995);
separator.revalidate();
}
private void resetGEInventory()
{
final Widget invContainer = getInventoryContainer();
if (invContainer == null)
{
return;
}
if (itemInformationTitle != null && invContainer.getChild(0) == itemInformationTitle)
{
invContainer.deleteAllChildren();
itemInformationTitle = null;
}
final Widget geInv = client.getWidget(WidgetInfo.GRAND_EXCHANGE_INVENTORY_ITEMS_CONTAINER);
if (geInv != null)
{
geInv.setHidden(false);
}
}
private int getCurrentGP()
{
final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY);
if (inventory == null)
{
return 0;
}
for (final Item item : inventory.getItems())
{
if (item.getId() == ItemID.COINS_995)
{
return item.getQuantity();
}
}
return 0;
}
private Widget getInventoryContainer()
{
if (client.isResized())
{
if (client.getVar(Varbits.SIDE_PANELS) == 1)
{
return client.getWidget(WidgetInfo.RESIZABLE_VIEWPORT_BOTTOM_LINE_INVENTORY_CONTAINER);
}
else
{
return client.getWidget(WidgetInfo.RESIZABLE_VIEWPORT_INVENTORY_CONTAINER);
}
}
else
{
return client.getWidget(WidgetInfo.FIXED_VIEWPORT_INVENTORY_CONTAINER);
}
}
}

View File

@@ -148,8 +148,8 @@ enum PrayerItems
ANCIENT_DHIDE(ItemID.ANCIENT_DHIDE, 1),
ARMADYL_DHIDE(ItemID.ARMADYL_DHIDE, 1),
BANDOS_DHIDE(ItemID.BANDOS_DHIDE, 1),
GUTHIX_DRAGONHIDE(ItemID.GUTHIX_DRAGONHIDE, 1),
GUTHIX_DRAGONHIDE_10794(ItemID.GUTHIX_DRAGONHIDE_10794, 1),
GUTHIX_DRAGONHIDE(ItemID.GUTHIX_DHIDE, 1),
GUTHIX_DRAGONHIDE_10794(ItemID.GUTHIX_DRAGONHIDE, 1),
SARADOMIN_DHIDE(ItemID.SARADOMIN_DHIDE, 1),
SARADOMIN_DHIDE_10792(ItemID.SARADOMIN_DHIDE_10792, 1),
ZAMORAK_DHIDE(ItemID.ZAMORAK_DHIDE, 1),

View File

@@ -65,7 +65,7 @@ enum Task
CAVE_SLIMES("Cave slimes", ItemID.SWAMP_CAVE_SLIME),
CERBERUS("Cerberus", ItemID.HELLPUPPY),
CHAOS_ELEMENTAL("Chaos Elemental", ItemID.PET_CHAOS_ELEMENTAL),
CHAOS_FANATIC("Chaos Fanatic", ItemID.PET_CHAOS_ELEMENTAL),
CHAOS_FANATIC("Chaos Fanatic", ItemID.ANCIENT_STAFF),
COCKATRICE("Cockatrice", ItemID.COCKATRICE, "Cockathrice"),
COWS("Cows", ItemID.COW_MASK),
CRAWLING_HANDS("Crawling hands", ItemID.CRAWLING_HAND, "Crushing hand"),

View File

@@ -131,6 +131,9 @@ public class WikiPlugin extends Plugin
return;
}
children[0] = null;
onDeselect();
client.setSpellSelected(false);
});
}
@@ -186,7 +189,10 @@ public class WikiPlugin extends Plugin
private void onDeselect()
{
wikiSelected = false;
icon.setSpriteId(WikiSprite.WIKI_ICON.getSpriteId());
if (icon != null)
{
icon.setSpriteId(WikiSprite.WIKI_ICON.getSpriteId());
}
}
@Subscribe

View File

@@ -79,7 +79,7 @@ class XpState
if (state.getStartXp() == -1)
{
if (currentXp > 0)
if (currentXp >= 0)
{
initializeSkill(skill, currentXp);
return XpUpdateResult.INITIALIZED;
@@ -198,7 +198,8 @@ class XpState
boolean isInitialized(Skill skill)
{
return xpSkills.containsKey(skill);
XpStateSingle xpStateSingle = xpSkills.get(skill);
return xpStateSingle != null && xpStateSingle.getStartXp() != -1;
}
@NonNull

View File

@@ -305,7 +305,9 @@ public class XpTrackerPlugin extends Plugin
if (skill == Skill.CONSTRUCTION && updateResult == XpUpdateResult.INITIALIZED)
{
// Construction is the last skill initialized on login, now initialize the total experience
xpState.initializeSkill(Skill.OVERALL, client.getOverallExperience());
long overallXp = client.getOverallExperience();
log.debug("Initializing XP tracker with {} overall exp", overallXp);
xpState.initializeSkill(Skill.OVERALL, overallXp);
}
else if (xpState.isInitialized(Skill.OVERALL))
{

View File

@@ -62,4 +62,10 @@ public class JagexColors
public static final Color TOOLTIP_BACKGROUND = new Color(255, 255, 160);
public static final Color TOOLTIP_BORDER = Color.BLACK;
public static final Color TOOLTIP_TEXT = Color.BLACK;
/*
* Colors used in interfaces
*/
public static final Color DARK_ORANGE_INTERFACE_TEXT = new Color(255, 152, 31);
public static final Color YELLOW_INTERFACE_TEXT = Color.YELLOW;
}