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
|
||||
* 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;
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
* (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.attackindicator;
|
||||
package net.runelite.client.plugins.attackstyles;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
@@ -30,18 +30,29 @@ import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup(
|
||||
keyName = "attackIndicator",
|
||||
name = "Attack Indicators",
|
||||
description = "Configuration for the attack indicator plugin"
|
||||
name = "Attack Styles",
|
||||
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(
|
||||
keyName = "warnForDefensive",
|
||||
name = "Warn for defensive",
|
||||
description = "Configures whether or not users are warned for selecting a defensive combat option",
|
||||
name = "Warn for defence",
|
||||
description = "Show warning when a Defence skill combat option is selected",
|
||||
position = 2
|
||||
)
|
||||
default boolean warnForDefensive()
|
||||
default boolean warnForDefence()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -49,7 +60,7 @@ public interface AttackIndicatorConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "warnForAttack",
|
||||
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
|
||||
)
|
||||
default boolean warnForAttack()
|
||||
@@ -60,7 +71,7 @@ public interface AttackIndicatorConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "warnForStrength",
|
||||
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
|
||||
)
|
||||
default boolean warnForStrength()
|
||||
@@ -71,7 +82,7 @@ public interface AttackIndicatorConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "warnForRanged",
|
||||
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
|
||||
)
|
||||
default boolean warnForRanged()
|
||||
@@ -82,7 +93,7 @@ public interface AttackIndicatorConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "warnForMagic",
|
||||
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
|
||||
)
|
||||
default boolean warnForMagic()
|
||||
@@ -93,7 +104,7 @@ public interface AttackIndicatorConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "removeWarnedStyles",
|
||||
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
|
||||
)
|
||||
default boolean removeWarnedStyles()
|
||||
@@ -22,7 +22,7 @@
|
||||
* (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.attackindicator;
|
||||
package net.runelite.client.plugins.attackstyles;
|
||||
|
||||
import java.awt.Color;
|
||||
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.components.PanelComponent;
|
||||
|
||||
public class AttackIndicatorOverlay extends Overlay
|
||||
public class AttackStylesOverlay extends Overlay
|
||||
{
|
||||
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();
|
||||
|
||||
@Inject
|
||||
public AttackIndicatorOverlay(AttackIndicatorPlugin plugin)
|
||||
public AttackStylesOverlay(AttackStylesPlugin plugin, AttackStylesConfig config)
|
||||
{
|
||||
setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT);
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
final String attackStyleString = plugin.getAttackStyle().getName();
|
||||
boolean warnedSkillSelected = plugin.isWarnedSkillSelected();
|
||||
|
||||
panelComponent.setTitleColor(plugin.isWarnedSkillSelected() ? Color.RED : Color.WHITE);
|
||||
panelComponent.setTitle(attackStyleString);
|
||||
panelComponent.setWidth(COMPONENT_WIDTH);
|
||||
if (warnedSkillSelected || config.alwaysShowStyle())
|
||||
{
|
||||
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
|
||||
* 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.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.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import static net.runelite.client.plugins.attackindicator.AttackStyle.CASTING;
|
||||
import static net.runelite.client.plugins.attackindicator.AttackStyle.DEFENSIVE_CASTING;
|
||||
import static net.runelite.client.plugins.attackindicator.AttackStyle.OTHER;
|
||||
import static net.runelite.client.plugins.attackstyles.AttackStyle.CASTING;
|
||||
import static net.runelite.client.plugins.attackstyles.AttackStyle.DEFENSIVE_CASTING;
|
||||
import static net.runelite.client.plugins.attackstyles.AttackStyle.OTHER;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Attack Indicators"
|
||||
name = "Attack Styles"
|
||||
)
|
||||
@Slf4j
|
||||
public class AttackIndicatorPlugin extends Plugin
|
||||
public class AttackStylesPlugin extends Plugin
|
||||
{
|
||||
private int attackStyleVarbit = -1;
|
||||
private int equippedWeaponTypeVarbit = -1;
|
||||
@@ -71,19 +71,19 @@ public class AttackIndicatorPlugin extends Plugin
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private AttackIndicatorConfig config;
|
||||
private AttackStylesConfig config;
|
||||
|
||||
@Inject
|
||||
private AttackIndicatorOverlay overlay;
|
||||
private AttackStylesOverlay overlay;
|
||||
|
||||
@Provides
|
||||
AttackIndicatorConfig provideConfig(ConfigManager configManager)
|
||||
AttackStylesConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(AttackIndicatorConfig.class);
|
||||
return configManager.getConfig(AttackStylesConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AttackIndicatorOverlay getOverlay()
|
||||
public AttackStylesOverlay getOverlay()
|
||||
{
|
||||
return overlay;
|
||||
}
|
||||
@@ -96,7 +96,7 @@ public class AttackIndicatorPlugin extends Plugin
|
||||
{
|
||||
updateWarnedSkills(config.warnForAttack(), Skill.ATTACK);
|
||||
updateWarnedSkills(config.warnForStrength(), Skill.STRENGTH);
|
||||
updateWarnedSkills(config.warnForDefensive(), Skill.DEFENCE);
|
||||
updateWarnedSkills(config.warnForDefence(), Skill.DEFENCE);
|
||||
updateWarnedSkills(config.warnForRanged(), Skill.RANGED);
|
||||
updateWarnedSkills(config.warnForMagic(), Skill.MAGIC);
|
||||
updateAttackStyle(
|
||||
@@ -164,7 +164,7 @@ public class AttackIndicatorPlugin extends Plugin
|
||||
{
|
||||
updateWarnedSkills(config.warnForAttack(), Skill.ATTACK);
|
||||
updateWarnedSkills(config.warnForStrength(), Skill.STRENGTH);
|
||||
updateWarnedSkills(config.warnForDefensive(), Skill.DEFENCE);
|
||||
updateWarnedSkills(config.warnForDefence(), Skill.DEFENCE);
|
||||
updateWarnedSkills(config.warnForRanged(), Skill.RANGED);
|
||||
updateWarnedSkills(config.warnForMagic(), Skill.MAGIC);
|
||||
}
|
||||
@@ -22,11 +22,11 @@
|
||||
* (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.attackindicator;
|
||||
package net.runelite.client.plugins.attackstyles;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import static net.runelite.client.plugins.attackindicator.AttackStyle.*;
|
||||
import static net.runelite.client.plugins.attackstyles.AttackStyle.*;
|
||||
|
||||
public enum WeaponType
|
||||
{
|
||||
@@ -22,7 +22,7 @@
|
||||
* (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.attackindicator;
|
||||
package net.runelite.client.plugins.attackstyles;
|
||||
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.testing.fieldbinder.Bind;
|
||||
@@ -48,7 +48,7 @@ import static org.mockito.Mockito.when;
|
||||
import org.mockito.runners.MockitoJUnitRunner;
|
||||
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class AttackIndicatorPluginTest
|
||||
public class AttackStylesPluginTest
|
||||
{
|
||||
@Mock
|
||||
@Bind
|
||||
@@ -56,10 +56,10 @@ public class AttackIndicatorPluginTest
|
||||
|
||||
@Mock
|
||||
@Bind
|
||||
AttackIndicatorConfig attackConfig;
|
||||
AttackStylesConfig attackConfig;
|
||||
|
||||
@Inject
|
||||
AttackIndicatorPlugin attackPlugin;
|
||||
AttackStylesPlugin attackPlugin;
|
||||
|
||||
@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
|
||||
public void testHiddenWidget()
|
||||
Reference in New Issue
Block a user