ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.139 by root, Sat Dec 9 22:06:51 2006 UTC vs.
Revision 1.143 by root, Fri Mar 16 02:33:50 2007 UTC

176sub destroy_query_dialog { 176sub destroy_query_dialog {
177 (delete $_[0]{query_dialog})->destroy 177 (delete $_[0]{query_dialog})->destroy
178 if $_[0]{query_dialog}; 178 if $_[0]{query_dialog};
179} 179}
180 180
181# FIXME: a very ugly hack to wait for stat update look below! #d#
182our $QUERY_TIMER; #d#
183
181# server query dialog 184# server query dialog
182sub server_query { 185sub server_query {
183 my ($conn, $flags, $prompt) = @_; 186 my ($conn, $flags, $prompt) = @_;
187
188 # FIXME: a very ugly hack to wait for stat update #d#
189 if ($prompt =~ /roll new stats/ and not $conn->{stat_change_with}) {
190 unless ($QUERY_TIMER) {
191 $QUERY_TIMER =
192 Event->timer (
193 after => 1,
194 cb => sub {
195 server_query ($conn, $flags, $prompt, 1);
196 $QUERY_TIMER = undef
197 }
198 );
199 return;
200 }
201 }
184 202
185 $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel 203 $conn->{query_dialog} = my $dialog = new CFPlus::UI::Toplevel
186 x => "center", 204 x => "center",
187 y => "center", 205 y => "center",
188 title => "Server Query", 206 title => "Server Query",
887 for 0 .. $#col; 905 for 0 .. $#col;
888 906
889 my @align = qw(1 0 1 1 -1); 907 my @align = qw(1 0 1 1 -1);
890 908
891 my $y = 0; 909 my $y = 0;
892 for my $m (
893 sort {
894 $b->{version} <=> $a->{version}
895 or $b->{users} <=> $a->{users}
896 }
897 @{ $msg->{servers} } 910 for my $m (@{ $msg->{servers} }) {
898 ) {
899 my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime) = 911 my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime, $highlight) =
900 @$m{qw(ip age hostname users version description ibytes obytes uptime)}; 912 @$m{qw(ip age hostname users version description ibytes obytes uptime highlight)};
901 913
902 for ($desc) { 914 for ($desc) {
903 s/<br>/\n/gi; 915 s/<br>/\n/gi;
904 s/<li>/\n· /gi; 916 s/<li>/\n· /gi;
905 s/<.*?>//sgi; 917 s/<.*?>//sgi;
935 max_w => $::WIDTH * 0.4, 947 max_w => $::WIDTH * 0.4,
936 ellipsise => 0, 948 ellipsise => 0,
937 align => $align[$_], 949 align => $align[$_],
938 text => $m->[$_], 950 text => $m->[$_],
939 tooltip => $tip[$_], 951 tooltip => $tip[$_],
940 fg => ($m->[3] =~ /\+$/ ? [1, 1, 1] : [.7, .7, .7]), 952 fg => ($highlight ? [1, 1, 1] : [.7, .7, .7]),
941 can_hover => 1, 953 can_hover => 1,
942 can_events => 1, 954 can_events => 1,
943 fontsize => 0.8) 955 fontsize => 0.8)
944 for 0 .. $#$m; 956 for 0 .. $#$m;
945 } 957 }
1046 . "so only set it if you really need to prefetch images. " 1058 . "so only set it if you really need to prefetch images. "
1047 . "This option can be set and unset any time.", 1059 . "This option can be set and unset any time.",
1048 on_changed => sub { $CFG->{face_prefetch} = $_[1]; 0 }, 1060 on_changed => sub { $CFG->{face_prefetch} = $_[1]; 0 },
1049 ); 1061 );
1050 1062
1051 $table->add (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count"); 1063 $table->add (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate");
1052 $table->add (1, 9, new CFPlus::UI::Entry 1064 $table->add (1, 9, new CFPlus::UI::Entry
1065 text => $CFG->{output_rate},
1066 tooltip => "The approximate bandwidth in bytes per second that the server should not exceed "
1067 . "when sending images, to ensure interactiveness. When 0 or unset, the server "
1068 . "default will be used, which is usually around 100kb/s.",
1069 on_changed => sub { $CFG->{output_rate} = $_[1]; 0 },
1070 );
1071
1072 $table->add (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count");
1073 $table->add (1, 10, new CFPlus::UI::Entry
1053 text => $CFG->{output_count}, 1074 text => $CFG->{output_count},
1054 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", 1075 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.",
1055 on_changed => sub { $CFG->{output_count} = $_[1]; 0 }, 1076 on_changed => sub { $CFG->{output_count} = $_[1]; 0 },
1056 ); 1077 );
1057 1078
1058 $table->add (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync"); 1079 $table->add (0, 11, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync");
1059 $table->add (1, 10, new CFPlus::UI::Entry 1080 $table->add (1, 11, new CFPlus::UI::Entry
1060 text => $CFG->{output_sync}, 1081 text => $CFG->{output_sync},
1061 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", 1082 tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.",
1062 on_changed => sub { $CFG->{output_sync} = $_[1]; 0 }, 1083 on_changed => sub { $CFG->{output_sync} = $_[1]; 0 },
1063 ); 1084 );
1064 1085
1065 $table->add (1, 11, $LOGIN_BUTTON = new CFPlus::UI::Button 1086 $table->add (1, 12, $LOGIN_BUTTON = new CFPlus::UI::Button
1066 expand => 1, 1087 expand => 1,
1067 align => 0, 1088 align => 0,
1068 text => "Login", 1089 text => "Login",
1069 on_activate => sub { 1090 on_activate => sub {
1070 $CONN ? stop_game 1091 $CONN ? stop_game
1071 : start_game; 1092 : start_game;
1072 0 1093 0
1073 }, 1094 },
1074 ); 1095 );
1075 1096
1076 $table->add (0, 12, new CFPlus::UI::Label valign => 0, align => 1, text => "Chat Command"); 1097 $table->add (0, 13, new CFPlus::UI::Label valign => 0, align => 1, text => "Chat Command");
1077 $table->add (1, 12, my $saycmd = new CFPlus::UI::Entry 1098 $table->add (1, 13, my $saycmd = new CFPlus::UI::Entry
1078 text => $CFG->{say_command}, 1099 text => $CFG->{say_command},
1079 tooltip => "This is the command that will be used if you write a line in the message window entry or press <b>\"</b> in the map window. " 1100 tooltip => "This is the command that will be used if you write a line in the message window entry or press <b>\"</b> in the map window. "
1080 . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " 1101 . "Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
1081 . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.", 1102 . "But you could also set it to <b>tell <i>playername</i></b> to only chat with that user.",
1082 on_changed => sub { 1103 on_changed => sub {
1084 $CFG->{say_command} = $value; 1105 $CFG->{say_command} = $value;
1085 0 1106 0
1086 } 1107 }
1087 ); 1108 );
1088 1109
1089 $table->add (0, 13, new CFPlus::UI::Label valign => 0, align => 1, text => "Tip of the day"); 1110 $table->add (0, 14, new CFPlus::UI::Label valign => 0, align => 1, text => "Tip of the day");
1090 $table->add (1, 13, my $saycmd = new CFPlus::UI::CheckBox 1111 $table->add (1, 14, my $saycmd = new CFPlus::UI::CheckBox
1091 state => $CFG->{show_tips}, 1112 state => $CFG->{show_tips},
1092 tooltip => "Show the <b>Tip of the day</b> window at startup?", 1113 tooltip => "Show the <b>Tip of the day</b> window at startup?",
1093 on_changed => sub { 1114 on_changed => sub {
1094 my ($self, $value) = @_; 1115 my ($self, $value) = @_;
1095 $CFG->{show_tips} = $value; 1116 $CFG->{show_tips} = $value;
1770} 1791}
1771 1792
1772sub setup_build_button { 1793sub setup_build_button {
1773 my ($enabled) = @_; 1794 my ($enabled) = @_;
1774 if ($enabled) { 1795 if ($enabled) {
1796 $BUILD_BUTTON->hide if $BUILD_BUTTON;
1775 $BUILD_BUTTON ||= new CFPlus::UI::Button 1797 $BUILD_BUTTON ||= new CFPlus::UI::Button
1776 text => "Build", 1798 text => "Build",
1777 tooltip => "Opens the ingame builder", 1799 tooltip => "Opens the ingame builder",
1778 on_activate => sub { 1800 on_activate => sub {
1779 if ($CONN) { 1801 if ($CONN) {
2080 bgm_enable => 1, 2102 bgm_enable => 1,
2081 bgm_volume => 0.25, 2103 bgm_volume => 0.25,
2082 face_prefetch => 0, 2104 face_prefetch => 0,
2083 output_sync => 1, 2105 output_sync => 1,
2084 output_count => 1, 2106 output_count => 1,
2107 output_rate => "",
2085 pickup => 0, 2108 pickup => 0,
2086 inv_sort => "mtime", 2109 inv_sort => "mtime",
2087 default => "profile", # default profile 2110 default => "profile", # default profile
2088 show_tips => 1, 2111 show_tips => 1,
2089 ); 2112 );

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines