--- deliantra/Deliantra-Client/DC/Protocol.pm 2007/12/27 18:35:56 1.184 +++ deliantra/Deliantra-Client/DC/Protocol.pm 2008/03/25 19:28:54 1.191 @@ -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), ]; @@ -1165,7 +1142,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}}) { @@ -1233,7 +1210,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 @@ -1327,7 +1304,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 +1322,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" ); @@ -1491,7 +1468,7 @@ $self->{options}->clear; $self->{options}->add ($self->{bye_button}); - for my $kw (sort keys %{ $self->{kw} }) { + for my $kw (sort keys %{ $self->[DC::Pod::N_KW] }) { $self->{options}->add (new DC::UI::Button text => $kw, on_activate => sub { @@ -1510,12 +1487,12 @@ if ($type eq "update") { my (%info) = @arg; - $self->{kw}{$_} = 1 for @{$info{add_topics} || []}; - $self->{kw}{$_} = 0 for @{$info{del_topics} || []}; + $self->[DC::Pod::N_KW]{$_} = 1 for @{$info{add_topics} || []}; + $self->[DC::Pod::N_KW]{$_} = 0 for @{$info{del_topics} || []}; if (exists $info{msg}) { my $text = "\n" . DC::Protocol::sanitise_xml $info{msg}; - my $match = join "|", map "\\b\Q$_\E\\b", sort { (length $b) <=> (length $a) } keys %{ $self->{kw} }; + my $match = join "|", map "\\b\Q$_\E\\b", sort { (length $b) <=> (length $a) } keys %{ $self->[DC::Pod::N_KW] }; my @link; $text =~ s{ ($match)