… | |
… | |
11 | use DC::Pod; |
11 | use DC::Pod; |
12 | use DC::Macro; |
12 | use DC::Macro; |
13 | use DC::Item; |
13 | use DC::Item; |
14 | |
14 | |
15 | use base 'Deliantra::Protocol::Base'; |
15 | use base 'Deliantra::Protocol::Base'; |
|
|
16 | |
|
|
17 | our $TEX_DIALOGUE = new_from_resource DC::Texture |
|
|
18 | "dialogue.png", minify => 1, mipmap => 1; |
|
|
19 | |
|
|
20 | our $TEX_NOFACE = new_from_resource DC::Texture |
|
|
21 | "noface.png", minify => 1, mipmap => 1; |
16 | |
22 | |
17 | sub new { |
23 | sub new { |
18 | my ($class, %arg) = @_; |
24 | my ($class, %arg) = @_; |
19 | |
25 | |
20 | my $self = $class->SUPER::new (%arg, |
26 | my $self = $class->SUPER::new (%arg, |
… | |
… | |
67 | for values %{delete $ws->{w} || {}}; |
73 | for values %{delete $ws->{w} || {}}; |
68 | } |
74 | } |
69 | |
75 | |
70 | delete $self->{items}; |
76 | delete $self->{items}; |
71 | $::INV->clear; |
77 | $::INV->clear; |
|
|
78 | $::INVR->clear; |
72 | $::INVR_HB->clear; |
79 | $::INVR_HB->clear; |
73 | $::FLOORBOX->clear; |
80 | $::FLOORBOX->clear; |
74 | }); |
81 | }); |
75 | |
82 | |
76 | $self->{map_widget}->add_command (@$_) |
83 | $self->{map_widget}->add_command (@$_) |
77 | for @cmd_help; |
84 | for @cmd_help; |
78 | |
85 | |
79 | { |
86 | { |
80 | $self->{dialogue} = my $tex = new_from_file DC::Texture |
87 | $self->{dialogue} = my $tex = $TEX_DIALOGUE; |
81 | DC::find_rcfile "dialogue.png", minify => 1, mipmap => 1; |
|
|
82 | $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
88 | $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
83 | } |
89 | } |
84 | |
90 | |
85 | { |
91 | { |
86 | $self->{noface} = my $tex = new_from_file DC::Texture |
92 | $self->{noface} = my $tex = $TEX_NOFACE; |
87 | DC::find_rcfile "noface.png", minify => 1, mipmap => 1; |
|
|
88 | $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
93 | $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
89 | } |
94 | } |
90 | |
95 | |
91 | $self->{open_container} = 0; |
96 | $self->{open_container} = 0; |
92 | |
97 | |
… | |
… | |
1092 | |
1097 | |
1093 | ## try to create single paragraphs of multiple lines sent by the server |
1098 | ## try to create single paragraphs of multiple lines sent by the server |
1094 | # no longer neecssary with TRT servers |
1099 | # no longer neecssary with TRT servers |
1095 | #$text =~ s/(?<=\S)\n(?=\w)/ /g; |
1100 | #$text =~ s/(?<=\S)\n(?=\w)/ /g; |
1096 | |
1101 | |
1097 | for (split /\n/, $text) { |
|
|
1098 | ::message ({ |
1102 | ::message ({ |
1099 | fg => $fg, |
1103 | fg => $fg, |
1100 | markup => $_, |
1104 | markup => $text, |
1101 | type => $type, |
1105 | type => $type, |
1102 | extra => [@extra], |
1106 | extra => [@extra], |
1103 | color_flags => $color, #d# ugly, kill |
1107 | color_flags => $color, #d# ugly, kill |
1104 | }); |
1108 | }); |
1105 | |
1109 | |
1106 | $color &= ~NDI_CLEAR; # only clear once for multiline messages |
1110 | # $color &= ~NDI_CLEAR; # only clear once for multiline messages |
1107 | # actually, this is an ugly design. _we_ should control the channels, |
1111 | # # actually, this is an ugly design. _we_ should control the channels, |
1108 | # not some random other widget, as the channels are clearly protocol-specific. |
1112 | # # not some random other widget, as the channels are clearly protocol-specific. |
1109 | # then we could also react to flags such as CLEAR without resorting to |
1113 | # # then we could also react to flags such as CLEAR without resorting to |
1110 | # hacks such as color_flags, above. |
1114 | # # hacks such as color_flags, above. |
1111 | } |
|
|
1112 | |
1115 | |
1113 | $self->{statusbox}->add ($text, |
1116 | $self->{statusbox}->add ($text, |
1114 | group => $text, |
1117 | group => $text, |
1115 | fg => $fg, |
1118 | fg => $fg, |
1116 | timeout => $color >= 2 ? 180 : 10, |
1119 | timeout => $color >= 2 ? 180 : 10, |
… | |
… | |
1364 | |
1367 | |
1365 | $self->update_server_info; |
1368 | $self->update_server_info; |
1366 | |
1369 | |
1367 | $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; |
1370 | $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; |
1368 | $self->send_command ("pickup $::CFG->{pickup}"); |
1371 | $self->send_command ("pickup $::CFG->{pickup}"); |
|
|
1372 | |
|
|
1373 | $self->send_exti_msg (clientlog => sprintf "OpenGL Info: %s [%s]", |
|
|
1374 | DC::OpenGL::gl_vendor, DC::OpenGL::gl_version);#d# |
1369 | } |
1375 | } |
1370 | |
1376 | |
1371 | sub lookat { |
1377 | sub lookat { |
1372 | my ($self, $x, $y) = @_; |
1378 | my ($self, $x, $y) = @_; |
1373 | |
1379 | |
… | |
… | |
1537 | } |
1543 | } |
1538 | |
1544 | |
1539 | sub send { |
1545 | sub send { |
1540 | my ($self, $msg) = @_; |
1546 | my ($self, $msg) = @_; |
1541 | |
1547 | |
1542 | $self->{textview}->add_paragraph ({ markup => "\n" . DC::asxml $msg }); |
1548 | $self->{textview}->add_paragraph ({ |
|
|
1549 | markup => |
|
|
1550 | "\n<span foreground='#ffff00'><b>" |
|
|
1551 | . (DC::asxml $msg) |
|
|
1552 | . "</b></span>" |
|
|
1553 | }); |
1543 | $self->{textview}->scroll_to_bottom; |
1554 | $self->{textview}->scroll_to_bottom; |
1544 | |
1555 | |
1545 | $self->{conn}->send_ext_msg (npc_dialog_tell => $self->{id}, $msg); |
1556 | $self->{conn}->send_ext_msg (npc_dialog_tell => $self->{id}, $msg); |
1546 | } |
1557 | } |
1547 | |
1558 | |