… | |
… | |
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 | |
… | |
… | |
412 | |
412 | |
413 | $text = CFClient::UI::Label::escape $text; |
413 | $text = CFClient::UI::Label::escape $text; |
414 | $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; |
414 | $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; |
415 | $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; |
415 | $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; |
416 | |
416 | |
417 | $self->{logview}->add_paragraph ($color[$color], |
417 | $self->{logview}->add_paragraph ($color[$color], $_) |
418 | join "\n", map "$time $_", split /\n/, $text); |
418 | for map "$time $_", split /\n/, $text; |
|
|
419 | $self->{logview}->scroll_to_bottom; |
419 | |
420 | |
420 | $self->{statusbox}->add ($text, |
421 | $self->{statusbox}->add ($text, |
421 | group => $text, |
422 | group => $text, |
422 | fg => $color[$color], |
423 | fg => $color[$color], |
423 | timeout => $color >= 2 ? 60 : 10, |
424 | timeout => $color >= 2 ? 60 : 10, |
… | |
… | |
522 | return unless $::CONN; |
523 | return unless $::CONN; |
523 | |
524 | |
524 | $::FLOORBOX->clear; |
525 | $::FLOORBOX->clear; |
525 | |
526 | |
526 | my $row; |
527 | my $row; |
527 | for (@{ $::CONN->{container}{0} }) { |
528 | for (sort { $a->{count} <=> $b->{count} } values %{ $::CONN->{container}{0} }) { |
528 | if ($row < 6) { |
529 | if ($row < 6) { |
529 | local $_->{face_widget}; # hack to force recreation of widget |
530 | local $_->{face_widget}; # hack to force recreation of widget |
530 | local $_->{desc_widget}; # hack to force recreation of widget |
531 | local $_->{desc_widget}; # hack to force recreation of widget |
531 | CFClient::Item::update_widgets $_; |
532 | CFClient::Item::update_widgets $_; |
532 | |
533 | |
… | |
… | |
584 | |
585 | |
585 | if ($tag == 0) { |
586 | if ($tag == 0) { |
586 | update_floorbox; |
587 | update_floorbox; |
587 | update_container (0); |
588 | update_container (0); |
588 | } elsif ($tag == $self->{player}{tag}) { |
589 | } elsif ($tag == $self->{player}{tag}) { |
|
|
590 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $self->{player}->{weight} / 1000); |
589 | $::INV->set_items ($self->{container}{$self->{player}{tag}}) |
591 | $::INV->set_items ($self->{container}{$self->{player}{tag}}) |
590 | } else { |
592 | } else { |
591 | update_container ($tag); |
593 | update_container ($tag); |
592 | } |
594 | } |
593 | |
595 | |
… | |
… | |
811 | } |
813 | } |
812 | |
814 | |
813 | sub feed { |
815 | sub feed { |
814 | my ($self, $data) = @_; |
816 | my ($self, $data) = @_; |
815 | |
817 | |
|
|
818 | Scalar::Util::weaken $self; |
|
|
819 | |
816 | my ($type, $msg) = split / /, $data, 2; |
820 | my ($type, $msg) = split / /, $data, 2; |
817 | |
821 | |
818 | if ($type eq "msg") { |
822 | if ($type eq "msg") { |
819 | my ($msg, @kw) = split /\x00/, $msg; |
823 | my ($msg, @kw) = split /\x00/, $msg; |
820 | $self->{kw}{$_} = 1 for @kw; |
824 | $self->{kw}{$_} = 1 for @kw; |
821 | |
825 | |
822 | $msg = CFClient::UI::Label::escape $msg; |
826 | $msg = "\n" . CFClient::UI::Label::escape $msg; |
823 | 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} }; |
824 | $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; |
825 | |
846 | |
826 | $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; |
827 | $self->update_options; |
849 | $self->update_options; |
828 | } else { |
850 | } else { |
829 | $self->destroy; |
851 | $self->destroy; |
830 | } |
852 | } |
831 | |
853 | |
… | |
… | |
835 | sub send { |
857 | sub send { |
836 | my ($self, $msg) = @_; |
858 | my ($self, $msg) = @_; |
837 | |
859 | |
838 | $self->{conn}->send ("ext npc_dialog_tell $self->{token} $msg"); |
860 | $self->{conn}->send ("ext npc_dialog_tell $self->{token} $msg"); |
839 | $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; |
840 | } |
863 | } |
841 | |
864 | |
842 | sub destroy { |
865 | sub destroy { |
843 | my ($self) = @_; |
866 | my ($self) = @_; |
844 | |
867 | |