… | |
… | |
1370 | my ($self) = @_; |
1370 | my ($self) = @_; |
1371 | |
1371 | |
1372 | $MAPWIDGET->clr_commands; |
1372 | $MAPWIDGET->clr_commands; |
1373 | |
1373 | |
1374 | for my $skill (values %{$self->{skill_info}}) { |
1374 | for my $skill (values %{$self->{skill_info}}) { |
1375 | $MAPWIDGET->add_command ("ready_\\skill $skill", "Ready the skill '$skill'"); |
1375 | $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'"); |
1376 | $MAPWIDGET->add_command ("use_\\skill $skill", "Immediately use the skill '$skill'"); |
1376 | $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'"); |
1377 | } |
1377 | } |
1378 | |
1378 | |
1379 | $MAPWIDGET->add_command ("pet\\mode defend", "Tell pets to stay close to you and defend you"); |
1379 | $MAPWIDGET->add_command ("petmode defend", "Tell pets to stay close to you and defend you"); |
1380 | $MAPWIDGET->add_command ("pet\\mode arena", "Same as petmode sad, but also attack other players"); |
1380 | $MAPWIDGET->add_command ("petmode arena", "Same as petmode sad, but also attack other players"); |
1381 | $MAPWIDGET->add_command ("pet\\mode sad", "Search & Destroy - tell pets to roam about and attack enemies"); |
1381 | $MAPWIDGET->add_command ("petmode sad", "Search & Destroy - tell pets to roam about and attack enemies"); |
1382 | $MAPWIDGET->add_command ("kill\\pets", "Kill your pets"); |
1382 | $MAPWIDGET->add_command ("killpets", "Kill your pets"); |
1383 | $MAPWIDGET->add_command ("chat", "chat TEXT\nChat with all other players"); |
1383 | $MAPWIDGET->add_command ("chat", "chat TEXT\nChat with all other players"); |
1384 | $MAPWIDGET->add_command ("shout", "shout TEXT\nShout loudly, used for emergencies"); |
1384 | $MAPWIDGET->add_command ("shout", "shout TEXT\nShout loudly, used for emergencies"); |
1385 | $MAPWIDGET->add_command ("tell", "tell USERNAME TEXT\nPrivately tell a specific player"); |
1385 | $MAPWIDGET->add_command ("tell", "tell USERNAME TEXT\nPrivately tell a specific player"); |
1386 | |
1386 | |
1387 | # TODO: add documentation on these |
1387 | # TODO: add documentation on these |
1388 | for (qw( |
1388 | for (qw( |
1389 | save |
1389 | afk |
1390 | sound |
|
|
1391 | party |
|
|
1392 | gsay |
|
|
1393 | apply |
1390 | apply |
1394 | applymode |
|
|
1395 | body |
1391 | body |
|
|
1392 | bowmode |
1396 | brace |
1393 | brace |
1397 | build |
1394 | build |
1398 | disarm |
1395 | disarm |
1399 | dm |
1396 | dm |
1400 | dmhide |
1397 | dmhide |
1401 | drop |
1398 | drop |
1402 | dropall |
1399 | dropall |
1403 | examine |
1400 | examine |
1404 | get |
1401 | get |
|
|
1402 | gsay |
1405 | help |
1403 | help |
1406 | hiscore |
1404 | hiscore |
1407 | inventory |
1405 | inventory |
1408 | invoke |
1406 | invoke |
1409 | killpets |
1407 | killpets |
1410 | listen |
1408 | listen |
1411 | logs |
1409 | logs |
|
|
1410 | mapinfo |
1412 | maps |
1411 | maps |
1413 | mapinfo |
|
|
1414 | mark |
1412 | mark |
1415 | motd |
1413 | motd |
|
|
1414 | output-count |
1416 | output-sync |
1415 | output-sync |
1417 | output-count |
1416 | party |
1418 | peaceful |
1417 | peaceful |
|
|
1418 | petmode |
1419 | pickup |
1419 | pickup |
1420 | players |
1420 | players |
1421 | prepare |
1421 | prepare |
|
|
1422 | quests |
1422 | rename |
1423 | rename |
1423 | resistances |
1424 | resistances |
1424 | rotateshoottype |
1425 | rotateshoottype |
1425 | skills |
1426 | save |
1426 | quests |
1427 | say |
1427 | search |
1428 | search |
1428 | search-items |
1429 | search-items |
1429 | showpets |
1430 | showpets |
|
|
1431 | skills |
|
|
1432 | sound |
1430 | take |
1433 | take |
1431 | throw |
1434 | throw |
1432 | time |
1435 | time |
|
|
1436 | title |
|
|
1437 | usekeys |
|
|
1438 | version |
1433 | weather |
1439 | weather |
1434 | whereabouts |
1440 | whereabouts |
1435 | whereami |
1441 | whereami |
1436 | title |
1442 | who |
1437 | usekeys |
|
|
1438 | bowmode |
|
|
1439 | petmode |
|
|
1440 | version |
|
|
1441 | wimpy |
1443 | wimpy |
1442 | who |
|
|
1443 | afk |
|
|
1444 | )) { |
1444 | )) { |
1445 | $MAPWIDGET->add_command ($_, "$_: no help available (yet)"); |
1445 | $MAPWIDGET->add_command ($_, "$_: no help available (yet)"); |
1446 | } |
1446 | } |
1447 | |
1447 | |
1448 | #TODO: add " and ' "aliases" etc. |
1448 | #TODO: add " and ' "aliases" etc. |
… | |
… | |
1476 | } |
1476 | } |
1477 | |
1477 | |
1478 | sub conn::container_add { |
1478 | sub conn::container_add { |
1479 | my ($self, $tag, $items) = @_; |
1479 | my ($self, $tag, $items) = @_; |
1480 | |
1480 | |
|
|
1481 | #d# print "container_add: container $tag ($self->{player}{tag})\n"; |
|
|
1482 | |
1481 | if ($tag == 0) { |
1483 | if ($tag == 0) { |
1482 | update_floorbox; |
1484 | update_floorbox; |
|
|
1485 | $OPENCONT = 0; |
1483 | $INVR->set_items ($self->{container}{0}); |
1486 | $INVR->set_items ($self->{container}{0}); |
1484 | $OPENCONT = 0; |
|
|
1485 | } elsif ($tag == $self->{player}{tag}) { |
1487 | } elsif ($tag == $self->{player}{tag}) { |
1486 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1488 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1487 | } else { |
1489 | } else { |
1488 | $OPENCONT = $tag; |
1490 | $OPENCONT = $tag; |
1489 | $INVR->set_items ($self->{container}{$tag}); |
1491 | $INVR->set_items ($self->{container}{$tag}); |
… | |
… | |
1494 | } |
1496 | } |
1495 | |
1497 | |
1496 | sub conn::container_clear { |
1498 | sub conn::container_clear { |
1497 | my ($self, $tag) = @_; |
1499 | my ($self, $tag) = @_; |
1498 | |
1500 | |
|
|
1501 | #d# print "container_clear: container $tag ($self->{player}{tag})\n"; |
|
|
1502 | |
1499 | if ($tag == 0) { |
1503 | if ($tag == 0) { |
1500 | update_floorbox; |
1504 | update_floorbox; |
|
|
1505 | $OPENCONT = 0; |
1501 | $INVR->set_items ($self->{container}{0}); |
1506 | $INVR->set_items ($self->{container}{0}); |
1502 | $OPENCONT = 0; |
|
|
1503 | } elsif ($tag == $self->{player}{tag}) { |
1507 | } elsif ($tag == $self->{player}{tag}) { |
1504 | $INV->set_items ($self->{container}{$tag}) |
1508 | $INV->set_items ($self->{container}{$tag}) |
1505 | } else { |
1509 | } else { |
|
|
1510 | $OPENCONT = $tag; |
1506 | $INVR->set_items ($self->{container}{$tag}); |
1511 | $INVR->set_items ($self->{container}{$tag}); |
1507 | $OPENCONT = $tag; |
|
|
1508 | } |
1512 | } |
1509 | |
1513 | |
1510 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
1514 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
1511 | } |
1515 | } |
1512 | |
1516 | |
1513 | sub conn::item_delete { |
1517 | sub conn::item_delete { |
1514 | my ($self, @items) = @_; |
1518 | my ($self, @items) = @_; |
1515 | |
1519 | |
1516 | for (@items) { |
1520 | for (@items) { |
|
|
1521 | #d# print "item_delete: $_->{tag} from $_->{container} ($self->{player}{tag})\n"; |
|
|
1522 | |
1517 | if ($_->{container} == 0) { |
1523 | if ($_->{container} == 0) { |
1518 | update_floorbox; |
1524 | update_floorbox; |
|
|
1525 | $OPENCONT = 0; |
1519 | $INVR->set_items ($self->{container}{0}); |
1526 | $INVR->set_items ($self->{container}{0}); |
1520 | } elsif ($_->{container} == $self->{player}{tag}) { |
1527 | } elsif ($_->{container} == $self->{player}{tag}) { |
1521 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1528 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1522 | } else { |
1529 | } else { |
|
|
1530 | $OPENCONT = $_->{container}; |
1523 | $INVR->set_items ($self->{container}{0}); |
1531 | $INVR->set_items ($self->{container}{$_->{container}}); |
1524 | } |
1532 | } |
1525 | } |
1533 | } |
1526 | } |
1534 | } |
1527 | |
1535 | |
1528 | sub conn::item_update { |
1536 | sub conn::item_update { |
1529 | my ($self, $item) = @_; |
1537 | my ($self, $item) = @_; |
1530 | |
1538 | |
1531 | if ($item->{container} == 0) { |
1539 | #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($OPENCONT)\n"; |
1532 | update_floorbox; |
1540 | |
|
|
1541 | if ($item->{tag} == $OPENCONT && not ($item->{flags} & Crossfire::Protocol::F_OPEN)) { |
|
|
1542 | $OPENCONT = 0; |
1533 | $INVR->set_items ($self->{container}{0}); |
1543 | $INVR->set_items ($self->{container}{0}); |
|
|
1544 | } else { |
|
|
1545 | if ($item->{container} == 0) { |
|
|
1546 | update_floorbox; |
|
|
1547 | $OPENCONT = 0; |
|
|
1548 | $INVR->set_items ($self->{container}{0}); |
1534 | } elsif ($item->{container} == $self->{player}{tag}) { |
1549 | } elsif ($item->{container} == $self->{player}{tag}) { |
1535 | $INV->set_items ($self->{container}{$item->{container}}) |
1550 | $INV->set_items ($self->{container}{$item->{container}}) |
|
|
1551 | } |
1536 | } |
1552 | } |
1537 | } |
1553 | } |
1538 | |
1554 | |
1539 | %SDL_CB = ( |
1555 | %SDL_CB = ( |
1540 | CFClient::SDL_QUIT => sub { |
1556 | CFClient::SDL_QUIT => sub { |