forked from m0bilebtw/c-engineer-completed
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2a986da
commit ae34a25
Showing
5 changed files
with
98 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/main/java/com/github/dappermickie/odablock/sounds/OdablockWarriors.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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("<col=ff9040>Odablock Warriors</col>"); | ||
w.setTextColor(901389); | ||
w.revalidate(); | ||
warriorWidget = w; | ||
return; | ||
} | ||
} | ||
} | ||
|
||
public void onMenuOptionClicked(MenuOptionClicked event) | ||
{ | ||
if (warriorWidget == null) | ||
{ | ||
return; | ||
} | ||
if (event.getWidget() != warriorWidget) | ||
{ | ||
return; | ||
} | ||
|
||
event.consume(); | ||
|
||
soundEngine.playClip(Sound.WARRIOR, executor); | ||
} | ||
} |