… | |
… | |
105 | push @{$self->{record}}, $command; |
105 | push @{$self->{record}}, $command; |
106 | } |
106 | } |
107 | |
107 | |
108 | $self->logprint ("send: ", $command); |
108 | $self->logprint ("send: ", $command); |
109 | $self->send_command ($command); |
109 | $self->send_command ($command); |
110 | ::status $command; |
110 | ::status ($command); |
111 | } |
111 | } |
112 | |
112 | |
113 | sub start_record { |
113 | sub start_record { |
114 | my ($self) = @_; |
114 | my ($self) = @_; |
115 | |
115 | |
… | |
… | |
523 | return unless $::CONN; |
523 | return unless $::CONN; |
524 | |
524 | |
525 | $::FLOORBOX->clear; |
525 | $::FLOORBOX->clear; |
526 | |
526 | |
527 | my $row; |
527 | my $row; |
528 | for (@{ $::CONN->{container}{0} }) { |
528 | for (sort { $a->{count} <=> $b->{count} } values %{ $::CONN->{container}{0} }) { |
529 | if ($row < 6) { |
529 | if ($row < 6) { |
530 | local $_->{face_widget}; # hack to force recreation of widget |
530 | local $_->{face_widget}; # hack to force recreation of widget |
531 | local $_->{desc_widget}; # hack to force recreation of widget |
531 | local $_->{desc_widget}; # hack to force recreation of widget |
532 | CFClient::Item::update_widgets $_; |
532 | CFClient::Item::update_widgets $_; |
533 | |
533 | |
… | |
… | |
585 | |
585 | |
586 | if ($tag == 0) { |
586 | if ($tag == 0) { |
587 | update_floorbox; |
587 | update_floorbox; |
588 | update_container (0); |
588 | update_container (0); |
589 | } elsif ($tag == $self->{player}{tag}) { |
589 | } elsif ($tag == $self->{player}{tag}) { |
|
|
590 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $self->{player}->{weight} / 1000); |
590 | $::INV->set_items ($self->{container}{$self->{player}{tag}}) |
591 | $::INV->set_items ($self->{container}{$self->{player}{tag}}) |
591 | } else { |
592 | } else { |
592 | update_container ($tag); |
593 | update_container ($tag); |
593 | } |
594 | } |
594 | |
595 | |
… | |
… | |
812 | } |
813 | } |
813 | |
814 | |
814 | sub feed { |
815 | sub feed { |
815 | my ($self, $data) = @_; |
816 | my ($self, $data) = @_; |
816 | |
817 | |
|
|
818 | Scalar::Util::weaken $self; |
|
|
819 | |
817 | my ($type, $msg) = split / /, $data, 2; |
820 | my ($type, $msg) = split / /, $data, 2; |
818 | |
821 | |
819 | if ($type eq "msg") { |
822 | if ($type eq "msg") { |
820 | my ($msg, @kw) = split /\x00/, $msg; |
823 | my ($msg, @kw) = split /\x00/, $msg; |
821 | $self->{kw}{$_} = 1 for @kw; |
824 | $self->{kw}{$_} = 1 for @kw; |
822 | |
825 | |
823 | $msg = CFClient::UI::Label::escape $msg; |
826 | $msg = "\n" . CFClient::UI::Label::escape $msg; |
824 | my $match = join "|", map "\\b\Q$_\E\\b", sort { (length $b) <=> (length $a) } keys %{ $self->{kw} }; |
827 | my $match = join "|", map "\\b\Q$_\E\\b", sort { (length $b) <=> (length $a) } keys %{ $self->{kw} }; |
825 | $msg =~ s/($match)/<span foreground='#c0c0ff' underline='none'>$1<\/span>/gi; # underline when http-ready, huh. |
828 | my @link; |
|
|
829 | $msg =~ s{ |
|
|
830 | ($match) |
|
|
831 | }{ |
|
|
832 | my $kw = $1; |
|
|
833 | |
|
|
834 | push @link, new CFClient::UI::Label |
|
|
835 | markup => "<span foreground='#c0c0ff' underline='single'>$kw</span>", |
|
|
836 | can_hover => 1, |
|
|
837 | can_events => 1, |
|
|
838 | padding_x => 0, |
|
|
839 | padding_y => 0, |
|
|
840 | on_button_up => sub { |
|
|
841 | $self->send ($kw); |
|
|
842 | }; |
|
|
843 | |
|
|
844 | chr 0xfffc |
|
|
845 | }giex; |
826 | |
846 | |
827 | $self->{textview}->add_paragraph ([1, 1, 1, 1], "\n$msg"); |
847 | $self->{textview}->add_paragraph ([1, 1, 1, 1], [$msg, @link]); |
|
|
848 | $self->{textview}->scroll_to_bottom; |
828 | $self->update_options; |
849 | $self->update_options; |
829 | } else { |
850 | } else { |
830 | $self->destroy; |
851 | $self->destroy; |
831 | } |
852 | } |
832 | |
853 | |
… | |
… | |
836 | sub send { |
857 | sub send { |
837 | my ($self, $msg) = @_; |
858 | my ($self, $msg) = @_; |
838 | |
859 | |
839 | $self->{conn}->send ("ext npc_dialog_tell $self->{token} $msg"); |
860 | $self->{conn}->send ("ext npc_dialog_tell $self->{token} $msg"); |
840 | $self->{textview}->add_paragraph ([1, 1, 0, 1], "\n" . CFClient::UI::Label::escape $msg); |
861 | $self->{textview}->add_paragraph ([1, 1, 0, 1], "\n" . CFClient::UI::Label::escape $msg); |
|
|
862 | $self->{textview}->scroll_to_bottom; |
841 | } |
863 | } |
842 | |
864 | |
843 | sub destroy { |
865 | sub destroy { |
844 | my ($self) = @_; |
866 | my ($self) = @_; |
845 | |
867 | |