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.183 by root, Tue Apr 25 11:18:50 2006 UTC vs.
Revision 1.190 by elmex, Thu Apr 27 08:55:35 2006 UTC

70 70
71our $FONT_PROP; 71our $FONT_PROP;
72our $FONT_FIXED; 72our $FONT_FIXED;
73 73
74our $MAP; 74our $MAP;
75our $MAPMAP;
75our $MAPWIDGET; 76our $MAPWIDGET;
76our $BUTTONBAR; 77our $BUTTONBAR;
77our $LOGVIEW; 78our $LOGVIEW;
78our $CONSOLE; 79our $CONSOLE;
79our $METASERVER; 80our $METASERVER;
313 audio_shutdown (); 314 audio_shutdown ();
314 audio_init (); 315 audio_init ();
315 } 316 }
316 ); 317 );
317 318
319 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Communication cmd");
320 $table->add (1, $row++, my $saycmd = new CFClient::UI::Entry
321 text => $CFG->{say_command},
322 tooltip => "This is the command that will be used if you write a line in the message window entry. "
323 ."Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
324 ."But you could also set it to 'tell <playername>' to only chat with that user.",
325 connect_changed => sub {
326 my ($self, $value) = @_;
327 $CFG->{say_command} = $value;
328 }
329 );
330
318 $dialog 331 $dialog
319} 332}
320 333
321sub set_stats_window_fontsize { 334sub set_stats_window_fontsize {
322 for (values %{$STATWIDS}) { 335 for (values %{$STATWIDS}) {
381} 394}
382 395
383sub make_stats_window { 396sub make_stats_window {
384 my $tgw = new CFClient::UI::FancyFrame x => $WIDTH * 2/5, y => 0, title => "Stats"; 397 my $tgw = new CFClient::UI::FancyFrame x => $WIDTH * 2/5, y => 0, title => "Stats";
385 398
386 $tgw->add (my $vb = new CFClient::UI::VBox); 399 $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox);
387 $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1); 400 $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1);
388 $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1); 401 $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1);
389 402
390 $vb->add (my $hb = new CFClient::UI::HBox expand => 1); 403 $vb->add (my $hb = new CFClient::UI::HBox expand => 1);
391 404
410 [2, 5, st_wspd => "WSp", 10.54, "Weapon Speed, how many attacks you may make per unit of time (0.120s). Higher values indicate faster attack speed. Current weapon and Dex effect the value of weapon speed."], 423 [2, 5, st_wspd => "WSp", 10.54, "Weapon Speed, how many attacks you may make per unit of time (0.120s). Higher values indicate faster attack speed. Current weapon and Dex effect the value of weapon speed."],
411 ) { 424 ) {
412 my ($col, $row, $id, $label, $template, $tooltip) = @$_; 425 my ($col, $row, $id, $label, $template, $tooltip) = @$_;
413 426
414 $tbl->add ($col , $row, $STATWIDS->{$id} = new CFClient::UI::Label 427 $tbl->add ($col , $row, $STATWIDS->{$id} = new CFClient::UI::Label
415 can_hover => 1, can_events => 1, valign => 0, align => +1, template => $template, tooltip => $tooltip); 428 font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, align => +1, template => $template, tooltip => $tooltip);
416 $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFClient::UI::Label 429 $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFClient::UI::Label
417 can_hover => 1, can_events => 1, fg => $black, valign => 0, align => -1, text => $label, tooltip => $tooltip); 430 font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $black, valign => 0, align => -1, text => $label, tooltip => $tooltip);
418 } 431 }
419 432
420 $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1); 433 $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1);
421 434
422 my $row = 0; 435 my $row = 0;
423 my $col = 0; 436 my $col = 0;
424 437
425 my %resist_names = ( 438 my %resist_names = (
426 slow => "Slow", 439 slow => "Slow (slows you down when you are hit by the spell. Monsters will have an opportunity to come near you faster and hit you more often.)",
427 holyw => "Holy Word", 440 holyw => "Holy Word (resistance you against getting the fear when someone whose god doesn't like you spells the holy word on you.)",
428 conf => "Confusion", 441 conf => "Confusion (If you are hit by confusion you will move into random directions, and likely into monsters.)",
429 fire => "Fire", 442 fire => "Fire (just your resistance to fire spells like burning hands, dragonbreath, meteor swarm fire, ...)",
430 depl => "Depletion (some monsters and other effects can cause stats depletion)", 443 depl => "Depletion (some monsters and other effects can cause stats depletion)",
431 magic => "Magic", 444 magic => "Magic (resistance to magic spells like magic missile or similar)",
432 drain => "Draining (some monsters (e.g. vampires) and other effects can steal experience)", 445 drain => "Draining (some monsters (e.g. vampires) and other effects can steal experience)",
433 acid => "Acid", 446 acid => "Acid (resistance to acid, acid hurts pretty much and also corrodes your weapons)",
434 pois => "Poison", 447 pois => "Poison (resistance to getting poisoned)",
435 para => "Paralysation", 448 para => "Paralysation (this resistance affects the chance you get paralysed)",
436 deat => "Death (resistance against death spells)", 449 deat => "Death (resistance against death spells)",
437 phys => "Physical", 450 phys => "Physical (this is the resistance against physical attacks, like when a monster hit you in melee combat)",
438 blind => "Blind", 451 blind => "Blind (blind resistance affects the chance of a successful blinding attack)",
439 fear => "Fear", 452 fear => "Fear (this attack will drive you away from monsters who cast this and hit you successfully, being resistant to this helps a lot when fighting those monsters)",
440 tund => "Turn undead", 453 tund => "Turn undead",
441 elec => "Electricity", 454 elec => "Electricity (resistance againt electricity, spells like large lightning, small lightning, ...)",
442 cold => "Cold", 455 cold => "Cold (this is your resistance against cold spells like icestorm, snowstorm, ...)",
443 ghit => "Ghost hit (special attack used by ghosts and ghost-like beings)", 456 ghit => "Ghost hit (special attack used by ghosts and ghost-like beings)",
444 ); 457 );
445 for (qw/slow holyw conf fire depl magic 458 for (qw/slow holyw conf fire depl magic
446 drain acid pois para deat phys 459 drain acid pois para deat phys
447 blind fear tund elec cold ghit/) 460 blind fear tund elec cold ghit/)
448 { 461 {
449 $tbl2->add ($col, $row, 462 $tbl2->add ($col, $row,
450 $STATWIDS->{"res_$_"} = 463 $STATWIDS->{"res_$_"} =
451 new CFClient::UI::Label 464 new CFClient::UI::Label
465 font => $FONT_FIXED,
452 template => "-100%", 466 template => "-100%",
453 align => +1, 467 align => +1,
454 valign => 0, 468 valign => 0,
455 can_events => 1, 469 can_events => 1,
456 can_hover => 1, 470 can_hover => 1,
457 tooltip => $resist_names{$_}, 471 tooltip => $resist_names{$_},
458 ); 472 );
459 $tbl2->add ($col + 1, $row, new CFClient::UI::Image 473 $tbl2->add ($col + 1, $row, new CFClient::UI::Image
474 font => $FONT_FIXED,
460 can_hover => 1, 475 can_hover => 1,
461 can_events => 1, 476 can_events => 1,
462 image => "ui/resist/resist_$_.png", 477 image => "ui/resist/resist_$_.png",
463 tooltip => $resist_names{$_}, 478 tooltip => $resist_names{$_},
464 ); 479 );
689 my ($self, $value) = @_; 704 my ($self, $value) = @_;
690 $CFG->{password} = $value; 705 $CFG->{password} = $value;
691 } 706 }
692 ); 707 );
693 708
694 $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "Def. say cmd");
695 $table->add (1, 6, my $saycmd = new CFClient::UI::Entry
696 text => $CFG->{say_command},
697 tooltip => "This is the command that will be used if you write a line in the message window entry. "
698 ."Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
699 ."But you could also set it to 'tell <playername>' to only chat with that user.",
700 connect_changed => sub {
701 my ($self, $value) = @_;
702 $CFG->{say_command} = $value;
703 }
704 );
705
706 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); 709 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size");
707 $table->add (1, 7, new CFClient::UI::Slider 710 $table->add (1, 7, new CFClient::UI::Slider
708 req_w => 100, 711 req_w => 100,
709 range => [$CFG->{mapsize}, 10, 100 + 1, 1], 712 range => [$CFG->{mapsize}, 10, 100 + 1, 1],
710 tooltip => "This is the size of the portion of the map update the server sends you. " 713 tooltip => "This is the size of the portion of the map update the server sends you. "
724} 727}
725 728
726sub message_window { 729sub message_window {
727 my $window = new CFClient::UI::FancyFrame 730 my $window = new CFClient::UI::FancyFrame
728 title => "Messages", 731 title => "Messages",
729 border_bg => [1, 1, 1, 0.5], 732 border_bg => [1, 1, 1, 1],
730 bg => [0.3, 0.3, 0.3, 0.8], 733 bg => [0, 0, 0, 0.5],
731 user_w => int $::WIDTH / 3, 734 user_w => int $::WIDTH / 3,
732 user_h => int $::HEIGHT / 5, 735 user_h => int $::HEIGHT / 5,
733 child => (my $vbox = new CFClient::UI::VBox); 736 child => (my $vbox = new CFClient::UI::VBox);
734 737
735 $vbox->add ($LOGVIEW = new CFClient::UI::TextView 738 $vbox->add ($LOGVIEW = new CFClient::UI::TextView
815 fontsize => 0.8, 818 fontsize => 0.8,
816 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode"; 819 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode";
817 $ALT_ENTER_MESSAGE->show; 820 $ALT_ENTER_MESSAGE->show;
818 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h}); 821 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h});
819 822
820 $CFClient::UI::ROOT->add ($MAPWIDGET = new CFClient::MapWidget); 823 CFClient::UI::FancyFrame->new (
821 $MAPWIDGET->focus_in; 824 border_bg => [1, 1, 1, 192/255],
825 bg => [1, 1, 1, 0],
826 child => ($MAPMAP = new CFClient::MapWidget::MapMap),
827 )->show;
828
829 $MAPWIDGET = new CFClient::MapWidget;
822 $MAPWIDGET->connect (activate_console => sub { 830 $MAPWIDGET->connect (activate_console => sub {
823 my ($mapwidget, $preset) = @_; 831 my ($mapwidget, $preset) = @_;
824 832
825 if ($CONSOLE) { 833 if ($CONSOLE) {
826 $CONSOLE->{input}->{auto_activated} = 1; 834 $CONSOLE->{input}->{auto_activated} = 1;
829 if ($preset && $CONSOLE->{input}->get_text eq '') { 837 if ($preset && $CONSOLE->{input}->get_text eq '') {
830 $CONSOLE->{input}->set_text ($preset); 838 $CONSOLE->{input}->set_text ($preset);
831 } 839 }
832 } 840 }
833 }); 841 });
842 $MAPWIDGET->show;
843 $MAPWIDGET->focus_in;
834 844
835 $CFClient::UI::ROOT->add ($BUTTONBAR = new CFClient::UI::HBox); 845 $BUTTONBAR = new CFClient::UI::HBox;
836 846
837 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); 847 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup);
838 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); 848 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup);
839 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); 849 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window);
840 850
843 853
844 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { 854 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub {
845 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; 855 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
846 status "Configuration Saved"; 856 status "Configuration Saved";
847 }); 857 });
858
859 $BUTTONBAR->show;
848 860
849 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup 861 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup
850} 862}
851 863
852sub video_shutdown { 864sub video_shutdown {
1034# at worst. 1046# at worst.
1035sub conn::flood_fill { 1047sub conn::flood_fill {
1036 my ($self, $gx, $gy, $path, $hash, $flags) = @_; 1048 my ($self, $gx, $gy, $path, $hash, $flags) = @_;
1037 1049
1038 # the server does not allow map paths > 6 1050 # the server does not allow map paths > 6
1039 return if 6 <= length $path; 1051 return if 7 <= length $path;
1040 1052
1041 my ($x0, $y0, $x1, $y1) = @{$self->{neigh_rect}}; 1053 my ($x0, $y0, $x1, $y1) = @{$self->{neigh_rect}};
1042 1054
1043 for ( 1055 for (
1044 [1, 0, -1], 1056 [1, 0, -1],
1087 1099
1088 $self->flush_map; 1100 $self->flush_map;
1089 1101
1090 my ($ox, $oy) = ($::MAP->ox, $::MAP->oy); 1102 my ($ox, $oy) = ($::MAP->ox, $::MAP->oy);
1091 1103
1092 my $mapmapw = 250; 1104 my $mapmapw = $MAPMAP->{w};
1093 my $mapmaph = 250; 1105 my $mapmaph = $MAPMAP->{h};
1094 1106
1095 $self->{neigh_rect} = [ 1107 $self->{neigh_rect} = [
1096 $ox - $mapmapw * 0.5, $oy - $mapmapw * 0.5, 1108 $ox - $mapmapw * 0.5, $oy - $mapmapw * 0.5,
1097 $ox + $mapmapw * 0.5 + $w, $oy + $mapmapw * 0.5 + $h, 1109 $ox + $mapmapw * 0.5 + $w, $oy + $mapmapw * 0.5 + $h,
1098 ]; 1110 ];
1321 if ($ev->{button} == 1) { 1333 if ($ev->{button} == 1) {
1322 $CONN->send ("move $CONN->{player}{tag} $item->{tag} 0"); 1334 $CONN->send ("move $CONN->{player}{tag} $item->{tag} 0");
1323 } elsif ($ev->{button} == 2) { 1335 } elsif ($ev->{button} == 2) {
1324 $CONN->send ("apply $item->{tag}"); 1336 $CONN->send ("apply $item->{tag}");
1325 } elsif ($ev->{button} == 3) { 1337 } elsif ($ev->{button} == 3) {
1326 # examine, lock, mark, maybe other things 1338 CFClient::UI::Menu->new (
1327 warn "MENU not implemented yet\n"; 1339 items => [
1340 ["examine", sub { $CONN->send ("examine $item->{tag}") }],
1341 [
1342 $item->{flags} & Crossfire::Protocol::F_LOCKED ? "lock" : "unlock",
1343 sub { $CONN->send ("lock $item->{tag}") },
1344 ],
1345 ["mark", sub { $CONN->send ("mark $item->{tag}") }],
1346 ["apply", sub { $CONN->send ("apply $item->{tag}") }],
1347 ],
1348 )->popup ($ev);
1328 } 1349 }
1329 1350
1330 1 1351 1
1331 }, 1352 },
1332 ); 1353 );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines