… | |
… | |
6 | use CFPlus::UI; |
6 | use CFPlus::UI; |
7 | |
7 | |
8 | our $REFRESH_MACRO_LIST; |
8 | our $REFRESH_MACRO_LIST; |
9 | |
9 | |
10 | our %DEFAULT_KEYMAP = ( |
10 | our %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 |
37 | our %MODIFIER = ( |
41 | our %MODIFIER = ( |
38 | "LShift" => CFPlus::KMOD_LSHIFT, |
42 | "LShift" => CFPlus::KMOD_LSHIFT, |
… | |
… | |
240 | } |
244 | } |
241 | |
245 | |
242 | sub find_default($) { |
246 | sub 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 | |