@@ -54,6 +54,7 @@ public enum WidgetInfo
|
||||
WORLD_MAP_SURFACE_SELECTOR(WidgetID.WORLD_MAP_GROUP_ID, WidgetID.WorldMap.SURFACE_SELECTOR),
|
||||
WORLD_MAP_TOOLTIP(WidgetID.WORLD_MAP_GROUP_ID, WidgetID.WorldMap.TOOLTIP),
|
||||
WORLD_MAP_OPTION(WidgetID.WORLD_MAP_MENU_GROUP_ID, WidgetID.WorldMap.OPTION),
|
||||
WORLD_MAP_BUTTON_BORDER(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WORLDMAP_ORB),
|
||||
|
||||
CLUE_SCROLL_TEXT(WidgetID.CLUE_SCROLL_GROUP_ID, WidgetID.Cluescroll.CLUE_TEXT),
|
||||
CLUE_SCROLL_REWARD_ITEM_CONTAINER(WidgetID.CLUE_SCROLL_REWARD_GROUP_ID, WidgetID.Cluescroll.CLUE_SCROLL_ITEM_CONTAINER),
|
||||
@@ -161,6 +162,7 @@ public enum WidgetInfo
|
||||
MINIMAP_HEALTH_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.HEALTH_ORB),
|
||||
MINIMAP_SPEC_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.SPEC_ORB),
|
||||
MINIMAP_WORLDMAP_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WORLDMAP_ORB),
|
||||
MINIMAP_WORLD_ORB(WidgetID.MINIMAP_GROUP_ID, WidgetID.Minimap.WORLDMAP_ORB),
|
||||
|
||||
LOGIN_CLICK_TO_PLAY_SCREEN(WidgetID.LOGIN_CLICK_TO_PLAY_GROUP_ID, 0),
|
||||
LOGIN_CLICK_TO_PLAY_SCREEN_MESSAGE_OF_THE_DAY(WidgetID.LOGIN_CLICK_TO_PLAY_GROUP_ID, WidgetID.LoginClickToPlayScreen.MESSAGE_OF_THE_DAY),
|
||||
|
||||
@@ -24,17 +24,18 @@
|
||||
*/
|
||||
package net.runelite.client.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class ConfigDescriptor
|
||||
{
|
||||
private final ConfigGroup group;
|
||||
private final Collection<ConfigItemDescriptor> items;
|
||||
private final Collection<ConfigItemsGroup> itemGroups;
|
||||
|
||||
public ConfigDescriptor(ConfigGroup group, Collection<ConfigItemDescriptor> items)
|
||||
public ConfigDescriptor(ConfigGroup group, Collection<ConfigItemsGroup> itemGroups)
|
||||
{
|
||||
this.group = group;
|
||||
this.items = items;
|
||||
this.itemGroups = itemGroups;
|
||||
}
|
||||
|
||||
public ConfigGroup getGroup()
|
||||
@@ -42,8 +43,22 @@ public class ConfigDescriptor
|
||||
return group;
|
||||
}
|
||||
|
||||
public Collection<ConfigItemsGroup> getItemGroups()
|
||||
{
|
||||
return itemGroups;
|
||||
}
|
||||
|
||||
public Collection<ConfigItemDescriptor> getItems()
|
||||
{
|
||||
return items;
|
||||
Collection<ConfigItemDescriptor> allItems = new ArrayList<>();
|
||||
for (ConfigItemsGroup g : itemGroups)
|
||||
{
|
||||
for (ConfigItemDescriptor item : g.getItems())
|
||||
{
|
||||
allItems.add(item);
|
||||
}
|
||||
}
|
||||
return allItems;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -46,4 +46,7 @@ public @interface ConfigItem
|
||||
String warning() default "";
|
||||
|
||||
boolean secret() default false;
|
||||
|
||||
String group() default "";
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Craftiii4 <craftiii4@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.config;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class ConfigItemsGroup
|
||||
{
|
||||
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
private final String group;
|
||||
|
||||
@Getter(AccessLevel.PUBLIC)
|
||||
private Collection<ConfigItemDescriptor> items;
|
||||
|
||||
public ConfigItemsGroup(String group)
|
||||
{
|
||||
this.group = group;
|
||||
this.items = new ArrayList<>();
|
||||
}
|
||||
|
||||
public void addItem(ConfigItemDescriptor item)
|
||||
{
|
||||
items.add(item);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -47,7 +47,9 @@ import java.text.DateFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -462,7 +464,35 @@ public class ConfigManager
|
||||
.result())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return new ConfigDescriptor(group, items);
|
||||
Collection<ConfigItemsGroup> itemGroups = new ArrayList<>();
|
||||
|
||||
for (ConfigItemDescriptor item : items)
|
||||
{
|
||||
String groupName = item.getItem().group();
|
||||
boolean found = false;
|
||||
for (ConfigItemsGroup g : itemGroups)
|
||||
{
|
||||
if (g.getGroup().equals(groupName))
|
||||
{
|
||||
g.addItem(item);
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
{
|
||||
ConfigItemsGroup newGroup = new ConfigItemsGroup(groupName);
|
||||
newGroup.addItem(item);
|
||||
itemGroups.add(newGroup);
|
||||
}
|
||||
}
|
||||
|
||||
itemGroups = itemGroups.stream().sorted((a, b) -> ComparisonChain.start()
|
||||
.compare(a.getGroup(), b.getGroup())
|
||||
.result())
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return new ConfigDescriptor(group, itemGroups);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -108,6 +108,10 @@ public enum AgilityShortcut
|
||||
AL_KHARID_MINING_PITCLIFF_SCRAMBLE(38, "Rocks", new WorldPoint(3305, 3315, 0), ROCKS_16549, ROCKS_16550),
|
||||
YANILLE_WALL_GRAPPLE(39, "Grapple Wall", new WorldPoint(2552, 3072, 0), WALL_17047),
|
||||
NEITIZNOT_BRIDGE_REPAIR(40, "Bridge Repair - Quest", new WorldPoint(2315, 3828, 0), ROPE_BRIDGE_21306, ROPE_BRIDGE_21307),
|
||||
NEITIZNOT_BRIDGE_SOUTHEAST(40, "Rope Bridge", null, ROPE_BRIDGE_21308, ROPE_BRIDGE_21309),
|
||||
NEITIZNOT_BRIDGE_NORTHWEST(40, "Rope Bridge", null, ROPE_BRIDGE_21310, ROPE_BRIDGE_21311),
|
||||
NEITIZNOT_BRIDGE_NORTH(40, "Rope Bridge", null, ROPE_BRIDGE_21312, ROPE_BRIDGE_21313),
|
||||
NEITIZNOT_BRIDGE_NORTHEAST(40, "Broken Rope bridge", null, ROPE_BRIDGE_21314, ROPE_BRIDGE_21315),
|
||||
KOUREND_LAKE_JUMP_EAST(40, "Stepping Stones", new WorldPoint(1612, 3570, 0), STEPPING_STONE_29729, STEPPING_STONE_29730),
|
||||
KOUREND_LAKE_JUMP_WEST(40, "Stepping Stones", new WorldPoint(1604, 3572, 0), STEPPING_STONE_29729, STEPPING_STONE_29730),
|
||||
YANILLE_DUNGEON_BALANCE(40, "Balancing Ledge", null, BALANCING_LEDGE_23548),
|
||||
|
||||
@@ -1,59 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2019 Hydrox6 <ikada@protonmail.ch>
|
||||
* 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.ammo;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.overlay.infobox.Counter;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
|
||||
public class AmmoCounter extends Counter
|
||||
{
|
||||
@Getter
|
||||
private int itemID;
|
||||
|
||||
@Getter
|
||||
private String name;
|
||||
|
||||
public AmmoCounter(Plugin plugin, int itemID, int count, String name, BufferedImage image)
|
||||
{
|
||||
super(image, plugin, count);
|
||||
this.itemID = itemID;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText()
|
||||
{
|
||||
return StackFormatter.quantityToRSDecimalStack(getCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Copyright (c) 2019 Hydrox6 <ikada@protonmail.ch>
|
||||
* 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.ammo;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.overlay.infobox.Counter;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
|
||||
class AmmoCounter extends Counter
|
||||
{
|
||||
@Getter
|
||||
private final int itemID;
|
||||
private final String name;
|
||||
|
||||
AmmoCounter(Plugin plugin, int itemID, int count, String name, BufferedImage image)
|
||||
{
|
||||
super(image, plugin, count);
|
||||
this.itemID = itemID;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText()
|
||||
{
|
||||
return StackFormatter.quantityToRSDecimalStack(getCount());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,7 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
@PluginDescriptor(
|
||||
name = "Ammo",
|
||||
description = "Shows the current ammo the player has equipped",
|
||||
tags = {"bolts", "darts", "chinchompa"},
|
||||
type = "utility"
|
||||
tags = {"bolts", "darts", "chinchompa", "equipment"}
|
||||
)
|
||||
public class AmmoPlugin extends Plugin
|
||||
{
|
||||
@@ -63,20 +62,21 @@ public class AmmoPlugin extends Plugin
|
||||
private AmmoCounter counterBox;
|
||||
|
||||
@Override
|
||||
public void startUp() throws Exception
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
clientThread.invokeLater(() ->
|
||||
{
|
||||
ItemContainer container = client.getItemContainer(InventoryID.EQUIPMENT);
|
||||
final ItemContainer container = client.getItemContainer(InventoryID.EQUIPMENT);
|
||||
|
||||
if (container != null)
|
||||
{
|
||||
parseInventory(container.getItems());
|
||||
checkInventory(container.getItems());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutDown() throws Exception
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
infoBoxManager.removeInfoBox(counterBox);
|
||||
counterBox = null;
|
||||
@@ -90,10 +90,10 @@ public class AmmoPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
parseInventory(event.getItemContainer().getItems());
|
||||
checkInventory(event.getItemContainer().getItems());
|
||||
}
|
||||
|
||||
private void parseInventory(Item[] items)
|
||||
private void checkInventory(final Item[] items)
|
||||
{
|
||||
// Check for weapon slot items. This overrides the ammo slot,
|
||||
// as the player will use the thrown weapon (eg. chinchompas, knives, darts)
|
||||
@@ -126,7 +126,7 @@ public class AmmoPlugin extends Plugin
|
||||
updateInfobox(ammo, comp);
|
||||
}
|
||||
|
||||
private void updateInfobox(Item item, ItemComposition comp)
|
||||
private void updateInfobox(final Item item, final ItemComposition comp)
|
||||
{
|
||||
if (counterBox != null && counterBox.getItemID() == item.getId())
|
||||
{
|
||||
|
||||
@@ -1,43 +1,68 @@
|
||||
/*
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.freezetimers;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.client.plugins.freezetimers.Spell;
|
||||
import net.runelite.client.util.Text;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class Barrage
|
||||
extends Spell {
|
||||
public static final long DURATION = 20000L;
|
||||
public class Barrage extends Spell
|
||||
{
|
||||
|
||||
|
||||
@Getter
|
||||
public static final long DURATION = 20000;
|
||||
private long remainingTime;
|
||||
@Getter
|
||||
private boolean isFinished;
|
||||
|
||||
public Barrage(Actor affectedTarget, Actor caster) {
|
||||
|
||||
public Barrage(Actor affectedTarget, Actor caster)
|
||||
{
|
||||
super(affectedTarget, caster);
|
||||
}
|
||||
|
||||
public long getRemainingTime() {
|
||||
public long getRemainingTime()
|
||||
{
|
||||
long elapsedTime = System.currentTimeMillis() - this.startTime;
|
||||
if (Barrage.getDURATION() > elapsedTime) {
|
||||
return Barrage.getDURATION() - elapsedTime;
|
||||
if (getDURATION() > elapsedTime)
|
||||
{
|
||||
return getDURATION() - elapsedTime;
|
||||
}
|
||||
this.isFinished = true;
|
||||
return 0L;
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof Barrage) {
|
||||
Barrage barrage = (Barrage)o;
|
||||
return Text.standardize(this.getAffectedTarget().getName()).equals(Text.standardize(((Barrage)o).getAffectedTarget().getName())) && this.getStartTime() == ((Barrage)o).getStartTime();
|
||||
else
|
||||
{
|
||||
this.isFinished = true;
|
||||
return 0;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static long getDURATION() {
|
||||
return 20000L;
|
||||
public boolean equals(Object o)
|
||||
{
|
||||
if (o instanceof Barrage)
|
||||
{
|
||||
Barrage barrage = (Barrage) o;
|
||||
if (Text.standardize(this.getAffectedTarget().getName()).equals(Text.standardize(((Barrage) o)
|
||||
.getAffectedTarget().getName())) && this.getStartTime() == ((Barrage) o).getStartTime())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFinished() {
|
||||
return this.isFinished;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -5,38 +5,75 @@ import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup(value="freezetimers")
|
||||
public interface FreezeTimersConfig
|
||||
extends Config {
|
||||
@ConfigItem(position=0, keyName="freezeenable", name="Enable PvP freeze timers", description="Configures whether or not to show freeze timers.")
|
||||
default public boolean EnableFreezeTimers() {
|
||||
@ConfigGroup("freezetimers")
|
||||
public interface FreezeTimersConfig extends Config
|
||||
{
|
||||
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "freezeenable",
|
||||
name = "Enable PvP freeze timers",
|
||||
description = "Configures whether or not to show freeze timers."
|
||||
)
|
||||
default boolean EnableFreezeTimers()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(position=1, keyName="tilehighlight", name="Frozen opponent tile highlighting", description="Configures whether or not to highlight tiles frozen opponents are standing on.")
|
||||
default public boolean drawTiles() {
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "tilehighlight",
|
||||
name = "Frozen opponent tile highlighting",
|
||||
description = "Configures whether or not to highlight tiles frozen opponents are standing on."
|
||||
)
|
||||
default boolean drawTiles()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(position=2, keyName="timercolor", name="Freeze Timer Color", description="Color of freeze timer")
|
||||
default public Color FreezeTimerColor() {
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "timercolor",
|
||||
name = "Freeze Timer Color",
|
||||
description = "Color of freeze timer"
|
||||
)
|
||||
default Color FreezeTimerColor()
|
||||
{
|
||||
return new Color(0, 184, 212);
|
||||
}
|
||||
|
||||
@ConfigItem(position=3, keyName="spellIcon", name="Show spell icon", description="Shows the spell icon for the freeze spell affecting the target")
|
||||
default public boolean spellIcon() {
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "spellIcon",
|
||||
name = "Show spell icon",
|
||||
description = "Shows the spell icon for the freeze spell affecting the target"
|
||||
)
|
||||
default boolean spellIcon()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(position=4, keyName="refreezeTimer", name="Refreeze Timer", description="Show a timer that counts up until the target can be refrozen")
|
||||
default public boolean refreezeTimer() {
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "refreezeTimer",
|
||||
name = "Refreeze Timer",
|
||||
description = "Show a timer that counts up until the target can be refrozen"
|
||||
)
|
||||
default boolean refreezeTimer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(position=5, keyName="refreezeTimerColor", name="Refreeze color", description="The color for the timer that counts until the target can be refrozen")
|
||||
default public Color RefreezeTimerColor() {
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "refreezeTimerColor",
|
||||
name = "Refreeze color",
|
||||
description = "The color for the timer that counts until the target can be refrozen"
|
||||
)
|
||||
default Color RefreezeTimerColor()
|
||||
{
|
||||
return Color.red;
|
||||
}
|
||||
}
|
||||
|
||||
@ConfigItem(position = 6, keyName = "tbtimer", name = "Tele Block Timer", description = "Enables tele block timer")
|
||||
default boolean TBTimer() {
|
||||
|
||||
@@ -1,24 +1,25 @@
|
||||
/*
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.freezetimers;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.FontMetrics;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.function.BiConsumer;
|
||||
import java.awt.font.TextLayout;
|
||||
import java.awt.image.*;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.HeadIcon;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Point;
|
||||
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.plugins.freezetimers.FreezeTimersConfig;
|
||||
import net.runelite.client.plugins.freezetimers.FreezeTimersPlugin;
|
||||
import net.runelite.client.plugins.freezetimers.FreezeTimersService;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
@@ -26,8 +27,8 @@ import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
@Singleton
|
||||
public class FreezeTimersOverlay
|
||||
extends Overlay {
|
||||
public class FreezeTimersOverlay extends Overlay
|
||||
{
|
||||
private final FreezeTimersService FreezeTimersService;
|
||||
private final FreezeTimersConfig config;
|
||||
private final FreezeTimersPlugin plugin;
|
||||
@@ -35,123 +36,165 @@ extends Overlay {
|
||||
private final Client client;
|
||||
|
||||
@Inject
|
||||
private FreezeTimersOverlay(FreezeTimersConfig config, FreezeTimersService FreezeTimersService2, FreezeTimersPlugin plugin, Client client, SpriteManager spriteManager) {
|
||||
private FreezeTimersOverlay(FreezeTimersConfig config, FreezeTimersService FreezeTimersService, FreezeTimersPlugin plugin, Client client, SpriteManager spriteManager)
|
||||
{
|
||||
this.config = config;
|
||||
this.FreezeTimersService = FreezeTimersService2;
|
||||
this.FreezeTimersService = FreezeTimersService;
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
this.spriteManager = spriteManager;
|
||||
this.setPosition(OverlayPosition.DYNAMIC);
|
||||
this.setPriority(OverlayPriority.MED);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.MED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
if (!this.config.EnableFreezeTimers()) {
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (!config.EnableFreezeTimers())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
this.FreezeTimersService.forEachPlayer((player, color) -> this.renderPlayerOverlay(graphics, (Player)player, (Color)color));
|
||||
FreezeTimersService.forEachPlayer((player, color) -> renderPlayerOverlay(graphics, player, color));
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color) {
|
||||
BufferedImage clanchatImage;
|
||||
private void renderPlayerOverlay(Graphics2D graphics, Player actor, Color color)
|
||||
{
|
||||
int timer = 0;
|
||||
String name = actor.getName();
|
||||
int freezetype = this.plugin.freezetype(name);
|
||||
boolean frozenoverlay = false;
|
||||
int freezetype = plugin.freezetype(name);
|
||||
boolean frozenoverlay = false;
|
||||
int offset = 5;
|
||||
long dtime = this.plugin.opponentfreezetime(name);
|
||||
long tbed = plugin.istbed(name);
|
||||
long dtime = plugin.opponentfreezetime(name);
|
||||
long tbed = plugin.istbed(name);
|
||||
Point textLocation = null;
|
||||
HeadIcon headIcon = actor.getOverheadIcon();
|
||||
int freezetime = 0;
|
||||
if (freezetype == 1 || freezetype == 4) {
|
||||
if (freezetype == 1 || freezetype == 4)
|
||||
{
|
||||
freezetime = 5000;
|
||||
} else if (freezetype == 2 || freezetype == 5) {
|
||||
}
|
||||
else if (freezetype == 2 || freezetype == 5)
|
||||
{
|
||||
freezetime = 10000;
|
||||
} else if (freezetype == 3 || freezetype == 6) {
|
||||
}
|
||||
else if (freezetype == 3 || freezetype == 6)
|
||||
{
|
||||
freezetime = 15000;
|
||||
} else if (freezetype == 7) {
|
||||
}
|
||||
else if (freezetype == 7)
|
||||
{
|
||||
freezetime = 20000;
|
||||
} else if (freezetype == 8) {
|
||||
}
|
||||
else if (freezetype == 8)
|
||||
{
|
||||
freezetime = 2500;
|
||||
} else if (freezetype == 9) {
|
||||
}
|
||||
else if (freezetype == 9)
|
||||
{
|
||||
freezetime = 5000;
|
||||
} else if (freezetype == 10) {
|
||||
}
|
||||
else if (freezetype == 10)
|
||||
{
|
||||
freezetime = 7500;
|
||||
}
|
||||
|
||||
long currenttime = System.currentTimeMillis();
|
||||
long timediff = currenttime - dtime;
|
||||
timer = (freezetime - (int)timediff) / 1000;
|
||||
if (timediff < (long)freezetime) {
|
||||
textLocation = actor.getCanvasTextLocation(graphics, String.valueOf(timer), actor.getLogicalHeight() + config.FreezeTimerPos());
|
||||
timer = (freezetime - (int) timediff) / 1000;
|
||||
|
||||
if (timediff < freezetime)
|
||||
{
|
||||
// if the freezetimer is still active. . .
|
||||
textLocation = actor.getCanvasTextLocation(graphics, String.valueOf((timer)), offset);
|
||||
textLocation = new Point(textLocation.getX(), textLocation.getY() - config.FreezeTimerPos());
|
||||
} else if (timediff < (long)(freezetime + 3000)) {
|
||||
timer = Math.abs(timer);
|
||||
++timer;
|
||||
if (this.config.refreezeTimer()) {
|
||||
textLocation = actor.getCanvasTextLocation(graphics, String.valueOf(timer), actor.getLogicalHeight() + config.FreezeTimerPos());
|
||||
textLocation = new Point(textLocation.getX(), textLocation.getY() - config.FreezeTimerPos());
|
||||
graphics.setFont(FontManager.getRunescapeBoldFont());
|
||||
if (headIcon != null) {
|
||||
}
|
||||
else
|
||||
{
|
||||
if (timediff < freezetime + 3000)
|
||||
{
|
||||
timer = Math.abs(timer);
|
||||
timer += 1;
|
||||
if (config.refreezeTimer())
|
||||
{
|
||||
textLocation = actor.getCanvasTextLocation(graphics, String.valueOf((timer)), offset);
|
||||
textLocation = new Point(textLocation.getX(), textLocation.getY() - config.FreezeTimerPos());
|
||||
graphics.setFont(FontManager.getRunescapeBoldFont());
|
||||
if (headIcon != null)
|
||||
{
|
||||
textLocation = new Point(textLocation.getX() + 10, textLocation.getY() + 5);
|
||||
}
|
||||
frozenoverlay = true;
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf((timer)), config.RefreezeTimerColor());
|
||||
return;
|
||||
}
|
||||
frozenoverlay = true;
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf(timer), this.config.RefreezeTimerColor());
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
this.plugin.deleteopponent(name);
|
||||
}
|
||||
if (textLocation != null && (clanchatImage = this.plugin.GetFreezeIcon(freezetype - 1)) != null) {
|
||||
int width = clanchatImage.getWidth();
|
||||
int textHeight = graphics.getFontMetrics().getHeight() - graphics.getFontMetrics().getMaxDescent();
|
||||
Point imageLocation = new Point(textLocation.getX(), textLocation.getY() - (config.FreezeTimerPos() / 2));
|
||||
graphics.setFont(FontManager.getRunescapeFont());
|
||||
graphics.setStroke(new BasicStroke(3.0f));
|
||||
if (this.config.spellIcon()) {
|
||||
frozenoverlay = true;
|
||||
graphics.drawOval(imageLocation.getX(), imageLocation.getY(), clanchatImage.getWidth(), clanchatImage.getHeight());
|
||||
OverlayUtil.renderImageLocation(graphics, imageLocation, clanchatImage);
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf(timer), color);
|
||||
} else {
|
||||
graphics.setColor(Color.cyan);
|
||||
graphics.drawOval(textLocation.getX() - 3, textLocation.getY() - 15, clanchatImage.getWidth(), graphics.getFontMetrics().getHeight());
|
||||
graphics.setColor(Color.blue);
|
||||
graphics.fillOval(textLocation.getX() - 3, textLocation.getY() - 15, clanchatImage.getWidth(), graphics.getFontMetrics().getHeight());
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf(timer), Color.WHITE);
|
||||
else
|
||||
{
|
||||
plugin.deleteopponent(name);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.TBTimer()) {
|
||||
if (tbed > 0) {
|
||||
int type = plugin.tbtype(name);
|
||||
int tbexpiry;
|
||||
if (type > 0) {
|
||||
if (type == 1) {
|
||||
tbexpiry = 300000;
|
||||
} else if (type == 2) {
|
||||
tbexpiry = 150000;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
long tbtime = currenttime - tbed;
|
||||
int tbtimer = (tbexpiry - (int) tbtime) / 1000;
|
||||
if (tbtime < tbexpiry) {
|
||||
textLocation = actor.getCanvasTextLocation(graphics, Integer.toString(tbtimer), actor.getLogicalHeight() + config.FreezeTimerPos());
|
||||
if (frozenoverlay) {
|
||||
textLocation = new Point(textLocation.getX() + 40, textLocation.getY() - config.FreezeTimerPos());
|
||||
} else {
|
||||
textLocation = new Point(textLocation.getX(), textLocation.getY() - config.FreezeTimerPos());
|
||||
}
|
||||
} else {
|
||||
plugin.deletetb(name);
|
||||
}
|
||||
}
|
||||
if (textLocation != null)
|
||||
{
|
||||
BufferedImage clanchatImage = plugin.GetFreezeIcon(freezetype - 1);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (clanchatImage != null)
|
||||
{
|
||||
int width = clanchatImage.getWidth();
|
||||
int textHeight = graphics.getFontMetrics().getHeight() - graphics.getFontMetrics().getMaxDescent();
|
||||
Point imageLocation = new Point(textLocation.getX() - width, ((textLocation.getY() -
|
||||
graphics.getFontMetrics().getHeight()) + 10));
|
||||
graphics.setFont(FontManager.getRunescapeFont());
|
||||
// graphics.setStroke(new BasicStroke(3));
|
||||
|
||||
if (config.spellIcon())
|
||||
{
|
||||
frozenoverlay = true;
|
||||
// graphics.drawOval(imageLocation.getX(), imageLocation.getY(), clanchatImage.getWidth(), clanchatImage.getHeight());
|
||||
OverlayUtil.renderImageLocation(graphics, imageLocation, clanchatImage);
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf(timer), color);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
graphics.setColor(Color.cyan);
|
||||
graphics.drawOval(textLocation.getX() - 3, textLocation.getY() - 15, clanchatImage.getWidth(),
|
||||
graphics.getFontMetrics().getHeight());
|
||||
graphics.setColor(Color.blue);
|
||||
graphics.fillOval(textLocation.getX() - 3, textLocation.getY() - 15, clanchatImage.getWidth(),
|
||||
graphics.getFontMetrics().getHeight());
|
||||
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf(timer), Color.WHITE);
|
||||
}
|
||||
}
|
||||
if (config.TBTimer()) {
|
||||
if (tbed > 0) {
|
||||
int type = plugin.tbtype(name);
|
||||
int tbexpiry;
|
||||
if (type > 0) {
|
||||
if (type == 1) {
|
||||
tbexpiry = 300000;
|
||||
} else if (type == 2) {
|
||||
tbexpiry = 150000;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
long tbtime = currenttime - tbed;
|
||||
int tbtimer = (tbexpiry - (int) tbtime) / 1000;
|
||||
if (tbtime < tbexpiry) {
|
||||
textLocation = actor.getCanvasTextLocation(graphics, Integer.toString(tbtimer), actor.getLogicalHeight() + config.FreezeTimerPos());
|
||||
if (frozenoverlay) {
|
||||
textLocation = new Point(textLocation.getX() + 40, textLocation.getY() - config.FreezeTimerPos());
|
||||
} else {
|
||||
textLocation = new Point(textLocation.getX(), textLocation.getY() - config.FreezeTimerPos());
|
||||
}
|
||||
} else {
|
||||
plugin.deletetb(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,99 +1,86 @@
|
||||
/*
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.freezetimers;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
import net.runelite.api.events.*;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.*;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.awt.image.ColorModel;
|
||||
import java.awt.image.DataBuffer;
|
||||
import java.awt.image.DataBufferByte;
|
||||
import java.awt.image.ImageObserver;
|
||||
import java.awt.image.IndexColorModel;
|
||||
import java.awt.image.WritableRaster;
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.*;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.HeadIcon;
|
||||
import net.runelite.api.IndexedSprite;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Skill;
|
||||
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.ExperienceChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.freezetimers.Barrage;
|
||||
import net.runelite.client.plugins.freezetimers.FreezeTimersConfig;
|
||||
import net.runelite.client.plugins.freezetimers.FreezeTimersOverlay;
|
||||
import net.runelite.client.plugins.freezetimers.FreezeTimersTileOverlay;
|
||||
import net.runelite.client.plugins.freezetimers.Spell;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import org.slf4j.Logger;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Freeze Timers",
|
||||
description = "PVP Freeze Timers",
|
||||
tags = {"PvP", "Freeze", "Timers"},
|
||||
type = "PVP"
|
||||
name = "Freeze Timers",
|
||||
description = "PVP Freeze Timers",
|
||||
type = "PVP",
|
||||
tags = {"PvP", "Freeze", "Timers", "pklite"}
|
||||
)
|
||||
|
||||
public class FreezeTimersPlugin
|
||||
extends Plugin {
|
||||
public class FreezeTimersPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private FreezeTimersConfig config;
|
||||
|
||||
@Inject
|
||||
private FreezeTimersOverlay FreezeTimersOverlay;
|
||||
|
||||
@Inject
|
||||
private FreezeTimersTileOverlay FreezeTimersTileOverlay;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private SpriteManager spriteManager;
|
||||
|
||||
private static final int[] FREEZE_ICONS = {
|
||||
SpriteID.SPELL_BIND,
|
||||
SpriteID.SPELL_SNARE,
|
||||
SpriteID.SPELL_ENTANGLE,
|
||||
SpriteID.SPELL_ICE_RUSH,
|
||||
SpriteID.SPELL_ICE_BURST,
|
||||
SpriteID.SPELL_ICE_BLITZ,
|
||||
SpriteID.SPELL_ICE_BARRAGE,
|
||||
SpriteID.SPELL_BIND,
|
||||
SpriteID.SPELL_SNARE,
|
||||
SpriteID.SPELL_ENTANGLE,
|
||||
SpriteID.SPELL_TELE_BLOCK
|
||||
};
|
||||
private static final Dimension FREEZE_ICON_DIMENSION = new Dimension(25, 25);
|
||||
|
||||
@Provides
|
||||
FreezeTimersConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(FreezeTimersConfig.class);
|
||||
}
|
||||
|
||||
private static final int[] FREEZE_ICONS =
|
||||
{
|
||||
SpriteID.SPELL_BIND,
|
||||
SpriteID.SPELL_SNARE,
|
||||
SpriteID.SPELL_ENTANGLE,
|
||||
SpriteID.SPELL_ICE_RUSH,
|
||||
SpriteID.SPELL_ICE_BURST,
|
||||
SpriteID.SPELL_ICE_BLITZ,
|
||||
SpriteID.SPELL_ICE_BARRAGE,
|
||||
SpriteID.SPELL_BIND,
|
||||
SpriteID.SPELL_SNARE,
|
||||
SpriteID.SPELL_ENTANGLE,
|
||||
SpriteID.SPELL_TELE_BLOCK
|
||||
};
|
||||
|
||||
private static final Dimension FREEZE_ICON_DIMENSION = new Dimension(25, 25);
|
||||
private static final Color FREEZE_ICON_OUTLINE_COLOR = new Color(33, 33, 33);
|
||||
private final BufferedImage[] FreezeIcons = new BufferedImage[FREEZE_ICONS.length];
|
||||
|
||||
private final int SPLASH_ID = 85;
|
||||
Map<String, Long> tbedthings = new HashMap<>();
|
||||
Map<String, Integer> tbtypes = new HashMap<>();
|
||||
@@ -108,248 +95,319 @@ extends Plugin {
|
||||
String currtarget;
|
||||
String spell;
|
||||
|
||||
@Provides
|
||||
FreezeTimersConfig provideConfig(ConfigManager configManager) {
|
||||
return configManager.getConfig(FreezeTimersConfig.class);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged) {
|
||||
if (gameStateChanged.getGameState() == GameState.LOGGED_IN) {
|
||||
this.loadFreezeIcons();
|
||||
loadFreezeIcons();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception {
|
||||
this.overlayManager.add(this.FreezeTimersOverlay);
|
||||
this.overlayManager.add(this.FreezeTimersTileOverlay);
|
||||
overlayManager.add(FreezeTimersOverlay);
|
||||
overlayManager.add(FreezeTimersTileOverlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception {
|
||||
this.overlayManager.remove(this.FreezeTimersOverlay);
|
||||
this.overlayManager.remove(this.FreezeTimersTileOverlay);
|
||||
this.frozenthings.clear();
|
||||
this.frozenthingpoints.clear();
|
||||
this.tbedthings.clear();
|
||||
this.tbtypes.clear();
|
||||
overlayManager.remove(FreezeTimersOverlay);
|
||||
overlayManager.remove(FreezeTimersTileOverlay);
|
||||
frozenthings.clear();
|
||||
frozenthingpoints.clear();
|
||||
tbedthings.clear();
|
||||
tbtypes.clear();
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onMenuOptionClicked(MenuOptionClicked event) {
|
||||
if (event.getMenuTarget().contains("->")) {
|
||||
Pattern spattern = Pattern.compile(">(.+?)</col>");
|
||||
Pattern ppattern = Pattern.compile("> <col=ffffff>(.+?)<col=");
|
||||
Matcher smatch = spattern.matcher(event.getMenuTarget());
|
||||
Matcher pmatch = ppattern.matcher(event.getMenuTarget());
|
||||
public void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (event.getMenuTarget().contains("->"))
|
||||
{
|
||||
final Pattern spattern = Pattern.compile(">(.+?)</col>");
|
||||
final Pattern ppattern = Pattern.compile("> <col=ffffff>(.+?)<col=");
|
||||
final Matcher smatch = spattern.matcher(event.getMenuTarget());
|
||||
final Matcher pmatch = ppattern.matcher(event.getMenuTarget());
|
||||
smatch.find();
|
||||
pmatch.find();
|
||||
if (smatch.group(1) != null && pmatch.group(1) != null) {
|
||||
this.currticks = this.ticks;
|
||||
this.spell = smatch.group(1);
|
||||
this.currtarget = pmatch.group(1).replace("\u00a0", " ");
|
||||
if (smatch.group(1) != null && pmatch.group(1) != null)
|
||||
{
|
||||
currticks = ticks;
|
||||
spell = smatch.group(1);
|
||||
currtarget = pmatch.group(1).replace(" ", " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onExperienceChanged(ExperienceChanged event) {
|
||||
if (event.getSkill() == Skill.MAGIC) {
|
||||
int xp = this.client.getSkillExperience(Skill.MAGIC);
|
||||
int gains = xp - this.lastxp;
|
||||
this.lastxp = xp;
|
||||
if (!this.magexp.containsKey(this.ticks)) {
|
||||
this.magexp.clear();
|
||||
this.magexp.put(this.ticks, gains);
|
||||
public void onExperienceChanged(ExperienceChanged event)
|
||||
{
|
||||
if (event.getSkill() == Skill.MAGIC)
|
||||
{
|
||||
final int xp = client.getSkillExperience(Skill.MAGIC);
|
||||
int gains = xp - lastxp;
|
||||
lastxp = xp;
|
||||
if (!magexp.containsKey(ticks))
|
||||
{
|
||||
magexp.clear();
|
||||
magexp.put(ticks, gains);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
private void onAnimationChanged(AnimationChanged event) {
|
||||
Logger l = this.client.getLogger();
|
||||
Actor subject = event.getActor();
|
||||
Actor target = subject.getInteracting();
|
||||
if (subject.getAnimation() == 1979) {
|
||||
try {
|
||||
if (target.getGraphic() == 85 || target.getGraphic() != -1) {
|
||||
private void onAnimationChanged(AnimationChanged event)
|
||||
{
|
||||
Logger l = client.getLogger();
|
||||
final Actor subject = event.getActor();
|
||||
final Actor target = subject.getInteracting();
|
||||
|
||||
if (subject.getAnimation() == 1979)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (target.getGraphic() == SPLASH_ID || target.getGraphic() != -1)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.frozenthings.containsKey(target.getName())) {
|
||||
if (frozenthings.containsKey(target.getName()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.testMap.put(target.getName(), new Barrage(target, subject));
|
||||
this.freezetype.put(target.getName(), 7);
|
||||
this.frozenthings.put(target.getName(), System.currentTimeMillis());
|
||||
this.frozenthingpoints.put(target.getName(), target.getWorldLocation());
|
||||
testMap.put(target.getName(), new Barrage(target, subject));
|
||||
freezetype.put(target.getName(), 7);
|
||||
frozenthings.put(target.getName(), System.currentTimeMillis());
|
||||
frozenthingpoints.put(target.getName(), target.getWorldLocation());
|
||||
|
||||
}
|
||||
catch (NullPointerException nullPointerException) {
|
||||
// empty catch block
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
//no
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event) {
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
int xp = 0;
|
||||
boolean praymage = false;
|
||||
if (this.magexp.containsKey(this.ticks)) {
|
||||
xp = this.magexp.get(this.ticks);
|
||||
if (magexp.containsKey(ticks))
|
||||
{
|
||||
xp = magexp.get(ticks);
|
||||
}
|
||||
if (xp > 0 && this.currtarget != null) {
|
||||
if (this.frozenthings.containsKey(this.currtarget)) {
|
||||
this.currtarget = null;
|
||||
if (xp > 0 && currtarget != null)
|
||||
{
|
||||
if (frozenthings.containsKey(currtarget))
|
||||
{
|
||||
currtarget = null;
|
||||
return;
|
||||
}
|
||||
WorldPoint targetPosition = null;
|
||||
for (Player player : this.client.getPlayers()) {
|
||||
String playerName;
|
||||
if (player == null || !(playerName = player.getName()).equals(this.currtarget)) continue;
|
||||
if (player.getOverheadIcon() != null && player.getOverheadIcon().equals((Object)HeadIcon.MAGIC)) {
|
||||
praymage = true;
|
||||
for (Player player : client.getPlayers())
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
String playerName = player.getName();
|
||||
if (playerName.equals(currtarget))
|
||||
{
|
||||
if (player.getOverheadIcon() != null)
|
||||
{
|
||||
if (player.getOverheadIcon().equals(HeadIcon.MAGIC))
|
||||
{
|
||||
praymage = true;
|
||||
}
|
||||
}
|
||||
targetPosition = player.getWorldLocation();
|
||||
break;
|
||||
}
|
||||
targetPosition = player.getWorldLocation();
|
||||
break;
|
||||
}
|
||||
if (targetPosition != null) {
|
||||
if (this.spell.equals("Bind") && xp > 30) {
|
||||
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
|
||||
this.frozenthingpoints.put(this.currtarget, targetPosition);
|
||||
if (praymage) {
|
||||
this.freezetype.put(this.currtarget, 8);
|
||||
} else {
|
||||
this.freezetype.put(this.currtarget, 1);
|
||||
if (targetPosition != null)
|
||||
{
|
||||
if (spell.equals("Bind") && xp > 30)
|
||||
{
|
||||
frozenthings.put(currtarget, System.currentTimeMillis());
|
||||
frozenthingpoints.put(currtarget, targetPosition);
|
||||
if (praymage)
|
||||
{
|
||||
freezetype.put(currtarget, 8);
|
||||
}
|
||||
} else if (this.spell.equals("Snare") && xp > 60) {
|
||||
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
|
||||
this.frozenthingpoints.put(this.currtarget, targetPosition);
|
||||
if (praymage) {
|
||||
this.freezetype.put(this.currtarget, 9);
|
||||
} else {
|
||||
this.freezetype.put(this.currtarget, 2);
|
||||
else
|
||||
{
|
||||
freezetype.put(currtarget, 1);
|
||||
}
|
||||
} else if (this.spell.equals("Entangle") && xp >= 89) {
|
||||
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
|
||||
this.frozenthingpoints.put(this.currtarget, targetPosition);
|
||||
if (praymage) {
|
||||
this.freezetype.put(this.currtarget, 10);
|
||||
} else {
|
||||
this.freezetype.put(this.currtarget, 3);
|
||||
}
|
||||
else if (spell.equals("Snare") && xp > 60)
|
||||
{
|
||||
frozenthings.put(currtarget, System.currentTimeMillis());
|
||||
frozenthingpoints.put(currtarget, targetPosition);
|
||||
if (praymage)
|
||||
{
|
||||
freezetype.put(currtarget, 9);
|
||||
}
|
||||
} else if (this.spell.equals("Ice Rush") && xp > 34) {
|
||||
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
|
||||
this.frozenthingpoints.put(this.currtarget, targetPosition);
|
||||
this.freezetype.put(this.currtarget, 4);
|
||||
} else if (this.spell.equals("Ice Burst") && xp > 40) {
|
||||
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
|
||||
this.frozenthingpoints.put(this.currtarget, targetPosition);
|
||||
this.freezetype.put(this.currtarget, 5);
|
||||
} else if (this.spell.equals("Ice Blitz") && xp > 46) {
|
||||
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
|
||||
this.frozenthingpoints.put(this.currtarget, targetPosition);
|
||||
this.freezetype.put(this.currtarget, 6);
|
||||
} else if (this.spell.equals("Ice Barrage") && xp > 52) {
|
||||
Barrage barrage = new Barrage(this.client.getLocalPlayer().getInteracting(), this.client.getLocalPlayer());
|
||||
this.testMap.put(this.currtarget, barrage);
|
||||
this.frozenthings.put(this.currtarget, System.currentTimeMillis());
|
||||
this.frozenthingpoints.put(this.currtarget, targetPosition);
|
||||
this.freezetype.put(this.currtarget, 7);
|
||||
} else if (spell.equals("Tele Block") && xp == 95) {
|
||||
if (config.TBTimer()) {
|
||||
if (praymage) {
|
||||
this.tbtypes.put(this.currtarget, 2);
|
||||
} else {
|
||||
this.tbtypes.put(this.currtarget, 1);
|
||||
}
|
||||
this.tbedthings.put(this.currtarget, System.currentTimeMillis());
|
||||
}
|
||||
else
|
||||
{
|
||||
freezetype.put(currtarget, 2);
|
||||
}
|
||||
}
|
||||
else if (spell.equals("Entangle") && xp >= 89)
|
||||
{
|
||||
frozenthings.put(currtarget, System.currentTimeMillis());
|
||||
frozenthingpoints.put(currtarget, targetPosition);
|
||||
if (praymage)
|
||||
{
|
||||
freezetype.put(currtarget, 10);
|
||||
}
|
||||
else
|
||||
{
|
||||
freezetype.put(currtarget, 3);
|
||||
}
|
||||
}
|
||||
else if (spell.equals("Ice Rush") && xp > 34)
|
||||
{
|
||||
frozenthings.put(currtarget, System.currentTimeMillis());
|
||||
frozenthingpoints.put(currtarget, targetPosition);
|
||||
freezetype.put(currtarget, 4);
|
||||
}
|
||||
else if (spell.equals("Ice Burst") && xp > 40)
|
||||
{
|
||||
frozenthings.put(currtarget, System.currentTimeMillis());
|
||||
frozenthingpoints.put(currtarget, targetPosition);
|
||||
freezetype.put(currtarget, 5);
|
||||
}
|
||||
else if (spell.equals("Ice Blitz") && xp > 46)
|
||||
{
|
||||
frozenthings.put(currtarget, System.currentTimeMillis());
|
||||
frozenthingpoints.put(currtarget, targetPosition);
|
||||
freezetype.put(currtarget, 6);
|
||||
}
|
||||
else if (spell.equals("Ice Barrage") && xp > 52)
|
||||
{
|
||||
Barrage barrage = new Barrage(client.getLocalPlayer().getInteracting(), client.getLocalPlayer());
|
||||
testMap.put(currtarget, barrage);
|
||||
frozenthings.put(currtarget, System.currentTimeMillis());
|
||||
frozenthingpoints.put(currtarget, targetPosition);
|
||||
freezetype.put(currtarget, 7);
|
||||
}
|
||||
} else if (spell.equals("Tele Block") && xp == 95) {
|
||||
if (config.TBTimer()) {
|
||||
if (praymage) {
|
||||
tbtypes.put(currtarget, 2);
|
||||
} else {
|
||||
tbtypes.put(currtarget, 1);
|
||||
}
|
||||
tbedthings.put(currtarget, System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (this.currtarget != null && this.ticks > this.currticks + 1) {
|
||||
Player local = this.client.getLocalPlayer();
|
||||
if (currtarget != null && ticks > currticks + 1)
|
||||
{
|
||||
Player local = client.getLocalPlayer();
|
||||
Actor interacting = local.getInteracting();
|
||||
if (interacting != null) {
|
||||
if (!interacting.getName().equals(this.currtarget)) {
|
||||
this.currtarget = null;
|
||||
if (interacting != null)
|
||||
{
|
||||
if (!interacting.getName().equals(currtarget))
|
||||
{
|
||||
currtarget = null;
|
||||
}
|
||||
} else {
|
||||
this.currtarget = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
currtarget = null;
|
||||
}
|
||||
}
|
||||
++this.ticks;
|
||||
ticks++;
|
||||
}
|
||||
|
||||
public long opponentfreezetime(String name) {
|
||||
if (this.frozenthings.containsKey(name)) {
|
||||
return this.frozenthings.get(name);
|
||||
public long opponentfreezetime(String name)
|
||||
{
|
||||
if (frozenthings.containsKey(name))
|
||||
{
|
||||
return frozenthings.get(name);
|
||||
}
|
||||
return 0L;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public WorldPoint playerpos(String name) {
|
||||
if (this.frozenthingpoints.containsKey(name)) {
|
||||
return this.frozenthingpoints.get(name);
|
||||
public WorldPoint playerpos(String name)
|
||||
{
|
||||
if (frozenthingpoints.containsKey(name))
|
||||
{
|
||||
return frozenthingpoints.get(name);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void updatePosition(String name, WorldPoint point) {
|
||||
if (this.frozenthingpoints.containsKey(name)) {
|
||||
this.frozenthingpoints.remove(name);
|
||||
this.frozenthingpoints.put(name, point);
|
||||
public void updatePosition(String name, WorldPoint point)
|
||||
{
|
||||
if (frozenthingpoints.containsKey(name))
|
||||
{
|
||||
frozenthingpoints.remove(name);
|
||||
frozenthingpoints.put(name, point);
|
||||
}
|
||||
}
|
||||
|
||||
public int freezetype(String name) {
|
||||
if (this.freezetype.containsKey(name)) {
|
||||
return this.freezetype.get(name);
|
||||
public int freezetype(String name)
|
||||
{
|
||||
if (freezetype.containsKey(name))
|
||||
{
|
||||
return freezetype.get(name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public long istbed(String name) {
|
||||
if (this.tbedthings.containsKey(name)) {
|
||||
return this.tbedthings.get(name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public int tbtype(String name) {
|
||||
if (this.tbtypes.containsKey(name)) {
|
||||
return this.tbtypes.get(name);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
public void deleteopponent(String name) {
|
||||
if (this.frozenthings.containsKey(name)) {
|
||||
this.frozenthings.remove(name);
|
||||
|
||||
public long istbed(String name) {
|
||||
if (tbedthings.containsKey(name)) {
|
||||
return tbedthings.get(name);
|
||||
}
|
||||
if (this.frozenthingpoints.containsKey(name)) {
|
||||
this.frozenthingpoints.remove(name);
|
||||
return 0;
|
||||
}
|
||||
public int tbtype(String name) {
|
||||
if (tbtypes.containsKey(name)) {
|
||||
return tbtypes.get(name);
|
||||
}
|
||||
if (this.freezetype.containsKey(name)) {
|
||||
this.freezetype.remove(name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public void deleteopponent(String name)
|
||||
{
|
||||
if (frozenthings.containsKey(name))
|
||||
{
|
||||
frozenthings.remove(name);
|
||||
}
|
||||
if (frozenthingpoints.containsKey(name))
|
||||
{
|
||||
frozenthingpoints.remove(name);
|
||||
}
|
||||
if (freezetype.containsKey(name))
|
||||
{
|
||||
freezetype.remove(name);
|
||||
}
|
||||
}
|
||||
public void deletetb(String name) {
|
||||
if (this.tbedthings.containsKey(name)) {
|
||||
this.tbedthings.remove(name);
|
||||
}
|
||||
if (this.tbtypes.containsKey(name)) {
|
||||
this.tbtypes.remove(name);
|
||||
}
|
||||
}
|
||||
private void loadFreezeIcons() {
|
||||
IndexedSprite[] freezeIcons = new IndexedSprite[]{};
|
||||
IndexedSprite[] newfreezeIcons = Arrays.copyOf(freezeIcons, FREEZE_ICONS.length);
|
||||
|
||||
public void deletetb(String name) {
|
||||
if (tbedthings.containsKey(name)) {
|
||||
tbedthings.remove(name);
|
||||
}
|
||||
if (tbtypes.containsKey(name)) {
|
||||
tbtypes.remove(name);
|
||||
}
|
||||
}
|
||||
|
||||
private void loadFreezeIcons()
|
||||
{
|
||||
final IndexedSprite[] freezeIcons = {};
|
||||
final IndexedSprite[] newfreezeIcons = Arrays.copyOf(freezeIcons, FREEZE_ICONS.length);
|
||||
int curPosition = 0;
|
||||
int i = 0;
|
||||
while (i < FREEZE_ICONS.length) {
|
||||
int resource = FREEZE_ICONS[i];
|
||||
this.FreezeIcons[i] = FreezeTimersPlugin.rgbaToIndexedBufferedImage(FreezeTimersPlugin.FreezeIconFromSprite(this.spriteManager.getSprite(resource, 0)));
|
||||
newfreezeIcons[curPosition] = FreezeTimersPlugin.createIndexedSprite(this.client, this.FreezeIcons[i]);
|
||||
++i;
|
||||
++curPosition;
|
||||
|
||||
for (int i = 0; i < FREEZE_ICONS.length; i++, curPosition++)
|
||||
{
|
||||
final int resource = FREEZE_ICONS[i];
|
||||
FreezeIcons[i] = rgbaToIndexedBufferedImage(FreezeIconFromSprite(spriteManager.getSprite(resource, 0)));
|
||||
newfreezeIcons[curPosition] = createIndexedSprite(client, FreezeIcons[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,7 +431,7 @@ extends Plugin {
|
||||
}
|
||||
|
||||
private static BufferedImage rgbaToIndexedBufferedImage(BufferedImage sourceBufferedImage) {
|
||||
BufferedImage indexedImage = new BufferedImage(sourceBufferedImage.getWidth(), sourceBufferedImage.getHeight(), 13);
|
||||
BufferedImage indexedImage = new BufferedImage(sourceBufferedImage.getWidth(), sourceBufferedImage.getHeight(), BufferedImage.TYPE_BYTE_INDEXED);
|
||||
ColorModel cm = indexedImage.getColorModel();
|
||||
IndexColorModel icm = (IndexColorModel)cm;
|
||||
int size = icm.getMapSize();
|
||||
@@ -383,21 +441,23 @@ extends Plugin {
|
||||
icm.getReds(reds);
|
||||
icm.getGreens(greens);
|
||||
icm.getBlues(blues);
|
||||
WritableRaster raster = indexedImage.getRaster();
|
||||
int pixel = raster.getSample(0, 0, 0);
|
||||
IndexColorModel resultIcm = new IndexColorModel(8, size, reds, greens, blues, pixel);
|
||||
BufferedImage resultIndexedImage = new BufferedImage(resultIcm, raster, sourceBufferedImage.isAlphaPremultiplied(), null);
|
||||
|
||||
final WritableRaster raster = indexedImage.getRaster();
|
||||
final int pixel = raster.getSample(0, 0, 0);
|
||||
final IndexColorModel resultIcm = new IndexColorModel(8, size, reds, greens, blues, pixel);
|
||||
final BufferedImage resultIndexedImage = new BufferedImage(resultIcm, raster, sourceBufferedImage.isAlphaPremultiplied(), null);
|
||||
resultIndexedImage.getGraphics().drawImage(sourceBufferedImage, 0, 0, null);
|
||||
return resultIndexedImage;
|
||||
}
|
||||
|
||||
private static BufferedImage FreezeIconFromSprite(BufferedImage freezeSprite) {
|
||||
BufferedImage freezeCanvas = ImageUtil.resizeCanvas(freezeSprite, FreezeTimersPlugin.FREEZE_ICON_DIMENSION.width, FreezeTimersPlugin.FREEZE_ICON_DIMENSION.height);
|
||||
private static BufferedImage FreezeIconFromSprite(final BufferedImage freezeSprite)
|
||||
{
|
||||
final BufferedImage freezeCanvas = ImageUtil.resizeCanvas(freezeSprite, FREEZE_ICON_DIMENSION.width, FREEZE_ICON_DIMENSION.height);
|
||||
return ImageUtil.outlineImage(freezeCanvas, FREEZE_ICON_OUTLINE_COLOR);
|
||||
}
|
||||
|
||||
BufferedImage GetFreezeIcon(int id) {
|
||||
return this.FreezeIcons[id];
|
||||
BufferedImage GetFreezeIcon(int id)
|
||||
{
|
||||
return FreezeIcons[id];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,81 +1,123 @@
|
||||
/*
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.freezetimers;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.function.BiConsumer;
|
||||
import javax.inject.Inject;
|
||||
import javax.inject.Singleton;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.plugins.freezetimers.FreezeTimersConfig;
|
||||
import net.runelite.client.plugins.freezetimers.FreezeTimersPlugin;
|
||||
|
||||
|
||||
@Singleton
|
||||
public class FreezeTimersService {
|
||||
public class FreezeTimersService
|
||||
{
|
||||
private final Client client;
|
||||
private final FreezeTimersConfig config;
|
||||
private final FreezeTimersPlugin plugin;
|
||||
|
||||
@Inject
|
||||
private FreezeTimersService(Client client, FreezeTimersConfig config, FreezeTimersPlugin plugin) {
|
||||
private FreezeTimersService(Client client, FreezeTimersConfig config, FreezeTimersPlugin plugin)
|
||||
{
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
public void forEachPlayer(BiConsumer<Player, Color> consumer) {
|
||||
for (Player player : this.client.getPlayers()) {
|
||||
if (player == null || player.getName() == null) continue;
|
||||
public void forEachPlayer(final BiConsumer<Player, Color> consumer)
|
||||
{
|
||||
|
||||
for (Player player : client.getPlayers())
|
||||
{
|
||||
if (player == null || player.getName() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String name = player.getName();
|
||||
int freezetype = this.plugin.freezetype(name);
|
||||
long tbed = plugin.istbed(name);
|
||||
long dtime = this.plugin.opponentfreezetime(name);
|
||||
int freezetype = plugin.freezetype(name);
|
||||
long dtime = plugin.opponentfreezetime(name);
|
||||
long tbed = plugin.istbed(name);
|
||||
int freezetime = 0;
|
||||
if (freezetype == 1 || freezetype == 4) {
|
||||
if (freezetype == 1 || freezetype == 4)
|
||||
{
|
||||
freezetime = 5000;
|
||||
} else if (freezetype == 2 || freezetype == 5) {
|
||||
}
|
||||
else if (freezetype == 2 || freezetype == 5)
|
||||
{
|
||||
freezetime = 10000;
|
||||
} else if (freezetype == 3 || freezetype == 6) {
|
||||
}
|
||||
else if (freezetype == 3 || freezetype == 6)
|
||||
{
|
||||
freezetime = 15000;
|
||||
} else if (freezetype == 7) {
|
||||
}
|
||||
else if (freezetype == 7)
|
||||
{
|
||||
freezetime = 20000;
|
||||
} else if (freezetype == 8) {
|
||||
}
|
||||
else if (freezetype == 8)
|
||||
{
|
||||
freezetime = 2500;
|
||||
} else if (freezetype == 9) {
|
||||
}
|
||||
else if (freezetype == 9)
|
||||
{
|
||||
freezetime = 5000;
|
||||
} else if (freezetype == 10) {
|
||||
}
|
||||
else if (freezetype == 10)
|
||||
{
|
||||
freezetime = 7500;
|
||||
}
|
||||
if (dtime <= 0L) continue;
|
||||
long currenttime = System.currentTimeMillis();
|
||||
long timediff = currenttime - dtime;
|
||||
if (timediff < (long)freezetime) {
|
||||
WorldPoint lastWorldPoint;
|
||||
WorldPoint currentWorldPoint = player.getWorldLocation();
|
||||
if (currentWorldPoint.equals(lastWorldPoint = this.plugin.playerpos(name))) {
|
||||
consumer.accept(player, this.config.FreezeTimerColor());
|
||||
continue;
|
||||
if (dtime > 0)
|
||||
{
|
||||
long currenttime = System.currentTimeMillis();
|
||||
long timediff = currenttime - dtime;
|
||||
if (timediff < freezetime)
|
||||
{
|
||||
WorldPoint currentWorldPoint = player.getWorldLocation();
|
||||
WorldPoint lastWorldPoint = plugin.playerpos(name);
|
||||
if (currentWorldPoint.equals(lastWorldPoint))
|
||||
{
|
||||
consumer.accept(player, config.FreezeTimerColor());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (timediff < 605)
|
||||
{
|
||||
plugin.updatePosition(name, currentWorldPoint);
|
||||
consumer.accept(player, config.FreezeTimerColor());
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.deleteopponent(name);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (timediff < 605L) {
|
||||
this.plugin.updatePosition(name, currentWorldPoint);
|
||||
consumer.accept(player, this.config.FreezeTimerColor());
|
||||
continue;
|
||||
else
|
||||
{
|
||||
if (timediff < freezetime + 3000)
|
||||
{
|
||||
consumer.accept(player, Color.YELLOW);
|
||||
}
|
||||
else
|
||||
{
|
||||
plugin.deleteopponent(name);
|
||||
}
|
||||
if (tbed > 0) {
|
||||
consumer.accept(player, config.FreezeTimerColor());
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.plugin.deleteopponent(name);
|
||||
continue;
|
||||
}
|
||||
if (timediff < (long)(freezetime + 3000)) {
|
||||
consumer.accept(player, Color.YELLOW);
|
||||
continue;
|
||||
} else {
|
||||
this.plugin.deleteopponent(name);
|
||||
}
|
||||
if (tbed > 0) {
|
||||
consumer.accept(player, config.FreezeTimerColor());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,46 +1,57 @@
|
||||
/*
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.freezetimers;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.util.function.BiConsumer;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.client.plugins.freezetimers.FreezeTimersConfig;
|
||||
import net.runelite.client.plugins.freezetimers.FreezeTimersService;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
public class FreezeTimersTileOverlay
|
||||
extends Overlay {
|
||||
public class FreezeTimersTileOverlay extends Overlay
|
||||
{
|
||||
private final FreezeTimersService FreezeTimersService;
|
||||
private final FreezeTimersConfig config;
|
||||
|
||||
@Inject
|
||||
private FreezeTimersTileOverlay(FreezeTimersConfig config, FreezeTimersService FreezeTimersService2) {
|
||||
private FreezeTimersTileOverlay(FreezeTimersConfig config, FreezeTimersService FreezeTimersService)
|
||||
{
|
||||
this.config = config;
|
||||
this.FreezeTimersService = FreezeTimersService2;
|
||||
this.setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
this.setPosition(OverlayPosition.DYNAMIC);
|
||||
this.setPriority(OverlayPriority.MED);
|
||||
this.FreezeTimersService = FreezeTimersService;
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.MED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
if (!this.config.drawTiles()) {
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (!config.drawTiles())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
this.FreezeTimersService.forEachPlayer((player, color) -> {
|
||||
Polygon poly = player.getCanvasTilePoly();
|
||||
if (poly != null) {
|
||||
|
||||
FreezeTimersService.forEachPlayer((player, color) ->
|
||||
{
|
||||
final Polygon poly = player.getCanvasTilePoly();
|
||||
|
||||
if (poly != null)
|
||||
{
|
||||
OverlayUtil.renderPolygon(graphics, poly, color);
|
||||
}
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,35 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.freezetimers;
|
||||
|
||||
public enum PlayerSpellEffect {
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public enum PlayerSpellEffect
|
||||
{
|
||||
|
||||
|
||||
BARRAGE("Ice Barrage", 20000, false),
|
||||
BLITZ("Ice Blitz", 15000, false);
|
||||
|
||||
private final String SPELL_NAME;
|
||||
private long startTime;
|
||||
private int duration;
|
||||
private boolean halvable;
|
||||
|
||||
private PlayerSpellEffect(String name, int duration, boolean halvable) {
|
||||
@Getter
|
||||
private final String SPELL_NAME;
|
||||
@Getter
|
||||
private long startTime;
|
||||
@Getter
|
||||
private int duration;
|
||||
@Getter
|
||||
private boolean halvable;
|
||||
//private final BufferedImage SPELL_ICON;
|
||||
|
||||
|
||||
|
||||
PlayerSpellEffect(String name, int duration, boolean halvable)
|
||||
{
|
||||
this.SPELL_NAME = name;
|
||||
this.duration = duration;
|
||||
this.halvable = halvable;
|
||||
this.startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public String getSPELL_NAME() {
|
||||
return this.SPELL_NAME;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return this.startTime;
|
||||
}
|
||||
|
||||
public int getDuration() {
|
||||
return this.duration;
|
||||
}
|
||||
|
||||
public boolean isHalvable() {
|
||||
return this.halvable;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
/*
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.freezetimers;
|
||||
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Actor;
|
||||
|
||||
public abstract class Spell {
|
||||
public abstract class Spell
|
||||
{
|
||||
|
||||
@Getter
|
||||
private final Actor affectedTarget;
|
||||
@Getter
|
||||
private final Actor caster;
|
||||
@Getter
|
||||
public final long startTime;
|
||||
private long remainingTime;
|
||||
@Getter
|
||||
private boolean isFinished;
|
||||
|
||||
protected Spell(Actor affectedTarget, Actor caster) {
|
||||
protected Spell(Actor affectedTarget, Actor caster)
|
||||
{
|
||||
this.affectedTarget = affectedTarget;
|
||||
this.caster = caster;
|
||||
this.startTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public Actor getAffectedTarget() {
|
||||
return this.affectedTarget;
|
||||
}
|
||||
|
||||
public Actor getCaster() {
|
||||
return this.caster;
|
||||
}
|
||||
|
||||
public long getStartTime() {
|
||||
return this.startTime;
|
||||
}
|
||||
|
||||
public boolean isFinished() {
|
||||
return this.isFinished;
|
||||
startTime = System.currentTimeMillis();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,74 +1,70 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.139.
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Canvas;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.LayoutManager;
|
||||
import java.awt.Point;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.ClipboardOwner;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.plugins.pvptools.PvpToolsPlugin;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
|
||||
public class CurrentPlayersJFrame
|
||||
extends JFrame {
|
||||
public JList currentPlayersJList;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
|
||||
CurrentPlayersJFrame(Client client, PvpToolsPlugin pvpToolsPlugin, List<String> list) {
|
||||
int x = client.getCanvas().getLocationOnScreen().x + client.getCanvas().getWidth();
|
||||
int y = client.getCanvas().getLocationOnScreen().y;
|
||||
JPanel scrollContainerCurrent = new JPanel(new BorderLayout());
|
||||
JScrollPane jScrollPane = new JScrollPane(scrollContainerCurrent);
|
||||
JButton refreshJButton = new JButton("Refresh");
|
||||
refreshJButton.addActionListener(pvpToolsPlugin.currentPlayersActionListener);
|
||||
JButton copyJButton = new JButton("Copy List");
|
||||
this.currentPlayersJList = new JList<Object>(list.toArray());
|
||||
ActionListener copyButtonActionListener = e -> {
|
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
list.forEach(s -> {
|
||||
stringBuilder.append((String)s);
|
||||
stringBuilder.append(System.getProperty("line.separator"));
|
||||
});
|
||||
StringSelection stringSelection = new StringSelection(stringBuilder.toString());
|
||||
clipboard.setContents(stringSelection, stringSelection);
|
||||
};
|
||||
copyJButton.addActionListener(copyButtonActionListener);
|
||||
this.setTitle("Current CC Members");
|
||||
this.setDefaultCloseOperation(2);
|
||||
JLabel titleLabel = new JLabel("Current CC Members");
|
||||
titleLabel.setFont(FontManager.getRunescapeFont().deriveFont(1, 18.0f));
|
||||
this.currentPlayersJList.setFont(new Font("Arial", 0, 14));
|
||||
scrollContainerCurrent.add((Component)refreshJButton, "North");
|
||||
scrollContainerCurrent.add((Component)titleLabel, "Center");
|
||||
JPanel footerPanel = new JPanel(new BorderLayout());
|
||||
footerPanel.add((Component)this.currentPlayersJList, "North");
|
||||
footerPanel.add((Component)copyJButton, "Center");
|
||||
scrollContainerCurrent.add((Component)footerPanel, "South");
|
||||
this.add(jScrollPane);
|
||||
this.setLocation(x, y);
|
||||
this.setMaximumSize(Toolkit.getDefaultToolkit().getScreenSize());
|
||||
this.pack();
|
||||
this.setVisible(true);
|
||||
}
|
||||
public class CurrentPlayersJFrame extends JFrame
|
||||
{
|
||||
|
||||
public JList currentPlayersJList;
|
||||
|
||||
CurrentPlayersJFrame(Client client, PvpToolsPlugin pvpToolsPlugin, List<String> list)
|
||||
{
|
||||
super();
|
||||
int x = client.getCanvas().getLocationOnScreen().x + client.getCanvas().getWidth();
|
||||
int y = client.getCanvas().getLocationOnScreen().y;
|
||||
JPanel scrollContainerCurrent = new JPanel(new BorderLayout());
|
||||
|
||||
JScrollPane jScrollPane = new JScrollPane(scrollContainerCurrent);
|
||||
JButton refreshJButton = new JButton("Refresh");
|
||||
refreshJButton.addActionListener(pvpToolsPlugin.currentPlayersActionListener);
|
||||
JButton copyJButton = new JButton("Copy List");
|
||||
currentPlayersJList = new JList(list.toArray());
|
||||
ActionListener copyButtonActionListener = e ->
|
||||
{
|
||||
StringSelection stringSelection;
|
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
list.forEach(s ->
|
||||
{
|
||||
stringBuilder.append(s);
|
||||
stringBuilder.append(System.getProperty("line.separator"));
|
||||
});
|
||||
stringSelection = new StringSelection(stringBuilder.toString());
|
||||
clipboard.setContents(stringSelection, stringSelection);
|
||||
};
|
||||
copyJButton.addActionListener(copyButtonActionListener);
|
||||
this.setTitle("Current CC Members");
|
||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
JLabel titleLabel = new JLabel("Current CC Members");
|
||||
titleLabel.setFont(FontManager.getRunescapeFont().deriveFont(Font.BOLD, 18));
|
||||
currentPlayersJList.setFont(new Font("Arial", Font.PLAIN, 14));
|
||||
scrollContainerCurrent.add(refreshJButton, BorderLayout.NORTH);
|
||||
scrollContainerCurrent.add(titleLabel, BorderLayout.CENTER);
|
||||
JPanel footerPanel = new JPanel(new BorderLayout());
|
||||
footerPanel.add(currentPlayersJList, BorderLayout.NORTH);
|
||||
footerPanel.add(copyJButton, BorderLayout.CENTER);
|
||||
scrollContainerCurrent.add(footerPanel, BorderLayout.SOUTH);
|
||||
this.add(jScrollPane);
|
||||
this.setLocation(x, y);
|
||||
this.setMaximumSize(Toolkit.getDefaultToolkit().getScreenSize());
|
||||
this.pack();
|
||||
this.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,74 +1,79 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.139.
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Canvas;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Container;
|
||||
import java.awt.Font;
|
||||
import java.awt.LayoutManager;
|
||||
import java.awt.Point;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.ClipboardOwner;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.Vector;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import net.runelite.api.ClanMember;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.plugins.pvptools.PvpToolsPlugin;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
|
||||
public class MissingPlayersJFrame
|
||||
extends JFrame {
|
||||
public JList missingPlayersJList;
|
||||
public class MissingPlayersJFrame extends JFrame
|
||||
{
|
||||
|
||||
MissingPlayersJFrame(Client client, PvpToolsPlugin pvpToolsPlugin, List<String> list) {
|
||||
int x = client.getCanvas().getLocationOnScreen().x + client.getCanvas().getWidth();
|
||||
int y = client.getCanvas().getLocationOnScreen().y;
|
||||
JPanel scrollConatiner = new JPanel(new BorderLayout());
|
||||
JScrollPane jScrollPane = new JScrollPane(scrollConatiner);
|
||||
JButton refreshJButton = new JButton("Refresh");
|
||||
refreshJButton.addActionListener(pvpToolsPlugin.playersButtonActionListener);
|
||||
JButton copyJButton = new JButton("Copy List");
|
||||
this.missingPlayersJList = new JList<Object>(list.toArray());
|
||||
ActionListener copyButtonActionListener = e -> {
|
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
list.forEach(s -> {
|
||||
stringBuilder.append((String)s);
|
||||
stringBuilder.append(System.getProperty("line.separator"));
|
||||
});
|
||||
StringSelection stringSelection = new StringSelection(stringBuilder.toString());
|
||||
clipboard.setContents(stringSelection, stringSelection);
|
||||
};
|
||||
copyJButton.addActionListener(copyButtonActionListener);
|
||||
this.setTitle("Missing CC Members");
|
||||
this.setDefaultCloseOperation(2);
|
||||
JLabel titleLabel = new JLabel("Missing CC Members");
|
||||
titleLabel.setFont(FontManager.getRunescapeFont().deriveFont(1, 18.0f));
|
||||
this.missingPlayersJList.setFont(new Font("Arial", 0, 14));
|
||||
scrollConatiner.add((Component)refreshJButton, "North");
|
||||
scrollConatiner.add((Component)titleLabel, "Center");
|
||||
JPanel footerPanel = new JPanel(new BorderLayout());
|
||||
footerPanel.add((Component)this.missingPlayersJList, "North");
|
||||
footerPanel.add((Component)copyJButton, "Center");
|
||||
scrollConatiner.add((Component)footerPanel, "South");
|
||||
this.add(jScrollPane);
|
||||
this.setLocation(x, y);
|
||||
this.setMaximumSize(Toolkit.getDefaultToolkit().getScreenSize());
|
||||
this.pack();
|
||||
this.setVisible(true);
|
||||
}
|
||||
public JList missingPlayersJList;
|
||||
|
||||
MissingPlayersJFrame(Client client, PvpToolsPlugin pvpToolsPlugin, List<String> list)
|
||||
{
|
||||
super();
|
||||
int x = client.getCanvas().getLocationOnScreen().x + client.getCanvas().getWidth();
|
||||
int y = client.getCanvas().getLocationOnScreen().y;
|
||||
JPanel scrollConatiner = new JPanel(new BorderLayout());
|
||||
|
||||
JScrollPane jScrollPane = new JScrollPane(scrollConatiner);
|
||||
JButton refreshJButton = new JButton("Refresh");
|
||||
refreshJButton.addActionListener(pvpToolsPlugin.playersButtonActionListener);
|
||||
JButton copyJButton = new JButton("Copy List");
|
||||
missingPlayersJList = new JList(list.toArray());
|
||||
ActionListener copyButtonActionListener = e ->
|
||||
{
|
||||
StringSelection stringSelection;
|
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
list.forEach(s ->
|
||||
{
|
||||
stringBuilder.append(s);
|
||||
stringBuilder.append(System.getProperty("line.separator"));
|
||||
});
|
||||
stringSelection = new StringSelection(stringBuilder.toString());
|
||||
clipboard.setContents(stringSelection, stringSelection);
|
||||
};
|
||||
copyJButton.addActionListener(copyButtonActionListener);
|
||||
this.setTitle("Missing CC Members");
|
||||
this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
|
||||
JLabel titleLabel = new JLabel("Missing CC Members");
|
||||
titleLabel.setFont(FontManager.getRunescapeFont().deriveFont(Font.BOLD, 18));
|
||||
missingPlayersJList.setFont(new Font("Arial", Font.PLAIN, 14));
|
||||
scrollConatiner.add(refreshJButton, BorderLayout.NORTH);
|
||||
scrollConatiner.add(titleLabel, BorderLayout.CENTER);
|
||||
JPanel footerPanel = new JPanel(new BorderLayout());
|
||||
footerPanel.add(missingPlayersJList, BorderLayout.NORTH);
|
||||
footerPanel.add(copyJButton, BorderLayout.CENTER);
|
||||
scrollConatiner.add(footerPanel, BorderLayout.SOUTH);
|
||||
this.add(jScrollPane);
|
||||
this.setLocation(x, y);
|
||||
this.setMaximumSize(Toolkit.getDefaultToolkit().getScreenSize());
|
||||
this.pack();
|
||||
this.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,69 +1,147 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.139.
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.security.Key;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.Keybind;
|
||||
|
||||
@ConfigGroup(value="pvptools")
|
||||
public interface PvpToolsConfig
|
||||
extends Config {
|
||||
@ConfigItem(keyName="countPlayers", name="Count Players", description="When in PvP zones, counts the attackable players in and not in player's CC", position=3)
|
||||
default public boolean countPlayers() {
|
||||
return true;
|
||||
}
|
||||
@ConfigGroup("pvptools")
|
||||
public interface PvpToolsConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "countPlayers",
|
||||
name = "Count Players",
|
||||
description = "When in PvP zones, counts the attackable players in and not in player's CC",
|
||||
position = 3
|
||||
)
|
||||
default boolean countPlayers()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="countOverHeads", name="Count Enemy Overheads", description="Counts the number of each protection prayer attackable targets not in your CC are currently using", position=4)
|
||||
default public boolean countOverHeads() {
|
||||
return true;
|
||||
}
|
||||
@ConfigItem(
|
||||
keyName = "countOverHeads",
|
||||
name = "Count Enemy Overheads",
|
||||
description = "Counts the number of each protection prayer attackable targets not in your CC are currently" +
|
||||
" using",
|
||||
position = 4
|
||||
)
|
||||
default boolean countOverHeads()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="fallInHelper", name="Fall In Helper", description="Hides all non-friendly player entities other than the one that is attacking you.", position=5)
|
||||
default public boolean fallInHelper() {
|
||||
return true;
|
||||
}
|
||||
@ConfigItem(
|
||||
keyName = "fallInHelper",
|
||||
name = "Fall In Helper",
|
||||
description = "Hides all non-friendly player entities other than the one that is attacking you.",
|
||||
position = 5
|
||||
)
|
||||
default boolean fallInHelper()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="hotkey", name="Fall In Hotkey", description="Turns the fall in helper on or off when you press this hotkey", position=6)
|
||||
default public Keybind hotkey() {
|
||||
return Keybind.NOT_SET;
|
||||
}
|
||||
@ConfigItem(
|
||||
keyName = "hotkey",
|
||||
name = "Fall In Hotkey",
|
||||
description = "Turns the fall in helper on or off when you press this hotkey",
|
||||
position = 6
|
||||
)
|
||||
default Keybind hotkey()
|
||||
{
|
||||
return Keybind.NOT_SET;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="attackOptionsClan", name="Hide CC Attack Option", description="Hides the attack option for people in the same CC", position=7)
|
||||
default public boolean attackOptionsClan() {
|
||||
return false;
|
||||
}
|
||||
@ConfigItem(
|
||||
keyName = "attackOptionsClan",
|
||||
name = "Move CC Attack Option",
|
||||
description = "Moves the attack option for people in the same CC",
|
||||
position = 7,
|
||||
group = "Right-Click Attack Options"
|
||||
)
|
||||
default boolean attackOptionsClan()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="attackOptionsFriend", name="Hide Friend Attack Options", description="Hides the attack option for people on your friends list", position=8)
|
||||
default public boolean attackOptionsFriend() {
|
||||
return false;
|
||||
}
|
||||
@ConfigItem(
|
||||
keyName = "attackOptionsFriend",
|
||||
name = "Move Friend Attack Options",
|
||||
description = "Moves the attack option for people on your friends list",
|
||||
position = 8,
|
||||
group = "Right-Click Attack Options"
|
||||
)
|
||||
default boolean attackOptionsFriend()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="attackOptionsHotkey", name="Attack Option Hotkey", description="Enables a hotkey for attack options to disable or enable hiding quickly", position=10)
|
||||
default public Keybind attackOptionsHotkey() {
|
||||
return Keybind.CTRL;
|
||||
}
|
||||
@ConfigItem(
|
||||
keyName = "attackOptionsHotkey",
|
||||
name = "Attack Option Hotkey",
|
||||
description = "Enables a hotkey for attack options to disable or enable hiding quickly",
|
||||
position = 10,
|
||||
group = "Right-Click Attack Options"
|
||||
)
|
||||
default Keybind attackOptionsHotkey()
|
||||
{
|
||||
return Keybind.CTRL;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="levelRangeAttackOptions", name="Hide Other Attack Options", description="Hides the attack option for people that are outside your level range", position=9)
|
||||
default public boolean levelRangeAttackOptions() {
|
||||
return false;
|
||||
}
|
||||
@ConfigItem(
|
||||
keyName = "levelRangeAttackOptions",
|
||||
name = "Moves Other Attack Options",
|
||||
description = "Moves the attack option for people that are outside your level range",
|
||||
position = 9,
|
||||
group = "Right-Click Attack Options"
|
||||
)
|
||||
default boolean levelRangeAttackOptions()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="riskCalculator", name="Risk Calculator", description="Enables a panel in the PvP Tools Panel that shows the players current risk", position=13)
|
||||
default public boolean riskCalculatorEnabled() {
|
||||
return true;
|
||||
}
|
||||
@ConfigItem(
|
||||
keyName = "riskCalculator",
|
||||
name = "Risk Calculator",
|
||||
description = "Enables a panel in the PvP Tools Panel that shows the players current risk",
|
||||
position = 13
|
||||
)
|
||||
default boolean riskCalculatorEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="missingPlayers", name="Missing CC Players", description="Adds a button to the PvP Tools panel that opens a window showing which CC members are not at the current players location", position=14)
|
||||
default public boolean missingPlayersEnabled() {
|
||||
return true;
|
||||
}
|
||||
@ConfigItem(
|
||||
keyName = "missingPlayers",
|
||||
name = "Missing CC Players",
|
||||
description = "Adds a button to the PvP Tools panel that opens a window showing which CC members are not at" +
|
||||
" the current players location",
|
||||
position = 14
|
||||
)
|
||||
default boolean missingPlayersEnabled() { return true; }
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "currentPlayers",
|
||||
name = "Current CC Players",
|
||||
description = "Adds a button to the PvP Tools panel that opens a window showing which CC members currently at" +
|
||||
" the players location",
|
||||
position = 15
|
||||
)
|
||||
default boolean currentPlayersEnabled()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="currentPlayers", name="Current CC Players", description="Adds a button to the PvP Tools panel that opens a window showing which CC members currently at the players location", position=15)
|
||||
default public boolean currentPlayersEnabled() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,21 +1,23 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.139.
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Shape;
|
||||
import java.awt.Stroke;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.plugins.pvptools.PvpToolsConfig;
|
||||
import net.runelite.client.plugins.pvptools.PvpToolsPlugin;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
@@ -23,39 +25,47 @@ import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
public class PvpToolsOverlay
|
||||
extends Overlay {
|
||||
private PvpToolsPlugin pvpToolsPlugin;
|
||||
private PvpToolsConfig pvpToolsConfig;
|
||||
private Client client;
|
||||
public class PvpToolsOverlay extends Overlay
|
||||
{
|
||||
private PvpToolsPlugin pvpToolsPlugin;
|
||||
private PvpToolsConfig pvpToolsConfig;
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private PvpToolsOverlay(PvpToolsConfig pvpToolsConfig, PvpToolsPlugin pvpToolsPlugin, Client client) {
|
||||
this.pvpToolsPlugin = pvpToolsPlugin;
|
||||
this.pvpToolsConfig = pvpToolsConfig;
|
||||
this.client = client;
|
||||
this.setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.setPriority(OverlayPriority.HIGH);
|
||||
this.setPosition(OverlayPosition.DYNAMIC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
if (this.pvpToolsConfig.fallInHelper() && this.pvpToolsPlugin.fallinHelperEnabled) {
|
||||
graphics.setFont(FontManager.getRunescapeFont().deriveFont(28));
|
||||
OverlayUtil.renderTextLocation(graphics, new Point(200, 80), "FALL IN HELPER ENABLED", Color.YELLOW);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderPoly(Graphics2D graphics, Color color, Polygon polygon) {
|
||||
if (polygon != null) {
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2.0f));
|
||||
graphics.draw(polygon);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||
graphics.fill(polygon);
|
||||
}
|
||||
}
|
||||
@Inject
|
||||
private PvpToolsOverlay(PvpToolsConfig pvpToolsConfig, PvpToolsPlugin pvpToolsPlugin, Client client)
|
||||
{
|
||||
this.pvpToolsPlugin = pvpToolsPlugin;
|
||||
this.pvpToolsConfig = pvpToolsConfig;
|
||||
this.client = client;
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (pvpToolsConfig.fallInHelper())
|
||||
{
|
||||
if (pvpToolsPlugin.fallinHelperEnabled)
|
||||
{
|
||||
graphics.setFont(FontManager.getRunescapeFont().deriveFont(28));
|
||||
OverlayUtil.renderTextLocation(graphics, new Point(200, 80), "FALL IN HELPER ENABLED", Color.YELLOW);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderPoly(Graphics2D graphics, Color color, Polygon polygon)
|
||||
{
|
||||
if (polygon != null)
|
||||
{
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.draw(polygon);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||
graphics.fill(polygon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,138 +1,166 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.139.
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.LayoutManager;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.plugins.info.JRichTextPane;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.PluginPanel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PvpToolsPanel
|
||||
extends PluginPanel {
|
||||
private static final Logger log = LoggerFactory.getLogger(PvpToolsPanel.class);
|
||||
private final JLabel loggedLabel = new JLabel();
|
||||
private final JRichTextPane emailLabel = new JRichTextPane();
|
||||
public JLabel numCC = new JLabel();
|
||||
public JLabel numOther = new JLabel();
|
||||
public JLabel numMageJLabel = new JLabel(" ");
|
||||
public JLabel numRangeJLabel = new JLabel(" ");
|
||||
public JLabel numMeleeJLabel = new JLabel(" ");
|
||||
public JLabel totalRiskLabel = new JLabel(" ");
|
||||
public JLabel riskProtectingItem = new JLabel(" ");
|
||||
public JLabel biggestItemLabel = new JLabel("Protected Item: ");
|
||||
public JButton missingPlayers = new JButton("Show missing CC members");
|
||||
public JButton currentPlayers = new JButton("Show current CC members");
|
||||
public JLabel numBrews = new JLabel();
|
||||
@Inject
|
||||
private JPanel pvpToolsPanel = new JPanel(new GridLayout(11, 1));
|
||||
private JPanel missingPlayersPanel = new JPanel();
|
||||
private JPanel currentPlayersPanel = new JPanel();
|
||||
@Slf4j
|
||||
public class PvpToolsPanel extends PluginPanel
|
||||
{
|
||||
|
||||
public static String htmlLabel(String key, String value) {
|
||||
return "<html><body style = 'color:#a5a5a5'>" + key + "<span style = 'color:white'>" + value + "</span></body></html>";
|
||||
}
|
||||
private final JLabel loggedLabel = new JLabel();
|
||||
private final JRichTextPane emailLabel = new JRichTextPane();
|
||||
public JLabel numCC = new JLabel();
|
||||
public JLabel numOther = new JLabel();
|
||||
public JLabel numMageJLabel = new JLabel(" ");
|
||||
public JLabel numRangeJLabel = new JLabel(" ");
|
||||
public JLabel numMeleeJLabel = new JLabel(" ");
|
||||
public JLabel totalRiskLabel = new JLabel(" ");
|
||||
public JLabel riskProtectingItem = new JLabel(" ");
|
||||
public JLabel biggestItemLabel = new JLabel("Protected Item: ");
|
||||
public JButton missingPlayers = new JButton("Show missing CC members");
|
||||
public JButton currentPlayers = new JButton("Show current CC members");
|
||||
public JLabel numBrews = new JLabel();
|
||||
@Inject
|
||||
private JPanel pvpToolsPanel = new JPanel(new GridLayout(11, 1));
|
||||
private JPanel missingPlayersPanel = new JPanel();
|
||||
private JPanel currentPlayersPanel = new JPanel();
|
||||
|
||||
void init() {
|
||||
this.setLayout(new BorderLayout());
|
||||
this.setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||
this.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
JPanel versionPanel = new JPanel();
|
||||
versionPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
versionPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
versionPanel.setLayout(new GridLayout(0, 1));
|
||||
JPanel riskPanel = new JPanel();
|
||||
riskPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
riskPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
riskPanel.setLayout(new GridLayout(0, 1));
|
||||
Font smallFont = FontManager.getRunescapeSmallFont();
|
||||
this.numCC.setText(PvpToolsPanel.htmlLabel("Friendly Player Count: ", "0"));
|
||||
this.numOther.setText(PvpToolsPanel.htmlLabel("Other Player Count: ", "0"));
|
||||
this.numBrews.setText(PvpToolsPanel.htmlLabel("Player brew count: ", "0"));
|
||||
this.numMageJLabel.setText(PvpToolsPanel.htmlLabel("Enemies Praying Mage: ", "0"));
|
||||
this.numMageJLabel.setFont(FontManager.getRunescapeFont());
|
||||
this.numRangeJLabel.setText(PvpToolsPanel.htmlLabel("Enemies Praying Range: ", "0"));
|
||||
this.numRangeJLabel.setFont(FontManager.getRunescapeFont());
|
||||
this.numMeleeJLabel.setText(PvpToolsPanel.htmlLabel("Enemies Praying Melee: ", "0"));
|
||||
this.numMeleeJLabel.setFont(FontManager.getRunescapeFont());
|
||||
this.totalRiskLabel.setText(PvpToolsPanel.htmlLabel("Total risk: ", "0"));
|
||||
this.totalRiskLabel.setFont(FontManager.getRunescapeFont());
|
||||
this.riskProtectingItem.setText(PvpToolsPanel.htmlLabel("Risk Protecting Item: ", "0"));
|
||||
this.riskProtectingItem.setFont(FontManager.getRunescapeFont());
|
||||
this.biggestItemLabel.setText("Most Valuable Item: ");
|
||||
JLabel revision = new JLabel();
|
||||
revision.setFont(smallFont);
|
||||
revision.setText("Oldschool revision: ");
|
||||
JLabel launcher = new JLabel(PvpToolsPanel.htmlLabel("Launcher version: ", MoreObjects.firstNonNull(RuneLiteProperties.getLauncherVersion(), "Unknown")));
|
||||
launcher.setFont(smallFont);
|
||||
this.loggedLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||
this.loggedLabel.setFont(smallFont);
|
||||
this.emailLabel.setForeground(Color.WHITE);
|
||||
this.emailLabel.setFont(smallFont);
|
||||
versionPanel.add(this.numCC);
|
||||
versionPanel.add(this.numOther);
|
||||
versionPanel.add(this.numBrews);
|
||||
versionPanel.add(this.numMageJLabel);
|
||||
versionPanel.add(this.numRangeJLabel);
|
||||
versionPanel.add(this.numMeleeJLabel);
|
||||
versionPanel.add(Box.createGlue());
|
||||
versionPanel.add(this.loggedLabel);
|
||||
versionPanel.add(this.emailLabel);
|
||||
riskPanel.add(this.totalRiskLabel);
|
||||
riskPanel.add(this.riskProtectingItem);
|
||||
riskPanel.add(this.biggestItemLabel);
|
||||
this.add((Component)versionPanel, "North");
|
||||
this.add((Component)riskPanel, "Center");
|
||||
this.currentPlayers.setVisible(false);
|
||||
this.missingPlayers.setVisible(false);
|
||||
this.missingPlayersPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
this.missingPlayersPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
this.missingPlayersPanel.setLayout(new GridLayout(0, 1));
|
||||
this.missingPlayersPanel.add((Component)this.missingPlayers, "Last");
|
||||
this.missingPlayersPanel.add((Component)this.currentPlayers, "Last");
|
||||
this.add((Component)this.missingPlayersPanel, "Last");
|
||||
}
|
||||
|
||||
public void disablePlayerCount() {
|
||||
this.numOther.setText("Disabled");
|
||||
this.numCC.setText("Disabled");
|
||||
this.numCC.repaint();
|
||||
this.numOther.repaint();
|
||||
}
|
||||
public static String htmlLabel(String key, String value)
|
||||
{
|
||||
return "<html><body style = 'color:#a5a5a5'>" + key + "<span style = 'color:white'>" + value + "</span></body></html>";
|
||||
}
|
||||
|
||||
public void disablePrayerCount() {
|
||||
this.numMageJLabel.setText("disabled");
|
||||
this.numRangeJLabel.setText("disabled");
|
||||
this.numMeleeJLabel.setText("disabled");
|
||||
this.numMageJLabel.repaint();
|
||||
this.numRangeJLabel.repaint();
|
||||
this.numMeleeJLabel.repaint();
|
||||
}
|
||||
void init()
|
||||
{
|
||||
setLayout(new BorderLayout());
|
||||
setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||
setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
|
||||
public void disableRiskCalculator() {
|
||||
this.totalRiskLabel.setText("disabled");
|
||||
this.riskProtectingItem.setText("disabled");
|
||||
this.biggestItemLabel.setText("disabled");
|
||||
this.totalRiskLabel.repaint();
|
||||
this.riskProtectingItem.repaint();
|
||||
this.biggestItemLabel.repaint();
|
||||
}
|
||||
|
||||
|
||||
JPanel versionPanel = new JPanel();
|
||||
versionPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
versionPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
versionPanel.setLayout(new GridLayout(0, 1));
|
||||
|
||||
JPanel riskPanel = new JPanel();
|
||||
riskPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
riskPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
riskPanel.setLayout(new GridLayout(0, 1));
|
||||
|
||||
final Font smallFont = FontManager.getRunescapeSmallFont();
|
||||
|
||||
numCC.setText(htmlLabel("Friendly Player Count: ", "0"));
|
||||
numOther.setText(htmlLabel("Other Player Count: ", "0"));
|
||||
numBrews.setText(htmlLabel("Player brew count: ", "0"));
|
||||
numMageJLabel.setText(htmlLabel("Enemies Praying Mage: ", "0"));
|
||||
numMageJLabel.setFont(FontManager.getRunescapeFont());
|
||||
numRangeJLabel.setText(htmlLabel("Enemies Praying Range: ", "0"));
|
||||
numRangeJLabel.setFont(FontManager.getRunescapeFont());
|
||||
numMeleeJLabel.setText(htmlLabel("Enemies Praying Melee: ", "0"));
|
||||
numMeleeJLabel.setFont(FontManager.getRunescapeFont());
|
||||
|
||||
totalRiskLabel.setText(htmlLabel("Total risk: ", "0"));
|
||||
totalRiskLabel.setFont(FontManager.getRunescapeFont());
|
||||
riskProtectingItem.setText(htmlLabel("Risk Protecting Item: ", "0"));
|
||||
riskProtectingItem.setFont(FontManager.getRunescapeFont());
|
||||
biggestItemLabel.setText("Most Valuable Item: ");
|
||||
|
||||
|
||||
JLabel revision = new JLabel();
|
||||
revision.setFont(smallFont);
|
||||
|
||||
revision.setText("Oldschool revision: ");
|
||||
|
||||
JLabel launcher = new JLabel(htmlLabel("Launcher version: ", MoreObjects
|
||||
.firstNonNull(RuneLiteProperties.getLauncherVersion(), "Unknown")));
|
||||
launcher.setFont(smallFont);
|
||||
|
||||
loggedLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||
loggedLabel.setFont(smallFont);
|
||||
|
||||
emailLabel.setForeground(Color.WHITE);
|
||||
emailLabel.setFont(smallFont);
|
||||
|
||||
versionPanel.add(numCC);
|
||||
versionPanel.add(numOther);
|
||||
versionPanel.add(numBrews);
|
||||
versionPanel.add(numMageJLabel);
|
||||
versionPanel.add(numRangeJLabel);
|
||||
versionPanel.add(numMeleeJLabel);
|
||||
|
||||
versionPanel.add(Box.createGlue());
|
||||
versionPanel.add(loggedLabel);
|
||||
versionPanel.add(emailLabel);
|
||||
|
||||
riskPanel.add(totalRiskLabel);
|
||||
riskPanel.add(riskProtectingItem);
|
||||
riskPanel.add(biggestItemLabel);
|
||||
|
||||
add(versionPanel, BorderLayout.NORTH);
|
||||
add(riskPanel, BorderLayout.CENTER);
|
||||
|
||||
currentPlayers.setVisible(false);
|
||||
missingPlayers.setVisible(false);
|
||||
missingPlayersPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
missingPlayersPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
missingPlayersPanel.setLayout(new GridLayout(0, 1));
|
||||
missingPlayersPanel.add(missingPlayers, BorderLayout.AFTER_LAST_LINE);
|
||||
missingPlayersPanel.add(currentPlayers, BorderLayout.AFTER_LAST_LINE);
|
||||
add(missingPlayersPanel, BorderLayout.AFTER_LAST_LINE);
|
||||
|
||||
}
|
||||
|
||||
public void disablePlayerCount()
|
||||
{
|
||||
this.numOther.setText("Disabled");
|
||||
this.numCC.setText("Disabled");
|
||||
this.numCC.repaint();
|
||||
this.numOther.repaint();
|
||||
}
|
||||
|
||||
public void disablePrayerCount()
|
||||
{
|
||||
this.numMageJLabel.setText("disabled");
|
||||
this.numRangeJLabel.setText("disabled");
|
||||
this.numMeleeJLabel.setText("disabled");
|
||||
this.numMageJLabel.repaint();
|
||||
this.numRangeJLabel.repaint();
|
||||
this.numMeleeJLabel.repaint();
|
||||
}
|
||||
|
||||
public void disableRiskCalculator()
|
||||
{
|
||||
this.totalRiskLabel.setText("disabled");
|
||||
this.riskProtectingItem.setText("disabled");
|
||||
this.biggestItemLabel.setText("disabled");
|
||||
this.totalRiskLabel.repaint();
|
||||
this.riskProtectingItem.repaint();
|
||||
this.biggestItemLabel.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -63,6 +63,7 @@ import java.awt.image.BufferedImage;
|
||||
name = "Supplies Used Tracker",
|
||||
description = "Tracks supplies used during the session",
|
||||
tags = {"cost"},
|
||||
type = "PVM",
|
||||
enabledByDefault = false
|
||||
)
|
||||
@Slf4j
|
||||
|
||||
@@ -1,34 +1,68 @@
|
||||
package net.runelite.client.plugins.whalewatchers;
|
||||
|
||||
import java.awt.*;
|
||||
import net.runelite.client.config.*;
|
||||
import java.awt.Color;
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("WhaleWatchers")
|
||||
public interface WhaleWatchersConfig extends Config
|
||||
{
|
||||
@ConfigItem(position = 1, keyName = "protectItemWarning", name = "Protect Item Warning", description = "Warns you when you are skulled and don't have protect item turned on.")
|
||||
default boolean protectItemWarning() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(position = 2, keyName = "showDamageCounter", name = "Damage Counter", description = "Shows damage you've done and damage your opponent has done to you while in a fight")
|
||||
default boolean showDamageCounter() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(position = 3, keyName = "damageBackgroundColor", name = "Counter Background Color", description = "The background color for the damage counter overlay")
|
||||
default Color damageBackgroundColor() {
|
||||
return Color.darkGray;
|
||||
}
|
||||
|
||||
@ConfigItem(position = 4, keyName = "smiteableWarning", name = "Smite Warning", description = "Displays a warning overlay when your prayer is at a smiteable level")
|
||||
default boolean smiteableWarning() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(position = 5, keyName = "gloryWarning", name = "Glory Warning", description = "Displays a warning box while you are wearing an uncharged glory")
|
||||
default boolean gloryWarning() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "protectItemWarning",
|
||||
name = "Protect Item Warning",
|
||||
description = "Warns you when you are skulled and don't have protect item turned on."
|
||||
)
|
||||
default boolean protectItemWarning()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "showDamageCounter",
|
||||
name = "Damage Counter",
|
||||
description = "Shows damage you've done and damage your opponent has done to you while in a fight"
|
||||
)
|
||||
default boolean showDamageCounter()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "damageBackgroundColor",
|
||||
name = "Counter Background Color",
|
||||
description = "The background color for the damage counter overlay"
|
||||
)
|
||||
default Color damageBackgroundColor()
|
||||
{
|
||||
return Color.darkGray;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "smiteableWarning",
|
||||
name = "Smite Warning",
|
||||
description = "Displays a warning overlay when your prayer is at a smiteable level"
|
||||
)
|
||||
default boolean smiteableWarning()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "gloryWarning",
|
||||
name = "Glory Warning",
|
||||
description = "Displays a warning box while you are wearing an uncharged glory"
|
||||
)
|
||||
default boolean gloryWarning()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,48 +1,72 @@
|
||||
package net.runelite.client.plugins.whalewatchers;
|
||||
|
||||
import net.runelite.api.*;
|
||||
import javax.inject.*;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
import net.runelite.api.kit.*;
|
||||
import java.awt.*;
|
||||
import net.runelite.client.ui.overlay.components.*;
|
||||
import java.awt.image.*;
|
||||
import net.runelite.client.game.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.kit.KitType;
|
||||
import net.runelite.client.game.AsyncBufferedImage;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.components.ImageComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.TextComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
|
||||
public class WhaleWatchersGloryOverlay extends Overlay
|
||||
{
|
||||
private Client client;
|
||||
private final WhaleWatchersConfig config;
|
||||
private WhaleWatchersPlugin plugin;
|
||||
private PanelComponent panelComponent;
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
public WhaleWatchersGloryOverlay(final WhaleWatchersConfig config, final Client client, final WhaleWatchersPlugin plugin) {
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
this.setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.setPriority(OverlayPriority.HIGH);
|
||||
this.setPosition(OverlayPosition.DETACHED);
|
||||
this.panelComponent = new PanelComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(final Graphics2D graphics) {
|
||||
this.panelComponent.getChildren().clear();
|
||||
int amuletID = 0;
|
||||
try {
|
||||
amuletID = this.client.getLocalPlayer().getPlayerComposition().getEquipmentId(KitType.AMULET);
|
||||
}
|
||||
catch (NullPointerException ex) {}
|
||||
if (this.config.gloryWarning() && amuletID == 1704) {
|
||||
this.panelComponent.setBackgroundColor(Color.lightGray);
|
||||
final AsyncBufferedImage gloryImage = this.itemManager.getImage(1704);
|
||||
this.panelComponent.getChildren().add(TitleComponent.builder().text("Uncharged Glory").color(Color.BLACK).build());
|
||||
this.panelComponent.getChildren().add(new ImageComponent(gloryImage));
|
||||
}
|
||||
return this.panelComponent.render(graphics);
|
||||
}
|
||||
private Client client;
|
||||
private final WhaleWatchersConfig config;
|
||||
private WhaleWatchersPlugin plugin;
|
||||
private PanelComponent panelComponent;
|
||||
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
|
||||
@Inject
|
||||
public WhaleWatchersGloryOverlay(WhaleWatchersConfig config, Client client, WhaleWatchersPlugin plugin)
|
||||
{
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
setPosition(OverlayPosition.DETACHED);
|
||||
panelComponent = new PanelComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
panelComponent.getChildren().clear();
|
||||
int amuletID = 0;
|
||||
try
|
||||
{
|
||||
amuletID = client.getLocalPlayer().getPlayerComposition().getEquipmentId(KitType.AMULET);
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
|
||||
}
|
||||
if (config.gloryWarning() && amuletID == ItemID.AMULET_OF_GLORY)
|
||||
{
|
||||
panelComponent.setBackgroundColor(Color.lightGray);
|
||||
final AsyncBufferedImage gloryImage = itemManager.getImage(ItemID.AMULET_OF_GLORY);
|
||||
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text("Uncharged Glory")
|
||||
.color(Color.BLACK)
|
||||
.build());
|
||||
|
||||
panelComponent.getChildren().add(new ImageComponent(gloryImage));
|
||||
}
|
||||
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +1,79 @@
|
||||
package net.runelite.client.plugins.whalewatchers;
|
||||
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
import javax.inject.*;
|
||||
import net.runelite.client.ui.overlay.components.*;
|
||||
import java.awt.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
|
||||
public class WhaleWatchersOverlay extends Overlay
|
||||
{
|
||||
private Client client;
|
||||
private final WhaleWatchersConfig config;
|
||||
private WhaleWatchersPlugin plugin;
|
||||
private PanelComponent panelComponent;
|
||||
private String lastOpponent;
|
||||
|
||||
@Inject
|
||||
public WhaleWatchersOverlay(final WhaleWatchersConfig config, final Client client, final WhaleWatchersPlugin plugin) {
|
||||
this.lastOpponent = "-";
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
this.setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.setPriority(OverlayPriority.HIGH);
|
||||
this.setPosition(OverlayPosition.DETACHED);
|
||||
this.panelComponent = new PanelComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(final Graphics2D graphics) {
|
||||
this.panelComponent.getChildren().clear();
|
||||
if (this.plugin.inCombat && this.config.showDamageCounter()) {
|
||||
this.panelComponent.setBackgroundColor(this.config.damageBackgroundColor());
|
||||
final String opp = (this.client.getLocalPlayer().getInteracting() != null) ? this.client.getLocalPlayer().getInteracting().getName() : this.lastOpponent;
|
||||
if (this.client.getLocalPlayer().getInteracting() != null) {
|
||||
this.lastOpponent = this.client.getLocalPlayer().getInteracting().getName();
|
||||
}
|
||||
final String opponent = "Fight vs " + opp;
|
||||
final String damageTaken = "Damage Taken: " + this.plugin.damageTaken;
|
||||
final String damageDealt = "Damage Dealt: " + this.plugin.damageDone;
|
||||
this.panelComponent.getChildren().add(TitleComponent.builder().text(opponent).color(Color.BLACK).build());
|
||||
this.panelComponent.getChildren().add(TitleComponent.builder().text(damageDealt).color(Color.BLACK).build());
|
||||
this.panelComponent.getChildren().add(TitleComponent.builder().text(damageTaken).color(Color.BLACK).build());
|
||||
this.panelComponent.setPreferredSize(new Dimension(graphics.getFontMetrics().stringWidth(damageDealt) + graphics.getFontMetrics().stringWidth(opponent) + 10, 0));
|
||||
}
|
||||
else {
|
||||
this.panelComponent.getChildren().clear();
|
||||
}
|
||||
return this.panelComponent.render(graphics);
|
||||
}
|
||||
private Client client;
|
||||
private final WhaleWatchersConfig config;
|
||||
private WhaleWatchersPlugin plugin;
|
||||
private PanelComponent panelComponent;
|
||||
private String lastOpponent = "-";
|
||||
|
||||
@Inject
|
||||
public WhaleWatchersOverlay(WhaleWatchersConfig config, Client client, WhaleWatchersPlugin plugin)
|
||||
{
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
setPosition(OverlayPosition.DETACHED);
|
||||
panelComponent = new PanelComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
panelComponent.getChildren().clear();
|
||||
|
||||
if (plugin.inCombat && config.showDamageCounter())
|
||||
{
|
||||
panelComponent.setBackgroundColor(config.damageBackgroundColor());
|
||||
String opp = client.getLocalPlayer().getInteracting() != null ?
|
||||
client.getLocalPlayer().getInteracting().getName() : lastOpponent;
|
||||
if (client.getLocalPlayer().getInteracting() != null)
|
||||
{
|
||||
lastOpponent = client.getLocalPlayer().getInteracting().getName();
|
||||
}
|
||||
final String opponent = "Fight vs " + opp;
|
||||
String damageTaken = "Damage Taken: " + plugin.damageTaken;
|
||||
String damageDealt = "Damage Dealt: " + plugin.damageDone;
|
||||
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text(opponent)
|
||||
.color(Color.BLACK)
|
||||
.build());
|
||||
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text(damageDealt)
|
||||
.color(Color.BLACK)
|
||||
.build());
|
||||
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text(damageTaken)
|
||||
.color(Color.BLACK)
|
||||
.build());
|
||||
|
||||
panelComponent.setPreferredSize(new Dimension(
|
||||
graphics.getFontMetrics().stringWidth(damageDealt) +
|
||||
+ graphics.getFontMetrics().stringWidth(opponent) + 10,0));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
panelComponent.getChildren().clear();
|
||||
}
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,200 +1,316 @@
|
||||
package net.runelite.client.plugins.whalewatchers;
|
||||
|
||||
|
||||
import org.jetbrains.annotations.*;
|
||||
import net.runelite.client.plugins.*;
|
||||
import net.runelite.client.game.*;
|
||||
import net.runelite.client.config.*;
|
||||
import com.google.inject.*;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
import net.runelite.client.eventbus.*;
|
||||
import net.runelite.api.kit.*;
|
||||
import org.apache.commons.lang3.*;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.*;
|
||||
import java.util.*;
|
||||
import com.google.inject.Provides;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.function.Predicate;
|
||||
import javax.inject.Inject;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Actor;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.MenuAction;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.PlayerComposition;
|
||||
import net.runelite.api.Skill;
|
||||
import net.runelite.api.SkullIcon;
|
||||
import net.runelite.api.VarPlayer;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.WorldType;
|
||||
import static net.runelite.api.WorldType.*;
|
||||
import net.runelite.api.events.ExperienceChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.HitsplatApplied;
|
||||
import net.runelite.api.events.InteractingChanged;
|
||||
import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.MenuOptionClicked;
|
||||
import net.runelite.api.events.PlayerMenuOptionClicked;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.kit.KitType;
|
||||
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.overlay.OverlayManager;
|
||||
import net.runelite.client.util.WorldUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Whale Watchers",
|
||||
description = "A Plugin to save help whales in the wild",
|
||||
tags = { "whale watchers", "whale", "protect item", "warning", "pklite" },
|
||||
type = "PVP",
|
||||
enabledByDefault = false
|
||||
name = "Whale Watchers",
|
||||
description = "A Plugin to save help whales in the wild",
|
||||
tags = {"whale watchers", "whale", "protect item", "warning", "pklite"},
|
||||
enabledByDefault = true,
|
||||
hidden = false,
|
||||
developerPlugin = false,
|
||||
type = "PVP",
|
||||
loadWhenOutdated = false
|
||||
)
|
||||
public class WhaleWatchersPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private WhaleWatchersConfig config;
|
||||
@Inject
|
||||
private WhaleWatchersOverlay overlay;
|
||||
@Inject
|
||||
private WhaleWatchersProtOverlay whaleWatchersProtOverlay;
|
||||
@Inject
|
||||
private WhaleWatchersSmiteableOverlay whaleWatchersSmiteableOverlay;
|
||||
@Inject
|
||||
private WhaleWatchersGloryOverlay whaleWatchersGloryOverlay;
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
public boolean enableOverlay;
|
||||
private int lastXP;
|
||||
public int damageDone;
|
||||
public int damageTaken;
|
||||
public boolean inCombat;
|
||||
private int tickCountdown;
|
||||
private boolean displaySmiteOverlay;
|
||||
private boolean displayGloryOverlay;
|
||||
|
||||
public WhaleWatchersPlugin() {
|
||||
this.enableOverlay = false;
|
||||
this.lastXP = 0;
|
||||
this.damageDone = 0;
|
||||
this.damageTaken = 0;
|
||||
this.inCombat = false;
|
||||
this.tickCountdown = 0;
|
||||
}
|
||||
|
||||
@Provides
|
||||
WhaleWatchersConfig getConfig(final ConfigManager configManager) {
|
||||
return configManager.getConfig(WhaleWatchersConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception {
|
||||
this.overlayManager.add(this.overlay);
|
||||
this.overlayManager.add(this.whaleWatchersProtOverlay);
|
||||
this.overlayManager.add(this.whaleWatchersSmiteableOverlay);
|
||||
this.overlayManager.add(this.whaleWatchersGloryOverlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception {
|
||||
this.overlayManager.remove(this.overlay);
|
||||
this.overlayManager.remove(this.whaleWatchersProtOverlay);
|
||||
this.overlayManager.remove(this.whaleWatchersSmiteableOverlay);
|
||||
this.overlayManager.remove(this.whaleWatchersGloryOverlay);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onHitsplatApplied(final HitsplatApplied event) {
|
||||
if (this.config.showDamageCounter()) {
|
||||
if (!(event.getActor() == this.client.getLocalPlayer() | event.getActor() == this.client.getLocalPlayer().getInteracting())) {
|
||||
return;
|
||||
}
|
||||
if (this.isAttackingPlayer(this.client) || this.inCombat) {
|
||||
this.inCombat = true;
|
||||
if (event.getActor() == this.client.getLocalPlayer()) {
|
||||
this.damageTaken += event.getHitsplat().getAmount();
|
||||
}
|
||||
if (event.getActor() == this.client.getLocalPlayer().getInteracting()) {
|
||||
this.damageDone += event.getHitsplat().getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onItemContainerChanged(final ItemContainerChanged event) {
|
||||
if (this.config.gloryWarning() && event.getItemContainer().equals(InventoryID.EQUIPMENT)) {
|
||||
final int amuletID = ObjectUtils.defaultIfNull(this.client.getLocalPlayer().getPlayerComposition().getEquipmentId(KitType.AMULET), 0);
|
||||
if (amuletID == 1704) {
|
||||
this.displayGloryOverlay = true;
|
||||
}
|
||||
else {
|
||||
this.displayGloryOverlay = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.displayGloryOverlay = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onExperienceChanged(final ExperienceChanged event) {
|
||||
final Skill skill = event.getSkill();
|
||||
final Player player = this.client.getLocalPlayer();
|
||||
if (skill.equals(Skill.HITPOINTS) && player.getInteracting() instanceof Player) {
|
||||
this.lastXP = this.client.getSkillExperience(skill);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuOptionClicked(final MenuOptionClicked event) {
|
||||
if (this.config.showDamageCounter() && event.getMenuAction().equals(MenuAction.SPELL_CAST_ON_PLAYER)) {
|
||||
this.inCombat = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onVarbitChanged(final VarbitChanged event) {
|
||||
if (this.config.showDamageCounter() && this.client.getVar(VarPlayer.ATTACKING_PLAYER) == -1 && this.inCombat) {
|
||||
this.tickCountdown = 10;
|
||||
}
|
||||
if (this.config.protectItemWarning()) {
|
||||
try {
|
||||
if (this.client.getLocalPlayer().getSkullIcon() == SkullIcon.SKULL) {
|
||||
if ((this.client.getVar(Varbits.PRAYER_PROTECT_ITEM) == 0 && this.client.getVar(Varbits.IN_WILDERNESS) == 1) || this.client.getWorldType().contains(WorldType.PVP)) {
|
||||
this.enableOverlay = true;
|
||||
}
|
||||
if (this.client.getVar(Varbits.PRAYER_PROTECT_ITEM) == 1 || this.client.getVar(Varbits.IN_WILDERNESS) == 0 || this.client.getWorldType().contains(WorldType.PVP_HIGH_RISK) || this.client.getWorld() == 365) {
|
||||
this.enableOverlay = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.enableOverlay = false;
|
||||
}
|
||||
}
|
||||
catch (NullPointerException ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(final GameTick event) {
|
||||
if (this.tickCountdown > 0 && this.tickCountdown < 11) {
|
||||
--this.tickCountdown;
|
||||
if (this.tickCountdown == 1 && !this.isAttackingPlayer(this.client)) {
|
||||
this.inCombat = false;
|
||||
this.damageDone = 0;
|
||||
this.damageTaken = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this.config.smiteableWarning() && (this.client.getVar(Varbits.IN_WILDERNESS) == 1 || WorldType.isPvpWorld(this.client.getWorldType()))) {
|
||||
if (this.client.getLocalPlayer().getSkullIcon() != null && this.client.getLocalPlayer().getSkullIcon().equals(SkullIcon.SKULL)) {
|
||||
final int currentHealth = this.client.getLocalPlayer().getHealth();
|
||||
final int currentPrayer = this.client.getBoostedSkillLevel(Skill.PRAYER);
|
||||
if (currentPrayer <= Math.ceil(currentHealth / 4)) {
|
||||
this.displaySmiteOverlay = true;
|
||||
}
|
||||
else {
|
||||
this.displaySmiteOverlay = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.displaySmiteOverlay = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.displaySmiteOverlay = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAttackingPlayer(@NotNull final Client c) {
|
||||
if (this.client.getVar(Varbits.IN_WILDERNESS) == 1 && this.client.getLocalPlayer().getInteracting() != null) {
|
||||
return true;
|
||||
}
|
||||
final int varp = c.getVar(VarPlayer.ATTACKING_PLAYER);
|
||||
return varp != -1;
|
||||
}
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
public boolean isDisplaySmiteOverlay() {
|
||||
return this.displaySmiteOverlay;
|
||||
}
|
||||
@Inject
|
||||
private WhaleWatchersConfig config;
|
||||
|
||||
@Inject
|
||||
private WhaleWatchersOverlay overlay;
|
||||
|
||||
@Inject
|
||||
private WhaleWatchersProtOverlay whaleWatchersProtOverlay;
|
||||
|
||||
@Inject
|
||||
private WhaleWatchersSmiteableOverlay whaleWatchersSmiteableOverlay;
|
||||
|
||||
@Inject
|
||||
private WhaleWatchersGloryOverlay whaleWatchersGloryOverlay;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
|
||||
public boolean enableOverlay = false;
|
||||
private int lastXP = 0;
|
||||
public int damageDone = 0;
|
||||
public int damageTaken = 0;
|
||||
public boolean inCombat = false;
|
||||
private int tickCountdown = 0;
|
||||
@Getter
|
||||
private boolean displaySmiteOverlay;
|
||||
@Getter
|
||||
private boolean displayGloryOverlay;
|
||||
|
||||
@Provides
|
||||
WhaleWatchersConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(WhaleWatchersConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
overlayManager.add(whaleWatchersProtOverlay);
|
||||
overlayManager.add(whaleWatchersSmiteableOverlay);
|
||||
overlayManager.add(whaleWatchersGloryOverlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
overlayManager.remove(whaleWatchersProtOverlay);
|
||||
overlayManager.remove(whaleWatchersSmiteableOverlay);
|
||||
overlayManager.remove(whaleWatchersGloryOverlay);
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onHitsplatApplied(HitsplatApplied event)
|
||||
{
|
||||
if (config.showDamageCounter())
|
||||
{
|
||||
if (!(event.getActor() == client.getLocalPlayer() |
|
||||
event.getActor() == client.getLocalPlayer().getInteracting()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (isAttackingPlayer(client) || inCombat)
|
||||
{
|
||||
inCombat = true;
|
||||
|
||||
if (event.getActor() == client.getLocalPlayer())
|
||||
{
|
||||
damageTaken += event.getHitsplat().getAmount();
|
||||
|
||||
}
|
||||
if (event.getActor() == client.getLocalPlayer().getInteracting())
|
||||
{
|
||||
damageDone += event.getHitsplat().getAmount();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* final Player target = (Player) event.getTarget();
|
||||
* if (lastInteracting == null)
|
||||
* {
|
||||
* lastInteracting = target;
|
||||
* inCombat = true;
|
||||
* interactingStarted = System.currentTimeMillis();
|
||||
* }
|
||||
* List<String> optionsList = Arrays.asList(client.getPlayerOptions());
|
||||
* <p>
|
||||
* if (target == lastInteracting || target == null)
|
||||
* {
|
||||
* inCombat = true;
|
||||
* lastInteracting = target;
|
||||
* interactingStarted = System.currentTimeMillis();
|
||||
* }
|
||||
* if (target != lastInteracting && target != null && lastInteracting != null)
|
||||
* {
|
||||
* damageDone = 0;
|
||||
* damageTaken = 0;
|
||||
* interactingStarted = System.currentTimeMillis();
|
||||
* inCombat = true;
|
||||
* }
|
||||
**/
|
||||
|
||||
@Subscribe
|
||||
public void onItemContainerChanged(ItemContainerChanged event)
|
||||
{
|
||||
if (config.gloryWarning() && event.getItemContainer().equals(InventoryID.EQUIPMENT))
|
||||
{
|
||||
final int amuletID = ObjectUtils.defaultIfNull(client.getLocalPlayer()
|
||||
.getPlayerComposition().getEquipmentId(KitType.AMULET), 0);
|
||||
if (amuletID == ItemID.AMULET_OF_GLORY)
|
||||
{
|
||||
displayGloryOverlay = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
displayGloryOverlay = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
displayGloryOverlay = false;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onExperienceChanged(ExperienceChanged event)
|
||||
{
|
||||
final Skill skill = event.getSkill();
|
||||
final Player player = client.getLocalPlayer();
|
||||
if (skill.equals(Skill.HITPOINTS))
|
||||
{
|
||||
if (player.getInteracting() instanceof Player)
|
||||
{
|
||||
//lient.getLogger().info(String.valueOf(Math.round((client.getSkillExperience(skill) - lastXP) / 1.33)) + 2);
|
||||
lastXP = client.getSkillExperience(skill);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (config.showDamageCounter() && event.getMenuAction().equals(MenuAction.SPELL_CAST_ON_PLAYER))
|
||||
{
|
||||
inCombat = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onVarbitChanged(VarbitChanged event)
|
||||
{
|
||||
if (config.showDamageCounter())
|
||||
{
|
||||
if (client.getVar(VarPlayer.ATTACKING_PLAYER) == -1)
|
||||
{
|
||||
if (inCombat)
|
||||
{
|
||||
//damageTaken = 0;
|
||||
//damageDone = 0;
|
||||
tickCountdown = 10;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.protectItemWarning())
|
||||
{
|
||||
try
|
||||
{
|
||||
if (client.getLocalPlayer().getSkullIcon() == (SkullIcon.SKULL))
|
||||
{
|
||||
if (client.getVar(Varbits.PRAYER_PROTECT_ITEM) == 0 && client.getVar(Varbits.IN_WILDERNESS) == 1 ||
|
||||
client.getWorldType().contains(PVP))
|
||||
{
|
||||
enableOverlay = true;
|
||||
}
|
||||
if (client.getVar(Varbits.PRAYER_PROTECT_ITEM) == 1 || client.getVar(Varbits.IN_WILDERNESS) == 0 ||
|
||||
client.getWorldType().contains(PVP_HIGH_RISK) || client.getWorld() == 365)
|
||||
{
|
||||
enableOverlay = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
enableOverlay = false;
|
||||
}
|
||||
}
|
||||
catch (NullPointerException e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
|
||||
if (tickCountdown > 0 && tickCountdown < 11)
|
||||
{
|
||||
tickCountdown--;
|
||||
if (tickCountdown == 1)
|
||||
{
|
||||
if (!isAttackingPlayer(client))
|
||||
{
|
||||
inCombat = false;
|
||||
damageDone = 0;
|
||||
damageTaken = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.smiteableWarning() && (client.getVar(Varbits.IN_WILDERNESS) == 1 || isPvpWorld(client.getWorldType())))
|
||||
{
|
||||
if (client.getLocalPlayer().getSkullIcon() != null && client.getLocalPlayer().getSkullIcon().equals(SkullIcon.SKULL))
|
||||
{
|
||||
final int currentHealth = client.getLocalPlayer().getHealth();
|
||||
final int currentPrayer = client.getBoostedSkillLevel(Skill.PRAYER);
|
||||
if (currentPrayer <= (Math.ceil(currentHealth / 4)))
|
||||
{
|
||||
displaySmiteOverlay = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
displaySmiteOverlay = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
displaySmiteOverlay = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
displaySmiteOverlay = false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAttackingPlayer(@NotNull Client c)
|
||||
{
|
||||
if (client.getVar(Varbits.IN_WILDERNESS) == 1 && client.getLocalPlayer().getInteracting() != null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
int varp = c.getVar(VarPlayer.ATTACKING_PLAYER);
|
||||
return varp != -1;
|
||||
}
|
||||
|
||||
public boolean isDisplayGloryOverlay() {
|
||||
return this.displayGloryOverlay;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,44 +1,59 @@
|
||||
package net.runelite.client.plugins.whalewatchers;
|
||||
|
||||
import javax.inject.*;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Rectangle;
|
||||
import java.awt.Stroke;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.ui.*;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
import java.awt.*;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
|
||||
public class WhaleWatchersProtOverlay extends Overlay
|
||||
{
|
||||
private Client client;
|
||||
private final WhaleWatchersConfig config;
|
||||
private WhaleWatchersPlugin plugin;
|
||||
|
||||
@Inject
|
||||
public WhaleWatchersProtOverlay(final WhaleWatchersConfig config, final Client client, final WhaleWatchersPlugin plugin) {
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
this.setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.setPriority(OverlayPriority.HIGH);
|
||||
this.setPosition(OverlayPosition.DYNAMIC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(final Graphics2D graphics) {
|
||||
if (this.plugin.enableOverlay && this.config.protectItemWarning()) {
|
||||
final Rectangle rectangle = new Rectangle();
|
||||
rectangle.setBounds(this.client.getCanvas().getBounds());
|
||||
rectangle.setLocation(this.client.getCanvas().getLocation());
|
||||
final Stroke oldStroke = graphics.getStroke();
|
||||
graphics.setStroke(new BasicStroke(10.0f));
|
||||
graphics.setColor(Color.RED);
|
||||
graphics.draw(rectangle);
|
||||
final Font font = FontManager.getRunescapeBoldFont().deriveFont(1, 72.0f);
|
||||
graphics.setFont(font);
|
||||
OverlayUtil.renderTextLocation(graphics, new Point((int)rectangle.getCenterX() - 50, font.getSize()), "Protect item prayer disabled!!!", Color.red);
|
||||
graphics.setStroke(oldStroke);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private Client client;
|
||||
private final WhaleWatchersConfig config;
|
||||
private WhaleWatchersPlugin plugin;
|
||||
|
||||
@Inject
|
||||
public WhaleWatchersProtOverlay(WhaleWatchersConfig config, Client client, WhaleWatchersPlugin plugin)
|
||||
{
|
||||
this.client = client;
|
||||
this.config = config;
|
||||
this.plugin = plugin;
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (plugin.enableOverlay && config.protectItemWarning())
|
||||
{
|
||||
Rectangle rectangle = new Rectangle();
|
||||
rectangle.setBounds(client.getCanvas().getBounds());
|
||||
rectangle.setLocation(client.getCanvas().getLocation());
|
||||
Stroke oldStroke = graphics.getStroke();
|
||||
graphics.setStroke(new BasicStroke(10));
|
||||
graphics.setColor(Color.RED);
|
||||
graphics.draw(rectangle);
|
||||
Font font = FontManager.getRunescapeBoldFont().deriveFont(Font.BOLD, 72);
|
||||
graphics.setFont(font);
|
||||
OverlayUtil.renderTextLocation(graphics, new Point((int) rectangle.getCenterX() - 50, font.getSize()), "Protect item prayer disabled!!!", Color.red);
|
||||
graphics.setStroke(oldStroke);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,39 +1,59 @@
|
||||
package net.runelite.client.plugins.whalewatchers;
|
||||
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
import javax.inject.*;
|
||||
import java.awt.*;
|
||||
import net.runelite.client.ui.overlay.components.*;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
|
||||
public class WhaleWatchersSmiteableOverlay extends Overlay
|
||||
{
|
||||
private Client client;
|
||||
private WhaleWatchersPlugin plugin;
|
||||
private PanelComponent panelComponent;
|
||||
|
||||
@Inject
|
||||
public WhaleWatchersSmiteableOverlay(final WhaleWatchersPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
this.setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.setPriority(OverlayPriority.HIGH);
|
||||
this.setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
this.panelComponent = new PanelComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(final Graphics2D graphics) {
|
||||
final String subText = "You could be smited in 1 tick";
|
||||
this.panelComponent.getChildren().clear();
|
||||
if (this.plugin.isDisplaySmiteOverlay()) {
|
||||
this.panelComponent.setBackgroundColor(Color.WHITE);
|
||||
this.panelComponent.getChildren().add(TitleComponent.builder().text("LOW PRAYER WARNING").color(Color.BLACK).build());
|
||||
this.panelComponent.getChildren().add(TitleComponent.builder().text(subText).color(Color.BLACK).build());
|
||||
this.panelComponent.setPreferredSize(new Dimension(graphics.getFontMetrics().stringWidth(subText) + 20, 0));
|
||||
}
|
||||
else {
|
||||
this.panelComponent.getChildren().clear();
|
||||
}
|
||||
return this.panelComponent.render(graphics);
|
||||
}
|
||||
private Client client;
|
||||
private WhaleWatchersPlugin plugin;
|
||||
private PanelComponent panelComponent;
|
||||
|
||||
|
||||
@Inject
|
||||
public WhaleWatchersSmiteableOverlay( WhaleWatchersPlugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||
|
||||
panelComponent = new PanelComponent();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
String subText = "You could be smited in 1 tick";
|
||||
panelComponent.getChildren().clear();
|
||||
if (plugin.isDisplaySmiteOverlay())
|
||||
{
|
||||
panelComponent.setBackgroundColor(Color.WHITE);
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text("LOW PRAYER WARNING")
|
||||
.color(Color.BLACK)
|
||||
.build());
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text(subText)
|
||||
.color(Color.BLACK)
|
||||
.build());
|
||||
|
||||
panelComponent.setPreferredSize(new Dimension(graphics.getFontMetrics().stringWidth(subText)
|
||||
+ 20 , 0));
|
||||
}
|
||||
else
|
||||
{
|
||||
panelComponent.getChildren().clear();
|
||||
}
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -428,6 +428,13 @@ class WorldSwitcherPanel extends PluginPanel
|
||||
|
||||
void populate(List<World> worlds)
|
||||
{
|
||||
Map<Integer, Integer> pingHistory = new HashMap<>();
|
||||
|
||||
for (WorldTableRow row : rows)
|
||||
{
|
||||
pingHistory.put(row.getWorld().getId(), row.getPing());
|
||||
}
|
||||
|
||||
rows.clear();
|
||||
|
||||
for (int i = 0; i < worlds.size(); i++)
|
||||
@@ -450,7 +457,8 @@ class WorldSwitcherPanel extends PluginPanel
|
||||
break;
|
||||
}
|
||||
|
||||
rows.add(buildRow(world, i % 2 == 0, world.getId() == plugin.getCurrentWorld() && plugin.getLastWorld() != 0, plugin.isFavorite(world)));
|
||||
Integer ping = pingHistory.getOrDefault(world.getId(), 0);
|
||||
rows.add(buildRow(world, i % 2 == 0, world.getId() == plugin.getCurrentWorld() && plugin.getLastWorld() != 0, plugin.isFavorite(world), ping));
|
||||
}
|
||||
|
||||
updateList();
|
||||
@@ -599,7 +607,7 @@ class WorldSwitcherPanel extends PluginPanel
|
||||
/**
|
||||
* Builds a table row, that displays the world's information.
|
||||
*/
|
||||
private WorldTableRow buildRow(World world, boolean stripe, boolean current, boolean favorite)
|
||||
private WorldTableRow buildRow(World world, boolean stripe, boolean current, boolean favorite, Integer ping)
|
||||
{
|
||||
WorldTableRow row = new WorldTableRow(world, current, favorite,
|
||||
world1 ->
|
||||
|
||||
@@ -41,7 +41,7 @@ enum QuestStartLocation
|
||||
IMP_CATCHER("Imp Catcher", new WorldPoint(3108, 3160, 0)),
|
||||
THE_KNIGHTS_SWORD("The Knight's Sword", new WorldPoint(2976, 3342, 0)),
|
||||
MISTHALIN_MYSTERY("Misthalin Mystery", new WorldPoint(3234, 3155, 0)),
|
||||
PIRATES_TREASURE("Pirate's Treasure", new WorldPoint(3050, 3248, 0)),
|
||||
PIRATES_TREASURE("Pirate's Treasure", new WorldPoint(3051, 3252, 0)),
|
||||
PRINCE_ALI_RESCUE("Prince Ali Rescue", new WorldPoint(3301, 3163, 0)),
|
||||
THE_RESTLESS_GHOST("The Restless Ghost", new WorldPoint(3240, 3210, 0)),
|
||||
RUNE_MYSTERIES("Rune Mysteries", new WorldPoint(3210, 3220, 0)),
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
/*
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.worldmaphider;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("worldMapHider")
|
||||
public interface WorldMapHiderConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "hideWorldMapButton",
|
||||
name = "Hide World Map Button",
|
||||
description = "Hides the world map button. Prevents missclicks that open the world map"
|
||||
)
|
||||
default boolean hideWorldMapButton()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
/*
|
||||
* Copyright (c) 2019. PKLite - All Rights Reserved
|
||||
* Unauthorized modification, distribution, or possession of this source file, via any medium is strictly prohibited.
|
||||
* Proprietary and confidential. Refer to PKLite License file for more information on
|
||||
* full terms of this copyright and to determine what constitutes authorized use.
|
||||
* Written by PKLite(ST0NEWALL, others) <stonewall@thots.cc.usa>, 2019
|
||||
*
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.worldmaphider;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.events.WidgetMenuOptionClicked;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.menus.MenuManager;
|
||||
import net.runelite.client.menus.WidgetMenuOption;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Hide Worldmap Button",
|
||||
description = "Hides the world map button",
|
||||
type = "PVM",
|
||||
tags = {"world", "world map", "hide", "button", "map", "hide world map", "pklite"}
|
||||
)
|
||||
public class WorldMapHiderPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private MenuManager menuManager;
|
||||
|
||||
@Inject
|
||||
private WorldMapHiderConfig config;
|
||||
|
||||
@Inject
|
||||
private ConfigManager configManager;
|
||||
|
||||
private WidgetMenuOption hideWidgetMenuOption = new WidgetMenuOption("Hide Map Button",
|
||||
"Hide Map Button", WidgetInfo.WORLD_MAP_OPTION);
|
||||
|
||||
private ImmutableList<WidgetInfo> widgetList =
|
||||
ImmutableList.of(WidgetInfo.WORLD_MAP_OPTION, WidgetInfo.WORLD_MAP_BUTTON_BORDER,
|
||||
WidgetInfo.MINIMAP_WORLD_ORB);
|
||||
|
||||
@Provides
|
||||
WorldMapHiderConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(WorldMapHiderConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
menuManager.addManagedCustomMenu(hideWidgetMenuOption);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
if (config.hideWorldMapButton())
|
||||
{
|
||||
setMapHidden(false);
|
||||
}
|
||||
menuManager.removeManagedCustomMenu(hideWidgetMenuOption);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (config.hideWorldMapButton())
|
||||
{
|
||||
setMapHidden(true);
|
||||
}
|
||||
if (!config.hideWorldMapButton())
|
||||
{
|
||||
setMapHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetMenuOptionClicked(WidgetMenuOptionClicked event)
|
||||
{
|
||||
if (event.getMenuOption().equals("Hide Map Button"))
|
||||
{
|
||||
configManager.setConfiguration("worldMapHider", "hideWorldMapButton", true);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (config.hideWorldMapButton() && event.getGroupId() == WidgetID.MINIMAP_GROUP_ID)
|
||||
{
|
||||
setMapHidden(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void setMapHidden(Boolean hidden)
|
||||
{
|
||||
if (widgetList.size() > 0)
|
||||
widgetList.forEach(widgetInfo ->
|
||||
{
|
||||
if (widgetInfo != null && client.getWidget(widgetInfo) != null)
|
||||
{
|
||||
client.getWidget(widgetInfo).setHidden(hidden);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user