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.13 by elmex, Sun Sep 9 17:47:00 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-s" => "ready_skill find traps",
37 "LAlt-d" => "ready_skill disarm traps",
38 "LAlt-p" => "ready_skill praying",
34); 39);
35 40
36# allowed modifiers 41# allowed modifiers
37our %MODIFIER = ( 42our %MODIFIER = (
38 "LShift" => CFPlus::KMOD_LSHIFT, 43 "LShift" => CFPlus::KMOD_LSHIFT,
83 "toggle-inventory" => sub { ::toggle_player_page ($::INVENTORY_PAGE) }, 88 "toggle-inventory" => sub { ::toggle_player_page ($::INVENTORY_PAGE) },
84 "toggle-pickup" => sub { ::toggle_player_page ($::PICKUP_PAGE) }, 89 "toggle-pickup" => sub { ::toggle_player_page ($::PICKUP_PAGE) },
85 "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility }, 90 "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility },
86 "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility }, 91 "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility },
87 "switch-tab" => sub { $::MESSAGE_WINDOW->user_switch_to_page (0 + shift) }, 92 "switch-tab" => sub { $::MESSAGE_WINDOW->user_switch_to_page (0 + shift) },
93 "close-current-tab" => sub { $::MESSAGE_WINDOW->close_current_tab },
88 "activate-chat" => sub { $::MESSAGE_WINDOW->activate_current }, 94 "activate-chat" => sub { $::MESSAGE_WINDOW->activate_current },
89 "repeat-command" => sub { 95 "repeat-command" => sub {
90 $::CONN->user_send ($::COMPLETER->{last_command}) 96 $::CONN->user_send ($::COMPLETER->{last_command})
91 if $::CONN && exists $::COMPLETER->{last_command}; 97 if $::CONN && exists $::COMPLETER->{last_command};
92 }, 98 },
240} 246}
241 247
242sub find_default($) { 248sub find_default($) {
243 my ($ev) = @_; 249 my ($ev) = @_;
244 250
245 if (my $cmd = $DEFAULT_KEYMAP->{U}{$ev->{unicode}}) {
246 return $cmd;
247 }
248
249 for my $m (reverse grep $_, @{ $DEFAULT_KEYMAP->{K} }) { 251 for my $m (reverse grep $_, @{ $DEFAULT_KEYMAP->{K} }) {
250 for (keys %$m) { 252 for (keys %$m) {
251 if ($_ == ($ev->{mod} & $_)) { 253 if ($_ == ($ev->{mod} & $_)) {
252 if (defined (my $cmd = $m->{$_}{$ev->{sym}})) { 254 if (defined (my $cmd = $m->{$_}{$ev->{sym}})) {
253 return $cmd; 255 return $cmd;
254 } 256 }
255 } 257 }
256 } 258 }
259 }
260
261 if (my $cmd = $DEFAULT_KEYMAP->{U}{$ev->{unicode}}) {
262 return $cmd;
257 } 263 }
258 264
259 () 265 ()
260} 266}
261 267

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines