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.216 by root, Mon May 15 17:45:31 2006 UTC vs.
Revision 1.217 by elmex, Mon May 15 18:23:33 2006 UTC

99our $STATUSBOX; 99our $STATUSBOX;
100our $DEBUG_STATUS; 100our $DEBUG_STATUS;
101 101
102our $INVWIN; 102our $INVWIN;
103our $INV; 103our $INV;
104our $INVR;
105our $OPENCONT;
104 106
105sub status { 107sub status {
106 $STATUSBOX->add ($_[0], pri => -10, group => "status", timeout => 20, fg => [1, 1, 0, 1]); 108 $STATUSBOX->add ($_[0], pri => -10, group => "status", timeout => 20, fg => [1, 1, 0, 1]);
107} 109}
108 110
807 809
808 $window 810 $window
809} 811}
810 812
811sub make_inventory_window { 813sub make_inventory_window {
812 my $invwin = new CFClient::UI::FancyFrame user_w => 300, user_h => 300, title => "Inventory"; 814 my $invwin = new CFClient::UI::FancyFrame
815 user_w => $WIDTH * (4/5), user_h => $HEIGHT * (4/5), title => "Inventory";
816
817 $invwin->add (my $hb = new CFClient::UI::HBox);
813 $invwin->add ($INV = new CFClient::UI::Inventory expand => 1); 818 $hb->add ($INV = new CFClient::UI::Inventory expand => 1);
819 $hb->add ($INVR = new CFClient::UI::Inventory expand => 1);
820
814 $invwin 821 $invwin
815} 822}
816 823
817sub sdl_init { 824sub sdl_init {
818 CFClient::SDL_Init 825 CFClient::SDL_Init
1399} 1406}
1400 1407
1401sub conn::container_add { 1408sub conn::container_add {
1402 my ($self, $tag, $items) = @_; 1409 my ($self, $tag, $items) = @_;
1403 1410
1404 update_floorbox if $tag == 0; 1411 print "container_add on conainer $tag (player: $self->{player}{tag})\n";
1405 1412
1413 if ($tag == 0) {
1414 update_floorbox;
1415 $INVR->set_items ($self->{container}{0});
1416 $OPENCONT = 0;
1417 } elsif ($tag == $self->{player}{tag}) {
1406 $INV->set_items ($self->{container}{$self->{player}{tag}}) 1418 $INV->set_items ($self->{container}{$self->{player}{tag}})
1407 if $tag == $self->{player}{tag}; 1419 } else {
1420 $OPENCONT = $tag;
1421 $INVR->set_items ($self->{container}{$tag});
1422 }
1408 1423
1409 # $self-<{player}{tag} => player inv 1424 # $self-<{player}{tag} => player inv
1410 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; 1425 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}};
1411} 1426}
1412 1427
1413sub conn::container_clear { 1428sub conn::container_clear {
1414 my ($self, $tag) = @_; 1429 my ($self, $tag) = @_;
1415 1430
1416 update_floorbox if $tag == 0; 1431 print "container_clear on conainer $tag (player: $self->{player}{tag})\n";
1417 1432
1433 if ($tag == 0) {
1434 update_floorbox;
1435 $INVR->set_items ($self->{container}{0});
1436 $OPENCONT = 0;
1437 } elsif ($tag == $self->{player}{tag}) {
1418 $INV->set_items ($self->{container}{$tag}) 1438 $INV->set_items ($self->{container}{$tag})
1419 if $tag == $self->{player}{tag}; 1439 } else {
1440 $INVR->set_items ($self->{container}{$tag});
1441 $OPENCONT = $tag;
1442 }
1420 1443
1421# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; 1444# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
1422} 1445}
1423 1446
1424sub conn::item_delete { 1447sub conn::item_delete {
1425 my ($self, @items) = @_; 1448 my ($self, @items) = @_;
1426 1449
1427 for (@items) { 1450 for (@items) {
1428 update_floorbox if $_->{container} == 0; 1451 print "item_delete on container $_->{container} (player: $self->{player}{tag})\n";
1429 1452 if ($_->{container} == 0) {
1453 update_floorbox;
1430 $INV->set_items ($self->{container}{$_->{container}}) 1454 $INVR->set_items ($self->{container}{0});
1431 if $_->{container} == $self->{player}{tag}; 1455 } elsif ($_->{container} == $self->{player}{tag}) {
1456 $INV->set_items ($self->{container}{$self->{player}{tag}})
1457 } else {
1458 $INVR->set_items ($self->{container}{0});
1459 }
1432 } 1460 }
1433} 1461}
1434 1462
1435sub conn::item_update { 1463sub conn::item_update {
1436 my ($self, $item) = @_; 1464 my ($self, $item) = @_;
1437 1465
1438 update_floorbox if $item->{container} == 0; 1466 print "item_update: container: $item->{container} (player: $self->{player}{tag})\n";
1439 1467
1468 if ($item->{container} == 0) {
1469 update_floorbox;
1470 $INVR->set_items ($self->{container}{0});
1471 } elsif ($item->{container} == $self->{player}{tag}) {
1440 $INV->set_items ($self->{container}{$item->{container}}) 1472 $INV->set_items ($self->{container}{$item->{container}})
1441 if $item->{container} == $self->{player}{tag}; 1473 }
1442} 1474}
1443 1475
1444%SDL_CB = ( 1476%SDL_CB = (
1445 CFClient::SDL_QUIT => sub { 1477 CFClient::SDL_QUIT => sub {
1446 Event::unloop -1; 1478 Event::unloop -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines