ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Protocol.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.183 by root, Wed Dec 26 21:03:21 2007 UTC vs.
Revision 1.187 by root, Sat Dec 29 13:44:30 2007 UTC

19 19
20 my $self = $class->SUPER::new (%arg, 20 my $self = $class->SUPER::new (%arg,
21 setup_req => { 21 setup_req => {
22 extmap => 1, 22 extmap => 1,
23 excmd => 1, 23 excmd => 1,
24 widget => 1, 24 widget => 2,
25 %{$arg{setup_req} || {}}, 25 %{$arg{setup_req} || {}},
26 }, 26 },
27 ); 27 );
28 28
29 $self->{map_widget}->clr_commands; 29 $self->{map_widget}->clr_commands;
102} 102}
103 103
104sub ext_capabilities { 104sub ext_capabilities {
105 my ($self, %cap) = @_; 105 my ($self, %cap) = @_;
106 106
107 #$self->send ("setup sound 0"); # we use a different protocol
108 $self->update_fx_want; 107 $self->update_fx_want;
109 108
110 $self->send_exti_req (resource => "exp_table", sub { 109 $self->send_exti_req (resource => "exp_table", sub {
111 my ($exp_table) = @_; 110 my ($exp_table) = @_;
112 111
191 $ws, $id => scalar eval { 190 $ws, $id => scalar eval {
192 local $SIG{__DIE__}; 191 local $SIG{__DIE__};
193 "DC::UI::$class"->new (%$args) 192 "DC::UI::$class"->new (%$args)
194 } 193 }
195 ); 194 );
195}
196
197# widgetset create template
198sub ext_ws_ct {
199 my ($self, $ws, $type, $template, $done_cb, $cfg) = @_;
200
201 $done_cb ||= sub { };
202
203 my $parse_list; $parse_list = sub {
204 my ($list) = @_;
205 my @w;
206
207 while (@$list) {
208 my ($class, $args) = splice @$list, 0, 2;
209 my $name = delete $args->{s_id};
210 my $cl = delete $args->{s_cl};
211 my $cfg = delete $cfg->{$name};
212 my $id = delete $cfg->{id};
213 my $w = eval { "DC::UI::$class"->new (%$args, %{ $cfg || {} }) }
214 or next;
215
216 $self->widget_associate ($ws, $id, $w)
217 if $id;
218
219 $w->add ($parse_list->($cl))
220 if $cl;
221
222 push @w, $w;
223 }
224
225 @w
226 };
227
228 # either array reference, or face #
229 if ($type eq "inline") {
230 $done_cb->();
231 $parse_list->($template);
232 } elsif ($type eq "face") {
233 my $handler; $handler = $self->register_face_handler ($template, sub {
234 my ($face) = @_;
235
236 undef $handler;
237 $done_cb->();
238 $parse_list->($self->{json_coder}->decode ($face->{data}));
239 });
240 } else {
241 $done_cb->(0);
242 }
196} 243}
197 244
198# widgetset associate 245# widgetset associate
199sub ext_ws_a { 246sub ext_ws_a {
200 my ($self, %ass) = @_; 247 my ($self, %ass) = @_;
478 $sktbl->clear; 525 $sktbl->clear;
479 526
480 my $sw = $self->{skillwid}{""} ||= [ 527 my $sw = $self->{skillwid}{""} ||= [
481 0, 0, (new DC::UI::Label text => "Experience", align => 1), 528 0, 0, (new DC::UI::Label text => "Experience", align => 1),
482 1, 0, (new DC::UI::Label text => "Lvl.", align => 1), 529 1, 0, (new DC::UI::Label text => "Lvl.", align => 1),
483 2, 0, (new DC::UI::Label text => "Progress", align => 0), 530 2, 0, (new DC::UI::Label text => "Progress"),
484 3, 0, (new DC::UI::Label text => "Skill", expand => 1), 531 3, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0),
485 4, 0, (new DC::UI::Label text => "Experience", align => 1), 532 4, 0, (new DC::UI::Label text => "Experience", align => 1),
486 5, 0, (new DC::UI::Label text => "Lvl.", align => 1), 533 5, 0, (new DC::UI::Label text => "Lvl.", align => 1),
487 6, 0, (new DC::UI::Label text => "Progress", align => 0), 534 6, 0, (new DC::UI::Label text => "Progress"),
488 7, 0, (new DC::UI::Label text => "Skill", expand => 1), 535 7, 0, (new DC::UI::Label text => "Skill", expand => 1, align => 0),
489 ]; 536 ];
490 537
491 my @add = @$sw; 538 my @add = @$sw;
492 539
493 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>"; 540 my $TOOLTIP_ALL = "\n\n<small>Left click - ready skill\nMiddle click - use spell\nRight click - further options</small>";
532 579
533 # progress 580 # progress
534 (new DC::UI::ExperienceProgress), 581 (new DC::UI::ExperienceProgress),
535 582
536 # label 583 # label
537 (new DC::UI::Label text => $name, on_button_down => $spell_cb, 584 (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), 585 can_events => 1, can_hover => 1, tooltip => (DC::Pod::section_label skill_description => $name) . $TOOLTIP_ALL),
539 ]; 586 ];
540 587
541 push @add, 588 push @add,
542 $x * 4 + 0, $y, $sw->[0], 589 $x * 4 + 0, $y, $sw->[0],
1160 my ($conn, $tag, $name) = @_; 1207 my ($conn, $tag, $name) = @_;
1161 $conn->{open_container} = $tag; 1208 $conn->{open_container} = $tag;
1162 update_floorbox; 1209 update_floorbox;
1163 1210
1164 $::INVR_HB->clear (); 1211 $::INVR_HB->clear ();
1165 $::INVR_HB->add (new DC::UI::Label align => 0, expand => 1, text => $name); 1212 $::INVR_HB->add (new DC::UI::Label expand => 1, text => $name);
1166 1213
1167 if ($tag != 0) { # Floor isn't closable, is it? 1214 if ($tag != 0) { # Floor isn't closable, is it?
1168 $::INVR_HB->add (new DC::UI::Button 1215 $::INVR_HB->add (new DC::UI::Button
1169 text => "Close container", 1216 text => "Close container",
1170 tooltip => "Close the currently open container (if one is open)", 1217 tooltip => "Close the currently open container (if one is open)",
1254 1301
1255 my $weight = .001 * $self->{player}{weight}; 1302 my $weight = .001 * $self->{player}{weight};
1256 my $limit = .001 * $self->{stat}{+CS_STAT_WEIGHT_LIM}; 1303 my $limit = .001 * $self->{stat}{+CS_STAT_WEIGHT_LIM};
1257 1304
1258 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $weight); 1305 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $weight);
1259 $::STATWIDS->{m_weight}->set_text (sprintf "%.1fkg", $limit); 1306 $::STATWIDS->{m_weight}->set_text (sprintf "Max Weight: %.1fkg", $limit);
1260 $::STATWIDS->{i_weight}->set_text (sprintf "%.1f/%.1fkg", $weight, $limit); 1307 $::STATWIDS->{i_weight}->set_text (sprintf "%.1f/%.1fkg", $weight, $limit);
1261} 1308}
1262 1309
1263sub update_server_info { 1310sub update_server_info {
1264 my ($self) = @_; 1311 my ($self) = @_;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines