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.217 by elmex, Mon May 15 18:23:33 2006 UTC vs.
Revision 1.222 by elmex, Wed May 17 10:33:03 2006 UTC

1330 [0.74, 0.65, 0.41], 1330 [0.74, 0.65, 0.41],
1331 ); 1331 );
1332 1332
1333 my $time = sprintf "%02d:%02d:%02d", (localtime time)[2,1,0]; 1333 my $time = sprintf "%02d:%02d:%02d", (localtime time)[2,1,0];
1334 1334
1335 $text =~ s/&/&amp;/g; $text =~ s/</&lt;/g; 1335 $text = CFClient::UI::Label::escape $text;
1336 $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; 1336 $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g;
1337 $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; 1337 $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g;
1338 1338
1339 $LOGVIEW->add_paragraph ($color[$color], 1339 $LOGVIEW->add_paragraph ($color[$color],
1340 join "\n", map "$time $_", split /\n/, $text); 1340 join "\n", map "$time $_", split /\n/, $text);
1367} 1367}
1368 1368
1369sub conn::addme_success { 1369sub conn::addme_success {
1370 my ($self) = @_; 1370 my ($self) = @_;
1371 1371
1372 $MAPWIDGET->clr_commands;
1373
1372 for my $skill (values %{$self->{skill_info}}) { 1374 for my $skill (values %{$self->{skill_info}}) {
1373 $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'"); 1375 $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'");
1374 $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'"); 1376 $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'");
1375 } 1377 }
1376 1378
1377 $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");
1378 $MAPWIDGET->add_command ("pet\\_mode arena", "Same as petmode attack, but also attack other players"); 1380 $MAPWIDGET->add_command ("petmode arena", "Same as petmode sad, but also attack other players");
1379 $MAPWIDGET->add_command ("pet\\_mode sad", "Search &amp; Destroy - tell pets to roam about and attack enemies"); 1381 $MAPWIDGET->add_command ("petmode sad", "Search &amp; Destroy - tell pets to roam about and attack enemies");
1380 $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");
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");
1386
1387 # TODO: add documentation on these
1388 for (qw(
1389 afk
1390 apply
1391 body
1392 bowmode
1393 brace
1394 build
1395 disarm
1396 dm
1397 dmhide
1398 drop
1399 dropall
1400 examine
1401 get
1402 gsay
1403 help
1404 hiscore
1405 inventory
1406 invoke
1407 killpets
1408 listen
1409 logs
1410 mapinfo
1411 maps
1412 mark
1413 motd
1414 output-count
1415 output-sync
1416 party
1417 peaceful
1418 petmode
1419 pickup
1420 players
1421 prepare
1422 quests
1423 rename
1424 resistances
1425 rotateshoottype
1426 save
1427 say
1428 search
1429 search-items
1430 showpets
1431 skills
1432 sound
1433 take
1434 throw
1435 time
1436 title
1437 usekeys
1438 version
1439 weather
1440 whereabouts
1441 whereami
1442 who
1443 wimpy
1444 )) {
1445 $MAPWIDGET->add_command ($_, "$_: no help available (yet)");
1446 }
1447
1448 #TODO: add " and ' "aliases" etc.
1381} 1449}
1382 1450
1383sub conn::eof { 1451sub conn::eof {
1452 $MAPWIDGET->clr_commands;
1453
1384 stop_game; 1454 stop_game;
1385} 1455}
1386 1456
1387sub update_floorbox { 1457sub update_floorbox {
1388 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { 1458 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub {
1406} 1476}
1407 1477
1408sub conn::container_add { 1478sub conn::container_add {
1409 my ($self, $tag, $items) = @_; 1479 my ($self, $tag, $items) = @_;
1410 1480
1411 print "container_add on conainer $tag (player: $self->{player}{tag})\n"; 1481 #d# print "container_add: container $tag ($self->{player}{tag})\n";
1412 1482
1413 if ($tag == 0) { 1483 if ($tag == 0) {
1414 update_floorbox; 1484 update_floorbox;
1485 $OPENCONT = 0;
1415 $INVR->set_items ($self->{container}{0}); 1486 $INVR->set_items ($self->{container}{0});
1416 $OPENCONT = 0;
1417 } elsif ($tag == $self->{player}{tag}) { 1487 } elsif ($tag == $self->{player}{tag}) {
1418 $INV->set_items ($self->{container}{$self->{player}{tag}}) 1488 $INV->set_items ($self->{container}{$self->{player}{tag}})
1419 } else { 1489 } else {
1420 $OPENCONT = $tag; 1490 $OPENCONT = $tag;
1421 $INVR->set_items ($self->{container}{$tag}); 1491 $INVR->set_items ($self->{container}{$tag});
1426} 1496}
1427 1497
1428sub conn::container_clear { 1498sub conn::container_clear {
1429 my ($self, $tag) = @_; 1499 my ($self, $tag) = @_;
1430 1500
1431 print "container_clear on conainer $tag (player: $self->{player}{tag})\n"; 1501 #d# print "container_clear: container $tag ($self->{player}{tag})\n";
1432 1502
1433 if ($tag == 0) { 1503 if ($tag == 0) {
1434 update_floorbox; 1504 update_floorbox;
1505 $OPENCONT = 0;
1435 $INVR->set_items ($self->{container}{0}); 1506 $INVR->set_items ($self->{container}{0});
1436 $OPENCONT = 0;
1437 } elsif ($tag == $self->{player}{tag}) { 1507 } elsif ($tag == $self->{player}{tag}) {
1438 $INV->set_items ($self->{container}{$tag}) 1508 $INV->set_items ($self->{container}{$tag})
1439 } else { 1509 } else {
1510 $OPENCONT = $tag;
1440 $INVR->set_items ($self->{container}{$tag}); 1511 $INVR->set_items ($self->{container}{$tag});
1441 $OPENCONT = $tag;
1442 } 1512 }
1443 1513
1444# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; 1514# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
1445} 1515}
1446 1516
1447sub conn::item_delete { 1517sub conn::item_delete {
1448 my ($self, @items) = @_; 1518 my ($self, @items) = @_;
1449 1519
1450 for (@items) { 1520 for (@items) {
1451 print "item_delete on container $_->{container} (player: $self->{player}{tag})\n"; 1521 #d# print "item_delete: $_->{tag} from $_->{container} ($self->{player}{tag})\n";
1522
1452 if ($_->{container} == 0) { 1523 if ($_->{container} == 0) {
1453 update_floorbox; 1524 update_floorbox;
1525 $OPENCONT = 0;
1454 $INVR->set_items ($self->{container}{0}); 1526 $INVR->set_items ($self->{container}{0});
1455 } elsif ($_->{container} == $self->{player}{tag}) { 1527 } elsif ($_->{container} == $self->{player}{tag}) {
1456 $INV->set_items ($self->{container}{$self->{player}{tag}}) 1528 $INV->set_items ($self->{container}{$self->{player}{tag}})
1457 } else { 1529 } else {
1530 $OPENCONT = $_->{container};
1458 $INVR->set_items ($self->{container}{0}); 1531 $INVR->set_items ($self->{container}{$_->{container}});
1459 } 1532 }
1460 } 1533 }
1461} 1534}
1462 1535
1463sub conn::item_update { 1536sub conn::item_update {
1464 my ($self, $item) = @_; 1537 my ($self, $item) = @_;
1465 1538
1466 print "item_update: container: $item->{container} (player: $self->{player}{tag})\n"; 1539 #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($OPENCONT)\n";
1467 1540
1468 if ($item->{container} == 0) { 1541 if ($item->{tag} == $OPENCONT && not ($item->{flags} & Crossfire::Protocol::F_OPEN)) {
1469 update_floorbox; 1542 $OPENCONT = 0;
1470 $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});
1471 } elsif ($item->{container} == $self->{player}{tag}) { 1549 } elsif ($item->{container} == $self->{player}{tag}) {
1472 $INV->set_items ($self->{container}{$item->{container}}) 1550 $INV->set_items ($self->{container}{$item->{container}})
1551 }
1473 } 1552 }
1474} 1553}
1475 1554
1476%SDL_CB = ( 1555%SDL_CB = (
1477 CFClient::SDL_QUIT => sub { 1556 CFClient::SDL_QUIT => sub {
1577 $FONT_FIXED = new_from_file CFClient::Font $fonts[1]; 1656 $FONT_FIXED = new_from_file CFClient::Font $fonts[1];
1578 1657
1579 $FONT_PROP->make_default; 1658 $FONT_PROP->make_default;
1580 } 1659 }
1581 1660
1661# compare mono (ft) vs. rgba (cairo)
1662# ft - 1.8s, cairo 3s, even in alpha-only mode
1663# for my $rgba (0..1) {
1664# my $t1 = Time::HiRes::time;
1665# for (1..1000) {
1666# my $layout = CFClient::Layout->new ($rgba);
1667# $layout->set_text ("hallo" x 100);
1668# $layout->render;
1669# }
1670# my $t2 = Time::HiRes::time;
1671# warn $t2-$t1;
1672# }
1673
1582 video_init; 1674 video_init;
1583 audio_init; 1675 audio_init;
1584} 1676}
1585 1677
1586Event::loop; 1678Event::loop;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines