wintertodt plugin: separate notifications into separate options

This commit is contained in:
loldudester
2020-01-21 19:48:39 +00:00
committed by Adam
parent c7d89860ab
commit ef6e53ccae
3 changed files with 98 additions and 37 deletions

View File

@@ -1,6 +1,7 @@
/* /*
* Copyright (c) 2018, terminatusx <jbfleischman@gmail.com> * Copyright (c) 2018, terminatusx <jbfleischman@gmail.com>
* Copyright (c) 2018, Adam <Adam@sigterm.info> * Copyright (c) 2018, Adam <Adam@sigterm.info>
* Copyright (c) 2020, loldudester <HannahRyanster@gmail.com>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -31,24 +32,13 @@ import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem; import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Range; import net.runelite.client.config.Range;
import net.runelite.client.config.Units; import net.runelite.client.config.Units;
import net.runelite.client.plugins.wintertodt.config.WintertodtNotifyMode; import net.runelite.client.plugins.wintertodt.config.WintertodtNotifyDamage;
@ConfigGroup("wintertodt") @ConfigGroup("wintertodt")
public interface WintertodtConfig extends Config public interface WintertodtConfig extends Config
{ {
@ConfigItem( @ConfigItem(
position = 1, position = 1,
keyName = "notifyCondition",
name = "Notify When",
description = "Configures when to send notifications"
)
default WintertodtNotifyMode notifyCondition()
{
return WintertodtNotifyMode.ONLY_WHEN_INTERRUPTED;
}
@ConfigItem(
position = 2,
keyName = "damageNotificationColor", keyName = "damageNotificationColor",
name = "Damage Notification Color", name = "Damage Notification Color",
description = "Color of damage notification text in chat" description = "Color of damage notification text in chat"
@@ -59,7 +49,7 @@ public interface WintertodtConfig extends Config
} }
@ConfigItem( @ConfigItem(
position = 3, position = 2,
keyName = "roundNotification", keyName = "roundNotification",
name = "Wintertodt round notification", name = "Wintertodt round notification",
description = "Notifies you before the round starts (in seconds)" description = "Notifies you before the round starts (in seconds)"
@@ -72,4 +62,70 @@ public interface WintertodtConfig extends Config
{ {
return 5; return 5;
} }
@ConfigItem(
position = 3,
keyName = "notifyCold",
name = "Ambient Damage Notification",
description = "Notifies when hit by the Wintertodt's ambient cold damage"
)
default WintertodtNotifyDamage notifyCold()
{
return WintertodtNotifyDamage.INTERRUPT;
}
@ConfigItem(
position = 4,
keyName = "notifySnowfall",
name = "Snowfall Damage Notification",
description = "Notifies when hit by the Wintertodt's snowfall attack"
)
default WintertodtNotifyDamage notifySnowfall()
{
return WintertodtNotifyDamage.INTERRUPT;
}
@ConfigItem(
position = 5,
keyName = "notifyBrazierDamage",
name = "Brazier Damage Notification",
description = "Notifies when hit by the brazier breaking"
)
default WintertodtNotifyDamage notifyBrazierDamage()
{
return WintertodtNotifyDamage.INTERRUPT;
}
@ConfigItem(
position = 6,
keyName = "notifyFullInv",
name = "Full Inventory Notification",
description = "Notifies when your inventory fills up with bruma roots"
)
default boolean notifyFullInv()
{
return true;
}
@ConfigItem(
position = 7,
keyName = "notifyEmptyInv",
name = "Empty Inventory Notification",
description = "Notifies when you run out of bruma roots"
)
default boolean notifyEmptyInv()
{
return true;
}
@ConfigItem(
position = 8,
keyName = "notifyBrazierOut",
name = "Brazier Extinguish Notification",
description = "Notifies when the brazier goes out"
)
default boolean notifyBrazierOut()
{
return true;
}
} }

View File

@@ -1,6 +1,7 @@
/* /*
* Copyright (c) 2018, terminatusx <jbfleischman@gmail.com> * Copyright (c) 2018, terminatusx <jbfleischman@gmail.com>
* Copyright (c) 2018, Adam <Adam@sigterm.info> * Copyright (c) 2018, Adam <Adam@sigterm.info>
* Copyright (c) 2020, loldudester <HannahRyanster@gmail.com>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -69,6 +70,9 @@ import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe; import net.runelite.client.eventbus.Subscribe;
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 net.runelite.client.plugins.wintertodt.config.WintertodtNotifyDamage;
import static net.runelite.client.plugins.wintertodt.config.WintertodtNotifyDamage.ALWAYS;
import static net.runelite.client.plugins.wintertodt.config.WintertodtNotifyDamage.INTERRUPT;
import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.ColorUtil; import net.runelite.client.util.ColorUtil;
@@ -290,7 +294,6 @@ public class WintertodtPlugin extends Plugin
} }
boolean wasInterrupted = false; boolean wasInterrupted = false;
boolean wasDamaged = false;
boolean neverNotify = false; boolean neverNotify = false;
switch (interruptType) switch (interruptType)
@@ -298,7 +301,6 @@ public class WintertodtPlugin extends Plugin
case COLD: case COLD:
case BRAZIER: case BRAZIER:
case SNOWFALL: case SNOWFALL:
wasDamaged = true;
// Recolor message for damage notification // Recolor message for damage notification
messageNode.setRuneLiteFormatMessage(ColorUtil.wrapWithColorTag(messageNode.getValue(), config.damageNotificationColor())); messageNode.setRuneLiteFormatMessage(ColorUtil.wrapWithColorTag(messageNode.getValue(), config.damageNotificationColor()));
@@ -327,23 +329,28 @@ public class WintertodtPlugin extends Plugin
if (!neverNotify) if (!neverNotify)
{ {
boolean shouldNotify = false; boolean shouldNotify = false;
switch (interruptType)
switch (config.notifyCondition())
{ {
case ONLY_WHEN_INTERRUPTED: case COLD:
if (wasInterrupted) WintertodtNotifyDamage notify = config.notifyCold();
{ shouldNotify = notify == ALWAYS || (notify == INTERRUPT && wasInterrupted);
shouldNotify = true;
}
break; break;
case WHEN_DAMAGED: case SNOWFALL:
if (wasDamaged) notify = config.notifySnowfall();
{ shouldNotify = notify == ALWAYS || (notify == INTERRUPT && wasInterrupted);
shouldNotify = true;
}
break; break;
case EITHER: case BRAZIER:
shouldNotify = true; notify = config.notifyBrazierDamage();
shouldNotify = notify == ALWAYS || (notify == INTERRUPT && wasInterrupted);
break;
case INVENTORY_FULL:
shouldNotify = config.notifyFullInv();
break;
case OUT_OF_ROOTS:
shouldNotify = config.notifyEmptyInv();
break;
case BRAZIER_WENT_OUT:
shouldNotify = config.notifyBrazierOut();
break; break;
} }

View File

@@ -1,6 +1,5 @@
/* /*
* Copyright (c) 2018, terminatusx <jbfleischman@gmail.com> * Copyright (c) 2020, loldudester <HannahRyanster@gmail.com>
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@@ -30,12 +29,11 @@ import lombok.RequiredArgsConstructor;
@Getter @Getter
@RequiredArgsConstructor @RequiredArgsConstructor
public enum WintertodtNotifyMode public enum WintertodtNotifyDamage
{ {
NONE("None"), OFF("Off"),
WHEN_DAMAGED("Damage Taken"), INTERRUPT("On Interrupt"),
ONLY_WHEN_INTERRUPTED("Action Interrupted"), ALWAYS("Always");
EITHER("Either");
private final String name; private final String name;
@@ -44,4 +42,4 @@ public enum WintertodtNotifyMode
{ {
return name; return name;
} }
} }