… | |
… | |
339 | |
339 | |
340 | $prompt = $LAST_QUERY unless length $prompt; |
340 | $prompt = $LAST_QUERY unless length $prompt; |
341 | $LAST_QUERY = $prompt; |
341 | $LAST_QUERY = $prompt; |
342 | |
342 | |
343 | my $dialog = new CFClient::UI::FancyFrame |
343 | my $dialog = new CFClient::UI::FancyFrame |
|
|
344 | x => "center", |
|
|
345 | y => "center", |
344 | title => "Query", |
346 | title => "Query", |
345 | child => my $vbox = new CFClient::UI::VBox, |
347 | child => my $vbox = new CFClient::UI::VBox, |
346 | on_visibility_change => sub { |
|
|
347 | my ($self, $visible) = @_; |
|
|
348 | $self->center if $visible; |
|
|
349 | }, |
|
|
350 | ; |
348 | ; |
351 | |
349 | |
352 | $vbox->add (new CFClient::UI::Label |
350 | $vbox->add (new CFClient::UI::Label |
353 | max_w => $::WIDTH * 0.4, |
351 | max_w => $::WIDTH * 0.4, |
354 | ellipsise => 0, |
352 | ellipsise => 0, |
… | |
… | |
458 | } |
456 | } |
459 | |
457 | |
460 | sub addme_success { |
458 | sub addme_success { |
461 | my ($self) = @_; |
459 | my ($self) = @_; |
462 | |
460 | |
463 | $self->send ("command output-sync $::CFG->{output_sync}"); |
|
|
464 | $self->send ("command output-count $::CFG->{output_count}"); |
|
|
465 | |
|
|
466 | my $parser = new Pod::POM; |
461 | my $parser = new Pod::POM; |
467 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/skill_help.pod"); |
462 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/skill_help.pod"); |
468 | |
463 | |
469 | my %skill_tooltip; |
464 | my %skill_tooltip; |
470 | |
465 | |
… | |
… | |
552 | } |
547 | } |
553 | |
548 | |
554 | sub set_opencont { |
549 | sub set_opencont { |
555 | my ($conn, $tag, $name) = @_; |
550 | my ($conn, $tag, $name) = @_; |
556 | $conn->{open_container} = $tag; |
551 | $conn->{open_container} = $tag; |
557 | $::INVR_LBL->set_text ($name); |
552 | |
|
|
553 | $::INV_RIGHT_HB->clear (); |
|
|
554 | $::INV_RIGHT_HB->add (new CFClient::UI::Label align => 0, expand => 1, text => $name); |
|
|
555 | |
|
|
556 | if ($tag != 0) { # Floor isn't closable, is it? |
|
|
557 | $::INV_RIGHT_HB->add (new CFClient::UI::Button |
|
|
558 | text => "Close container", |
|
|
559 | tooltip => "Close the currently open container (if one is open)", |
|
|
560 | on_activate => sub { |
|
|
561 | $::CONN->send ("apply $tag") # $::CONN->{open_container}") |
|
|
562 | if $tag != 0; |
|
|
563 | #if $CONN->{open_container} != 0; |
|
|
564 | }, |
|
|
565 | ); |
|
|
566 | } |
|
|
567 | |
558 | $::INVR->set_items ($conn->{container}{$tag}); |
568 | $::INVR->set_items ($conn->{container}{$tag}); |
559 | } |
569 | } |
560 | |
570 | |
561 | sub update_container { |
571 | sub update_container { |
562 | my ($tag) = @_; |
572 | my ($tag) = @_; |
… | |
… | |
591 | if ($tag == 0) { |
601 | if ($tag == 0) { |
592 | update_floorbox; |
602 | update_floorbox; |
593 | update_container (0); |
603 | update_container (0); |
594 | } elsif ($tag == $self->{player}{tag}) { |
604 | } elsif ($tag == $self->{player}{tag}) { |
595 | $::INV->set_items ($self->{container}{$tag}) |
605 | $::INV->set_items ($self->{container}{$tag}) |
|
|
606 | } else { |
|
|
607 | update_container ($tag); |
596 | } |
608 | } |
597 | |
609 | |
598 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
610 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
599 | } |
611 | } |
600 | |
612 | |
… | |
… | |
608 | update_floorbox; |
620 | update_floorbox; |
609 | update_container ($_->{tag}); |
621 | update_container ($_->{tag}); |
610 | } elsif ($_->{container} == $self->{player}{tag}) { |
622 | } elsif ($_->{container} == $self->{player}{tag}) { |
611 | $::INV->set_items ($self->{container}{$self->{player}{tag}}) |
623 | $::INV->set_items ($self->{container}{$self->{player}{tag}}) |
612 | } else { |
624 | } else { |
613 | update_container ($_->{tag}); |
625 | update_container ($_->{container}); |
614 | } |
626 | } |
615 | } |
627 | } |
616 | } |
628 | } |
617 | |
629 | |
618 | sub item_update { |
630 | sub item_update { |
… | |
… | |
643 | } |
655 | } |
644 | |
656 | |
645 | sub player_update { |
657 | sub player_update { |
646 | my ($self, $player) = @_; |
658 | my ($self, $player) = @_; |
647 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); |
659 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); |
|
|
660 | |
|
|
661 | # do it here because it is ignored earlier, and there is no "login" event |
|
|
662 | $self->send_command ("output-sync $::CFG->{output_sync}"); |
|
|
663 | $self->send_command ("output-count $::CFG->{output_count}"); |
648 | } |
664 | } |
649 | |
665 | |
650 | 1; |
666 | 1; |