diff --git a/build.gradle b/build.gradle index aa67811..d7c25e7 100644 --- a/build.gradle +++ b/build.gradle @@ -24,7 +24,7 @@ dependencies { } group = 'com.github.dappermickie.odablock' -version = '1.1.1' +version = '1.1.2' tasks.withType(JavaCompile) { diff --git a/src/main/java/com/github/dappermickie/odablock/OdablockConfig.java b/src/main/java/com/github/dappermickie/odablock/OdablockConfig.java index 0799659..3bfbe9f 100644 --- a/src/main/java/com/github/dappermickie/odablock/OdablockConfig.java +++ b/src/main/java/com/github/dappermickie/odablock/OdablockConfig.java @@ -380,6 +380,18 @@ default boolean snowballed() return true; } + @ConfigItem( + keyName = "warriors", + name = "Odablock Warriors", + description = "Should the '7th Realm' in-game sound be replaced with the Odablock Warriors song?", + position = 30, + warning = "If you turn this off, you'll have to reload the client to be able to manually play '7th Realm' again." + ) + default boolean warriors() + { + return true; + } + @ConfigSection( name = "Tombs of Amascut", description = "All the configurations regarding Tombs of Amascut.", diff --git a/src/main/java/com/github/dappermickie/odablock/OdablockPlugin.java b/src/main/java/com/github/dappermickie/odablock/OdablockPlugin.java index f89d667..67bcf15 100644 --- a/src/main/java/com/github/dappermickie/odablock/OdablockPlugin.java +++ b/src/main/java/com/github/dappermickie/odablock/OdablockPlugin.java @@ -21,6 +21,7 @@ import com.github.dappermickie.odablock.sounds.KillingPlayer; import com.github.dappermickie.odablock.sounds.KillingRat; import com.github.dappermickie.odablock.sounds.LevelUp; +import com.github.dappermickie.odablock.sounds.OdablockWarriors; import com.github.dappermickie.odablock.sounds.Pet; import com.github.dappermickie.odablock.sounds.PetDog; import com.github.dappermickie.odablock.sounds.PkChest; @@ -208,6 +209,10 @@ public class OdablockPlugin extends Plugin @Inject private KillingPlayer killingPlayer; + @Inject + private OdablockWarriors odablockWarriors; + // End of sound injections + @Inject private LivestreamManager livestreamManager; @@ -223,7 +228,6 @@ public class OdablockPlugin extends Plugin @Inject @Named("developerMode") private boolean developerMode; - // End of sound injections public static final String ODABLOCK = "Odablock"; @@ -395,6 +399,7 @@ public void onMenuOptionClicked(MenuOptionClicked menuOptionClicked) reportPlayer.onMenuOptionClicked(menuOptionClicked); declineTrade.onMenuOptionClicked(menuOptionClicked); dismissRandomEvent.onMenuOptionClicked(menuOptionClicked); + odablockWarriors.onMenuOptionClicked(menuOptionClicked); } @Subscribe @@ -407,6 +412,7 @@ public void onWidgetLoaded(WidgetLoaded event) hairDresser.onWidgetLoaded(event); pkChest.onWidgetLoaded(event); + odablockWarriors.onWidgetLoaded(event); } @Subscribe @@ -537,6 +543,9 @@ public void onScriptCallbackEvent(ScriptCallbackEvent scriptCallbackEvent) public void onCommandExecuted(CommandExecuted event) { emoteHandler.onCommandExecuted(event); + //if(event.getCommand().equals("loadwarrior")) { + // odablockWarriors.onWidgetLoaded(null); + //} } public static int TO_GROUP(int id) diff --git a/src/main/java/com/github/dappermickie/odablock/Sound.java b/src/main/java/com/github/dappermickie/odablock/Sound.java index a5fbfea..0d1f245 100644 --- a/src/main/java/com/github/dappermickie/odablock/Sound.java +++ b/src/main/java/com/github/dappermickie/odablock/Sound.java @@ -87,7 +87,9 @@ public enum Sound HAIRDRESSER_SOUND_3("hairdresser", "Hairdresser_r3.wav"), SNOWBALL_1("snowball", "Snowball_r1.wav"), - SNOWBALL_2("snowball", "Snowball_r2.wav"); + SNOWBALL_2("snowball", "Snowball_r2.wav"), + + WARRIOR("warriors", "odablock_warriors.wav"); private final String resourceName; private final String directory; diff --git a/src/main/java/com/github/dappermickie/odablock/sounds/OdablockWarriors.java b/src/main/java/com/github/dappermickie/odablock/sounds/OdablockWarriors.java new file mode 100644 index 0000000..3490822 --- /dev/null +++ b/src/main/java/com/github/dappermickie/odablock/sounds/OdablockWarriors.java @@ -0,0 +1,72 @@ +package com.github.dappermickie.odablock.sounds; + + +import com.github.dappermickie.odablock.OdablockConfig; +import com.github.dappermickie.odablock.Sound; +import com.github.dappermickie.odablock.SoundEngine; +import java.util.concurrent.ScheduledExecutorService; +import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.api.events.MenuOptionClicked; +import net.runelite.api.events.WidgetLoaded; +import net.runelite.api.widgets.Widget; + +public class OdablockWarriors +{ + @Inject + private Client client; + + @Inject + private SoundEngine soundEngine; + + @Inject + private ScheduledExecutorService executor; + + @Inject + private OdablockConfig config; + + private Widget warriorWidget = null; + + public void onWidgetLoaded(WidgetLoaded event) + { + if (!config.warriors()) + { + return; + } + Widget musicWidget = client.getWidget(15663110); + + if (musicWidget == null) + { + return; + } + + for (Widget w : musicWidget.getDynamicChildren()) + { + if (w.getText().equals("7th Realm") || w.getText().equals("Odablock Warriors")) + { + w.setText("Odablock Warriors"); + w.setName("