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.12 by root, Sun Sep 2 09:48:41 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",
27 "return" => "!activate-chat", 27 "return" => "!activate-chat",
28 "." => "!repeat-command", 28 "." => "!repeat-command",
29 29
30 "," => "take", 30 "," => "take",
31 "space" => "apply", 31 "space" => "apply",
32 "enter" => "examine",
32 "[+]" => "rotateshoottype +", 33 "[+]" => "rotateshoottype +",
33 "[-]" => "rotateshoottype -", 34 "[-]" => "rotateshoottype -",
35 "LAlt-s" => "ready_skill find traps",
36 "LAlt-d" => "ready_skill disarm traps",
37 "LAlt-p" => "ready_skill praying",
34); 38);
35 39
36# allowed modifiers 40# allowed modifiers
37our %MODIFIER = ( 41our %MODIFIER = (
38 "LShift" => CFPlus::KMOD_LSHIFT, 42 "LShift" => CFPlus::KMOD_LSHIFT,
240} 244}
241 245
242sub find_default($) { 246sub find_default($) {
243 my ($ev) = @_; 247 my ($ev) = @_;
244 248
245 if (my $cmd = $DEFAULT_KEYMAP->{U}{$ev->{unicode}}) {
246 return $cmd;
247 }
248
249 for my $m (reverse grep $_, @{ $DEFAULT_KEYMAP->{K} }) { 249 for my $m (reverse grep $_, @{ $DEFAULT_KEYMAP->{K} }) {
250 for (keys %$m) { 250 for (keys %$m) {
251 if ($_ == ($ev->{mod} & $_)) { 251 if ($_ == ($ev->{mod} & $_)) {
252 if (defined (my $cmd = $m->{$_}{$ev->{sym}})) { 252 if (defined (my $cmd = $m->{$_}{$ev->{sym}})) {
253 return $cmd; 253 return $cmd;
254 } 254 }
255 } 255 }
256 } 256 }
257 }
258
259 if (my $cmd = $DEFAULT_KEYMAP->{U}{$ev->{unicode}}) {
260 return $cmd;
257 } 261 }
258 262
259 () 263 ()
260} 264}
261 265

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines