… | |
… | |
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 | |
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; |
|
|
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, |
21 | setup_req => { |
27 | setup_req => { |
22 | extmap => 1, |
28 | extmap => 1, |
23 | excmd => 1, |
29 | excmd => 1, |
24 | widget => 1, |
30 | widget => 2, |
25 | %{$arg{setup_req} || {}}, |
31 | %{$arg{setup_req} || {}}, |
26 | }, |
32 | }, |
27 | ); |
33 | ); |
28 | |
34 | |
29 | $self->{map_widget}->clr_commands; |
35 | $self->{map_widget}->clr_commands; |
30 | |
36 | |
31 | my @cmd_help = map { |
37 | my @cmd_help = map { |
32 | $_->{kw}[0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x |
38 | $_->[DC::Pod::N_KW][0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x |
33 | or die "unparseable command help: $_->{kw}[0]"; |
39 | or die "unparseable command help: $_->[DC::Pod::N_KW][0]"; |
34 | |
40 | |
35 | my $cmd = $1; |
41 | my $cmd = $1; |
36 | my @args = split /\|/, $2; |
42 | my @args = split /\|/, $2; |
37 | @args = (".*") unless @args; |
43 | @args = (".*") unless @args; |
38 | |
44 | |
… | |
… | |
43 | for @args; |
49 | for @args; |
44 | |
50 | |
45 | map ["$cmd$_", $text], |
51 | map ["$cmd$_", $text], |
46 | sort { (length $a) <=> (length $b) } |
52 | sort { (length $a) <=> (length $b) } |
47 | @args |
53 | @args |
48 | } sort { $a->{par} <=> $b->{par} } |
54 | } sort { $a->[DC::Pod::N_PAR] <=> $b->[DC::Pod::N_PAR] } |
49 | DC::Pod::find command => "*"; |
55 | DC::Pod::find command => "*"; |
50 | |
56 | |
51 | $self->{json_coder} |
57 | $self->{json_coder} |
52 | ->convert_blessed |
58 | ->convert_blessed |
53 | ->filter_json_single_key_object ("\fw" => sub { |
59 | ->filter_json_single_key_object ("\fw" => sub { |
… | |
… | |
64 | $self->{on_stop_game_guard} = $self->{map_widget}{root}->connect (stop_game => sub { |
70 | $self->{on_stop_game_guard} = $self->{map_widget}{root}->connect (stop_game => sub { |
65 | for my $ws (values %{delete $self->{widgetset} || {}}) { |
71 | for my $ws (values %{delete $self->{widgetset} || {}}) { |
66 | $_->destroy |
72 | $_->destroy |
67 | for values %{delete $ws->{w} || {}}; |
73 | for values %{delete $ws->{w} || {}}; |
68 | } |
74 | } |
|
|
75 | |
|
|
76 | delete $self->{items}; |
|
|
77 | $::INV->clear; |
|
|
78 | $::INVR_HB->clear; |
|
|
79 | $::FLOORBOX->clear; |
69 | }); |
80 | }); |
70 | |
81 | |
71 | $self->{map_widget}->add_command (@$_) |
82 | $self->{map_widget}->add_command (@$_) |
72 | for @cmd_help; |
83 | for @cmd_help; |
73 | |
84 | |
74 | { |
85 | { |
75 | $self->{dialogue} = my $tex = new_from_file DC::Texture |
86 | $self->{dialogue} = my $tex = $TEX_DIALOGUE; |
76 | DC::find_rcfile "dialogue.png", minify => 1, mipmap => 1; |
|
|
77 | $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
87 | $self->{map}->set_texture (1, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
78 | } |
88 | } |
79 | |
89 | |
80 | { |
90 | { |
81 | $self->{noface} = my $tex = new_from_file DC::Texture |
91 | $self->{noface} = my $tex = $TEX_NOFACE; |
82 | DC::find_rcfile "noface.png", minify => 1, mipmap => 1; |
|
|
83 | $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
92 | $self->{map}->set_texture (2, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
84 | } |
93 | } |
85 | |
94 | |
86 | $self->{open_container} = 0; |
95 | $self->{open_container} = 0; |
87 | |
96 | |
… | |
… | |
102 | } |
111 | } |
103 | |
112 | |
104 | sub ext_capabilities { |
113 | sub ext_capabilities { |
105 | my ($self, %cap) = @_; |
114 | my ($self, %cap) = @_; |
106 | |
115 | |
107 | #$self->send ("setup sound 0"); # we use a different protocol |
|
|
108 | $self->update_fx_want; |
116 | $self->update_fx_want; |
109 | |
117 | |
110 | $self->send_exti_req (resource => "exp_table", sub { |
118 | $self->send_exti_req (resource => "exp_table", sub { |
111 | my ($exp_table) = @_; |
119 | my ($exp_table) = @_; |
112 | |
120 | |
… | |
… | |
191 | $ws, $id => scalar eval { |
199 | $ws, $id => scalar eval { |
192 | local $SIG{__DIE__}; |
200 | local $SIG{__DIE__}; |
193 | "DC::UI::$class"->new (%$args) |
201 | "DC::UI::$class"->new (%$args) |
194 | } |
202 | } |
195 | ); |
203 | ); |
|
|
204 | } |
|
|
205 | |
|
|
206 | # widgetset create template |
|
|
207 | sub ext_ws_ct { |
|
|
208 | my ($self, $ws, $type, $template, $done_cb, $cfg) = @_; |
|
|
209 | |
|
|
210 | $done_cb ||= sub { }; |
|
|
211 | |
|
|
212 | my $parse_list; $parse_list = sub { |
|
|
213 | my ($list) = @_; |
|
|
214 | my @w; |
|
|
215 | |
|
|
216 | while (@$list) { |
|
|
217 | my ($class, $args) = splice @$list, 0, 2; |
|
|
218 | my $name = delete $args->{s_id}; |
|
|
219 | my $cl = delete $args->{s_cl}; |
|
|
220 | my $cfg = delete $cfg->{$name}; |
|
|
221 | my $id = delete $cfg->{id}; |
|
|
222 | my $w = eval { "DC::UI::$class"->new (%$args, %{ $cfg || {} }) } |
|
|
223 | or next; |
|
|
224 | |
|
|
225 | $self->widget_associate ($ws, $id, $w) |
|
|
226 | if $id; |
|
|
227 | |
|
|
228 | $w->add ($parse_list->($cl)) |
|
|
229 | if $cl; |
|
|
230 | |
|
|
231 | push @w, $w; |
|
|
232 | } |
|
|
233 | |
|
|
234 | @w |
|
|
235 | }; |
|
|
236 | |
|
|
237 | # either array reference, or face # |
|
|
238 | if ($type eq "inline") { |
|
|
239 | $done_cb->(); |
|
|
240 | $parse_list->($template); |
|
|
241 | } elsif ($type eq "face") { |
|
|
242 | my $handler; $handler = $self->register_face_handler ($template, sub { |
|
|
243 | my ($face) = @_; |
|
|
244 | |
|
|
245 | undef $handler; |
|
|
246 | $done_cb->(); |
|
|
247 | $parse_list->($self->{json_coder}->decode ($face->{data})); |
|
|
248 | }); |
|
|
249 | } else { |
|
|
250 | $done_cb->(0); |
|
|
251 | } |
196 | } |
252 | } |
197 | |
253 | |
198 | # widgetset associate |
254 | # widgetset associate |
199 | sub ext_ws_a { |
255 | sub ext_ws_a { |
200 | my ($self, %ass) = @_; |
256 | my ($self, %ass) = @_; |
… | |
… | |
228 | spell_list => $::SPELL_LIST, |
284 | spell_list => $::SPELL_LIST, |
229 | |
285 | |
230 | floorbox => $::FLOORBOX, |
286 | floorbox => $::FLOORBOX, |
231 | help_window => $::HELP_WINDOW, |
287 | help_window => $::HELP_WINDOW, |
232 | message_window => $::MESSAGE_WINDOW, |
288 | message_window => $::MESSAGE_WINDOW, |
|
|
289 | message_dist => $::MESSAGE_DIST, |
233 | statusbox => $::SDTATUSBOX, |
290 | statusbox => $::SDTATUSBOX, |
234 | |
291 | |
235 | inv => $::INV, |
292 | inv => $::INV, |
236 | invr => $::INVR, |
293 | invr => $::INVR, |
237 | invr_hb => $::INVR_HB, |
294 | invr_hb => $::INVR_HB, |
… | |
… | |
286 | |
343 | |
287 | # message window |
344 | # message window |
288 | sub ext_channel_info { |
345 | sub ext_channel_info { |
289 | my ($self, $info) = @_; |
346 | my ($self, $info) = @_; |
290 | $self->{channels}->{$info->{id}} = $info; |
347 | $self->{channels}->{$info->{id}} = $info; |
291 | $::MESSAGE_WINDOW->add_channel ($info); |
348 | $::MESSAGE_DIST->add_channel ($info); |
292 | } |
349 | } |
293 | |
350 | |
294 | ############################################################################# |
351 | ############################################################################# |
295 | |
352 | |
296 | sub logprint { |
353 | sub logprint { |
… | |
… | |
478 | $sktbl->clear; |
535 | $sktbl->clear; |
479 | |
536 | |
480 | my $sw = $self->{skillwid}{""} ||= [ |
537 | my $sw = $self->{skillwid}{""} ||= [ |
481 | 0, 0, (new DC::UI::Label text => "Experience", align => 1), |
538 | 0, 0, (new DC::UI::Label text => "Experience", align => 1), |
482 | 1, 0, (new DC::UI::Label text => "Lvl.", align => 1), |
539 | 1, 0, (new DC::UI::Label text => "Lvl.", align => 1), |
483 | 2, 0, (new DC::UI::Label text => "Progress", align => 0), |
540 | 2, 0, (new DC::UI::Label text => "Progress"), |
484 | 3, 0, (new DC::UI::Label text => "Skill", expand => 1), |
541 | 3, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), |
485 | 4, 0, (new DC::UI::Label text => "Experience", align => 1), |
542 | 4, 0, (new DC::UI::Label text => "Experience", align => 1), |
486 | 5, 0, (new DC::UI::Label text => "Lvl.", align => 1), |
543 | 5, 0, (new DC::UI::Label text => "Lvl.", align => 1), |
487 | 6, 0, (new DC::UI::Label text => "Progress", align => 0), |
544 | 6, 0, (new DC::UI::Label text => "Progress"), |
488 | 7, 0, (new DC::UI::Label text => "Skill", expand => 1), |
545 | 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), |
489 | ]; |
546 | ]; |
490 | |
547 | |
491 | my @add = @$sw; |
548 | my @add = @$sw; |
492 | |
549 | |
493 | my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; |
550 | my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; |
… | |
… | |
532 | |
589 | |
533 | # progress |
590 | # progress |
534 | (new DC::UI::ExperienceProgress), |
591 | (new DC::UI::ExperienceProgress), |
535 | |
592 | |
536 | # label |
593 | # label |
537 | (new DC::UI::Label text => $name, on_button_down => $spell_cb, |
594 | (new DC::UI::Label text => $name, on_button_down => $spell_cb, align => 0, |
538 | can_events => 1, can_hover => 1, tooltip => (DC::Pod::section_label skill_description => $name) . $TOOLTIP_ALL), |
595 | can_events => 1, can_hover => 1, tooltip => (DC::Pod::section_label skill_description => $name) . $TOOLTIP_ALL), |
539 | ]; |
596 | ]; |
540 | |
597 | |
541 | push @add, |
598 | push @add, |
542 | $x * 4 + 0, $y, $sw->[0], |
599 | $x * 4 + 0, $y, $sw->[0], |
… | |
… | |
584 | } |
641 | } |
585 | |
642 | |
586 | sub map_scroll { |
643 | sub map_scroll { |
587 | my ($self, $dx, $dy) = @_; |
644 | my ($self, $dx, $dy) = @_; |
588 | |
645 | |
589 | $self->{map}->scroll ($dx, $dy); |
646 | $self->{map_widget}->scroll ($dx, $dy); |
590 | } |
647 | } |
591 | |
648 | |
592 | sub feed_map1a { |
649 | sub feed_map1a { |
593 | my ($self, $data) = @_; |
650 | my ($self, $data) = @_; |
594 | |
651 | |
… | |
… | |
631 | } |
688 | } |
632 | |
689 | |
633 | sub flush_map { |
690 | sub flush_map { |
634 | my ($self) = @_; |
691 | my ($self) = @_; |
635 | |
692 | |
636 | my $map_info = delete $self->{map_info} |
693 | return unless $self->{map_info}; |
637 | or return; |
|
|
638 | |
694 | |
|
|
695 | for my $map_info (values %{ $self->{map_cache} || {} }) { |
639 | my ($hash, $x, $y, $w, $h) = @$map_info; |
696 | my ($hash, $rdata, $x, $y, $w, $h) = @$map_info; |
640 | |
697 | |
641 | my $data = Compress::LZF::compress $self->{map}->get_rect ($x, $y, $w, $h); |
698 | my $data = $self->{map}->get_rect ($x, $y, $w, $h); |
642 | $self->{map_cache_new}{$hash} = \$data; |
699 | |
|
|
700 | if ($data ne $$rdata) { |
|
|
701 | $map_info->[1] = \$data; |
|
|
702 | my $cdata = Compress::LZF::compress $data; |
643 | DC::DB::put $self->{mapcache} => $hash => $data, sub { }; |
703 | DC::DB::put $self->{mapcache} => $hash => $cdata, sub { }; |
|
|
704 | } |
|
|
705 | } |
644 | } |
706 | } |
645 | |
707 | |
646 | sub map_clear { |
708 | sub map_clear { |
647 | my ($self) = @_; |
709 | my ($self) = @_; |
648 | |
710 | |
649 | $self->flush_map; |
711 | $self->flush_map; |
|
|
712 | delete $self->{map_info}; |
650 | delete $self->{neigh_map}; |
713 | delete $self->{neigh_map}; |
651 | |
714 | |
652 | $self->{map}->clear; |
715 | $self->{map}->clear; |
653 | delete $self->{map_widget}{magicmap}; |
716 | delete $self->{map_widget}{magicmap}; |
654 | } |
717 | } |
… | |
… | |
675 | |
738 | |
676 | $self->bg_fetch; |
739 | $self->bg_fetch; |
677 | }; |
740 | }; |
678 | } |
741 | } |
679 | |
742 | |
680 | sub load_map($$$) { |
743 | sub load_map($$$$$$) { |
681 | my ($self, $hash, $x, $y) = @_; |
744 | my ($self, $hash, $x, $y, $w, $h) = @_; |
682 | |
745 | |
683 | my $gen = $self->{map_change_gen}; |
746 | my $map_info = $self->{map_cache}{$hash} = [$hash, \"", $x, $y, $w, $h]; |
684 | |
747 | |
685 | my $cb = sub { |
748 | my $cb = sub { |
686 | return unless $gen == $self->{map_change_gen}; |
749 | $map_info->[1] = \$_[0]; |
687 | |
750 | |
688 | my ($data) = @_; |
|
|
689 | |
|
|
690 | if (defined $data) { |
|
|
691 | $self->{map_cache_new}{$hash} = \$data; |
|
|
692 | |
|
|
693 | my $data = Compress::LZF::decompress $data; |
|
|
694 | |
|
|
695 | my $inprogress = @{ $self->{bg_fetch} || [] }; |
751 | my $inprogress = @{ $self->{bg_fetch} || [] }; |
696 | unshift @{ $self->{bg_fetch} }, $self->{map}->set_rect ($x, $y, $data); |
752 | unshift @{ $self->{bg_fetch} }, $self->{map}->set_rect ($x, $y, $_[0]); |
697 | $self->bg_fetch unless $inprogress; |
753 | $self->bg_fetch unless $inprogress; |
698 | } |
|
|
699 | }; |
754 | }; |
700 | |
755 | |
701 | if (my $rdata = $self->{map_cache_old}{$hash}) { |
756 | if (my $map_info = $self->{map_cache_old}{$hash}) { |
702 | $cb->($$rdata); |
757 | $cb->(${ $map_info->[1] }); |
703 | } else { |
758 | } else { |
|
|
759 | my $gen = $self->{map_change_gen}; |
|
|
760 | |
704 | DC::DB::get $self->{mapcache} => $hash, $cb; |
761 | DC::DB::get $self->{mapcache} => $hash, sub { |
|
|
762 | return unless $gen == $self->{map_change_gen}; |
|
|
763 | return unless defined $_[0]; |
|
|
764 | $cb->(Compress::LZF::decompress $_[0]); |
|
|
765 | }; |
705 | } |
766 | } |
706 | } |
767 | } |
707 | |
768 | |
708 | # hardcode /world/world_xxx_xxx map names, the savings are enourmous, |
769 | # hardcode /world/world_xxx_xxx map names, the savings are enourmous, |
709 | # (server resource,s latency, bandwidth), so this hack is warranted. |
770 | # (server resources, latency, bandwidth), so this hack is warranted. |
710 | # the right fix is to make real tiled maps with an overview file |
771 | # the right fix is to make real tiled maps with an overview file |
711 | sub send_mapinfo { |
772 | sub send_mapinfo { |
712 | my ($self, $data, $cb) = @_; |
773 | my ($self, $data, $cb) = @_; |
713 | |
774 | |
714 | if ($self->{map_info}[0] =~ m%^/world/world_(\d\d\d)_(\d\d\d)$%) { |
775 | if ($self->{map_info}[0] =~ m%^/world/world_(\d\d\d)_(\d\d\d)$%) { |
… | |
… | |
739 | } |
800 | } |
740 | |
801 | |
741 | # this method does a "flood fill" into every tile direction |
802 | # this method does a "flood fill" into every tile direction |
742 | # it assumes that tiles are arranged in a rectangular grid, |
803 | # it assumes that tiles are arranged in a rectangular grid, |
743 | # i.e. a map is the same as the left of the right map etc. |
804 | # i.e. a map is the same as the left of the right map etc. |
744 | # failure to comply are harmless and result in display errors |
805 | # failure to comply is harmless and results in display errors |
745 | # at worst. |
806 | # at worst. |
746 | sub flood_fill { |
807 | sub flood_fill { |
747 | my ($self, $block, $gx, $gy, $path, $hash, $flags) = @_; |
808 | my ($self, $block, $gx, $gy, $path, $hash, $flags) = @_; |
748 | |
809 | |
749 | # the server does not allow map paths > 6 |
810 | # the server does not allow map paths > 6 |
… | |
… | |
785 | return if $mode ne "spatial"; |
846 | return if $mode ne "spatial"; |
786 | |
847 | |
787 | $x += $self->{map}->ox; |
848 | $x += $self->{map}->ox; |
788 | $y += $self->{map}->oy; |
849 | $y += $self->{map}->oy; |
789 | |
850 | |
790 | $self->load_map ($hash, $x, $y) |
851 | $self->load_map ($hash, $x, $y, $w, $h) |
791 | unless $self->{neigh_map}{$hash}[5]++;#d# |
852 | unless $self->{neigh_map}{$hash}[5]++;#d# |
792 | |
853 | |
793 | $neigh->[$tile] = [$flags, $x, $y, $w, $h, $hash]; |
854 | $neigh->[$tile] = [$flags, $x, $y, $w, $h, $hash]; |
794 | |
855 | |
795 | $self->flood_fill ($block, $gx, $gy, "$path$tile", $hash, $flags) |
856 | $self->flood_fill ($block, $gx, $gy, "$path$tile", $hash, $flags) |
… | |
… | |
803 | my ($self, $mode, $flags, $x, $y, $w, $h, $hash) = @_; |
864 | my ($self, $mode, $flags, $x, $y, $w, $h, $hash) = @_; |
804 | |
865 | |
805 | $self->flush_map; |
866 | $self->flush_map; |
806 | |
867 | |
807 | ++$self->{map_change_gen}; |
868 | ++$self->{map_change_gen}; |
808 | $self->{map_cache_old} = delete $self->{map_cache_new}; |
869 | $self->{map_cache_old} = delete $self->{map_cache}; |
809 | |
870 | |
810 | my ($ox, $oy) = ($::MAP->ox, $::MAP->oy); |
871 | my ($ox, $oy) = ($::MAP->ox, $::MAP->oy); |
811 | |
872 | |
812 | my $mapmapw = $self->{mapmap}->{w}; |
873 | my $mapmapw = $self->{mapmap}->{w}; |
813 | my $mapmaph = $self->{mapmap}->{h}; |
874 | my $mapmaph = $self->{mapmap}->{h}; |
… | |
… | |
825 | $self->{map_info} = [$hash, $x, $y, $w, $h]; |
886 | $self->{map_info} = [$hash, $x, $y, $w, $h]; |
826 | |
887 | |
827 | (my $map = $hash) =~ s/^.*?\/([^\/]+)$/\1/; |
888 | (my $map = $hash) =~ s/^.*?\/([^\/]+)$/\1/; |
828 | $::STATWIDS->{map}->set_text ("Map: " . $map); |
889 | $::STATWIDS->{map}->set_text ("Map: " . $map); |
829 | |
890 | |
830 | $self->load_map ($hash, $x, $y); |
891 | $self->load_map ($hash, $x, $y, $w, $h); |
831 | $self->flood_fill (0, 0, 0, "", $hash, $flags); |
892 | $self->flood_fill (0, 0, 0, "", $hash, $flags); |
832 | } |
893 | } |
833 | |
894 | |
834 | sub face_find { |
895 | sub face_find { |
835 | my ($self, $facenum, $face, $cb) = @_; |
896 | my ($self, $facenum, $face, $cb) = @_; |
… | |
… | |
977 | s/&(?!amp;|lt;|gt;|apos;|quot;|#[0-9]+;|#x[0-9a-fA-F]+;)/&/g; |
1038 | s/&(?!amp;|lt;|gt;|apos;|quot;|#[0-9]+;|#x[0-9a-fA-F]+;)/&/g; |
978 | |
1039 | |
979 | # handle some elements |
1040 | # handle some elements |
980 | s/<fg name='([^']*)'>(.*?)<\/fg>/<span foreground='$1'>$2<\/span>/gs; |
1041 | s/<fg name='([^']*)'>(.*?)<\/fg>/<span foreground='$1'>$2<\/span>/gs; |
981 | s/<fg name="([^"]*)">(.*?)<\/fg>/<span foreground="$1">$2<\/span>/gs; |
1042 | s/<fg name="([^"]*)">(.*?)<\/fg>/<span foreground="$1">$2<\/span>/gs; |
|
|
1043 | |
|
|
1044 | s/\s+$//; |
982 | |
1045 | |
983 | $_ |
1046 | $_ |
984 | } |
1047 | } |
985 | |
1048 | |
986 | our %NAME_TO_COLOR = ( |
1049 | our %NAME_TO_COLOR = ( |
… | |
… | |
1092 | |
1155 | |
1093 | my %skill_help; |
1156 | my %skill_help; |
1094 | |
1157 | |
1095 | for my $node (DC::Pod::find skill_description => "*") { |
1158 | for my $node (DC::Pod::find skill_description => "*") { |
1096 | my (undef, @par) = DC::Pod::section_of $node; |
1159 | my (undef, @par) = DC::Pod::section_of $node; |
1097 | $skill_help{$node->{kw}[0]} = DC::Pod::as_label @par; |
1160 | $skill_help{$node->[DC::Pod::N_KW][0]} = DC::Pod::as_label @par; |
1098 | }; |
1161 | }; |
1099 | |
1162 | |
1100 | for my $skill (values %{$self->{skill_info}}) { |
1163 | for my $skill (values %{$self->{skill_info}}) { |
1101 | $self->{map_widget}->add_command ("ready_skill $skill", |
1164 | $self->{map_widget}->add_command ("ready_skill $skill", |
1102 | (DC::asxml "Ready the skill '$skill'\n\n") |
1165 | (DC::asxml "Ready the skill '$skill'\n\n") |
… | |
… | |
1122 | $::FLOORBOX->clear; |
1185 | $::FLOORBOX->clear; |
1123 | |
1186 | |
1124 | my @add; |
1187 | my @add; |
1125 | |
1188 | |
1126 | my $row; |
1189 | my $row; |
1127 | for (sort { $a->{count} <=> $b->{count} } values %{ $::CONN->{container}{$::CONN->{open_container} || 0} }) { |
1190 | for (sort { $b->{count} <=> $a->{count} } values %{ $::CONN->{container}{$::CONN->{open_container} || 0} }) { |
|
|
1191 | next if $_->{tag} & 0x80000000; |
1128 | if ($row < 6) { |
1192 | if ($row < 6) { |
1129 | local $_->{face_widget}; # hack to force recreation of widget |
1193 | local $_->{face_widget}; # hack to force recreation of widget |
1130 | local $_->{desc_widget}; # hack to force recreation of widget |
1194 | local $_->{desc_widget}; # hack to force recreation of widget |
1131 | DC::Item::update_widgets $_; |
1195 | DC::Item::update_widgets $_; |
1132 | |
1196 | |
… | |
… | |
1159 | sub set_opencont { |
1223 | sub set_opencont { |
1160 | my ($conn, $tag, $name) = @_; |
1224 | my ($conn, $tag, $name) = @_; |
1161 | $conn->{open_container} = $tag; |
1225 | $conn->{open_container} = $tag; |
1162 | update_floorbox; |
1226 | update_floorbox; |
1163 | |
1227 | |
1164 | $::INVR_HB->clear (); |
1228 | $::INVR_HB->clear; |
1165 | $::INVR_HB->add (new DC::UI::Label align => 0, expand => 1, text => $name); |
1229 | $::INVR_HB->add (new DC::UI::Label expand => 1, text => $name); |
1166 | |
1230 | |
1167 | if ($tag != 0) { # Floor isn't closable, is it? |
1231 | if ($tag != 0) { # Floor isn't closable, is it? |
1168 | $::INVR_HB->add (new DC::UI::Button |
1232 | $::INVR_HB->add (new DC::UI::Button |
1169 | text => "Close container", |
1233 | text => "Close container", |
1170 | tooltip => "Close the currently open container (if one is open)", |
1234 | tooltip => "Close the currently open container (if one is open)", |
… | |
… | |
1225 | } |
1289 | } |
1226 | |
1290 | |
1227 | sub item_update { |
1291 | sub item_update { |
1228 | my ($self, $item) = @_; |
1292 | my ($self, $item) = @_; |
1229 | |
1293 | |
1230 | #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($::CONN->{open_container})\n"; |
1294 | #print "item_update: $item->{tag} in $item->{container} pt($self->{player}{tag}) oc($::CONN->{open_container}) f($item->{flags})\n"; |
1231 | |
1295 | |
1232 | DC::Item::update_widgets $item; |
1296 | DC::Item::update_widgets $item; |
1233 | |
1297 | |
1234 | if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { |
1298 | if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { |
1235 | set_opencont ($::CONN, 0, "Floor"); |
1299 | set_opencont ($::CONN, 0, "Floor"); |
1236 | |
1300 | |
1237 | } elsif ($item->{flags} & F_OPEN) { |
1301 | } elsif ($item->{flags} & F_OPEN) { |
1238 | set_opencont ($::CONN, $item->{tag}, DC::Item::desc_string $item); |
1302 | set_opencont ($::CONN, $item->{tag}, DC::Item::desc_string $item); |
… | |
… | |
1254 | |
1318 | |
1255 | my $weight = .001 * $self->{player}{weight}; |
1319 | my $weight = .001 * $self->{player}{weight}; |
1256 | my $limit = .001 * $self->{stat}{+CS_STAT_WEIGHT_LIM}; |
1320 | my $limit = .001 * $self->{stat}{+CS_STAT_WEIGHT_LIM}; |
1257 | |
1321 | |
1258 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $weight); |
1322 | $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $weight); |
1259 | $::STATWIDS->{m_weight}->set_text (sprintf "%.1fkg", $limit); |
1323 | $::STATWIDS->{m_weight}->set_text (sprintf "Max Weight: %.1fkg", $limit); |
1260 | $::STATWIDS->{i_weight}->set_text (sprintf "%.1f/%.1fkg", $weight, $limit); |
1324 | $::STATWIDS->{i_weight}->set_text (sprintf "%.1f/%.1fkg", $weight, $limit); |
1261 | } |
1325 | } |
1262 | |
1326 | |
1263 | sub update_server_info { |
1327 | sub update_server_info { |
1264 | my ($self) = @_; |
1328 | my ($self) = @_; |
… | |
… | |
1272 | . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n" |
1336 | . "extended command support $yesno[$self->{setup}{extcmd} > 0]\n" |
1273 | . "examine command support $yesno[$self->{setup}{excmd} > 0]\n" |
1337 | . "examine command support $yesno[$self->{setup}{excmd} > 0]\n" |
1274 | . "editing support $yesno[!!$self->{editor_support}]\n" |
1338 | . "editing support $yesno[!!$self->{editor_support}]\n" |
1275 | . "map attributes $yesno[$self->{setup}{extmap} > 0]\n" |
1339 | . "map attributes $yesno[$self->{setup}{extmap} > 0]\n" |
1276 | . "big image protocol support $yesno[$self->{setup}{fxix} > 0]\n" |
1340 | . "big image protocol support $yesno[$self->{setup}{fxix} > 0]\n" |
1277 | . "cfplus support $yesno[$self->{cfplus_ext} > 0]" |
1341 | . "client support $yesno[$self->{cfplus_ext} > 0]" |
1278 | . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" |
1342 | . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" |
1279 | . "map size $self->{mapw}×$self->{maph}\n" |
1343 | . "map size $self->{mapw}×$self->{maph}\n" |
1280 | ); |
1344 | ); |
1281 | |
1345 | |
1282 | } |
1346 | } |
… | |
… | |
1304 | |
1368 | |
1305 | $self->update_server_info; |
1369 | $self->update_server_info; |
1306 | |
1370 | |
1307 | $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; |
1371 | $self->send_command ("output-rate $::CFG->{output_rate}") if $::CFG->{output_rate} > 0; |
1308 | $self->send_command ("pickup $::CFG->{pickup}"); |
1372 | $self->send_command ("pickup $::CFG->{pickup}"); |
|
|
1373 | |
|
|
1374 | $self->send_exti_msg (clientlog => sprintf "OpenGL Info: %s [%s]", |
|
|
1375 | DC::OpenGL::gl_vendor, DC::OpenGL::gl_version);#d# |
1309 | } |
1376 | } |
1310 | |
1377 | |
1311 | sub lookat { |
1378 | sub lookat { |
1312 | my ($self, $x, $y) = @_; |
1379 | my ($self, $x, $y) = @_; |
1313 | |
1380 | |