… | |
… | |
194 | ); |
194 | ); |
195 | } |
195 | } |
196 | |
196 | |
197 | # widgetset create template |
197 | # widgetset create template |
198 | sub ext_ws_ct { |
198 | sub ext_ws_ct { |
199 | my ($self, $ws, $template, $cfg) = @_; |
199 | my ($self, $ws, $type, $template, $done_cb, $cfg) = @_; |
200 | |
200 | |
201 | $template = eval <<EOF; |
201 | $done_cb ||= sub { }; |
202 | [ |
|
|
203 | Toplevel => { |
|
|
204 | s_id => "toplevel", |
|
|
205 | title => "Character Creation", |
|
|
206 | x => "center", |
|
|
207 | y => "center", |
|
|
208 | z => 5, |
|
|
209 | s_cl => [VBox => {s_cl => [ |
|
|
210 | Label => { |
|
|
211 | text => "Character Creation", |
|
|
212 | fontsize => 1, |
|
|
213 | align => 0, |
|
|
214 | }, |
|
|
215 | Label => { |
|
|
216 | markup => "View or Edit your character attributes below, then press <b>Finish</b> to create your character", |
|
|
217 | fontsize => 0.8, |
|
|
218 | align => 0, |
|
|
219 | }, |
|
|
220 | Notebook => { |
|
|
221 | s_cl => [ |
|
|
222 | Label => { |
|
|
223 | text => "hulla-hoop" |
|
|
224 | }, |
|
|
225 | Entry => { |
|
|
226 | s_id => "entry", |
|
|
227 | }, |
|
|
228 | ], |
|
|
229 | }, |
|
|
230 | Button => { |
|
|
231 | s_id => "finish", |
|
|
232 | title => "Finish", |
|
|
233 | }, |
|
|
234 | ]}], |
|
|
235 | }, |
|
|
236 | ] |
|
|
237 | EOF |
|
|
238 | die if $@; |
|
|
239 | |
202 | |
240 | my $parse_list; $parse_list = sub { |
203 | my $parse_list; $parse_list = sub { |
241 | my ($list) = @_; |
204 | my ($list) = @_; |
242 | my @w; |
205 | my @w; |
243 | |
206 | |
… | |
… | |
260 | } |
223 | } |
261 | |
224 | |
262 | @w |
225 | @w |
263 | }; |
226 | }; |
264 | |
227 | |
|
|
228 | # either array reference, or face # |
|
|
229 | if ($type eq "inline") { |
|
|
230 | $done_cb->(); |
265 | $parse_list->($template); |
231 | $parse_list->($template); |
|
|
232 | } elsif ($type eq "face") { |
|
|
233 | my $handler; $handler = $self->register_face_handler ($template, sub { |
|
|
234 | my ($face) = @_; |
266 | |
235 | |
|
|
236 | undef $handler; |
|
|
237 | $done_cb->(); |
|
|
238 | $parse_list->($self->{json_coder}->decode ($face->{data})); |
|
|
239 | }); |
|
|
240 | } else { |
|
|
241 | $done_cb->(0); |
|
|
242 | } |
267 | } |
243 | } |
268 | |
244 | |
269 | # widgetset associate |
245 | # widgetset associate |
270 | sub ext_ws_a { |
246 | sub ext_ws_a { |
271 | my ($self, %ass) = @_; |
247 | my ($self, %ass) = @_; |
… | |
… | |
299 | spell_list => $::SPELL_LIST, |
275 | spell_list => $::SPELL_LIST, |
300 | |
276 | |
301 | floorbox => $::FLOORBOX, |
277 | floorbox => $::FLOORBOX, |
302 | help_window => $::HELP_WINDOW, |
278 | help_window => $::HELP_WINDOW, |
303 | message_window => $::MESSAGE_WINDOW, |
279 | message_window => $::MESSAGE_WINDOW, |
|
|
280 | message_dist => $::MESSAGE_DIST, |
304 | statusbox => $::SDTATUSBOX, |
281 | statusbox => $::SDTATUSBOX, |
305 | |
282 | |
306 | inv => $::INV, |
283 | inv => $::INV, |
307 | invr => $::INVR, |
284 | invr => $::INVR, |
308 | invr_hb => $::INVR_HB, |
285 | invr_hb => $::INVR_HB, |
… | |
… | |
357 | |
334 | |
358 | # message window |
335 | # message window |
359 | sub ext_channel_info { |
336 | sub ext_channel_info { |
360 | my ($self, $info) = @_; |
337 | my ($self, $info) = @_; |
361 | $self->{channels}->{$info->{id}} = $info; |
338 | $self->{channels}->{$info->{id}} = $info; |
362 | $::MESSAGE_WINDOW->add_channel ($info); |
339 | $::MESSAGE_DIST->add_channel ($info); |
363 | } |
340 | } |
364 | |
341 | |
365 | ############################################################################# |
342 | ############################################################################# |
366 | |
343 | |
367 | sub logprint { |
344 | sub logprint { |
… | |
… | |
549 | $sktbl->clear; |
526 | $sktbl->clear; |
550 | |
527 | |
551 | my $sw = $self->{skillwid}{""} ||= [ |
528 | my $sw = $self->{skillwid}{""} ||= [ |
552 | 0, 0, (new DC::UI::Label text => "Experience", align => 1), |
529 | 0, 0, (new DC::UI::Label text => "Experience", align => 1), |
553 | 1, 0, (new DC::UI::Label text => "Lvl.", align => 1), |
530 | 1, 0, (new DC::UI::Label text => "Lvl.", align => 1), |
554 | 2, 0, (new DC::UI::Label text => "Progress", align => 0), |
531 | 2, 0, (new DC::UI::Label text => "Progress"), |
555 | 3, 0, (new DC::UI::Label text => "Skill", expand => 1), |
532 | 3, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), |
556 | 4, 0, (new DC::UI::Label text => "Experience", align => 1), |
533 | 4, 0, (new DC::UI::Label text => "Experience", align => 1), |
557 | 5, 0, (new DC::UI::Label text => "Lvl.", align => 1), |
534 | 5, 0, (new DC::UI::Label text => "Lvl.", align => 1), |
558 | 6, 0, (new DC::UI::Label text => "Progress", align => 0), |
535 | 6, 0, (new DC::UI::Label text => "Progress"), |
559 | 7, 0, (new DC::UI::Label text => "Skill", expand => 1), |
536 | 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), |
560 | ]; |
537 | ]; |
561 | |
538 | |
562 | my @add = @$sw; |
539 | my @add = @$sw; |
563 | |
540 | |
564 | my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; |
541 | my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; |
… | |
… | |
603 | |
580 | |
604 | # progress |
581 | # progress |
605 | (new DC::UI::ExperienceProgress), |
582 | (new DC::UI::ExperienceProgress), |
606 | |
583 | |
607 | # label |
584 | # label |
608 | (new DC::UI::Label text => $name, on_button_down => $spell_cb, |
585 | (new DC::UI::Label text => $name, on_button_down => $spell_cb, align => 0, |
609 | can_events => 1, can_hover => 1, tooltip => (DC::Pod::section_label skill_description => $name) . $TOOLTIP_ALL), |
586 | can_events => 1, can_hover => 1, tooltip => (DC::Pod::section_label skill_description => $name) . $TOOLTIP_ALL), |
610 | ]; |
587 | ]; |
611 | |
588 | |
612 | push @add, |
589 | push @add, |
613 | $x * 4 + 0, $y, $sw->[0], |
590 | $x * 4 + 0, $y, $sw->[0], |
… | |
… | |
1231 | my ($conn, $tag, $name) = @_; |
1208 | my ($conn, $tag, $name) = @_; |
1232 | $conn->{open_container} = $tag; |
1209 | $conn->{open_container} = $tag; |
1233 | update_floorbox; |
1210 | update_floorbox; |
1234 | |
1211 | |
1235 | $::INVR_HB->clear (); |
1212 | $::INVR_HB->clear (); |
1236 | $::INVR_HB->add (new DC::UI::Label align => 0, expand => 1, text => $name); |
1213 | $::INVR_HB->add (new DC::UI::Label expand => 1, text => $name); |
1237 | |
1214 | |
1238 | if ($tag != 0) { # Floor isn't closable, is it? |
1215 | if ($tag != 0) { # Floor isn't closable, is it? |
1239 | $::INVR_HB->add (new DC::UI::Button |
1216 | $::INVR_HB->add (new DC::UI::Button |
1240 | text => "Close container", |
1217 | text => "Close container", |
1241 | tooltip => "Close the currently open container (if one is open)", |
1218 | tooltip => "Close the currently open container (if one is open)", |
… | |
… | |
1325 | |
1302 | |
1326 | my $weight = .001 * $self->{player}{weight}; |
1303 | my $weight = .001 * $self->{player}{weight}; |
1327 | my $limit = .001 * $self->{stat}{+CS_STAT_WEIGHT_LIM}; |
1304 | my $limit = .001 * $self->{stat}{+CS_STAT_WEIGHT_LIM}; |
1328 | |
1305 | |
1329 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $weight); |
1306 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $weight); |
1330 | $::STATWIDS->{m_weight}->set_text (sprintf "%.1fkg", $limit); |
1307 | $::STATWIDS->{m_weight}->set_text (sprintf "Max Weight: %.1fkg", $limit); |
1331 | $::STATWIDS->{i_weight}->set_text (sprintf "%.1f/%.1fkg", $weight, $limit); |
1308 | $::STATWIDS->{i_weight}->set_text (sprintf "%.1f/%.1fkg", $weight, $limit); |
1332 | } |
1309 | } |
1333 | |
1310 | |
1334 | sub update_server_info { |
1311 | sub update_server_info { |
1335 | my ($self) = @_; |
1312 | my ($self) = @_; |
… | |
… | |
1343 | . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n" |
1320 | . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n" |
1344 | . "examine command support $yesno[$self->{setup}{excmd} > 0]\n" |
1321 | . "examine command support $yesno[$self->{setup}{excmd} > 0]\n" |
1345 | . "editing support $yesno[!!$self->{editor_support}]\n" |
1322 | . "editing support $yesno[!!$self->{editor_support}]\n" |
1346 | . "map attributes $yesno[$self->{setup}{extmap} > 0]\n" |
1323 | . "map attributes $yesno[$self->{setup}{extmap} > 0]\n" |
1347 | . "big image protocol support $yesno[$self->{setup}{fxix} > 0]\n" |
1324 | . "big image protocol support $yesno[$self->{setup}{fxix} > 0]\n" |
1348 | . "cfplus support $yesno[$self->{cfplus_ext} > 0]" |
1325 | . "client support $yesno[$self->{cfplus_ext} > 0]" |
1349 | . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" |
1326 | . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" |
1350 | . "map size $self->{mapw}×$self->{maph}\n" |
1327 | . "map size $self->{mapw}×$self->{maph}\n" |
1351 | ); |
1328 | ); |
1352 | |
1329 | |
1353 | } |
1330 | } |