… | |
… | |
67 | }); |
67 | }); |
68 | |
68 | |
69 | () |
69 | () |
70 | }); |
70 | }); |
71 | |
71 | |
72 | $self->{map_widget}->clr_commands; |
72 | $::COMPLETER->reset; |
73 | |
|
|
74 | my @cmd_help = map { |
|
|
75 | $_->[DC::Pod::N_KW][0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x |
|
|
76 | or die "unparseable command help: $_->[DC::Pod::N_KW][0]"; |
|
|
77 | |
|
|
78 | my $cmd = $1; |
|
|
79 | my @args = split /\|/, $2; |
|
|
80 | @args = (".*") unless @args; |
|
|
81 | |
|
|
82 | my (undef, @par) = DC::Pod::section_of $_; |
|
|
83 | my $text = DC::Pod::as_label @par; |
|
|
84 | |
|
|
85 | $_ = $_ eq ".*" ? "" : " $_" |
|
|
86 | for @args; |
|
|
87 | |
|
|
88 | map ["$cmd$_", $text], |
|
|
89 | sort { (length $a) <=> (length $b) } |
|
|
90 | @args |
|
|
91 | } sort { $a->[DC::Pod::N_PAR] <=> $b->[DC::Pod::N_PAR] } |
|
|
92 | DC::Pod::find command => "*"; |
|
|
93 | |
73 | |
94 | $self->{json_coder} |
74 | $self->{json_coder} |
95 | ->convert_blessed |
75 | ->convert_blessed |
96 | ->filter_json_single_key_object ("\fw" => sub { |
76 | ->filter_json_single_key_object ("\fw" => sub { |
97 | $self->{widget}{$_[0]} |
77 | $self->{widget}{$_[0]} |
… | |
… | |
114 | $::INV->clear; |
94 | $::INV->clear; |
115 | $::INVR->clear; |
95 | $::INVR->clear; |
116 | $::INVR_HB->clear; |
96 | $::INVR_HB->clear; |
117 | $::FLOORBOX->clear; |
97 | $::FLOORBOX->clear; |
118 | }); |
98 | }); |
119 | |
|
|
120 | $self->{map_widget}->add_command (@$_) |
|
|
121 | for @cmd_help; |
|
|
122 | |
99 | |
123 | { |
100 | { |
124 | $self->{dialogue} = my $tex = $TEX_DIALOGUE; |
101 | $self->{dialogue} = my $tex = $TEX_DIALOGUE; |
125 | $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
102 | $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
126 | } |
103 | } |
… | |
… | |
151 | $self->{mapcache} = "mapcache_$self->{host}_$self->{port}"; |
128 | $self->{mapcache} = "mapcache_$self->{host}_$self->{port}"; |
152 | |
129 | |
153 | $self |
130 | $self |
154 | } |
131 | } |
155 | |
132 | |
|
|
133 | #$self->send_exti_req (nickmon => 1, sub { use Data::Dump; ddx \@_ });#d# |
|
|
134 | #sub ext_nicklist { shift; use Data::Dump; ddx \@_; } #d# |
|
|
135 | |
156 | sub update_fx_want { |
136 | sub update_fx_want { |
157 | my ($self) = @_; |
137 | my ($self) = @_; |
158 | |
138 | |
159 | $self->send_exti_msg (fx_want => { |
139 | $self->send_exti_msg (fx_want => { |
160 | 3 => !!$::CFG->{bgm_enable}, # FT_MUSIC |
140 | 3 => !!$::CFG->{bgm_enable}, # FT_MUSIC |
… | |
… | |
181 | } |
161 | } |
182 | |
162 | |
183 | sub ext_ambient_music { |
163 | sub ext_ambient_music { |
184 | my ($self, $songs) = @_; |
164 | my ($self, $songs) = @_; |
185 | &::audio_music_set_ambient ($songs); |
165 | &::audio_music_set_ambient ($songs); |
|
|
166 | } |
|
|
167 | |
|
|
168 | sub ext_command_list { |
|
|
169 | my ($self, @faces) = @_; |
|
|
170 | |
|
|
171 | my $handler = $self->{command_facehandler} = {}; |
|
|
172 | my $commands = $::COMPLETER->{command_list} = {}; |
|
|
173 | |
|
|
174 | for my $idx (@faces) { |
|
|
175 | $handler->{$idx} = $self->register_face_handler ($idx, sub { |
|
|
176 | my ($face) = @_; |
|
|
177 | |
|
|
178 | $commands->{$idx} = |
|
|
179 | $face->{cache} ||= $self->{json_coder}->decode ($face->{data}); |
|
|
180 | }); |
|
|
181 | } |
186 | } |
182 | } |
187 | |
183 | |
188 | ############################################################################# |
184 | ############################################################################# |
189 | |
185 | |
190 | sub widget_associate { |
186 | sub widget_associate { |
… | |
… | |
1103 | tan => 12, |
1099 | tan => 12, |
1104 | ); |
1100 | ); |
1105 | |
1101 | |
1106 | our @CF_COLOR = ( |
1102 | our @CF_COLOR = ( |
1107 | [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00], |
1103 | [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00], |
1108 | [1.00, 1.00, 1.00], |
1104 | [1.00, 1.00, 1.00], #[0.00, 0.00, 0.00], |
1109 | [0.50, 0.50, 1.00], #[0.00, 0.00, 0.55] |
1105 | [0.50, 0.50, 1.00], #[0.00, 0.00, 0.55], |
1110 | [1.00, 0.00, 0.00], |
1106 | [1.00, 0.00, 0.00], |
1111 | [1.00, 0.54, 0.00], |
1107 | [1.00, 0.54, 0.00], |
1112 | [0.11, 0.56, 1.00], |
1108 | [0.11, 0.56, 1.00], |
1113 | [0.93, 0.46, 0.00], |
1109 | [0.93, 0.46, 0.00], |
1114 | [0.18, 0.54, 0.34], |
1110 | [0.18, 0.54, 0.34], |
… | |
… | |
1165 | $spell->{message} =~ s/(?<=\S)\n(?=\w)/ /g; |
1161 | $spell->{message} =~ s/(?<=\S)\n(?=\w)/ /g; |
1166 | $spell->{message} =~ s/\n+$//; |
1162 | $spell->{message} =~ s/\n+$//; |
1167 | $spell->{message} ||= "Server did not provide a description for this spell."; |
1163 | $spell->{message} ||= "Server did not provide a description for this spell."; |
1168 | |
1164 | |
1169 | $::SPELL_LIST->add_spell ($spell); |
1165 | $::SPELL_LIST->add_spell ($spell); |
1170 | |
1166 | delete $::COMPLETER->{command_list}{spells}; |
1171 | $self->{map_widget}->add_command ("invoke $spell->{name}", DC::asxml $spell->{message}); |
|
|
1172 | $self->{map_widget}->add_command ("cast $spell->{name}", DC::asxml $spell->{message}); |
|
|
1173 | } |
1167 | } |
1174 | |
1168 | |
1175 | sub spell_delete { |
1169 | sub spell_delete { |
1176 | my ($self, $spell) = @_; |
1170 | my ($self, $spell) = @_; |
1177 | |
1171 | |
1178 | $::SPELL_LIST->remove_spell ($spell); |
1172 | $::SPELL_LIST->remove_spell ($spell); |
|
|
1173 | delete $::COMPLETER->{command_list}{spells}; |
1179 | } |
1174 | } |
1180 | |
1175 | |
1181 | sub setup { |
1176 | sub setup { |
1182 | my ($self, $setup) = @_; |
1177 | my ($self, $setup) = @_; |
1183 | |
1178 | |
… | |
… | |
1206 | } |
1201 | } |
1207 | |
1202 | |
1208 | sub eof { |
1203 | sub eof { |
1209 | my ($self) = @_; |
1204 | my ($self) = @_; |
1210 | |
1205 | |
1211 | $self->{map_widget}->clr_commands; |
1206 | $::COMPLETER->reset; |
1212 | |
1207 | |
1213 | ::stop_game (); |
1208 | ::stop_game (); |
1214 | } |
1209 | } |
1215 | |
1210 | |
1216 | sub update_floorbox { |
1211 | sub update_floorbox { |