ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/pclient
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/pclient (file contents):
Revision 1.168 by root, Sun Apr 23 21:47:32 2006 UTC vs.
Revision 1.169 by root, Mon Apr 24 02:41:48 2006 UTC

142 my ($self, $value) = @_; 142 my ($self, $value) = @_;
143 $CFG->{fast} = $value; 143 $CFG->{fast} = $value;
144 } 144 }
145 ); 145 );
146 146
147 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Map Scale");
148 $table->add (1, $row++, new CFClient::UI::Slider
149 range => [$CFG->{map_scale}, 0.25, 2, 0.05],
150 tooltip => "Enlarge or shrink the displayed map",
151 connect_changed => sub {
152 my ($self, $value) = @_;
153 $CFG->{map_scale} = 0.05 * int $value / 0.05;
154 }
155 );
156
147 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); 157 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War");
148 $table->add (1, $row++, new CFClient::UI::CheckBox 158 $table->add (1, $row++, new CFClient::UI::CheckBox
149 state => $CFG->{fow_enable}, 159 state => $CFG->{fow_enable},
150 tooltip => "Fog-of-War marks areas that cannot be seen by the player", 160 tooltip => "Fog-of-War marks areas that cannot be seen by the player",
151 connect_changed => sub { 161 connect_changed => sub {
222 range => [$CFG->{gauge_fontsize}, 0.5, 2.0, 0.1], 232 range => [$CFG->{gauge_fontsize}, 0.5, 2.0, 0.1],
223 tooltip => "Adjusts the fontsize of the gauges at the bottom right", 233 tooltip => "Adjusts the fontsize of the gauges at the bottom right",
224 connect_changed => sub { 234 connect_changed => sub {
225 $CFG->{gauge_fontsize} = 0.1 * int $_[1] * 10; 235 $CFG->{gauge_fontsize} = 0.1 * int $_[1] * 10;
226 &set_gauge_window_fontsize; 236 &set_gauge_window_fontsize;
227 #$GAUGES->{win}->check_size;
228 #$GAUGES->{win}->update;
229 } 237 }
230 ); 238 );
231 239
232 $table->add (1, $row++, new CFClient::UI::Button 240 $table->add (1, $row++, new CFClient::UI::Button
233 expand => 1, align => 0, text => "Apply", 241 expand => 1, align => 0, text => "Apply",
288 296
289sub set_gauge_window_fontsize { 297sub set_gauge_window_fontsize {
290 for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) { 298 for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) {
291 $_->set_fontsize ($::CFG->{gauge_fontsize}); 299 $_->set_fontsize ($::CFG->{gauge_fontsize});
292 } 300 }
301
302# local $GAUGES->{win}{parent};#d#
303# use PApp::Util; open D, ">:utf8", "d"; print D PApp::Util::dumpval $GAUGES->{win}; close D;
293} 304}
294 305
295sub make_gauge_window { 306sub make_gauge_window {
296 my $gh = int ($HEIGHT * $CFG->{gauge_size}); 307 my $gh = int ($HEIGHT * $CFG->{gauge_size});
297# my $gw = int ($WIDTH * $CFG->{gauge_w_size}); 308# my $gw = int ($WIDTH * $CFG->{gauge_w_size});
298 309
299 my $win = new CFClient::UI::Frame ( 310 my $win = new CFClient::UI::Frame (
300 y => $HEIGHT - $gh, x => 0, req_w => $WIDTH, req_h => $gh 311 y => $HEIGHT - $gh, x => 0, user_w => $WIDTH, user_h => $gh
301 ); 312 );
302 $win->add (my $vb = new CFClient::UI::VBox); 313 $win->add (my $vb = new CFClient::UI::VBox);
303 314
304 $vb->add (my $hbg = new CFClient::UI::HBox expand => 1); 315 $vb->add (my $hbg = new CFClient::UI::HBox expand => 1);
305
306 316
307 $hbg->add (new CFClient::UI::Empty expand => 1); 317 $hbg->add (new CFClient::UI::Empty expand => 1);
308 $hbg->add (my $hb = new CFClient::UI::HBox); 318 $hbg->add (my $hb = new CFClient::UI::HBox);
309 $hb->add (my $hg = new CFClient::UI::Gauge type => 'hp', tooltip => "Health points"); 319 $hb->add (my $hg = new CFClient::UI::Gauge type => 'hp', tooltip => "Health points");
310 $hb->add (my $mg = new CFClient::UI::Gauge type => 'mana', tooltip => "Spellpoints"); 320 $hb->add (my $mg = new CFClient::UI::Gauge type => 'mana', tooltip => "Spellpoints");
316 326
317 $GAUGES = { 327 $GAUGES = {
318 exp => $exp, win => $win, range => $rng, 328 exp => $exp, win => $win, range => $rng,
319 food => $fg, mana => $mg, hp => $hg, grace => $gg 329 food => $fg, mana => $mg, hp => $hg, grace => $gg
320 }; 330 };
331
332 &set_gauge_window_fontsize;
333
321 $win 334 $win
322} 335}
323 336
324sub make_stats_window { 337sub make_stats_window {
325 my $tgw = new CFClient::UI::FancyFrame (x => $WIDTH * 2/5, y => 0, title => "Stats"); 338 my $tgw = new CFClient::UI::FancyFrame (x => $WIDTH * 2/5, y => 0, title => "Stats");
417 update_stats_window ({}); 430 update_stats_window ({});
418 431
419 $tgw 432 $tgw
420} 433}
421 434
435sub formsep {
436 reverse join ",", grep length, split /(...)/, reverse $_[0] * 1
437}
438
422sub update_stats_window { 439sub update_stats_window {
423 my ($stats) = @_; 440 my ($stats) = @_;
424 441
425 # i love text protocols!!! 442 # i love text protocols!!!
426 my $hp = $stats->{1} * 1; 443 my $hp = $stats->{Crossfire::Protocol::CS_STAT_HP} * 1;
427 my $hp_m = $stats->{2} * 1; 444 my $hp_m = $stats->{Crossfire::Protocol::CS_STAT_MAXHP} * 1;
428 my $sp = $stats->{3} * 1; 445 my $sp = $stats->{Crossfire::Protocol::CS_STAT_SP} * 1;
429 my $sp_m = $stats->{4} * 1; 446 my $sp_m = $stats->{Crossfire::Protocol::CS_STAT_MAXSP} * 1;
430 my $fo = $stats->{18} * 1; 447 my $fo = $stats->{Crossfire::Protocol::CS_STAT_FOOD} * 1;
431 my $fo_m = 999; 448 my $fo_m = 999;
432 my $gr = $stats->{23} * 1; 449 my $gr = $stats->{Crossfire::Protocol::CS_STAT_GRACE} * 1;
433 my $gr_m = $stats->{24} * 1; 450 my $gr_m = $stats->{Crossfire::Protocol::CS_STAT_MAXGRACE} * 1;
434 451
435 $GAUGES->{hp} ->set_value ($hp, $hp_m); 452 $GAUGES->{hp} ->set_value ($hp, $hp_m);
436 $GAUGES->{mana} ->set_value ($sp, $sp_m); 453 $GAUGES->{mana} ->set_value ($sp, $sp_m);
437 $GAUGES->{food} ->set_value ($fo, $fo_m); 454 $GAUGES->{food} ->set_value ($fo, $fo_m);
438 $GAUGES->{grace} ->set_value ($gr, $gr_m); 455 $GAUGES->{grace} ->set_value ($gr, $gr_m);
439 $GAUGES->{exp} ->set_text ("XP: " . ($stats->{11} || $stats->{28}) * 1 456 $GAUGES->{exp} ->set_text ("Exp: " . (formsep $stats->{Crossfire::Protocol::CS_STAT_EXP64})
440 ." LVL: " . $stats->{12} * 1); 457 . " (lvl " . ($stats->{Crossfire::Protocol::CS_STAT_LEVEL} * 1) . ")");
441 my $rng = $stats->{20}; 458 my $rng = $stats->{Crossfire::Protocol::CS_STAT_RANGE};
442 $rng =~ s/^Range: //; # thank you so much dear server 459 $rng =~ s/^Range: //; # thank you so much dear server
443 $GAUGES->{range} ->set_text ("Rng: " . $rng); 460 $GAUGES->{range} ->set_text ("Rng: " . $rng);
444 my $title = $stats->{21}; 461 my $title = $stats->{Crossfire::Protocol::CS_STAT_TITLE};
445 $title =~ s/^Player: //; 462 $title =~ s/^Player: //;
446 $STATWIDS->{title} ->set_text ("Title: " . $title); 463 $STATWIDS->{title} ->set_text ("Title: " . $title);
447 464
448 $STATWIDS->{st_str} ->set_text (sprintf "%d", $stats->{5}); 465 $STATWIDS->{st_str} ->set_text (sprintf "%d", $stats->{5});
449 $STATWIDS->{st_dex} ->set_text (sprintf "%d", $stats->{8}); 466 $STATWIDS->{st_dex} ->set_text (sprintf "%d", $stats->{8});
450 $STATWIDS->{st_con} ->set_text (sprintf "%d", $stats->{9}); 467 $STATWIDS->{st_con} ->set_text (sprintf "%d", $stats->{9});
451 $STATWIDS->{st_int} ->set_text (sprintf "%d", $stats->{6}); 468 $STATWIDS->{st_int} ->set_text (sprintf "%d", $stats->{6});
452 $STATWIDS->{st_wis} ->set_text (sprintf "%d", $stats->{7}); 469 $STATWIDS->{st_wis} ->set_text (sprintf "%d", $stats->{7});
453 $STATWIDS->{st_pow} ->set_text (sprintf "%d", $stats->{22}); 470 $STATWIDS->{st_pow} ->set_text (sprintf "%d", $stats->{22});
454 $STATWIDS->{st_cha} ->set_text (sprintf "%d", $stats->{10}); 471 $STATWIDS->{st_cha} ->set_text (sprintf "%d", $stats->{10});
455 $STATWIDS->{st_wc} ->set_text (sprintf "%d", $stats->{13}); 472 $STATWIDS->{st_wc} ->set_text (sprintf "%d", $stats->{13});
456 $STATWIDS->{st_ac} ->set_text (sprintf "%d", $stats->{14}); 473 $STATWIDS->{st_ac} ->set_text (sprintf "%d", $stats->{14});
457 $STATWIDS->{st_dam} ->set_text (sprintf "%d", $stats->{15}); 474 $STATWIDS->{st_dam} ->set_text (sprintf "%d", $stats->{15});
458 $STATWIDS->{st_arm} ->set_text (sprintf "%d", $stats->{16}); 475 $STATWIDS->{st_arm} ->set_text (sprintf "%d", $stats->{16});
459 $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{17}); 476 $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{Crossfire::Protocol::CS_STAT_SPEED});
460 $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{19}); 477 $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{Crossfire::Protocol::CS_STAT_WEAP_SP});
461 478
462 my %tbl = ( 479 my %tbl = (
463 phys => 100, 480 phys => 100,
464 magic => 101, 481 magic => 101,
465 fire => 102, 482 fire => 102,
1158 $MAPWIDGET->add_command ("use_skill $skill", "", sub { 1175 $MAPWIDGET->add_command ("use_skill $skill", "", sub {
1159 }); 1176 });
1160 } 1177 }
1161} 1178}
1162 1179
1180sub conn::container_add {
1181 my ($self, $id, $items) = @_;
1182
1183 # 0 floor
1184 # $self-<{player}{tag} => player inv
1185 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}};
1186}
1187
1188sub conn::container_clear {
1189 my ($self, $id) = @_;
1190# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
1191}
1192
1163%SDL_CB = ( 1193%SDL_CB = (
1164 CFClient::SDL_QUIT => sub { 1194 CFClient::SDL_QUIT => sub {
1165 Event::unloop -1; 1195 Event::unloop -1;
1166 }, 1196 },
1167 CFClient::SDL_VIDEORESIZE => sub { 1197 CFClient::SDL_VIDEORESIZE => sub {
1200 sdl_mode => 0, 1230 sdl_mode => 0,
1201 width => 640, 1231 width => 640,
1202 height => 480, 1232 height => 480,
1203 fullscreen => 0, 1233 fullscreen => 0,
1204 fast => 0, 1234 fast => 0,
1235 map_scale => 0.5,
1205 fow_enable => 1, 1236 fow_enable => 1,
1206 fow_intensity => 0.45, 1237 fow_intensity => 0.45,
1207 fow_smooth => 0, 1238 fow_smooth => 0,
1208 gui_fontsize => 1, 1239 gui_fontsize => 1,
1209 log_fontsize => 1, 1240 log_fontsize => 1,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines