Send raid layout message on raid enter

Sends raid layout message as clan chat game message when entering raid.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2019-01-25 00:27:42 +01:00
parent d808baa3d3
commit c56ea05060
2 changed files with 49 additions and 15 deletions

View File

@@ -151,4 +151,15 @@ public interface RaidsConfig extends Config
{
return "";
}
@ConfigItem(
position = 11,
keyName = "layoutMessage",
name = "Send raid layout message when entering raid",
description = "Sends game message with raid layout on entering new raid"
)
default boolean layoutMessage()
{
return true;
}
}

View File

@@ -242,21 +242,21 @@ public class RaidsPlugin extends Plugin
double percentage = personalPoints / (totalPoints / 100.0);
String chatMessage = new ChatMessageBuilder()
.append(ChatColorType.NORMAL)
.append("Total points: ")
.append(ChatColorType.HIGHLIGHT)
.append(POINTS_FORMAT.format(totalPoints))
.append(ChatColorType.NORMAL)
.append(", Personal points: ")
.append(ChatColorType.HIGHLIGHT)
.append(POINTS_FORMAT.format(personalPoints))
.append(ChatColorType.NORMAL)
.append(" (")
.append(ChatColorType.HIGHLIGHT)
.append(DECIMAL_FORMAT.format(percentage))
.append(ChatColorType.NORMAL)
.append("%)")
.build();
.append(ChatColorType.NORMAL)
.append("Total points: ")
.append(ChatColorType.HIGHLIGHT)
.append(POINTS_FORMAT.format(totalPoints))
.append(ChatColorType.NORMAL)
.append(", Personal points: ")
.append(ChatColorType.HIGHLIGHT)
.append(POINTS_FORMAT.format(personalPoints))
.append(ChatColorType.NORMAL)
.append(" (")
.append(ChatColorType.HIGHLIGHT)
.append(DECIMAL_FORMAT.format(percentage))
.append(ChatColorType.NORMAL)
.append("%)")
.build();
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.CLANCHAT_INFO)
@@ -302,6 +302,7 @@ public class RaidsPlugin extends Plugin
raid.updateLayout(layout);
RotationSolver.solve(raid.getCombatRooms());
overlay.setScoutOverlayShown(true);
sendRaidLayoutMessage();
}
else if (!config.scoutOverlayAtBank())
{
@@ -316,6 +317,28 @@ public class RaidsPlugin extends Plugin
}
}
private void sendRaidLayoutMessage()
{
if (!config.layoutMessage())
{
return;
}
final String layout = getRaid().getLayout().toCodeString();
final String rooms = getRaid().toRoomString();
final String raidData = "[" + layout + "]: " + rooms;
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.CLANCHAT_INFO)
.runeLiteFormattedMessage(new ChatMessageBuilder()
.append(ChatColorType.HIGHLIGHT)
.append("Layout: ")
.append(ChatColorType.NORMAL)
.append(raidData)
.build())
.build());
}
private void updateInfoBoxState()
{
if (timer == null)