@@ -0,0 +1,123 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* 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.playerinfo;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@ConfigGroup("playerinfo")
|
||||
public interface PlayerInfoConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "enableHealth",
|
||||
name = "Enable Health Display",
|
||||
description = "Configures whether or not to display health information",
|
||||
position = 1
|
||||
)
|
||||
default boolean enableHealth()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "enablePrayer",
|
||||
name = "Enable Prayer Display",
|
||||
description = "Configures whether or not to display prayer information",
|
||||
position = 2
|
||||
)
|
||||
default boolean enablePrayer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "enableEnergy",
|
||||
name = "Enable Run Energy Display",
|
||||
description = "Configures whether or not to display run energy information",
|
||||
position = 3
|
||||
)
|
||||
default boolean enableEnergy()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "enableSpec",
|
||||
name = "Enable Special Attack Display",
|
||||
description = "Configures whether or not to display special attack information",
|
||||
position = 4
|
||||
)
|
||||
default boolean enableSpec()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "enableWorld",
|
||||
name = "Enable World Display",
|
||||
description = "Configures whether or not to display world information",
|
||||
position = 4
|
||||
)
|
||||
default boolean enableWorld()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "colorHigh",
|
||||
name = "Color High",
|
||||
description = "The color displayed for high values.",
|
||||
position = 5
|
||||
)
|
||||
default Color colorHigh()
|
||||
{
|
||||
return Color.GREEN;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "colorMed",
|
||||
name = "Color Medium",
|
||||
description = "The color displayed for medium values.",
|
||||
position = 6
|
||||
)
|
||||
default Color colorMed()
|
||||
{
|
||||
return Color.YELLOW;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "colorLow",
|
||||
name = "Color Low",
|
||||
description = "The color displayed for low values.",
|
||||
position = 7
|
||||
)
|
||||
default Color colorLow()
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* 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.playerinfo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBox;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class PlayerInfoCustomIndicator extends InfoBox
|
||||
{
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
enum IndicatorType
|
||||
{
|
||||
HEALTH("Current Hitpoints"),
|
||||
PRAYER("Current Prayer Points"),
|
||||
ENERGY("Current Run Energy"),
|
||||
SPECIAL("Current Special Attack"),
|
||||
WORLD("Current World");
|
||||
|
||||
private final String description;
|
||||
}
|
||||
|
||||
private final PlayerInfoConfig config;
|
||||
private final Client client;
|
||||
private final IndicatorType type;
|
||||
|
||||
PlayerInfoCustomIndicator(Image image, PlayerInfoPlugin plugin, PlayerInfoConfig config, Client client, IndicatorType type)
|
||||
{
|
||||
super(image, plugin);
|
||||
this.config = config;
|
||||
this.client = client;
|
||||
this.type = type;
|
||||
|
||||
setTooltip(type.getDescription());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText()
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case HEALTH:
|
||||
return String.valueOf(client.getBoostedSkillLevel(Skill.HITPOINTS));
|
||||
case PRAYER:
|
||||
return String.valueOf(client.getBoostedSkillLevel(Skill.PRAYER));
|
||||
case ENERGY:
|
||||
return String.valueOf(client.getEnergy());
|
||||
case SPECIAL:
|
||||
return String.valueOf(client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT) / 10);
|
||||
case WORLD:
|
||||
return String.valueOf(client.getWorld());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Color getTextColor()
|
||||
{
|
||||
float currLvl = 0;
|
||||
switch (type)
|
||||
{
|
||||
case HEALTH:
|
||||
currLvl = client.getBoostedSkillLevel(Skill.HITPOINTS) / (float) client.getRealSkillLevel(Skill.HITPOINTS);
|
||||
break;
|
||||
case PRAYER:
|
||||
currLvl = client.getBoostedSkillLevel(Skill.PRAYER) / (float) client.getRealSkillLevel(Skill.PRAYER);
|
||||
break;
|
||||
case ENERGY:
|
||||
currLvl = client.getEnergy() / 100.0F;
|
||||
break;
|
||||
case SPECIAL:
|
||||
currLvl = client.getVar(VarPlayer.SPECIAL_ATTACK_PERCENT) / 1000.0F;
|
||||
case WORLD:
|
||||
currLvl = 1000; // hacky
|
||||
}
|
||||
|
||||
if (currLvl > 1.0)
|
||||
{
|
||||
return config.colorHigh();
|
||||
}
|
||||
else if (currLvl > 0.5)
|
||||
{
|
||||
return ColorUtil.colorLerp(config.colorMed(), config.colorHigh(), (currLvl * 2) - 1.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
return ColorUtil.colorLerp(config.colorLow(), config.colorMed(), (currLvl * 2));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean render()
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case HEALTH:
|
||||
return config.enableHealth();
|
||||
case PRAYER:
|
||||
return config.enablePrayer();
|
||||
case ENERGY:
|
||||
return config.enableEnergy();
|
||||
case SPECIAL:
|
||||
return config.enableSpec();
|
||||
case WORLD:
|
||||
return config.enableWorld();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* 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.playerinfo;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.game.SkillIconManager;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
import static net.runelite.client.plugins.playerinfo.PlayerInfoCustomIndicator.*;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Player Information",
|
||||
description = "An alternative to the Minimap Orbs",
|
||||
tags = {"combat", "overlay"},
|
||||
type = PluginType.UTILITY,
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Singleton
|
||||
public class PlayerInfoPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
|
||||
@Inject
|
||||
private InfoBoxManager infoBoxManager;
|
||||
|
||||
@Inject
|
||||
private PlayerInfoConfig config;
|
||||
|
||||
@Inject
|
||||
private SpriteManager spriteManager;
|
||||
|
||||
@Inject
|
||||
private SkillIconManager skillIconManager;
|
||||
|
||||
@Provides
|
||||
PlayerInfoConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(PlayerInfoConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
clientThread.invoke(() ->
|
||||
{
|
||||
if (client.getGameState().ordinal() < GameState.LOGIN_SCREEN.ordinal())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BufferedImage healthImg = spriteManager.getSprite(SpriteID.MINIMAP_ORB_HITPOINTS_ICON, 0);
|
||||
BufferedImage prayerImg = spriteManager.getSprite(SpriteID.MINIMAP_ORB_PRAYER_ICON, 0);
|
||||
BufferedImage energyImg = spriteManager.getSprite(SpriteID.MINIMAP_ORB_RUN_ICON, 0);
|
||||
BufferedImage combatImg = spriteManager.getSprite(SpriteID.MINIMAP_ORB_SPECIAL_ICON, 0);
|
||||
BufferedImage worldImg = spriteManager.getSprite(SpriteID.MINIMAP_ORB_WORLD_MAP_PLANET, 0);
|
||||
|
||||
infoBoxManager.addInfoBox(new PlayerInfoCustomIndicator(healthImg, this, config, client, IndicatorType.HEALTH));
|
||||
infoBoxManager.addInfoBox(new PlayerInfoCustomIndicator(prayerImg, this, config, client, IndicatorType.PRAYER));
|
||||
infoBoxManager.addInfoBox(new PlayerInfoCustomIndicator(energyImg, this, config, client, IndicatorType.ENERGY));
|
||||
infoBoxManager.addInfoBox(new PlayerInfoCustomIndicator(combatImg, this, config, client, IndicatorType.SPECIAL));
|
||||
infoBoxManager.addInfoBox(new PlayerInfoCustomIndicator(worldImg, this, config, client, IndicatorType.WORLD));
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
infoBoxManager.removeIf(i -> i instanceof PlayerInfoCustomIndicator);
|
||||
}
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public interface WorldHopperConfig extends Config
|
||||
keyName = "showHistory",
|
||||
name = "Show history tab",
|
||||
description = "Shows the history tab",
|
||||
position = 5
|
||||
position = 7
|
||||
)
|
||||
default boolean showHistory()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user