Skip to content
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

Add new hotkey OpenAllCorpses #212

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions Razor/HotKeys/Misc.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ public static void Initialize()
HotKey.Add(HKCategory.Misc, LocString.LastObj, new HotKeyCallback(LastObj));
HotKey.Add(HKCategory.Misc, LocString.AllNames, new HotKeyCallback(AllNames));
HotKey.Add(HKCategory.Misc, LocString.AllCorpses, new HotKeyCallback(AllCorpses));
HotKey.Add(HKCategory.Misc, LocString.OpenAllCorpses, new HotKeyCallback(OpenAllCorpses));
HotKey.Add(HKCategory.Misc, LocString.AllMobiles, new HotKeyCallback(AllMobiles));
HotKey.Add(HKCategory.Misc, LocString.Dismount, new HotKeyCallback(Dismount));

Expand Down Expand Up @@ -245,6 +246,19 @@ private static void AllCorpses()
}
}

private static void OpenAllCorpses()
{
foreach (Item i in World.Items.Values)
{
if (i.IsCorpse &&
Utility.InRange(i.Position, World.Player.Position, Config.GetInt("CorpseRange")) &&
World.Player != null && World.Player.Visible)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please check for null first, or it would fail on World.Player.Position if World is null.

{
PlayerData.DoubleClick(i);
}
}
}

private static void AllMobiles()
{
bool textFlags = Config.GetBool("LastTargTextFlags");
Expand Down
1 change: 1 addition & 0 deletions Razor/UI/Languages.cs
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ public enum LocString : int
ResumeScriptMessage,
PauseScriptMessage,
ScriptFinishedStopwatch,
OpenAllCorpses,
__End
}

Expand Down
3 changes: 2 additions & 1 deletion etc/Language/Razor_lang.enu
Original file line number Diff line number Diff line change
Expand Up @@ -829,4 +829,5 @@ InputBox::ok=&OK
2123=> Pause Current Script
2124=Script resuming from line {0}
2125=Script pausing on line {0}
2126=Script '{0}' finished ({1}ms)
2126=Script '{0}' finished ({1}ms)
2127=Open All Corpses