ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Macro.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Macro.pm (file contents):
Revision 1.9 by root, Tue Aug 28 01:23:47 2007 UTC vs.
Revision 1.14 by root, Sun Oct 14 20:08:26 2007 UTC

6use CFPlus::UI; 6use CFPlus::UI;
7 7
8our $REFRESH_MACRO_LIST; 8our $REFRESH_MACRO_LIST;
9 9
10our %DEFAULT_KEYMAP = ( 10our %DEFAULT_KEYMAP = (
11 (map +($_ => "!completer $_"), "a" .. "z"), 11 (map +("($_)" => "!completer $_"), "a" .. "z"),
12 "(!)" => "!completer shout ", 12 "(!)" => "!completer shout ",
13 "(\")" => "!completer say ", 13 "(\")" => "!completer say ",
14 "(')" => "!completer", 14 "(')" => "!completer",
15 15
16 "LShift-tab" => "!toggle-messagewindow", 16 "LShift-tab" => "!toggle-messagewindow",
22 "f4" => "!toggle-spells", 22 "f4" => "!toggle-spells",
23 "f5" => "!toggle-inventory", 23 "f5" => "!toggle-inventory",
24 "f9" => "!toggle-setup", 24 "f9" => "!toggle-setup",
25 (map +("LAlt-$_" => "!switch-tab $_"), 0..9), 25 (map +("LAlt-$_" => "!switch-tab $_"), 0..9),
26 (map +("RAlt-$_" => "!switch-tab $_"), 0..9), 26 (map +("RAlt-$_" => "!switch-tab $_"), 0..9),
27 "LAlt-x" => "!close-current-tab",
27 "return" => "!activate-chat", 28 "return" => "!activate-chat",
28 "." => "!repeat-command", 29 "." => "!repeat-command",
29 30
30 "," => "take", 31 "," => "take",
31 "space" => "apply", 32 "space" => "apply",
33 "enter" => "examine",
32 "[+]" => "rotateshoottype +", 34 "[+]" => "rotateshoottype +",
33 "[-]" => "rotateshoottype -", 35 "[-]" => "rotateshoottype -",
36 "LAlt-e" => "examine",
37 "LAlt-s" => "ready_skill find traps",
38 "LAlt-d" => "ready_skill disarm traps",
39 "LAlt-p" => "ready_skill praying",
34); 40);
35 41
36# allowed modifiers 42# allowed modifiers
37our %MODIFIER = ( 43our %MODIFIER = (
38 "LShift" => CFPlus::KMOD_LSHIFT, 44 "LShift" => CFPlus::KMOD_LSHIFT,
83 "toggle-inventory" => sub { ::toggle_player_page ($::INVENTORY_PAGE) }, 89 "toggle-inventory" => sub { ::toggle_player_page ($::INVENTORY_PAGE) },
84 "toggle-pickup" => sub { ::toggle_player_page ($::PICKUP_PAGE) }, 90 "toggle-pickup" => sub { ::toggle_player_page ($::PICKUP_PAGE) },
85 "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility }, 91 "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility },
86 "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility }, 92 "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility },
87 "switch-tab" => sub { $::MESSAGE_WINDOW->user_switch_to_page (0 + shift) }, 93 "switch-tab" => sub { $::MESSAGE_WINDOW->user_switch_to_page (0 + shift) },
94 "close-current-tab" => sub { $::MESSAGE_WINDOW->close_current_tab },
88 "activate-chat" => sub { $::MESSAGE_WINDOW->activate_current }, 95 "activate-chat" => sub { $::MESSAGE_WINDOW->activate_current },
89 "repeat-command" => sub { 96 "repeat-command" => sub {
90 $::CONN->user_send ($::COMPLETER->{last_command}) 97 $::CONN->user_send ($::COMPLETER->{last_command})
91 if $::CONN && exists $::COMPLETER->{last_command}; 98 if $::CONN && exists $::COMPLETER->{last_command};
92 }, 99 },
240} 247}
241 248
242sub find_default($) { 249sub find_default($) {
243 my ($ev) = @_; 250 my ($ev) = @_;
244 251
245 if (my $cmd = $DEFAULT_KEYMAP->{U}{$ev->{unicode}}) {
246 return $cmd;
247 }
248
249 for my $m (reverse grep $_, @{ $DEFAULT_KEYMAP->{K} }) { 252 for my $m (reverse grep $_, @{ $DEFAULT_KEYMAP->{K} }) {
250 for (keys %$m) { 253 for (keys %$m) {
251 if ($_ == ($ev->{mod} & $_)) { 254 if ($_ == ($ev->{mod} & $_)) {
252 if (defined (my $cmd = $m->{$_}{$ev->{sym}})) { 255 if (defined (my $cmd = $m->{$_}{$ev->{sym}})) {
253 return $cmd; 256 return $cmd;
254 } 257 }
255 } 258 }
256 } 259 }
260 }
261
262 if (my $cmd = $DEFAULT_KEYMAP->{U}{$ev->{unicode}}) {
263 return $cmd;
257 } 264 }
258 265
259 () 266 ()
260} 267}
261 268

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines