… | |
… | |
100 | our $DEBUG_STATUS; |
100 | our $DEBUG_STATUS; |
101 | |
101 | |
102 | our $INVWIN; |
102 | our $INVWIN; |
103 | our $INV; |
103 | our $INV; |
104 | our $INVR; |
104 | our $INVR; |
|
|
105 | our $INVR_LBL; |
105 | our $OPENCONT; |
106 | our $OPENCONT; |
106 | |
107 | |
107 | sub status { |
108 | sub status { |
108 | $STATUSBOX->add ($_[0], pri => -10, group => "status", timeout => 20, fg => [1, 1, 0, 1]); |
109 | $STATUSBOX->add ($_[0], pri => -10, group => "status", timeout => 20, fg => [1, 1, 0, 1]); |
109 | } |
110 | } |
… | |
… | |
813 | sub make_inventory_window { |
814 | sub make_inventory_window { |
814 | my $invwin = new CFClient::UI::FancyFrame |
815 | my $invwin = new CFClient::UI::FancyFrame |
815 | user_w => $WIDTH * (4/5), user_h => $HEIGHT * (4/5), title => "Inventory"; |
816 | user_w => $WIDTH * (4/5), user_h => $HEIGHT * (4/5), title => "Inventory"; |
816 | |
817 | |
817 | $invwin->add (my $hb = new CFClient::UI::HBox); |
818 | $invwin->add (my $hb = new CFClient::UI::HBox); |
|
|
819 | |
|
|
820 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
|
|
821 | $vb1->add (my $lbl = new CFClient::UI::Label); |
|
|
822 | $lbl->set_text ("Player"); |
818 | $hb->add ($INV = new CFClient::UI::Inventory expand => 1); |
823 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
|
|
824 | |
|
|
825 | $hb->add (my $vb2 = new CFClient::UI::VBox expand => 1); |
|
|
826 | $vb2->add ($INVR_LBL = new CFClient::UI::Label); |
|
|
827 | $INVR_LBL->set_text ("Floor"); |
819 | $hb->add ($INVR = new CFClient::UI::Inventory expand => 1); |
828 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
820 | |
829 | |
821 | $invwin |
830 | $invwin |
822 | } |
831 | } |
823 | |
832 | |
824 | sub sdl_init { |
833 | sub sdl_init { |
… | |
… | |
1481 | #d# print "container_add: container $tag ($self->{player}{tag})\n"; |
1490 | #d# print "container_add: container $tag ($self->{player}{tag})\n"; |
1482 | |
1491 | |
1483 | if ($tag == 0) { |
1492 | if ($tag == 0) { |
1484 | update_floorbox; |
1493 | update_floorbox; |
1485 | $OPENCONT = 0; |
1494 | $OPENCONT = 0; |
|
|
1495 | $INVR_LBL->set_text ("Floor"); |
1486 | $INVR->set_items ($self->{container}{0}); |
1496 | $INVR->set_items ($self->{container}{0}); |
1487 | } elsif ($tag == $self->{player}{tag}) { |
1497 | } elsif ($tag == $self->{player}{tag}) { |
|
|
1498 | $INVR_LBL->set_text ("Player"); |
1488 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1499 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1489 | } else { |
1500 | } else { |
1490 | $OPENCONT = $tag; |
1501 | $OPENCONT = $tag; |
|
|
1502 | $INVR_LBL->set_text (CFClient::UI::InventoryItem::_item_to_desc ($self->{item}->{$OPENCONT})); |
1491 | $INVR->set_items ($self->{container}{$tag}); |
1503 | $INVR->set_items ($self->{container}{$tag}); |
1492 | } |
1504 | } |
1493 | |
1505 | |
1494 | # $self-<{player}{tag} => player inv |
1506 | # $self-<{player}{tag} => player inv |
1495 | #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; |
1507 | #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; |
… | |
… | |
1501 | #d# print "container_clear: container $tag ($self->{player}{tag})\n"; |
1513 | #d# print "container_clear: container $tag ($self->{player}{tag})\n"; |
1502 | |
1514 | |
1503 | if ($tag == 0) { |
1515 | if ($tag == 0) { |
1504 | update_floorbox; |
1516 | update_floorbox; |
1505 | $OPENCONT = 0; |
1517 | $OPENCONT = 0; |
|
|
1518 | $INVR_LBL->set_text ("Floor"); |
1506 | $INVR->set_items ($self->{container}{0}); |
1519 | $INVR->set_items ($self->{container}{0}); |
1507 | } elsif ($tag == $self->{player}{tag}) { |
1520 | } elsif ($tag == $self->{player}{tag}) { |
|
|
1521 | $INVR_LBL->set_text ("Player"); |
1508 | $INV->set_items ($self->{container}{$tag}) |
1522 | $INV->set_items ($self->{container}{$tag}) |
1509 | } else { |
1523 | } else { |
1510 | $OPENCONT = $tag; |
1524 | $OPENCONT = $tag; |
|
|
1525 | $INVR_LBL->set_text (CFClient::UI::InventoryItem::_item_to_desc ($self->{item}->{$OPENCONT})); |
1511 | $INVR->set_items ($self->{container}{$tag}); |
1526 | $INVR->set_items ($self->{container}{$tag}); |
1512 | } |
1527 | } |
1513 | |
1528 | |
1514 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
1529 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
1515 | } |
1530 | } |
… | |
… | |
1521 | #d# print "item_delete: $_->{tag} from $_->{container} ($self->{player}{tag})\n"; |
1536 | #d# print "item_delete: $_->{tag} from $_->{container} ($self->{player}{tag})\n"; |
1522 | |
1537 | |
1523 | if ($_->{container} == 0) { |
1538 | if ($_->{container} == 0) { |
1524 | update_floorbox; |
1539 | update_floorbox; |
1525 | $OPENCONT = 0; |
1540 | $OPENCONT = 0; |
|
|
1541 | $INVR_LBL->set_text ("Floor"); |
1526 | $INVR->set_items ($self->{container}{0}); |
1542 | $INVR->set_items ($self->{container}{0}); |
1527 | } elsif ($_->{container} == $self->{player}{tag}) { |
1543 | } elsif ($_->{container} == $self->{player}{tag}) { |
|
|
1544 | $INVR_LBL->set_text ("Player"); |
1528 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1545 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1529 | } else { |
1546 | } else { |
1530 | $OPENCONT = $_->{container}; |
1547 | $OPENCONT = $_->{container}; |
|
|
1548 | $INVR_LBL->set_text (CFClient::UI::InventoryItem::_item_to_desc ($self->{item}->{$OPENCONT})); |
1531 | $INVR->set_items ($self->{container}{$_->{container}}); |
1549 | $INVR->set_items ($self->{container}{$_->{container}}); |
1532 | } |
1550 | } |
1533 | } |
1551 | } |
1534 | } |
1552 | } |
1535 | |
1553 | |
… | |
… | |
1538 | |
1556 | |
1539 | #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($OPENCONT)\n"; |
1557 | #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($OPENCONT)\n"; |
1540 | |
1558 | |
1541 | if ($item->{tag} == $OPENCONT && not ($item->{flags} & Crossfire::Protocol::F_OPEN)) { |
1559 | if ($item->{tag} == $OPENCONT && not ($item->{flags} & Crossfire::Protocol::F_OPEN)) { |
1542 | $OPENCONT = 0; |
1560 | $OPENCONT = 0; |
|
|
1561 | $INVR_LBL->set_text ("Floor"); |
1543 | $INVR->set_items ($self->{container}{0}); |
1562 | $INVR->set_items ($self->{container}{0}); |
|
|
1563 | |
|
|
1564 | $item->{widget}->update_item |
|
|
1565 | if $item->{widget}; |
1544 | } else { |
1566 | } else { |
1545 | if ($item->{container} == 0) { |
1567 | if ($item->{container} == 0) { |
1546 | update_floorbox; |
1568 | update_floorbox; |
1547 | $OPENCONT = 0; |
1569 | $OPENCONT = 0; |
|
|
1570 | $INVR_LBL->set_text ("Floor"); |
1548 | $INVR->set_items ($self->{container}{0}); |
1571 | $INVR->set_items ($self->{container}{0}); |
1549 | } elsif ($item->{container} == $self->{player}{tag}) { |
1572 | } elsif ($item->{container} == $self->{player}{tag}) { |
1550 | $INV->set_items ($self->{container}{$item->{container}}) |
1573 | $INV->set_items ($self->{container}{$item->{container}}) |
1551 | } |
1574 | } |
1552 | } |
1575 | } |