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.224 by root, Wed May 17 15:18:57 2006 UTC vs.
Revision 1.229 by root, Fri May 19 16:43:57 2006 UTC

105our $INVR; 105our $INVR;
106our $INVR_LBL; 106our $INVR_LBL;
107our $OPENCONT; 107our $OPENCONT;
108 108
109sub status { 109sub status {
110 $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]);
111} 111}
112 112
113sub debug { 113sub debug {
114 $DEBUG_STATUS->set_text ($_[0]); 114 $DEBUG_STATUS->set_text ($_[0]);
115 my ($w, $h) = $DEBUG_STATUS->size_request; 115 my ($w, $h) = $DEBUG_STATUS->size_request;
136 maph => $mapsize, 136 maph => $mapsize,
137 ; 137 ;
138 }; 138 };
139 139
140 if ($CONN) { 140 if ($CONN) {
141 CFClient::lowdelay fileno $CONN->{fh};
142
141 $LOGIN_BUTTON->set_text ("Logout"); 143 $LOGIN_BUTTON->set_text ("Logout");
142
143 status "login successful"; 144 status "login successful";
144 145
145 CFClient::lowdelay fileno $CONN->{fh}; 146 $BUTTONBAR->{children}[1]->emit ("activate")
147 if $BUTTONBAR->{children}[1]->{state};
148
146 } else { 149 } else {
147 status "unable to connect"; 150 status "unable to connect";
148 stop_game(); 151 stop_game();
149 } 152 }
150} 153}
154 157
155 status "connection closed"; 158 status "connection closed";
156 $LOGIN_BUTTON->set_text ("Login"); 159 $LOGIN_BUTTON->set_text ("Login");
157 $CONN->destroy; 160 $CONN->destroy;
158 $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};
159 165
160 undef $MAPCACHE; 166 undef $MAPCACHE;
161 undef $MAP; 167 undef $MAP;
162} 168}
163 169
744 750
745 $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 751 $CFG->{mapsize} = $self->{range}[0] = $value = int $value;
746 }, 752 },
747 ); 753 );
748 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
749 $table->add (1, 8, $LOGIN_BUTTON = new CFClient::UI::Button 769 $table->add (1, 10, $LOGIN_BUTTON = new CFClient::UI::Button
750 expand => 1, 770 expand => 1,
751 align => 0, 771 align => 0,
752 text => "Login", 772 text => "Login",
753 connect_activate => sub { 773 connect_activate => sub {
754 $CONN ? stop_game 774 $CONN ? stop_game
766 bg => [0, 0, 0, 0.5], 786 bg => [0, 0, 0, 0.5],
767 user_w => int $::WIDTH / 3, 787 user_w => int $::WIDTH / 3,
768 user_h => int $::HEIGHT / 5, 788 user_h => int $::HEIGHT / 5,
769 child => (my $vbox = new CFClient::UI::VBox); 789 child => (my $vbox = new CFClient::UI::VBox);
770 790
771 $vbox->add ($LOGVIEW = new CFClient::UI::TextView 791 $vbox->add ($LOGVIEW);
772 expand => 1,
773 font => $FONT_FIXED,
774 fontsize => $::CFG->{log_fontsize},
775 );
776 792
777 $vbox->add (my $input = new CFClient::UI::Entry 793 $vbox->add (my $input = new CFClient::UI::Entry
778 connect_focus_in => sub { 794 connect_focus_in => sub {
779 my ($input, $prev_focus) = @_; 795 my ($input, $prev_focus) = @_;
780 796
895 } 911 }
896 }); 912 });
897 $MAPWIDGET->show; 913 $MAPWIDGET->show;
898 $MAPWIDGET->focus_in; 914 $MAPWIDGET->focus_in;
899 915
916 $LOGVIEW = new CFClient::UI::TextView
917 expand => 1,
918 font => $FONT_FIXED,
919 fontsize => $::CFG->{log_fontsize},
920 ;
921
900 $BUTTONBAR = new CFClient::UI::HBox; 922 $BUTTONBAR = new CFClient::UI::HBox;
901 923
902 $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);
903 $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);
904 $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);
935my $bgmusic;#TODO#hack#d# 957my $bgmusic;#TODO#hack#d#
936 958
937sub audio_channel_finished { 959sub audio_channel_finished {
938 my ($channel) = @_; 960 my ($channel) = @_;
939 961
940 warn "channel $channel finished\n";#d# 962 #warn "channel $channel finished\n";#d#
941} 963}
942 964
943sub audio_music_finished { 965sub audio_music_finished {
944 return unless $CFG->{bgm_enable}; 966 return unless $CFG->{bgm_enable};
945 967
1030 my ($widget) = @_; 1052 my ($widget) = @_;
1031 delete $animate_object{$widget}; 1053 delete $animate_object{$widget};
1032} 1054}
1033 1055
1034@conn::ISA = Crossfire::Protocol::; 1056@conn::ISA = Crossfire::Protocol::;
1057
1058sub 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}
1035 1087
1036sub conn::stats_update { 1088sub conn::stats_update {
1037 my ($self, $stats) = @_; 1089 my ($self, $stats) = @_;
1038 1090
1039 if (my $exp = $stats->{Crossfire::Protocol::CS_STAT_EXP64}) { 1091 if (my $exp = $stats->{Crossfire::Protocol::CS_STAT_EXP64}) {
1385} 1437}
1386 1438
1387sub conn::addme_success { 1439sub conn::addme_success {
1388 my ($self) = @_; 1440 my ($self) = @_;
1389 1441
1390 $MAPWIDGET->clr_commands; 1442 $self->send ("command output-sync $CFG->{output_sync}");
1443 $self->send ("command output-count $CFG->{output_count}");
1391 1444
1392 for my $skill (values %{$self->{skill_info}}) { 1445 for my $skill (values %{$self->{skill_info}}) {
1393 $MAPWIDGET->add_command ("ready_skill $skill", CFClient::UI::Label::escape "Ready the skill '$skill'"); 1446 $MAPWIDGET->add_command ("ready_skill $skill", CFClient::UI::Label::escape "Ready the skill '$skill'");
1394 $MAPWIDGET->add_command ("use_skill $skill", CFClient::UI::Label::escape "Immediately use the skill '$skill'"); 1447 $MAPWIDGET->add_command ("use_skill $skill", CFClient::UI::Label::escape "Immediately use the skill '$skill'");
1395 }
1396
1397 $MAPWIDGET->add_command ("petmode defend", "Tell pets to stay close to you and defend you");
1398 $MAPWIDGET->add_command ("petmode arena", "Same as petmode sad, but also attack other players");
1399 $MAPWIDGET->add_command ("petmode sad", "Search & Destroy - tell pets to roam about and attack enemies");
1400 $MAPWIDGET->add_command ("killpets", "Kill your pets");
1401 $MAPWIDGET->add_command ("chat", "chat TEXT\nChat with all other players");
1402 $MAPWIDGET->add_command ("shout", "shout TEXT\nShout loudly, used for emergencies");
1403 $MAPWIDGET->add_command ("tell", "tell USERNAME TEXT\nPrivately tell a specific player");
1404
1405 my $parser = new Pod::POM;
1406 my $pod = $parser->parse_file (CFClient::find_rcfile "pod/command_help.pod");
1407
1408 for my $head2 ($pod->head2) {
1409 $head2->title =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x
1410 or next;
1411
1412 my $cmd = $1;
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);
1422 }
1423 } 1448 }
1424} 1449}
1425 1450
1426sub conn::eof { 1451sub conn::eof {
1427 $MAPWIDGET->clr_commands; 1452 $MAPWIDGET->clr_commands;
1607 host => "crossfire.schmorp.de", 1632 host => "crossfire.schmorp.de",
1608 say_command => 'say', 1633 say_command => 'say',
1609 audio_enable => 1, 1634 audio_enable => 1,
1610 bgm_enable => 1, 1635 bgm_enable => 1,
1611 bgm_volume => 0.25, 1636 bgm_volume => 0.25,
1637 output_sync => 1,
1638 output_count => 1,
1612 ); 1639 );
1613 1640
1614 while (my ($k, $v) = each %DEF_CFG) { 1641 while (my ($k, $v) = each %DEF_CFG) {
1615 $CFG->{$k} = $v unless exists $CFG->{$k}; 1642 $CFG->{$k} = $v unless exists $CFG->{$k};
1616 } 1643 }
1721 1748
1722Typing B<climb> will display a list of commands with I<climb> in their 1749Typing B<climb> will display a list of commands with I<climb> in their
1723name, such as I<ready_skill climbing> and I<use_skill climbing>. 1750name, such as I<ready_skill climbing> and I<use_skill climbing>.
1724 1751
1725You can abbreviate commands by typing only the first character of every 1752You can abbreviate commands by typing only the first character of every
1726word. For example, typing I<iwor> will likely select I<invoke word of 1753word (or even characters within the word - the client will try to make
1727recall>, while I<ccfo> will select I<cast create food>. Likewise, I<rscli> 1754a good guess, as long as the characters are in order). For example,
1728will likely select I<ready_skill climbing> and I<usl> will give you 1755typing I<iwor> will likely select I<invoke word of recall>, while I<ccfo>
1729I<use_skill levitation>. 1756will select I<cast create food>. Likewise, I<rscli> will likely select
1757I<ready_skill climbing> and I<usl> will give you I<use_skill levitation>.
1758
1759You can enter space and other text as arguemnt to the command. For
1760example, C<cfoo waybread> will expand to C<cast create food waybread>.
1730 1761
1731=head2 The map overview 1762=head2 The map overview
1732 1763
1733#TODO# 1764#TODO#
1734 1765

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines