minimap: add clan chat dot color configuration
This commit is contained in:
@@ -28,69 +28,19 @@ import java.awt.Color;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.ConfigSection;
|
||||
|
||||
@ConfigGroup("minimap")
|
||||
@ConfigGroup(MinimapConfig.GROUP)
|
||||
public interface MinimapConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
keyName = "item",
|
||||
name = "Item color",
|
||||
description = "Set the minimap color items are drawn in"
|
||||
)
|
||||
default Color itemColor() //mapdot 0
|
||||
{
|
||||
return new Color(255, 0, 0);
|
||||
}
|
||||
String GROUP = "minimap";
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "npc",
|
||||
name = "NPC color",
|
||||
description = "Set the minimap color NPCs are drawn in"
|
||||
@ConfigSection(
|
||||
name = "Minimap dot colors",
|
||||
description = "The colors of dots on the minimap.",
|
||||
position = 0
|
||||
)
|
||||
default Color npcColor() //mapdot 1
|
||||
{
|
||||
return new Color(255, 255, 0);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "player",
|
||||
name = "Player color",
|
||||
description = "Set the minimap Color players are drawn in"
|
||||
)
|
||||
default Color playerColor() //mapdot 2
|
||||
{
|
||||
return new Color(255, 255, 255);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "friend",
|
||||
name = "Friends color",
|
||||
description = "Set the minimap color your friends are drawn in"
|
||||
)
|
||||
default Color friendColor() //mapdot 3
|
||||
{
|
||||
return new Color(0, 255, 0);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "team",
|
||||
name = "Team color",
|
||||
description = "Set the minimap color your team is drawn in"
|
||||
)
|
||||
default Color teamColor() //mapdot 4
|
||||
{
|
||||
return new Color(19, 110, 247);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "clan",
|
||||
name = "Friends Chat color",
|
||||
description = "Set the minimap color your friends chat members are drawn in"
|
||||
)
|
||||
default Color friendsChatColor() //mapdot 5
|
||||
{
|
||||
return new Color(170, 0, 190);
|
||||
}
|
||||
String minimapDotSection = "minimapDotSection";
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "hideMinimap",
|
||||
@@ -101,4 +51,60 @@ public interface MinimapConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "item",
|
||||
name = "Item color",
|
||||
description = "Set the minimap color items are drawn in",
|
||||
section = minimapDotSection
|
||||
)
|
||||
Color itemColor();
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "npc",
|
||||
name = "NPC color",
|
||||
description = "Set the minimap color NPCs are drawn in",
|
||||
section = minimapDotSection
|
||||
)
|
||||
Color npcColor();
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "player",
|
||||
name = "Player color",
|
||||
description = "Set the minimap Color players are drawn in",
|
||||
section = minimapDotSection
|
||||
)
|
||||
Color playerColor();
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "friend",
|
||||
name = "Friends color",
|
||||
description = "Set the minimap color your friends are drawn in",
|
||||
section = minimapDotSection
|
||||
)
|
||||
Color friendColor();
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "team",
|
||||
name = "Team color",
|
||||
description = "Set the minimap color your team is drawn in",
|
||||
section = minimapDotSection
|
||||
)
|
||||
Color teamColor();
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "clan", // old name from prior to clans
|
||||
name = "Friends Chat color",
|
||||
description = "Set the minimap color your friends chat members are drawn in",
|
||||
section = minimapDotSection
|
||||
)
|
||||
Color friendsChatColor();
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "clanchat",
|
||||
name = "Clan Chat color",
|
||||
description = "Set the minimap color your clan chat members are drawn in",
|
||||
section = minimapDotSection
|
||||
)
|
||||
Color clanChatColor();
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.awt.Color;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.SpritePixels;
|
||||
|
||||
public class MinimapDot
|
||||
class MinimapDot
|
||||
{
|
||||
private static final int MAP_DOT_WIDTH = 4;
|
||||
private static final int MAP_DOT_HEIGHT = 5;
|
||||
@@ -67,12 +67,9 @@ public class MinimapDot
|
||||
return pixels;
|
||||
}
|
||||
|
||||
public static SpritePixels create(Client client, Color color)
|
||||
static SpritePixels create(Client client, Color color)
|
||||
{
|
||||
int[] pixels = createPixels(color);
|
||||
|
||||
SpritePixels dotSprite = client.createSpritePixels(pixels, MAP_DOT_WIDTH, MAP_DOT_HEIGHT);
|
||||
|
||||
return dotSprite;
|
||||
return client.createSpritePixels(pixels, MAP_DOT_WIDTH, MAP_DOT_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,12 +44,18 @@ import net.runelite.client.plugins.PluginDescriptor;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Minimap",
|
||||
description = "Customize the color of minimap dots",
|
||||
description = "Customize the color of minimap dots, and hide the minimap",
|
||||
tags = {"items", "npcs", "players"}
|
||||
)
|
||||
public class MinimapPlugin extends Plugin
|
||||
{
|
||||
private static final int NUM_MAPDOTS = 6;
|
||||
private static final int DOT_ITEM = 0;
|
||||
private static final int DOT_NPC = 1;
|
||||
private static final int DOT_PLAYER = 2;
|
||||
private static final int DOT_FRIEND = 3;
|
||||
private static final int DOT_TEAM = 4;
|
||||
private static final int DOT_FRIENDSCHAT = 5;
|
||||
private static final int DOT_CLAN = 6;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
@@ -66,7 +72,7 @@ public class MinimapPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
protected void startUp()
|
||||
{
|
||||
updateMinimapWidgetVisibility(config.hideMinimap());
|
||||
storeOriginalDots();
|
||||
@@ -74,7 +80,7 @@ public class MinimapPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
protected void shutDown()
|
||||
{
|
||||
updateMinimapWidgetVisibility(false);
|
||||
restoreOriginalDots();
|
||||
@@ -93,7 +99,7 @@ public class MinimapPlugin extends Plugin
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (!event.getGroup().equals("minimap"))
|
||||
if (!event.getGroup().equals(MinimapConfig.GROUP))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -149,23 +155,21 @@ public class MinimapPlugin extends Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
Color[] minimapDotColors = getColors();
|
||||
for (int i = 0; i < mapDots.length && i < minimapDotColors.length; ++i)
|
||||
{
|
||||
mapDots[i] = MinimapDot.create(this.client, minimapDotColors[i]);
|
||||
}
|
||||
applyDot(mapDots, DOT_ITEM, config.itemColor());
|
||||
applyDot(mapDots, DOT_NPC, config.npcColor());
|
||||
applyDot(mapDots, DOT_PLAYER, config.playerColor());
|
||||
applyDot(mapDots, DOT_FRIEND, config.friendColor());
|
||||
applyDot(mapDots, DOT_TEAM, config.teamColor());
|
||||
applyDot(mapDots, DOT_FRIENDSCHAT, config.friendsChatColor());
|
||||
applyDot(mapDots, DOT_CLAN, config.clanChatColor());
|
||||
}
|
||||
|
||||
private Color[] getColors()
|
||||
private void applyDot(SpritePixels[] mapDots, int id, Color color)
|
||||
{
|
||||
Color[] colors = new Color[NUM_MAPDOTS];
|
||||
colors[0] = config.itemColor();
|
||||
colors[1] = config.npcColor();
|
||||
colors[2] = config.playerColor();
|
||||
colors[3] = config.friendColor();
|
||||
colors[4] = config.teamColor();
|
||||
colors[5] = config.friendsChatColor();
|
||||
return colors;
|
||||
if (id < mapDots.length && color != null)
|
||||
{
|
||||
mapDots[id] = MinimapDot.create(client, color);
|
||||
}
|
||||
}
|
||||
|
||||
private void storeOriginalDots()
|
||||
|
||||
Reference in New Issue
Block a user