Optionally prevent virtual levels from effecting total level
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019, Beau Mitchell <beaumitch@gmail.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.virtuallevels;
|
||||||
|
|
||||||
|
import net.runelite.client.config.Config;
|
||||||
|
import net.runelite.client.config.ConfigGroup;
|
||||||
|
import net.runelite.client.config.ConfigItem;
|
||||||
|
|
||||||
|
@ConfigGroup("virtuallevels")
|
||||||
|
public interface VirtualLevelsConfig extends Config
|
||||||
|
{
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "virtualTotalLevel",
|
||||||
|
name = "Virtual Total Level",
|
||||||
|
description = "Count virtual levels towards total level",
|
||||||
|
position = 0
|
||||||
|
)
|
||||||
|
default boolean virtualTotalLevel()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -25,12 +25,15 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.virtuallevels;
|
package net.runelite.client.plugins.virtuallevels;
|
||||||
|
|
||||||
|
import com.google.inject.Provides;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.Experience;
|
import net.runelite.api.Experience;
|
||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
|
import net.runelite.api.events.ConfigChanged;
|
||||||
import net.runelite.api.events.ScriptCallbackEvent;
|
import net.runelite.api.events.ScriptCallbackEvent;
|
||||||
import net.runelite.client.callback.ClientThread;
|
import net.runelite.client.callback.ClientThread;
|
||||||
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
import net.runelite.client.events.PluginChanged;
|
import net.runelite.client.events.PluginChanged;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
@@ -38,7 +41,7 @@ import net.runelite.client.plugins.PluginDescriptor;
|
|||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Virtual Levels",
|
name = "Virtual Levels",
|
||||||
description = "Configuration for the virtual levels plugin.",
|
description = "Shows virtual levels (beyond 99) and virtual skill total on the skills tab.",
|
||||||
tags = {"skill", "total", "max"},
|
tags = {"skill", "total", "max"},
|
||||||
enabledByDefault = false
|
enabledByDefault = false
|
||||||
)
|
)
|
||||||
@@ -46,12 +49,21 @@ public class VirtualLevelsPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
private static final String TOTAL_LEVEL_TEXT_PREFIX = "Total level:<br>";
|
private static final String TOTAL_LEVEL_TEXT_PREFIX = "Total level:<br>";
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private VirtualLevelsConfig config;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private ClientThread clientThread;
|
private ClientThread clientThread;
|
||||||
|
|
||||||
|
@Provides
|
||||||
|
VirtualLevelsConfig provideConfig(ConfigManager configManager)
|
||||||
|
{
|
||||||
|
return configManager.getConfig(VirtualLevelsConfig.class);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutDown()
|
protected void shutDown()
|
||||||
{
|
{
|
||||||
@@ -68,6 +80,17 @@ public class VirtualLevelsPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onConfigChanged(ConfigChanged configChanged)
|
||||||
|
{
|
||||||
|
if (!configChanged.getGroup().equals("virtuallevels"))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clientThread.invoke(this::simulateSkillChange);
|
||||||
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onScriptCallbackEvent(ScriptCallbackEvent e)
|
public void onScriptCallbackEvent(ScriptCallbackEvent e)
|
||||||
{
|
{
|
||||||
@@ -93,6 +116,10 @@ public class VirtualLevelsPlugin extends Plugin
|
|||||||
intStack[intStackSize - 1] = Experience.MAX_VIRT_LEVEL;
|
intStack[intStackSize - 1] = Experience.MAX_VIRT_LEVEL;
|
||||||
break;
|
break;
|
||||||
case "skillTabTotalLevel":
|
case "skillTabTotalLevel":
|
||||||
|
if (!config.virtualTotalLevel())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
int level = 0;
|
int level = 0;
|
||||||
|
|
||||||
for (Skill s : Skill.values())
|
for (Skill s : Skill.values())
|
||||||
|
|||||||
Reference in New Issue
Block a user