--- deliantra/Deliantra-Client/DC/Protocol.pm 2007/12/27 18:35:56 1.184 +++ deliantra/Deliantra-Client/DC/Protocol.pm 2008/05/08 20:19:49 1.195 @@ -29,8 +29,8 @@ $self->{map_widget}->clr_commands; my @cmd_help = map { - $_->{kw}[0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x - or die "unparseable command help: $_->{kw}[0]"; + $_->[DC::Pod::N_KW][0] =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x + or die "unparseable command help: $_->[DC::Pod::N_KW][0]"; my $cmd = $1; my @args = split /\|/, $2; @@ -45,7 +45,7 @@ map ["$cmd$_", $text], sort { (length $a) <=> (length $b) } @args - } sort { $a->{par} <=> $b->{par} } + } sort { $a->[DC::Pod::N_PAR] <=> $b->[DC::Pod::N_PAR] } DC::Pod::find command => "*"; $self->{json_coder} @@ -196,46 +196,9 @@ # widgetset create template sub ext_ws_ct { - my ($self, $ws, $template, $cfg) = @_; + my ($self, $ws, $type, $template, $done_cb, $cfg) = @_; - $template = eval < { - s_id => "toplevel", - title => "Character Creation", - x => "center", - y => "center", - z => 5, - s_cl => [VBox => {s_cl => [ - Label => { - text => "Character Creation", - fontsize => 1, - align => 0, - }, - Label => { - markup => "View or Edit your character attributes below, then press Finish to create your character", - fontsize => 0.8, - align => 0, - }, - Notebook => { - s_cl => [ - Label => { - text => "hulla-hoop" - }, - Entry => { - s_id => "entry", - }, - ], - }, - Button => { - s_id => "finish", - title => "Finish", - }, - ]}], - }, -] -EOF - die if $@; + $done_cb ||= sub { }; my $parse_list; $parse_list = sub { my ($list) = @_; @@ -262,8 +225,21 @@ @w }; - $parse_list->($template); + # either array reference, or face # + if ($type eq "inline") { + $done_cb->(); + $parse_list->($template); + } elsif ($type eq "face") { + my $handler; $handler = $self->register_face_handler ($template, sub { + my ($face) = @_; + undef $handler; + $done_cb->(); + $parse_list->($self->{json_coder}->decode ($face->{data})); + }); + } else { + $done_cb->(0); + } } # widgetset associate @@ -301,6 +277,7 @@ floorbox => $::FLOORBOX, help_window => $::HELP_WINDOW, message_window => $::MESSAGE_WINDOW, + message_dist => $::MESSAGE_DIST, statusbox => $::SDTATUSBOX, inv => $::INV, @@ -359,7 +336,7 @@ sub ext_channel_info { my ($self, $info) = @_; $self->{channels}->{$info->{id}} = $info; - $::MESSAGE_WINDOW->add_channel ($info); + $::MESSAGE_DIST->add_channel ($info); } ############################################################################# @@ -551,12 +528,12 @@ my $sw = $self->{skillwid}{""} ||= [ 0, 0, (new DC::UI::Label text => "Experience", align => 1), 1, 0, (new DC::UI::Label text => "Lvl.", align => 1), - 2, 0, (new DC::UI::Label text => "Progress", align => 0), - 3, 0, (new DC::UI::Label text => "Skill", expand => 1), + 2, 0, (new DC::UI::Label text => "Progress"), + 3, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), 4, 0, (new DC::UI::Label text => "Experience", align => 1), 5, 0, (new DC::UI::Label text => "Lvl.", align => 1), - 6, 0, (new DC::UI::Label text => "Progress", align => 0), - 7, 0, (new DC::UI::Label text => "Skill", expand => 1), + 6, 0, (new DC::UI::Label text => "Progress"), + 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0), ]; my @add = @$sw; @@ -605,7 +582,7 @@ (new DC::UI::ExperienceProgress), # label - (new DC::UI::Label text => $name, on_button_down => $spell_cb, + (new DC::UI::Label text => $name, on_button_down => $spell_cb, align => 0, can_events => 1, can_hover => 1, tooltip => (DC::Pod::section_label skill_description => $name) . $TOOLTIP_ALL), ]; @@ -1051,6 +1028,8 @@ s/(.*?)<\/fg>/$2<\/span>/gs; s/(.*?)<\/fg>/$2<\/span>/gs; + s/\s+$//; + $_ } @@ -1165,7 +1144,7 @@ for my $node (DC::Pod::find skill_description => "*") { my (undef, @par) = DC::Pod::section_of $node; - $skill_help{$node->{kw}[0]} = DC::Pod::as_label @par; + $skill_help{$node->[DC::Pod::N_KW][0]} = DC::Pod::as_label @par; }; for my $skill (values %{$self->{skill_info}}) { @@ -1195,7 +1174,8 @@ my @add; my $row; - for (sort { $a->{count} <=> $b->{count} } values %{ $::CONN->{container}{$::CONN->{open_container} || 0} }) { + for (sort { $b->{count} <=> $a->{count} } values %{ $::CONN->{container}{$::CONN->{open_container} || 0} }) { + next if $_->{tag} & 0x80000000; if ($row < 6) { local $_->{face_widget}; # hack to force recreation of widget local $_->{desc_widget}; # hack to force recreation of widget @@ -1233,7 +1213,7 @@ update_floorbox; $::INVR_HB->clear (); - $::INVR_HB->add (new DC::UI::Label align => 0, expand => 1, text => $name); + $::INVR_HB->add (new DC::UI::Label expand => 1, text => $name); if ($tag != 0) { # Floor isn't closable, is it? $::INVR_HB->add (new DC::UI::Button @@ -1298,10 +1278,10 @@ sub item_update { my ($self, $item) = @_; - #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($::CONN->{open_container})\n"; + #print "item_update: $item->{tag} in $item->{container} pt($self->{player}{tag}) oc($::CONN->{open_container}) f($item->{flags})\n"; DC::Item::update_widgets $item; - + if ($item->{tag} == $::CONN->{open_container} && not ($item->{flags} & F_OPEN)) { set_opencont ($::CONN, 0, "Floor"); @@ -1327,7 +1307,7 @@ my $limit = .001 * $self->{stat}{+CS_STAT_WEIGHT_LIM}; $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $weight); - $::STATWIDS->{m_weight}->set_text (sprintf "%.1fkg", $limit); + $::STATWIDS->{m_weight}->set_text (sprintf "Max Weight: %.1fkg", $limit); $::STATWIDS->{i_weight}->set_text (sprintf "%.1f/%.1fkg", $weight, $limit); } @@ -1345,7 +1325,7 @@ . "editing support $yesno[!!$self->{editor_support}]\n" . "map attributes $yesno[$self->{setup}{extmap} > 0]\n" . "big image protocol support $yesno[$self->{setup}{fxix} > 0]\n" - . "cfplus support $yesno[$self->{cfplus_ext} > 0]" + . "client support $yesno[$self->{cfplus_ext} > 0]" . ($self->{cfplus_ext} > 0 ? ", version $self->{cfplus_ext}" : "") ."\n" . "map size $self->{mapw}×$self->{maph}\n" );