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.186 by root, Tue Apr 25 12:10:58 2006 UTC vs.
Revision 1.192 by root, Fri Apr 28 18:06:13 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;
90our %AUDIO_CHUNKS; # audio files 91our %AUDIO_CHUNKS; # audio files
91 92
92our $ALT_ENTER_MESSAGE; 93our $ALT_ENTER_MESSAGE;
93our $STATUS_LINE; 94our $STATUS_LINE;
94our $DEBUG_STATUS; 95our $DEBUG_STATUS;
96
97our $INVWIN;
98our $INV;
95 99
96sub status { 100sub status {
97 $STATUS_LINE->set_text ($_[0]); 101 $STATUS_LINE->set_text ($_[0]);
98 $STATUS_LINE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h} - $STATUS_LINE->{h}); 102 $STATUS_LINE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h} - $STATUS_LINE->{h});
99} 103}
313 audio_shutdown (); 317 audio_shutdown ();
314 audio_init (); 318 audio_init ();
315 } 319 }
316 ); 320 );
317 321
322 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Communication cmd");
323 $table->add (1, $row++, my $saycmd = new CFClient::UI::Entry
324 text => $CFG->{say_command},
325 tooltip => "This is the command that will be used if you write a line in the message window entry. "
326 ."Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
327 ."But you could also set it to 'tell <playername>' to only chat with that user.",
328 connect_changed => sub {
329 my ($self, $value) = @_;
330 $CFG->{say_command} = $value;
331 }
332 );
333
318 $dialog 334 $dialog
319} 335}
320 336
321sub set_stats_window_fontsize { 337sub set_stats_window_fontsize {
322 for (values %{$STATWIDS}) { 338 for (values %{$STATWIDS}) {
421 437
422 my $row = 0; 438 my $row = 0;
423 my $col = 0; 439 my $col = 0;
424 440
425 my %resist_names = ( 441 my %resist_names = (
426 slow => "Slow", 442 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", 443 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", 444 conf => "Confusion (If you are hit by confusion you will move into random directions, and likely into monsters.)",
429 fire => "Fire", 445 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)", 446 depl => "Depletion (some monsters and other effects can cause stats depletion)",
431 magic => "Magic", 447 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)", 448 drain => "Draining (some monsters (e.g. vampires) and other effects can steal experience)",
433 acid => "Acid", 449 acid => "Acid (resistance to acid, acid hurts pretty much and also corrodes your weapons)",
434 pois => "Poison", 450 pois => "Poison (resistance to getting poisoned)",
435 para => "Paralysation", 451 para => "Paralysation (this resistance affects the chance you get paralysed)",
436 deat => "Death (resistance against death spells)", 452 deat => "Death (resistance against death spells)",
437 phys => "Physical", 453 phys => "Physical (this is the resistance against physical attacks, like when a monster hit you in melee combat)",
438 blind => "Blind", 454 blind => "Blind (blind resistance affects the chance of a successful blinding attack)",
439 fear => "Fear", 455 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", 456 tund => "Turn undead",
441 elec => "Electricity", 457 elec => "Electricity (resistance againt electricity, spells like large lightning, small lightning, ...)",
442 cold => "Cold", 458 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)", 459 ghit => "Ghost hit (special attack used by ghosts and ghost-like beings)",
444 ); 460 );
445 for (qw/slow holyw conf fire depl magic 461 for (qw/slow holyw conf fire depl magic
446 drain acid pois para deat phys 462 drain acid pois para deat phys
447 blind fear tund elec cold ghit/) 463 blind fear tund elec cold ghit/)
691 my ($self, $value) = @_; 707 my ($self, $value) = @_;
692 $CFG->{password} = $value; 708 $CFG->{password} = $value;
693 } 709 }
694 ); 710 );
695 711
696 $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "Def. say cmd");
697 $table->add (1, 6, my $saycmd = new CFClient::UI::Entry
698 text => $CFG->{say_command},
699 tooltip => "This is the command that will be used if you write a line in the message window entry. "
700 ."Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
701 ."But you could also set it to 'tell <playername>' to only chat with that user.",
702 connect_changed => sub {
703 my ($self, $value) = @_;
704 $CFG->{say_command} = $value;
705 }
706 );
707
708 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); 712 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size");
709 $table->add (1, 7, new CFClient::UI::Slider 713 $table->add (1, 7, new CFClient::UI::Slider
710 req_w => 100, 714 req_w => 100,
711 range => [$CFG->{mapsize}, 10, 100 + 1, 1], 715 range => [$CFG->{mapsize}, 10, 100 + 1, 1],
712 tooltip => "This is the size of the portion of the map update the server sends you. " 716 tooltip => "This is the size of the portion of the map update the server sends you. "
777 }; 781 };
778 782
779 $window 783 $window
780} 784}
781 785
786sub make_inventory_window {
787 my $invwin = new CFClient::UI::FancyFrame user_w => 300, user_h => 300, title => "Inventory";
788 $invwin->add (my $hb = new CFClient::UI::HBox);
789 $hb->add ($INV = new CFClient::UI::Inventory expand => 1);
790 $hb->add (my $rng = new CFClient::UI::Slider vertical => 1);
791 $INV->set_range ($rng);
792 $invwin
793}
794
782sub sdl_init { 795sub sdl_init {
783 CFClient::SDL_Init 796 CFClient::SDL_Init
784 and die "SDL::Init failed!\n"; 797 and die "SDL::Init failed!\n";
785} 798}
786 799
817 fontsize => 0.8, 830 fontsize => 0.8,
818 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode"; 831 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode";
819 $ALT_ENTER_MESSAGE->show; 832 $ALT_ENTER_MESSAGE->show;
820 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h}); 833 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h});
821 834
822 $CFClient::UI::ROOT->add ($MAPWIDGET = new CFClient::MapWidget); 835 CFClient::UI::FancyFrame->new (
823 $MAPWIDGET->focus_in; 836 border_bg => [1, 1, 1, 192/255],
837 bg => [1, 1, 1, 0],
838 child => ($MAPMAP = new CFClient::MapWidget::MapMap),
839 )->show;
840
841 $MAPWIDGET = new CFClient::MapWidget;
824 $MAPWIDGET->connect (activate_console => sub { 842 $MAPWIDGET->connect (activate_console => sub {
825 my ($mapwidget, $preset) = @_; 843 my ($mapwidget, $preset) = @_;
826 844
827 if ($CONSOLE) { 845 if ($CONSOLE) {
828 $CONSOLE->{input}->{auto_activated} = 1; 846 $CONSOLE->{input}->{auto_activated} = 1;
831 if ($preset && $CONSOLE->{input}->get_text eq '') { 849 if ($preset && $CONSOLE->{input}->get_text eq '') {
832 $CONSOLE->{input}->set_text ($preset); 850 $CONSOLE->{input}->set_text ($preset);
833 } 851 }
834 } 852 }
835 }); 853 });
854 $MAPWIDGET->show;
855 $MAPWIDGET->focus_in;
836 856
837 $CFClient::UI::ROOT->add ($BUTTONBAR = new CFClient::UI::HBox); 857 $BUTTONBAR = new CFClient::UI::HBox;
838 858
839 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); 859 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup);
840 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); 860 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup);
841 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); 861 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window);
842 862
843 $CFClient::UI::ROOT->add (make_gauge_window); # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D 863 make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D
864
844 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window); 865 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window);
866 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window);
845 867
846 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { 868 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub {
847 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; 869 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
848 status "Configuration Saved"; 870 status "Configuration Saved";
849 }); 871 });
872
873 $BUTTONBAR->show;
850 874
851 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup 875 $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup
852} 876}
853 877
854sub video_shutdown { 878sub video_shutdown {
1036# at worst. 1060# at worst.
1037sub conn::flood_fill { 1061sub conn::flood_fill {
1038 my ($self, $gx, $gy, $path, $hash, $flags) = @_; 1062 my ($self, $gx, $gy, $path, $hash, $flags) = @_;
1039 1063
1040 # the server does not allow map paths > 6 1064 # the server does not allow map paths > 6
1041 return if 6 <= length $path; 1065 return if 7 <= length $path;
1042 1066
1043 my ($x0, $y0, $x1, $y1) = @{$self->{neigh_rect}}; 1067 my ($x0, $y0, $x1, $y1) = @{$self->{neigh_rect}};
1044 1068
1045 for ( 1069 for (
1046 [1, 0, -1], 1070 [1, 0, -1],
1089 1113
1090 $self->flush_map; 1114 $self->flush_map;
1091 1115
1092 my ($ox, $oy) = ($::MAP->ox, $::MAP->oy); 1116 my ($ox, $oy) = ($::MAP->ox, $::MAP->oy);
1093 1117
1094 my $mapmapw = 250; 1118 my $mapmapw = $MAPMAP->{w};
1095 my $mapmaph = 250; 1119 my $mapmaph = $MAPMAP->{h};
1096 1120
1097 $self->{neigh_rect} = [ 1121 $self->{neigh_rect} = [
1098 $ox - $mapmapw * 0.5, $oy - $mapmapw * 0.5, 1122 $ox - $mapmapw * 0.5, $oy - $mapmapw * 0.5,
1099 $ox + $mapmapw * 0.5 + $w, $oy + $mapmapw * 0.5 + $h, 1123 $ox + $mapmapw * 0.5 + $w, $oy + $mapmapw * 0.5 + $h,
1100 ]; 1124 ];
1323 if ($ev->{button} == 1) { 1347 if ($ev->{button} == 1) {
1324 $CONN->send ("move $CONN->{player}{tag} $item->{tag} 0"); 1348 $CONN->send ("move $CONN->{player}{tag} $item->{tag} 0");
1325 } elsif ($ev->{button} == 2) { 1349 } elsif ($ev->{button} == 2) {
1326 $CONN->send ("apply $item->{tag}"); 1350 $CONN->send ("apply $item->{tag}");
1327 } elsif ($ev->{button} == 3) { 1351 } elsif ($ev->{button} == 3) {
1328 # examine, lock, mark, maybe other things 1352 CFClient::UI::Menu->new (
1329 warn "MENU not implemented yet\n"; 1353 items => [
1354 ["examine", sub { $CONN->send ("examine $item->{tag}") }],
1355 [
1356 $item->{flags} & Crossfire::Protocol::F_LOCKED ? "lock" : "unlock",
1357 sub { $CONN->send ("lock $item->{tag}") },
1358 ],
1359 ["mark", sub { $CONN->send ("mark $item->{tag}") }],
1360 ["apply", sub { $CONN->send ("apply $item->{tag}") }],
1361 ],
1362 )->popup ($ev);
1330 } 1363 }
1331 1364
1332 1 1365 1
1333 }, 1366 },
1334 ); 1367 );
1351 1384
1352sub conn::container_add { 1385sub conn::container_add {
1353 my ($self, $id, $items) = @_; 1386 my ($self, $id, $items) = @_;
1354 1387
1355 update_floorbox if $id == 0; 1388 update_floorbox if $id == 0;
1389 if ($self->{player}{tag} == $id) {
1390 $INV->set_items ($self->{container}{$self->{player}{tag}});
1391 }
1356 # $self-<{player}{tag} => player inv 1392 # $self-<{player}{tag} => player inv
1357 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; 1393 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}};
1358} 1394}
1359 1395
1360sub conn::container_clear { 1396sub conn::container_clear {
1361 my ($self, $id) = @_; 1397 my ($self, $id) = @_;
1362 1398
1363 update_floorbox if $id == 0; 1399 update_floorbox if $id == 0;
1400 if ($self->{player}{tag} == $id) {
1401 $INV->set_items ($self->{container}{$id});
1402 }
1403
1364# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; 1404# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
1365} 1405}
1366 1406
1367sub conn::item_delete { 1407sub conn::item_delete {
1368 my ($self, @items) = @_; 1408 my ($self, @items) = @_;
1369 1409
1370 for (@items) { 1410 for (@items) {
1371 update_floorbox if $_->{container} == 0; 1411 update_floorbox if $_->{container} == 0;
1412 if ($self->{player}{tag} == $_->{container}) {
1413 $INV->set_items ($self->{container}{$_->{container}});
1414 }
1372 } 1415 }
1373} 1416}
1374 1417
1375sub conn::item_update { 1418sub conn::item_update {
1376 my ($self, $item) = @_; 1419 my ($self, $item) = @_;
1377 1420
1378 update_floorbox if $item->{container} == 0; 1421 update_floorbox if $item->{container} == 0;
1422 if ($self->{player}{tag} == $item->{container}) {
1423 $INV->set_items ($self->{container}{$item->{container}});
1424 }
1379} 1425}
1380 1426
1381%SDL_CB = ( 1427%SDL_CB = (
1382 CFClient::SDL_QUIT => sub { 1428 CFClient::SDL_QUIT => sub {
1383 Event::unloop -1; 1429 Event::unloop -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines