-
Notifications
You must be signed in to change notification settings - Fork 38
Option to fire on death animation #879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 3 commits
242ca45
02fb6e2
11c09ef
01639f5
b4b33bd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -25,6 +25,7 @@ | |
| import net.runelite.api.Prayer; | ||
| import net.runelite.api.SkullIcon; | ||
| import net.runelite.api.events.ActorDeath; | ||
| import net.runelite.api.events.AnimationChanged; | ||
| import net.runelite.api.events.InteractingChanged; | ||
| import net.runelite.api.events.ScriptPreFired; | ||
| import net.runelite.api.gameval.ItemID; | ||
|
|
@@ -46,6 +47,7 @@ | |
| import java.util.ArrayList; | ||
| import java.util.Collection; | ||
| import java.util.Collections; | ||
| import java.util.Set; | ||
| import java.util.Comparator; | ||
| import java.util.HashSet; | ||
| import java.util.List; | ||
|
|
@@ -56,6 +58,7 @@ | |
| import java.util.function.Predicate; | ||
| import java.util.stream.Collectors; | ||
|
|
||
|
|
||
|
iProdigy marked this conversation as resolved.
Outdated
|
||
| @Slf4j | ||
| @Singleton | ||
| public class DeathNotifier extends BaseNotifier { | ||
|
|
@@ -68,6 +71,14 @@ public class DeathNotifier extends BaseNotifier { | |
|
|
||
| private static final String FORTIS_DOOM_MSG = "You have been doomed!"; | ||
|
|
||
| private static final Integer DEFAULT_DEATH_ANIM_ID = 836; | ||
|
|
||
| private static final Integer TRAILBLAZER_RELOADED_DEATH_ANIM_ID = 10629; | ||
|
|
||
| private static final Integer RAGING_ECHOES_DEATH_ANIM_ID = 11902; | ||
|
|
||
| private static final Set<Integer> DEATH_ANIM_IDS = Set.of(DEFAULT_DEATH_ANIM_ID, TRAILBLAZER_RELOADED_DEATH_ANIM_ID, RAGING_ECHOES_DEATH_ANIM_ID); | ||
|
zneix marked this conversation as resolved.
Outdated
|
||
|
|
||
| /** | ||
| * @see <a href="https://github.com/Joshua-F/cs2-scripts/blob/master/scripts/%5Bclientscript,tob_hud_portal%5D.cs2">CS2 Reference</a> | ||
| */ | ||
|
|
@@ -146,13 +157,23 @@ public void onConfigChanged(String key, String value) { | |
| public void onActorDeath(ActorDeath actor) { | ||
| boolean self = client.getLocalPlayer() == actor.getActor(); | ||
|
|
||
| if (self && isEnabled()) | ||
| if (self && isEnabled() && !config.notifyOnAnim()) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. not critical for this PR but: if we wanted to avoid delayed screenshot, we could capture now & use later (or destroy if unused for x ticks) |
||
| handleNotify(null); | ||
|
|
||
| if (self || actor.getActor() == lastTarget.get()) | ||
| lastTarget = new WeakReference<>(null); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if one remaining concern is interactions might change between time of ActorDeath & AnimationChanged, so killer detection may also be worse |
||
| } | ||
|
|
||
| public void onAnimationChanged(AnimationChanged animationChanged) { | ||
| Actor actor = animationChanged.getActor(); | ||
| boolean self = actor == client.getLocalPlayer(); | ||
| boolean isDeath = DEATH_ANIM_IDS.contains(actor.getAnimation()); | ||
|
|
||
| if(self && isDeath && isEnabled() && config.notifyOnAnim()) { | ||
| handleNotify(null); | ||
| } | ||
| } | ||
|
|
||
| public void onGameMessage(String message) { | ||
| var player = client.getLocalPlayer(); | ||
| if (message.equals(FORTIS_DOOM_MSG) && player.getHealthRatio() > 0 && WorldUtils.getLocation(client, player).getRegionID() == WorldUtils.FORTIS_REGION && isEnabled()) { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.