Merge pull request #1322 from SoyChai/attack-indicators-rename
Rename "Attack Indicators" plugin to "Attack Styles"
This commit is contained in:
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.attackindicator;
|
package net.runelite.client.plugins.attackstyles;
|
||||||
|
|
||||||
import net.runelite.api.Skill;
|
import net.runelite.api.Skill;
|
||||||
|
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.attackindicator;
|
package net.runelite.client.plugins.attackstyles;
|
||||||
|
|
||||||
import net.runelite.client.config.Config;
|
import net.runelite.client.config.Config;
|
||||||
import net.runelite.client.config.ConfigGroup;
|
import net.runelite.client.config.ConfigGroup;
|
||||||
@@ -30,18 +30,29 @@ import net.runelite.client.config.ConfigItem;
|
|||||||
|
|
||||||
@ConfigGroup(
|
@ConfigGroup(
|
||||||
keyName = "attackIndicator",
|
keyName = "attackIndicator",
|
||||||
name = "Attack Indicators",
|
name = "Attack Styles",
|
||||||
description = "Configuration for the attack indicator plugin"
|
description = "Configuration for the attack styles plugin"
|
||||||
)
|
)
|
||||||
public interface AttackIndicatorConfig extends Config
|
public interface AttackStylesConfig extends Config
|
||||||
{
|
{
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "alwaysShowStyle",
|
||||||
|
name = "Always show style",
|
||||||
|
description = "Show attack style indicator at all times",
|
||||||
|
position = 1
|
||||||
|
)
|
||||||
|
default boolean alwaysShowStyle()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "warnForDefensive",
|
keyName = "warnForDefensive",
|
||||||
name = "Warn for defensive",
|
name = "Warn for defence",
|
||||||
description = "Configures whether or not users are warned for selecting a defensive combat option",
|
description = "Show warning when a Defence skill combat option is selected",
|
||||||
position = 2
|
position = 2
|
||||||
)
|
)
|
||||||
default boolean warnForDefensive()
|
default boolean warnForDefence()
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -49,7 +60,7 @@ public interface AttackIndicatorConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "warnForAttack",
|
keyName = "warnForAttack",
|
||||||
name = "Warn for attack",
|
name = "Warn for attack",
|
||||||
description = "Configures whether or not users are warned for selecting an attack combat option",
|
description = "Show warning when an Attack skill combat option is selected",
|
||||||
position = 3
|
position = 3
|
||||||
)
|
)
|
||||||
default boolean warnForAttack()
|
default boolean warnForAttack()
|
||||||
@@ -60,7 +71,7 @@ public interface AttackIndicatorConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "warnForStrength",
|
keyName = "warnForStrength",
|
||||||
name = "Warn for strength",
|
name = "Warn for strength",
|
||||||
description = "Configures whether or not users are warned for selecting a strength combat option",
|
description = "Show warning when a Strength skill combat option is selected",
|
||||||
position = 4
|
position = 4
|
||||||
)
|
)
|
||||||
default boolean warnForStrength()
|
default boolean warnForStrength()
|
||||||
@@ -71,7 +82,7 @@ public interface AttackIndicatorConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "warnForRanged",
|
keyName = "warnForRanged",
|
||||||
name = "Warn for ranged",
|
name = "Warn for ranged",
|
||||||
description = "Configures whether or not users are warned for selecting a ranged combat option",
|
description = "Show warning when a Ranged skill combat option is selected",
|
||||||
position = 5
|
position = 5
|
||||||
)
|
)
|
||||||
default boolean warnForRanged()
|
default boolean warnForRanged()
|
||||||
@@ -82,7 +93,7 @@ public interface AttackIndicatorConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "warnForMagic",
|
keyName = "warnForMagic",
|
||||||
name = "Warn for magic",
|
name = "Warn for magic",
|
||||||
description = "Configures whether or not users are warned for selecting a magic combat option",
|
description = "Show warning when a Magic skill combat option is selected",
|
||||||
position = 6
|
position = 6
|
||||||
)
|
)
|
||||||
default boolean warnForMagic()
|
default boolean warnForMagic()
|
||||||
@@ -93,7 +104,7 @@ public interface AttackIndicatorConfig extends Config
|
|||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "removeWarnedStyles",
|
keyName = "removeWarnedStyles",
|
||||||
name = "Remove warned styles",
|
name = "Remove warned styles",
|
||||||
description = "Configures whether or not warned styles are removed from the combat options tab",
|
description = "Remove warned styles from the combat options tab",
|
||||||
position = 7
|
position = 7
|
||||||
)
|
)
|
||||||
default boolean removeWarnedStyles()
|
default boolean removeWarnedStyles()
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.attackindicator;
|
package net.runelite.client.plugins.attackstyles;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
@@ -32,29 +32,38 @@ import net.runelite.client.ui.overlay.Overlay;
|
|||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
|
||||||
public class AttackIndicatorOverlay extends Overlay
|
public class AttackStylesOverlay extends Overlay
|
||||||
{
|
{
|
||||||
private static final int COMPONENT_WIDTH = 80;
|
private static final int COMPONENT_WIDTH = 80;
|
||||||
|
|
||||||
private final AttackIndicatorPlugin plugin;
|
private final AttackStylesPlugin plugin;
|
||||||
|
private final AttackStylesConfig config;
|
||||||
private final PanelComponent panelComponent = new PanelComponent();
|
private final PanelComponent panelComponent = new PanelComponent();
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public AttackIndicatorOverlay(AttackIndicatorPlugin plugin)
|
public AttackStylesOverlay(AttackStylesPlugin plugin, AttackStylesConfig config)
|
||||||
{
|
{
|
||||||
setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT);
|
setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT);
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Dimension render(Graphics2D graphics)
|
public Dimension render(Graphics2D graphics)
|
||||||
{
|
{
|
||||||
final String attackStyleString = plugin.getAttackStyle().getName();
|
boolean warnedSkillSelected = plugin.isWarnedSkillSelected();
|
||||||
|
|
||||||
panelComponent.setTitleColor(plugin.isWarnedSkillSelected() ? Color.RED : Color.WHITE);
|
if (warnedSkillSelected || config.alwaysShowStyle())
|
||||||
panelComponent.setTitle(attackStyleString);
|
{
|
||||||
panelComponent.setWidth(COMPONENT_WIDTH);
|
final String attackStyleString = plugin.getAttackStyle().getName();
|
||||||
|
|
||||||
return panelComponent.render(graphics);
|
panelComponent.setTitleColor(warnedSkillSelected ? Color.RED : Color.WHITE);
|
||||||
|
panelComponent.setTitle(attackStyleString);
|
||||||
|
panelComponent.setWidth(COMPONENT_WIDTH);
|
||||||
|
|
||||||
|
return panelComponent.render(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.attackindicator;
|
package net.runelite.client.plugins.attackstyles;
|
||||||
|
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import com.google.common.collect.HashBasedTable;
|
import com.google.common.collect.HashBasedTable;
|
||||||
@@ -49,15 +49,15 @@ import static net.runelite.api.widgets.WidgetInfo.TO_GROUP;
|
|||||||
import net.runelite.client.config.ConfigManager;
|
import net.runelite.client.config.ConfigManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import static net.runelite.client.plugins.attackindicator.AttackStyle.CASTING;
|
import static net.runelite.client.plugins.attackstyles.AttackStyle.CASTING;
|
||||||
import static net.runelite.client.plugins.attackindicator.AttackStyle.DEFENSIVE_CASTING;
|
import static net.runelite.client.plugins.attackstyles.AttackStyle.DEFENSIVE_CASTING;
|
||||||
import static net.runelite.client.plugins.attackindicator.AttackStyle.OTHER;
|
import static net.runelite.client.plugins.attackstyles.AttackStyle.OTHER;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Attack Indicators"
|
name = "Attack Styles"
|
||||||
)
|
)
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class AttackIndicatorPlugin extends Plugin
|
public class AttackStylesPlugin extends Plugin
|
||||||
{
|
{
|
||||||
private int attackStyleVarbit = -1;
|
private int attackStyleVarbit = -1;
|
||||||
private int equippedWeaponTypeVarbit = -1;
|
private int equippedWeaponTypeVarbit = -1;
|
||||||
@@ -71,19 +71,19 @@ public class AttackIndicatorPlugin extends Plugin
|
|||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private AttackIndicatorConfig config;
|
private AttackStylesConfig config;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private AttackIndicatorOverlay overlay;
|
private AttackStylesOverlay overlay;
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
AttackIndicatorConfig provideConfig(ConfigManager configManager)
|
AttackStylesConfig provideConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
return configManager.getConfig(AttackIndicatorConfig.class);
|
return configManager.getConfig(AttackStylesConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AttackIndicatorOverlay getOverlay()
|
public AttackStylesOverlay getOverlay()
|
||||||
{
|
{
|
||||||
return overlay;
|
return overlay;
|
||||||
}
|
}
|
||||||
@@ -96,7 +96,7 @@ public class AttackIndicatorPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
updateWarnedSkills(config.warnForAttack(), Skill.ATTACK);
|
updateWarnedSkills(config.warnForAttack(), Skill.ATTACK);
|
||||||
updateWarnedSkills(config.warnForStrength(), Skill.STRENGTH);
|
updateWarnedSkills(config.warnForStrength(), Skill.STRENGTH);
|
||||||
updateWarnedSkills(config.warnForDefensive(), Skill.DEFENCE);
|
updateWarnedSkills(config.warnForDefence(), Skill.DEFENCE);
|
||||||
updateWarnedSkills(config.warnForRanged(), Skill.RANGED);
|
updateWarnedSkills(config.warnForRanged(), Skill.RANGED);
|
||||||
updateWarnedSkills(config.warnForMagic(), Skill.MAGIC);
|
updateWarnedSkills(config.warnForMagic(), Skill.MAGIC);
|
||||||
updateAttackStyle(
|
updateAttackStyle(
|
||||||
@@ -164,7 +164,7 @@ public class AttackIndicatorPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
updateWarnedSkills(config.warnForAttack(), Skill.ATTACK);
|
updateWarnedSkills(config.warnForAttack(), Skill.ATTACK);
|
||||||
updateWarnedSkills(config.warnForStrength(), Skill.STRENGTH);
|
updateWarnedSkills(config.warnForStrength(), Skill.STRENGTH);
|
||||||
updateWarnedSkills(config.warnForDefensive(), Skill.DEFENCE);
|
updateWarnedSkills(config.warnForDefence(), Skill.DEFENCE);
|
||||||
updateWarnedSkills(config.warnForRanged(), Skill.RANGED);
|
updateWarnedSkills(config.warnForRanged(), Skill.RANGED);
|
||||||
updateWarnedSkills(config.warnForMagic(), Skill.MAGIC);
|
updateWarnedSkills(config.warnForMagic(), Skill.MAGIC);
|
||||||
}
|
}
|
||||||
@@ -22,11 +22,11 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.attackindicator;
|
package net.runelite.client.plugins.attackstyles;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import static net.runelite.client.plugins.attackindicator.AttackStyle.*;
|
import static net.runelite.client.plugins.attackstyles.AttackStyle.*;
|
||||||
|
|
||||||
public enum WeaponType
|
public enum WeaponType
|
||||||
{
|
{
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.attackindicator;
|
package net.runelite.client.plugins.attackstyles;
|
||||||
|
|
||||||
import com.google.inject.Guice;
|
import com.google.inject.Guice;
|
||||||
import com.google.inject.testing.fieldbinder.Bind;
|
import com.google.inject.testing.fieldbinder.Bind;
|
||||||
@@ -48,7 +48,7 @@ import static org.mockito.Mockito.when;
|
|||||||
import org.mockito.runners.MockitoJUnitRunner;
|
import org.mockito.runners.MockitoJUnitRunner;
|
||||||
|
|
||||||
@RunWith(MockitoJUnitRunner.class)
|
@RunWith(MockitoJUnitRunner.class)
|
||||||
public class AttackIndicatorPluginTest
|
public class AttackStylesPluginTest
|
||||||
{
|
{
|
||||||
@Mock
|
@Mock
|
||||||
@Bind
|
@Bind
|
||||||
@@ -56,10 +56,10 @@ public class AttackIndicatorPluginTest
|
|||||||
|
|
||||||
@Mock
|
@Mock
|
||||||
@Bind
|
@Bind
|
||||||
AttackIndicatorConfig attackConfig;
|
AttackStylesConfig attackConfig;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
AttackIndicatorPlugin attackPlugin;
|
AttackStylesPlugin attackPlugin;
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void before()
|
public void before()
|
||||||
@@ -102,7 +102,7 @@ public class AttackIndicatorPluginTest
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Verify that attack style widgets are hidden when filtered with the AttackIndicatorPlugin.
|
* Verify that attack style widgets are hidden when filtered with the AttackStylesPlugin.
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testHiddenWidget()
|
public void testHiddenWidget()
|
||||||
Reference in New Issue
Block a user