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.223 by elmex, Wed May 17 14:55:15 2006 UTC vs.
Revision 1.224 by root, Wed May 17 15:18:57 2006 UTC

1#!/opt/bin/perl 1#!/opt/bin/perl
2 2
3use strict; 3use strict;
4use utf8; 4use utf8;
5 5
6# do things only needed for single-binary version (par)
6BEGIN { 7BEGIN {
7 if (%PAR::LibCache) { 8 if (%PAR::LibCache) {
8 @INC = grep ref, @INC; # weed out all paths except pars loader refs 9 @INC = grep ref, @INC; # weed out all paths except pars loader refs
9 10
10 while (my ($filename, $zip) = each %PAR::LibCache) { 11 while (my ($filename, $zip) = each %PAR::LibCache) {
13 $zip->extractMember ($_, "$ENV{PAR_TEMP}/$1") 14 $zip->extractMember ($_, "$ENV{PAR_TEMP}/$1")
14 unless -e "$ENV{PAR_TEMP}/$1"; 15 unless -e "$ENV{PAR_TEMP}/$1";
15 } 16 }
16 } 17 }
17 18
19 # TODO: pango-rc file, anybody?
20
18 unshift @INC, $ENV{PAR_TEMP}; 21 unshift @INC, $ENV{PAR_TEMP};
19
20 if ($^O eq "MSWin32") {
21 $ENV{GTK_RC_FILES} = "$ENV{PAR_TEMP}/share/themes/MS-Windows/gtk-2.0/gtkrc";
22 }
23 } 22 }
24} 23}
25 24
26# need to do it again because that pile of garbage called PAR nukes it before main 25# need to do it again because that pile of garbage called PAR nukes it before main
27unshift @INC, $ENV{PAR_TEMP}; 26unshift @INC, $ENV{PAR_TEMP}
27 if %PAR::LibCache;
28 28
29use Time::HiRes 'time'; 29use Time::HiRes 'time';
30use Pod::POM;
30use Event; 31use Event;
31 32
32use Crossfire; 33use Crossfire;
33use Crossfire::Protocol; 34use Crossfire::Protocol;
34 35
666 $HOST->set_text ($CFG->{host} = $host); 667 $HOST->set_text ($CFG->{host} = $host);
667 }), 668 }),
668 (new CFClient::UI::Empty expand => 1), 669 (new CFClient::UI::Empty expand => 1),
669 ]); 670 ]);
670 671
671 $table->add ($_ + 1, $y, new CFClient::UI::Label align => $align[$_], text => $m->[$_], fontsize => 0.8) 672 $table->add ($_ + 1, $y, new CFClient::UI::Label
673 ellipsise => 0, align => $align[$_], text => $m->[$_], fontsize => 0.8)
672 for 0 .. $#$m; 674 for 0 .. $#$m;
673 } 675 }
674 } 676 }
675 }); 677 });
676} 678}
1031 1033
1032@conn::ISA = Crossfire::Protocol::; 1034@conn::ISA = Crossfire::Protocol::;
1033 1035
1034sub conn::stats_update { 1036sub conn::stats_update {
1035 my ($self, $stats) = @_; 1037 my ($self, $stats) = @_;
1038
1039 if (my $exp = $stats->{Crossfire::Protocol::CS_STAT_EXP64}) {
1040 my $diff = $exp - $self->{prev_exp};
1041 $STATUSBOX->add ("$diff experience gained", group => "experience $diff", fg => [0.5, 1, 0.5, 0.8], timeout => 5)
1042 if exists $self->{prev_exp} && $diff;
1043 $self->{prev_exp} = $exp;
1044 }
1036 1045
1037 update_stats_window ($stats); 1046 update_stats_window ($stats);
1038} 1047}
1039 1048
1040sub conn::user_send { 1049sub conn::user_send {
1365sub conn::spell_add { 1374sub conn::spell_add {
1366 my ($self, $spell) = @_; 1375 my ($self, $spell) = @_;
1367 1376
1368 # TODO 1377 # TODO
1369 # create a widget dynamically, using spell face (CF::Protocol downloads them) 1378 # create a widget dynamically, using spell face (CF::Protocol downloads them)
1370 $MAPWIDGET->add_command ("invoke $spell->{name}", $spell->{message}); 1379 $MAPWIDGET->add_command ("invoke $spell->{name}", CFClient::UI::Label::escape $spell->{message});
1371 $MAPWIDGET->add_command ("cast $spell->{name}", $spell->{message}); 1380 $MAPWIDGET->add_command ("cast $spell->{name}", CFClient::UI::Label::escape $spell->{message});
1372} 1381}
1373 1382
1374sub conn::spell_delete { 1383sub conn::spell_delete {
1375 my ($self, $spell) = @_; 1384 my ($self, $spell) = @_;
1376} 1385}
1379 my ($self) = @_; 1388 my ($self) = @_;
1380 1389
1381 $MAPWIDGET->clr_commands; 1390 $MAPWIDGET->clr_commands;
1382 1391
1383 for my $skill (values %{$self->{skill_info}}) { 1392 for my $skill (values %{$self->{skill_info}}) {
1384 $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'"); 1393 $MAPWIDGET->add_command ("ready_skill $skill", CFClient::UI::Label::escape "Ready the skill '$skill'");
1385 $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'"); 1394 $MAPWIDGET->add_command ("use_skill $skill", CFClient::UI::Label::escape "Immediately use the skill '$skill'");
1386 } 1395 }
1387 1396
1388 $MAPWIDGET->add_command ("petmode defend", "Tell pets to stay close to you and defend you"); 1397 $MAPWIDGET->add_command ("petmode defend", "Tell pets to stay close to you and defend you");
1389 $MAPWIDGET->add_command ("petmode arena", "Same as petmode sad, but also attack other players"); 1398 $MAPWIDGET->add_command ("petmode arena", "Same as petmode sad, but also attack other players");
1390 $MAPWIDGET->add_command ("petmode sad", "Search & Destroy - tell pets to roam about and attack enemies"); 1399 $MAPWIDGET->add_command ("petmode sad", "Search & Destroy - tell pets to roam about and attack enemies");
1391 $MAPWIDGET->add_command ("killpets", "Kill your pets"); 1400 $MAPWIDGET->add_command ("killpets", "Kill your pets");
1392 $MAPWIDGET->add_command ("chat", "chat TEXT\nChat with all other players"); 1401 $MAPWIDGET->add_command ("chat", "chat TEXT\nChat with all other players");
1393 $MAPWIDGET->add_command ("shout", "shout TEXT\nShout loudly, used for emergencies"); 1402 $MAPWIDGET->add_command ("shout", "shout TEXT\nShout loudly, used for emergencies");
1394 $MAPWIDGET->add_command ("tell", "tell USERNAME TEXT\nPrivately tell a specific player"); 1403 $MAPWIDGET->add_command ("tell", "tell USERNAME TEXT\nPrivately tell a specific player");
1395 1404
1396 # TODO: add documentation on these 1405 my $parser = new Pod::POM;
1397 for (qw( 1406 my $pod = $parser->parse_file (CFClient::find_rcfile "pod/command_help.pod");
1398 afk 1407
1399 apply 1408 for my $head2 ($pod->head2) {
1400 body 1409 $head2->title =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x
1401 bowmode 1410 or next;
1402 brace 1411
1403 build 1412 my $cmd = $1;
1404 disarm 1413 my @args = split /\|/, $2;
1414 @args = (".*") unless @args;
1415
1416 my $text = CFClient::pod_to_pango $head2;
1417
1418 for my $arg (@args) {
1419 $arg = $arg eq ".*" ? "" : " $arg";
1420
1421 $MAPWIDGET->add_command ("$cmd$arg", $text);
1405 dm 1422 }
1406 dmhide
1407 drop
1408 dropall
1409 examine
1410 get
1411 gsay
1412 help
1413 hiscore
1414 inventory
1415 invoke
1416 killpets
1417 listen
1418 logs
1419 mapinfo
1420 maps
1421 mark
1422 motd
1423 output-count
1424 output-sync
1425 party
1426 peaceful
1427 petmode
1428 pickup
1429 players
1430 prepare
1431 quests
1432 rename
1433 resistances
1434 rotateshoottype
1435 save
1436 say
1437 search
1438 search-items
1439 showpets
1440 skills
1441 sound
1442 take
1443 throw
1444 time
1445 title
1446 usekeys
1447 version
1448 weather
1449 whereabouts
1450 whereami
1451 who
1452 wimpy
1453 )) {
1454 $MAPWIDGET->add_command ($_, "$_: no help available (yet)");
1455 } 1423 }
1456
1457 #TODO: add " and ' "aliases" etc.
1458} 1424}
1459 1425
1460sub conn::eof { 1426sub conn::eof {
1461 $MAPWIDGET->clr_commands; 1427 $MAPWIDGET->clr_commands;
1462 1428

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines