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.190 by elmex, Thu Apr 27 08:55:35 2006 UTC vs.
Revision 1.192 by root, Fri Apr 28 18:06:13 2006 UTC

91our %AUDIO_CHUNKS; # audio files 91our %AUDIO_CHUNKS; # audio files
92 92
93our $ALT_ENTER_MESSAGE; 93our $ALT_ENTER_MESSAGE;
94our $STATUS_LINE; 94our $STATUS_LINE;
95our $DEBUG_STATUS; 95our $DEBUG_STATUS;
96
97our $INVWIN;
98our $INV;
96 99
97sub status { 100sub status {
98 $STATUS_LINE->set_text ($_[0]); 101 $STATUS_LINE->set_text ($_[0]);
99 $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});
100} 103}
778 }; 781 };
779 782
780 $window 783 $window
781} 784}
782 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
783sub sdl_init { 795sub sdl_init {
784 CFClient::SDL_Init 796 CFClient::SDL_Init
785 and die "SDL::Init failed!\n"; 797 and die "SDL::Init failed!\n";
786} 798}
787 799
846 858
847 $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);
848 $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);
849 $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);
850 862
851 $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
852 $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);
853 867
854 $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 {
855 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; 869 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
856 status "Configuration Saved"; 870 status "Configuration Saved";
857 }); 871 });
1370 1384
1371sub conn::container_add { 1385sub conn::container_add {
1372 my ($self, $id, $items) = @_; 1386 my ($self, $id, $items) = @_;
1373 1387
1374 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 }
1375 # $self-<{player}{tag} => player inv 1392 # $self-<{player}{tag} => player inv
1376 #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}};
1377} 1394}
1378 1395
1379sub conn::container_clear { 1396sub conn::container_clear {
1380 my ($self, $id) = @_; 1397 my ($self, $id) = @_;
1381 1398
1382 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
1383# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; 1404# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
1384} 1405}
1385 1406
1386sub conn::item_delete { 1407sub conn::item_delete {
1387 my ($self, @items) = @_; 1408 my ($self, @items) = @_;
1388 1409
1389 for (@items) { 1410 for (@items) {
1390 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 }
1391 } 1415 }
1392} 1416}
1393 1417
1394sub conn::item_update { 1418sub conn::item_update {
1395 my ($self, $item) = @_; 1419 my ($self, $item) = @_;
1396 1420
1397 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 }
1398} 1425}
1399 1426
1400%SDL_CB = ( 1427%SDL_CB = (
1401 CFClient::SDL_QUIT => sub { 1428 CFClient::SDL_QUIT => sub {
1402 Event::unloop -1; 1429 Event::unloop -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines