1 | #!/opt/bin/perl |
1 | #!/opt/bin/perl |
2 | |
2 | |
3 | use strict; |
3 | use strict; |
4 | use utf8; |
4 | use utf8; |
5 | |
5 | |
|
|
6 | # do things only needed for single-binary version (par) |
6 | BEGIN { |
7 | BEGIN { |
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 |
27 | unshift @INC, $ENV{PAR_TEMP}; |
26 | unshift @INC, $ENV{PAR_TEMP} |
|
|
27 | if %PAR::LibCache; |
28 | |
28 | |
29 | use Time::HiRes 'time'; |
29 | use Time::HiRes 'time'; |
|
|
30 | use Pod::POM; |
30 | use Event; |
31 | use Event; |
31 | |
32 | |
32 | use Crossfire; |
33 | use Crossfire; |
33 | use Crossfire::Protocol; |
34 | use Crossfire::Protocol; |
34 | |
35 | |
… | |
… | |
100 | our $DEBUG_STATUS; |
101 | our $DEBUG_STATUS; |
101 | |
102 | |
102 | our $INVWIN; |
103 | our $INVWIN; |
103 | our $INV; |
104 | our $INV; |
104 | our $INVR; |
105 | our $INVR; |
|
|
106 | our $INVR_LBL; |
105 | our $OPENCONT; |
107 | our $OPENCONT; |
106 | |
108 | |
107 | sub status { |
109 | sub status { |
108 | $STATUSBOX->add ($_[0], pri => -10, group => "status", timeout => 20, fg => [1, 1, 0, 1]); |
110 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 20, fg => [1, 1, 0, 1]); |
109 | } |
111 | } |
110 | |
112 | |
111 | sub debug { |
113 | sub debug { |
112 | $DEBUG_STATUS->set_text ($_[0]); |
114 | $DEBUG_STATUS->set_text ($_[0]); |
113 | my ($w, $h) = $DEBUG_STATUS->size_request; |
115 | my ($w, $h) = $DEBUG_STATUS->size_request; |
… | |
… | |
134 | maph => $mapsize, |
136 | maph => $mapsize, |
135 | ; |
137 | ; |
136 | }; |
138 | }; |
137 | |
139 | |
138 | if ($CONN) { |
140 | if ($CONN) { |
|
|
141 | CFClient::lowdelay fileno $CONN->{fh}; |
|
|
142 | |
139 | $LOGIN_BUTTON->set_text ("Logout"); |
143 | $LOGIN_BUTTON->set_text ("Logout"); |
140 | |
|
|
141 | status "login successful"; |
144 | status "login successful"; |
142 | |
145 | |
143 | CFClient::lowdelay fileno $CONN->{fh}; |
146 | $BUTTONBAR->{children}[1]->emit ("activate") |
|
|
147 | if $BUTTONBAR->{children}[1]->{state}; |
|
|
148 | |
144 | } else { |
149 | } else { |
145 | status "unable to connect"; |
150 | status "unable to connect"; |
146 | stop_game(); |
151 | stop_game(); |
147 | } |
152 | } |
148 | } |
153 | } |
… | |
… | |
152 | |
157 | |
153 | status "connection closed"; |
158 | status "connection closed"; |
154 | $LOGIN_BUTTON->set_text ("Login"); |
159 | $LOGIN_BUTTON->set_text ("Login"); |
155 | $CONN->destroy; |
160 | $CONN->destroy; |
156 | $CONN = 0; # false, does not autovivify |
161 | $CONN = 0; # false, does not autovivify |
|
|
162 | |
|
|
163 | $BUTTONBAR->{children}[1]->emit ("activate") |
|
|
164 | unless $BUTTONBAR->{children}[1]->{state}; |
157 | |
165 | |
158 | undef $MAPCACHE; |
166 | undef $MAPCACHE; |
159 | undef $MAP; |
167 | undef $MAP; |
160 | } |
168 | } |
161 | |
169 | |
… | |
… | |
665 | $HOST->set_text ($CFG->{host} = $host); |
673 | $HOST->set_text ($CFG->{host} = $host); |
666 | }), |
674 | }), |
667 | (new CFClient::UI::Empty expand => 1), |
675 | (new CFClient::UI::Empty expand => 1), |
668 | ]); |
676 | ]); |
669 | |
677 | |
670 | $table->add ($_ + 1, $y, new CFClient::UI::Label align => $align[$_], text => $m->[$_], fontsize => 0.8) |
678 | $table->add ($_ + 1, $y, new CFClient::UI::Label |
|
|
679 | ellipsise => 0, align => $align[$_], text => $m->[$_], fontsize => 0.8) |
671 | for 0 .. $#$m; |
680 | for 0 .. $#$m; |
672 | } |
681 | } |
673 | } |
682 | } |
674 | }); |
683 | }); |
675 | } |
684 | } |
… | |
… | |
741 | |
750 | |
742 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
751 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
743 | }, |
752 | }, |
744 | ); |
753 | ); |
745 | |
754 | |
|
|
755 | $table->add (0, 8, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Count"); |
|
|
756 | $table->add (1, 8, new CFClient::UI::Entry |
|
|
757 | text => $CFG->{output_count}, |
|
|
758 | tooltip => "Should be set to 1 unless you know what you are doing", |
|
|
759 | connect_changed => sub { $CFG->{output_count} = $_[1] }, |
|
|
760 | ); |
|
|
761 | |
|
|
762 | $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
|
|
763 | $table->add (1, 9, new CFClient::UI::Entry |
|
|
764 | text => $CFG->{output_sync}, |
|
|
765 | tooltip => "Should be set to 1 unless you know what you are doing", |
|
|
766 | connect_changed => sub { $CFG->{output_sync} = $_[1] }, |
|
|
767 | ); |
|
|
768 | |
746 | $table->add (1, 8, $LOGIN_BUTTON = new CFClient::UI::Button |
769 | $table->add (1, 10, $LOGIN_BUTTON = new CFClient::UI::Button |
747 | expand => 1, |
770 | expand => 1, |
748 | align => 0, |
771 | align => 0, |
749 | text => "Login", |
772 | text => "Login", |
750 | connect_activate => sub { |
773 | connect_activate => sub { |
751 | $CONN ? stop_game |
774 | $CONN ? stop_game |
… | |
… | |
763 | bg => [0, 0, 0, 0.5], |
786 | bg => [0, 0, 0, 0.5], |
764 | user_w => int $::WIDTH / 3, |
787 | user_w => int $::WIDTH / 3, |
765 | user_h => int $::HEIGHT / 5, |
788 | user_h => int $::HEIGHT / 5, |
766 | child => (my $vbox = new CFClient::UI::VBox); |
789 | child => (my $vbox = new CFClient::UI::VBox); |
767 | |
790 | |
768 | $vbox->add ($LOGVIEW = new CFClient::UI::TextView |
791 | $vbox->add ($LOGVIEW); |
769 | expand => 1, |
|
|
770 | font => $FONT_FIXED, |
|
|
771 | fontsize => $::CFG->{log_fontsize}, |
|
|
772 | ); |
|
|
773 | |
792 | |
774 | $vbox->add (my $input = new CFClient::UI::Entry |
793 | $vbox->add (my $input = new CFClient::UI::Entry |
775 | connect_focus_in => sub { |
794 | connect_focus_in => sub { |
776 | my ($input, $prev_focus) = @_; |
795 | my ($input, $prev_focus) = @_; |
777 | |
796 | |
… | |
… | |
813 | sub make_inventory_window { |
832 | sub make_inventory_window { |
814 | my $invwin = new CFClient::UI::FancyFrame |
833 | my $invwin = new CFClient::UI::FancyFrame |
815 | user_w => $WIDTH * (4/5), user_h => $HEIGHT * (4/5), title => "Inventory"; |
834 | user_w => $WIDTH * (4/5), user_h => $HEIGHT * (4/5), title => "Inventory"; |
816 | |
835 | |
817 | $invwin->add (my $hb = new CFClient::UI::HBox); |
836 | $invwin->add (my $hb = new CFClient::UI::HBox); |
|
|
837 | |
|
|
838 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
|
|
839 | $vb1->add (my $lbl = new CFClient::UI::Label); |
|
|
840 | $lbl->set_text ("Player"); |
818 | $hb->add ($INV = new CFClient::UI::Inventory expand => 1); |
841 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
|
|
842 | |
|
|
843 | $hb->add (my $vb2 = new CFClient::UI::VBox expand => 1); |
|
|
844 | $vb2->add ($INVR_LBL = new CFClient::UI::Label); |
|
|
845 | $INVR_LBL->set_text ("Floor"); |
819 | $hb->add ($INVR = new CFClient::UI::Inventory expand => 1); |
846 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
820 | |
847 | |
821 | $invwin |
848 | $invwin |
822 | } |
849 | } |
823 | |
850 | |
824 | sub sdl_init { |
851 | sub sdl_init { |
… | |
… | |
884 | } |
911 | } |
885 | }); |
912 | }); |
886 | $MAPWIDGET->show; |
913 | $MAPWIDGET->show; |
887 | $MAPWIDGET->focus_in; |
914 | $MAPWIDGET->focus_in; |
888 | |
915 | |
|
|
916 | $LOGVIEW = new CFClient::UI::TextView |
|
|
917 | expand => 1, |
|
|
918 | font => $FONT_FIXED, |
|
|
919 | fontsize => $::CFG->{log_fontsize}, |
|
|
920 | ; |
|
|
921 | |
889 | $BUTTONBAR = new CFClient::UI::HBox; |
922 | $BUTTONBAR = new CFClient::UI::HBox; |
890 | |
923 | |
891 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); |
924 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); |
892 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); |
925 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); |
893 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); |
926 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); |
… | |
… | |
924 | my $bgmusic;#TODO#hack#d# |
957 | my $bgmusic;#TODO#hack#d# |
925 | |
958 | |
926 | sub audio_channel_finished { |
959 | sub audio_channel_finished { |
927 | my ($channel) = @_; |
960 | my ($channel) = @_; |
928 | |
961 | |
929 | warn "channel $channel finished\n";#d# |
962 | #warn "channel $channel finished\n";#d# |
930 | } |
963 | } |
931 | |
964 | |
932 | sub audio_music_finished { |
965 | sub audio_music_finished { |
933 | return unless $CFG->{bgm_enable}; |
966 | return unless $CFG->{bgm_enable}; |
934 | |
967 | |
… | |
… | |
1020 | delete $animate_object{$widget}; |
1053 | delete $animate_object{$widget}; |
1021 | } |
1054 | } |
1022 | |
1055 | |
1023 | @conn::ISA = Crossfire::Protocol::; |
1056 | @conn::ISA = Crossfire::Protocol::; |
1024 | |
1057 | |
|
|
1058 | sub conn::new { |
|
|
1059 | my $class = shift; |
|
|
1060 | |
|
|
1061 | my $self = $class->Crossfire::Protocol::new (@_); |
|
|
1062 | |
|
|
1063 | $MAPWIDGET->clr_commands; |
|
|
1064 | |
|
|
1065 | my $parser = new Pod::POM; |
|
|
1066 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/command_help.pod"); |
|
|
1067 | |
|
|
1068 | for my $head2 ($pod->head2) { |
|
|
1069 | $head2->title =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x |
|
|
1070 | or next; |
|
|
1071 | |
|
|
1072 | my $cmd = $1; |
|
|
1073 | my @args = split /\|/, $2; |
|
|
1074 | @args = (".*") unless @args; |
|
|
1075 | |
|
|
1076 | my $text = CFClient::pod_to_pango $head2->content; |
|
|
1077 | |
|
|
1078 | for my $arg (@args) { |
|
|
1079 | $arg = $arg eq ".*" ? "" : " $arg"; |
|
|
1080 | |
|
|
1081 | $MAPWIDGET->add_command ("$cmd$arg", $text); |
|
|
1082 | } |
|
|
1083 | } |
|
|
1084 | |
|
|
1085 | $self |
|
|
1086 | } |
|
|
1087 | |
1025 | sub conn::stats_update { |
1088 | sub conn::stats_update { |
1026 | my ($self, $stats) = @_; |
1089 | my ($self, $stats) = @_; |
|
|
1090 | |
|
|
1091 | if (my $exp = $stats->{Crossfire::Protocol::CS_STAT_EXP64}) { |
|
|
1092 | my $diff = $exp - $self->{prev_exp}; |
|
|
1093 | $STATUSBOX->add ("$diff experience gained", group => "experience $diff", fg => [0.5, 1, 0.5, 0.8], timeout => 5) |
|
|
1094 | if exists $self->{prev_exp} && $diff; |
|
|
1095 | $self->{prev_exp} = $exp; |
|
|
1096 | } |
1027 | |
1097 | |
1028 | update_stats_window ($stats); |
1098 | update_stats_window ($stats); |
1029 | } |
1099 | } |
1030 | |
1100 | |
1031 | sub conn::user_send { |
1101 | sub conn::user_send { |
… | |
… | |
1330 | [0.74, 0.65, 0.41], |
1400 | [0.74, 0.65, 0.41], |
1331 | ); |
1401 | ); |
1332 | |
1402 | |
1333 | my $time = sprintf "%02d:%02d:%02d", (localtime time)[2,1,0]; |
1403 | my $time = sprintf "%02d:%02d:%02d", (localtime time)[2,1,0]; |
1334 | |
1404 | |
1335 | $text =~ s/&/&/g; $text =~ s/</</g; |
1405 | $text = CFClient::UI::Label::escape $text; |
1336 | $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; |
1406 | $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; |
1337 | $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; |
1407 | $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; |
1338 | |
1408 | |
1339 | $LOGVIEW->add_paragraph ($color[$color], |
1409 | $LOGVIEW->add_paragraph ($color[$color], |
1340 | join "\n", map "$time $_", split /\n/, $text); |
1410 | join "\n", map "$time $_", split /\n/, $text); |
… | |
… | |
1356 | sub conn::spell_add { |
1426 | sub conn::spell_add { |
1357 | my ($self, $spell) = @_; |
1427 | my ($self, $spell) = @_; |
1358 | |
1428 | |
1359 | # TODO |
1429 | # TODO |
1360 | # create a widget dynamically, using spell face (CF::Protocol downloads them) |
1430 | # create a widget dynamically, using spell face (CF::Protocol downloads them) |
1361 | $MAPWIDGET->add_command ("invoke $spell->{name}", $spell->{message}); |
1431 | $MAPWIDGET->add_command ("invoke $spell->{name}", CFClient::UI::Label::escape $spell->{message}); |
1362 | $MAPWIDGET->add_command ("cast $spell->{name}", $spell->{message}); |
1432 | $MAPWIDGET->add_command ("cast $spell->{name}", CFClient::UI::Label::escape $spell->{message}); |
1363 | } |
1433 | } |
1364 | |
1434 | |
1365 | sub conn::spell_delete { |
1435 | sub conn::spell_delete { |
1366 | my ($self, $spell) = @_; |
1436 | my ($self, $spell) = @_; |
1367 | } |
1437 | } |
1368 | |
1438 | |
1369 | sub conn::addme_success { |
1439 | sub conn::addme_success { |
1370 | my ($self) = @_; |
1440 | my ($self) = @_; |
1371 | |
1441 | |
|
|
1442 | $self->send ("command output-sync $CFG->{output_sync}"); |
|
|
1443 | $self->send ("command output-count $CFG->{output_count}"); |
|
|
1444 | |
1372 | for my $skill (values %{$self->{skill_info}}) { |
1445 | for my $skill (values %{$self->{skill_info}}) { |
1373 | $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'"); |
1446 | $MAPWIDGET->add_command ("ready_skill $skill", CFClient::UI::Label::escape "Ready the skill '$skill'"); |
1374 | $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'"); |
1447 | $MAPWIDGET->add_command ("use_skill $skill", CFClient::UI::Label::escape "Immediately use the skill '$skill'"); |
1375 | } |
1448 | } |
1376 | |
|
|
1377 | $MAPWIDGET->add_command ("pet\\_mode 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"); |
|
|
1379 | $MAPWIDGET->add_command ("pet\\_mode sad", "Search & Destroy - tell pets to roam about and attack enemies"); |
|
|
1380 | $MAPWIDGET->add_command ("kill\\_pets", "kill your pets"); |
|
|
1381 | } |
1449 | } |
1382 | |
1450 | |
1383 | sub conn::eof { |
1451 | sub conn::eof { |
|
|
1452 | $MAPWIDGET->clr_commands; |
|
|
1453 | |
1384 | stop_game; |
1454 | stop_game; |
1385 | } |
1455 | } |
1386 | |
1456 | |
1387 | sub update_floorbox { |
1457 | sub update_floorbox { |
1388 | $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { |
1458 | $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { |
… | |
… | |
1406 | } |
1476 | } |
1407 | |
1477 | |
1408 | sub conn::container_add { |
1478 | sub conn::container_add { |
1409 | my ($self, $tag, $items) = @_; |
1479 | my ($self, $tag, $items) = @_; |
1410 | |
1480 | |
|
|
1481 | #d# print "container_add: container $tag ($self->{player}{tag})\n"; |
|
|
1482 | |
1411 | if ($tag == 0) { |
1483 | if ($tag == 0) { |
1412 | update_floorbox; |
1484 | update_floorbox; |
|
|
1485 | $OPENCONT = 0; |
|
|
1486 | $INVR_LBL->set_text ("Floor"); |
1413 | $INVR->set_items ($self->{container}{0}); |
1487 | $INVR->set_items ($self->{container}{0}); |
1414 | $OPENCONT = 0; |
|
|
1415 | } elsif ($tag == $self->{player}{tag}) { |
1488 | } elsif ($tag == $self->{player}{tag}) { |
|
|
1489 | $INVR_LBL->set_text ("Player"); |
1416 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1490 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1417 | } else { |
1491 | } else { |
1418 | $OPENCONT = $tag; |
1492 | $OPENCONT = $tag; |
|
|
1493 | $INVR_LBL->set_text (CFClient::UI::InventoryItem::_item_to_desc ($self->{item}->{$OPENCONT})); |
1419 | $INVR->set_items ($self->{container}{$tag}); |
1494 | $INVR->set_items ($self->{container}{$tag}); |
1420 | } |
1495 | } |
1421 | |
1496 | |
1422 | # $self-<{player}{tag} => player inv |
1497 | # $self-<{player}{tag} => player inv |
1423 | #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; |
1498 | #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; |
1424 | } |
1499 | } |
1425 | |
1500 | |
1426 | sub conn::container_clear { |
1501 | sub conn::container_clear { |
1427 | my ($self, $tag) = @_; |
1502 | my ($self, $tag) = @_; |
1428 | |
1503 | |
|
|
1504 | #d# print "container_clear: container $tag ($self->{player}{tag})\n"; |
|
|
1505 | |
1429 | if ($tag == 0) { |
1506 | if ($tag == 0) { |
1430 | update_floorbox; |
1507 | update_floorbox; |
|
|
1508 | $OPENCONT = 0; |
|
|
1509 | $INVR_LBL->set_text ("Floor"); |
1431 | $INVR->set_items ($self->{container}{0}); |
1510 | $INVR->set_items ($self->{container}{0}); |
1432 | $OPENCONT = 0; |
|
|
1433 | } elsif ($tag == $self->{player}{tag}) { |
1511 | } elsif ($tag == $self->{player}{tag}) { |
|
|
1512 | $INVR_LBL->set_text ("Player"); |
1434 | $INV->set_items ($self->{container}{$tag}) |
1513 | $INV->set_items ($self->{container}{$tag}) |
1435 | } else { |
1514 | } else { |
|
|
1515 | $OPENCONT = $tag; |
|
|
1516 | $INVR_LBL->set_text (CFClient::UI::InventoryItem::_item_to_desc ($self->{item}->{$OPENCONT})); |
1436 | $INVR->set_items ($self->{container}{$tag}); |
1517 | $INVR->set_items ($self->{container}{$tag}); |
1437 | $OPENCONT = $tag; |
|
|
1438 | } |
1518 | } |
1439 | |
1519 | |
1440 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
1520 | # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; |
1441 | } |
1521 | } |
1442 | |
1522 | |
1443 | sub conn::item_delete { |
1523 | sub conn::item_delete { |
1444 | my ($self, @items) = @_; |
1524 | my ($self, @items) = @_; |
1445 | |
1525 | |
1446 | for (@items) { |
1526 | for (@items) { |
|
|
1527 | #d# print "item_delete: $_->{tag} from $_->{container} ($self->{player}{tag})\n"; |
|
|
1528 | |
1447 | if ($_->{container} == 0) { |
1529 | if ($_->{container} == 0) { |
1448 | update_floorbox; |
1530 | update_floorbox; |
|
|
1531 | $OPENCONT = 0; |
|
|
1532 | $INVR_LBL->set_text ("Floor"); |
1449 | $INVR->set_items ($self->{container}{0}); |
1533 | $INVR->set_items ($self->{container}{0}); |
1450 | } elsif ($_->{container} == $self->{player}{tag}) { |
1534 | } elsif ($_->{container} == $self->{player}{tag}) { |
|
|
1535 | $INVR_LBL->set_text ("Player"); |
1451 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1536 | $INV->set_items ($self->{container}{$self->{player}{tag}}) |
1452 | } else { |
1537 | } else { |
|
|
1538 | $OPENCONT = $_->{container}; |
|
|
1539 | $INVR_LBL->set_text (CFClient::UI::InventoryItem::_item_to_desc ($self->{item}->{$OPENCONT})); |
1453 | $INVR->set_items ($self->{container}{0}); |
1540 | $INVR->set_items ($self->{container}{$_->{container}}); |
1454 | } |
1541 | } |
1455 | } |
1542 | } |
1456 | } |
1543 | } |
1457 | |
1544 | |
1458 | sub conn::item_update { |
1545 | sub conn::item_update { |
1459 | my ($self, $item) = @_; |
1546 | my ($self, $item) = @_; |
1460 | |
1547 | |
1461 | if ($item->{container} == 0) { |
1548 | #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($OPENCONT)\n"; |
1462 | update_floorbox; |
1549 | |
|
|
1550 | if ($item->{tag} == $OPENCONT && not ($item->{flags} & Crossfire::Protocol::F_OPEN)) { |
|
|
1551 | $OPENCONT = 0; |
|
|
1552 | $INVR_LBL->set_text ("Floor"); |
1463 | $INVR->set_items ($self->{container}{0}); |
1553 | $INVR->set_items ($self->{container}{0}); |
|
|
1554 | |
|
|
1555 | $item->{widget}->update_item |
|
|
1556 | if $item->{widget}; |
|
|
1557 | } else { |
|
|
1558 | if ($item->{container} == 0) { |
|
|
1559 | update_floorbox; |
|
|
1560 | $OPENCONT = 0; |
|
|
1561 | $INVR_LBL->set_text ("Floor"); |
|
|
1562 | $INVR->set_items ($self->{container}{0}); |
1464 | } elsif ($item->{container} == $self->{player}{tag}) { |
1563 | } elsif ($item->{container} == $self->{player}{tag}) { |
1465 | $INV->set_items ($self->{container}{$item->{container}}) |
1564 | $INV->set_items ($self->{container}{$item->{container}}) |
|
|
1565 | } |
1466 | } |
1566 | } |
1467 | } |
1567 | } |
1468 | |
1568 | |
1469 | %SDL_CB = ( |
1569 | %SDL_CB = ( |
1470 | CFClient::SDL_QUIT => sub { |
1570 | CFClient::SDL_QUIT => sub { |
… | |
… | |
1532 | host => "crossfire.schmorp.de", |
1632 | host => "crossfire.schmorp.de", |
1533 | say_command => 'say', |
1633 | say_command => 'say', |
1534 | audio_enable => 1, |
1634 | audio_enable => 1, |
1535 | bgm_enable => 1, |
1635 | bgm_enable => 1, |
1536 | bgm_volume => 0.25, |
1636 | bgm_volume => 0.25, |
|
|
1637 | output_sync => 1, |
|
|
1638 | output_count => 1, |
1537 | ); |
1639 | ); |
1538 | |
1640 | |
1539 | while (my ($k, $v) = each %DEF_CFG) { |
1641 | while (my ($k, $v) = each %DEF_CFG) { |
1540 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
1642 | $CFG->{$k} = $v unless exists $CFG->{$k}; |
1541 | } |
1643 | } |
… | |
… | |
1570 | $FONT_FIXED = new_from_file CFClient::Font $fonts[1]; |
1672 | $FONT_FIXED = new_from_file CFClient::Font $fonts[1]; |
1571 | |
1673 | |
1572 | $FONT_PROP->make_default; |
1674 | $FONT_PROP->make_default; |
1573 | } |
1675 | } |
1574 | |
1676 | |
|
|
1677 | # compare mono (ft) vs. rgba (cairo) |
|
|
1678 | # ft - 1.8s, cairo 3s, even in alpha-only mode |
|
|
1679 | # for my $rgba (0..1) { |
|
|
1680 | # my $t1 = Time::HiRes::time; |
|
|
1681 | # for (1..1000) { |
|
|
1682 | # my $layout = CFClient::Layout->new ($rgba); |
|
|
1683 | # $layout->set_text ("hallo" x 100); |
|
|
1684 | # $layout->render; |
|
|
1685 | # } |
|
|
1686 | # my $t2 = Time::HiRes::time; |
|
|
1687 | # warn $t2-$t1; |
|
|
1688 | # } |
|
|
1689 | |
1575 | video_init; |
1690 | video_init; |
1576 | audio_init; |
1691 | audio_init; |
1577 | } |
1692 | } |
1578 | |
1693 | |
1579 | Event::loop; |
1694 | Event::loop; |
… | |
… | |
1633 | |
1748 | |
1634 | Typing B<climb> will display a list of commands with I<climb> in their |
1749 | Typing B<climb> will display a list of commands with I<climb> in their |
1635 | name, such as I<ready_skill climbing> and I<use_skill climbing>. |
1750 | name, such as I<ready_skill climbing> and I<use_skill climbing>. |
1636 | |
1751 | |
1637 | You can abbreviate commands by typing only the first character of every |
1752 | You can abbreviate commands by typing only the first character of every |
1638 | word. For example, typing I<iwor> will likely select I<invoke word of |
1753 | word (or even characters within the word - the client will try to make |
1639 | recall>, while I<ccfo> will select I<cast create food>. Likewise, I<rscli> |
1754 | a good guess, as long as the characters are in order). For example, |
1640 | will likely select I<ready_skill climbing> and I<usl> will give you |
1755 | typing I<iwor> will likely select I<invoke word of recall>, while I<ccfo> |
1641 | I<use_skill levitation>. |
1756 | will select I<cast create food>. Likewise, I<rscli> will likely select |
|
|
1757 | I<ready_skill climbing> and I<usl> will give you I<use_skill levitation>. |
|
|
1758 | |
|
|
1759 | You can enter space and other text as arguemnt to the command. For |
|
|
1760 | example, C<cfoo waybread> will expand to C<cast create food waybread>. |
1642 | |
1761 | |
1643 | =head2 The map overview |
1762 | =head2 The map overview |
1644 | |
1763 | |
1645 | #TODO# |
1764 | #TODO# |
1646 | |
1765 | |