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.191 by elmex, Fri Apr 28 05:17:24 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
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 $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
852 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window); 864 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window);
865 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window);
853 866
854 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { 867 $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub {
855 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; 868 CFClient::write_cfg "$Crossfire::VARDIR/pclientrc";
856 status "Configuration Saved"; 869 status "Configuration Saved";
857 }); 870 });
1370 1383
1371sub conn::container_add { 1384sub conn::container_add {
1372 my ($self, $id, $items) = @_; 1385 my ($self, $id, $items) = @_;
1373 1386
1374 update_floorbox if $id == 0; 1387 update_floorbox if $id == 0;
1388 if ($self->{player}{tag} == $id) {
1389 $INV->set_items ($self->{container}{$self->{player}{tag}});
1390 }
1375 # $self-<{player}{tag} => player inv 1391 # $self-<{player}{tag} => player inv
1376 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; 1392 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}};
1377} 1393}
1378 1394
1379sub conn::container_clear { 1395sub conn::container_clear {
1380 my ($self, $id) = @_; 1396 my ($self, $id) = @_;
1381 1397
1382 update_floorbox if $id == 0; 1398 update_floorbox if $id == 0;
1399 if ($self->{player}{tag} == $id) {
1400 $INV->set_items ($self->{container}{$id});
1401 }
1402
1383# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; 1403# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
1384} 1404}
1385 1405
1386sub conn::item_delete { 1406sub conn::item_delete {
1387 my ($self, @items) = @_; 1407 my ($self, @items) = @_;
1388 1408
1389 for (@items) { 1409 for (@items) {
1390 update_floorbox if $_->{container} == 0; 1410 update_floorbox if $_->{container} == 0;
1411 if ($self->{player}{tag} == $_->{container}) {
1412 $INV->set_items ($self->{container}{$_->{container}});
1413 }
1391 } 1414 }
1392} 1415}
1393 1416
1394sub conn::item_update { 1417sub conn::item_update {
1395 my ($self, $item) = @_; 1418 my ($self, $item) = @_;
1396 1419
1397 update_floorbox if $item->{container} == 0; 1420 update_floorbox if $item->{container} == 0;
1421 if ($self->{player}{tag} == $item->{container}) {
1422 $INV->set_items ($self->{container}{$item->{container}});
1423 }
1398} 1424}
1399 1425
1400%SDL_CB = ( 1426%SDL_CB = (
1401 CFClient::SDL_QUIT => sub { 1427 CFClient::SDL_QUIT => sub {
1402 Event::unloop -1; 1428 Event::unloop -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines