… | |
… | |
84 | our $CONSOLE; |
84 | our $CONSOLE; |
85 | our $METASERVER; |
85 | our $METASERVER; |
86 | our $LOGIN_BUTTON; |
86 | our $LOGIN_BUTTON; |
87 | our $QUIT_DIALOG; |
87 | our $QUIT_DIALOG; |
88 | our $HOST_ENTRY; |
88 | our $HOST_ENTRY; |
|
|
89 | our $SERVER_INFO; |
89 | |
90 | |
90 | our $SETUP_DIALOG; |
91 | our $SETUP_DIALOG; |
91 | our $SETUP_NOTEBOOK; |
92 | our $SETUP_NOTEBOOK; |
92 | our $SETUP_SERVER; |
93 | our $SETUP_SERVER; |
93 | our $SETUP_KEYBOARD; |
94 | our $SETUP_KEYBOARD; |
… | |
… | |
362 | sub stop_game { |
363 | sub stop_game { |
363 | $LOGIN_BUTTON->set_text ("Login"); |
364 | $LOGIN_BUTTON->set_text ("Login"); |
364 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
365 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
365 | $SETUP_DIALOG->show; |
366 | $SETUP_DIALOG->show; |
366 | $INV_WINDOW->hide; |
367 | $INV_WINDOW->hide; |
|
|
368 | $SETUP_SPELLS->clear_spells; |
367 | |
369 | |
368 | return unless $CONN; |
370 | return unless $CONN; |
369 | |
371 | |
370 | status "connection closed"; |
372 | status "connection closed"; |
371 | |
373 | |
… | |
… | |
625 | &set_gauge_window_fontsize; |
627 | &set_gauge_window_fontsize; |
626 | |
628 | |
627 | $win |
629 | $win |
628 | } |
630 | } |
629 | |
631 | |
|
|
632 | sub debug_setup { |
|
|
633 | my $table = new CFClient::UI::Table; |
|
|
634 | |
|
|
635 | $table->add (0, 0, new CFClient::UI::Label text => "Widget Borders"); |
|
|
636 | $table->add (1, 0, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 1 }); |
|
|
637 | $table->add (0, 1, new CFClient::UI::Label text => "Tooltip Widget Info"); |
|
|
638 | $table->add (1, 1, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2 }); |
|
|
639 | $table->add (0, 2, new CFClient::UI::Label text => "Show FPS"); |
|
|
640 | $table->add (1, 2, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4 }); |
|
|
641 | $table->add (0, 3, new CFClient::UI::Label text => "Suppress Tooltips"); |
|
|
642 | $table->add (1, 3, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8 }); |
|
|
643 | |
|
|
644 | my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); |
|
|
645 | |
|
|
646 | for my $x (0..2) { |
|
|
647 | for my $y (0 .. 2) { |
|
|
648 | $table->add ($x + 3, $y, |
|
|
649 | new CFClient::UI::Entry |
|
|
650 | text => $default_smooth[$x * 3 + $y], |
|
|
651 | on_changed => sub { $MAP->{smooth_matrix}[$x * 3 + $y] = $_[1] if $MAP; 0 }, |
|
|
652 | ); |
|
|
653 | } |
|
|
654 | } |
|
|
655 | |
|
|
656 | |
|
|
657 | $table |
|
|
658 | } |
630 | |
659 | |
631 | sub stats_window { |
660 | sub stats_window { |
632 | my $tgw = new CFClient::UI::FancyFrame |
661 | my $tgw = new CFClient::UI::FancyFrame |
633 | y => $HEIGHT * (2/8), |
662 | y => $HEIGHT * (2/8), |
634 | x => "max", |
663 | x => "max", |
… | |
… | |
1049 | my ($self, $value) = @_; |
1078 | my ($self, $value) = @_; |
1050 | $CFG->{say_command} = $value; |
1079 | $CFG->{say_command} = $value; |
1051 | } |
1080 | } |
1052 | ); |
1081 | ); |
1053 | |
1082 | |
|
|
1083 | $vbox->add (new CFClient::UI::Label |
|
|
1084 | text => "Server Info", |
|
|
1085 | fontsize => 1.2, |
|
|
1086 | padding_y => 8, |
|
|
1087 | fg => [1, 1, 0, 1], |
|
|
1088 | ); |
|
|
1089 | |
|
|
1090 | $vbox->add ($SERVER_INFO = new CFClient::UI::Label ellipsise => 0); |
|
|
1091 | |
1054 | $vbox |
1092 | $vbox |
1055 | } |
1093 | } |
1056 | |
1094 | |
1057 | sub message_window { |
1095 | sub message_window { |
1058 | my $window = new CFClient::UI::FancyFrame |
1096 | my $window = new CFClient::UI::FancyFrame |
… | |
… | |
1182 | ["Potions" => PICKUP_POTION], |
1220 | ["Potions" => PICKUP_POTION], |
1183 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
1221 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
1184 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
1222 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
1185 | ["Jewelery" => PICKUP_JEWELS], |
1223 | ["Jewelery" => PICKUP_JEWELS], |
1186 | ], |
1224 | ], |
|
|
1225 | ["Weight/Value ratio", 2, 17] |
1187 | ) |
1226 | ) |
1188 | { |
1227 | { |
1189 | my ($title, $x, $y, @bits) = @$_; |
1228 | my ($title, $x, $y, @bits) = @$_; |
1190 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
1229 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
1191 | |
1230 | |
… | |
… | |
1208 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1247 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1209 | if defined $::CONN; |
1248 | if defined $::CONN; |
1210 | }); |
1249 | }); |
1211 | } |
1250 | } |
1212 | } |
1251 | } |
|
|
1252 | |
|
|
1253 | $table->add (2, 18, new CFClient::UI::ValSlider |
|
|
1254 | range => [0, 0, 16, 1, 1], |
|
|
1255 | to_value => sub { ">= " . 5 * $_[0] }, |
|
|
1256 | on_changed => sub { |
|
|
1257 | my ($slider, $value) = @_; |
|
|
1258 | |
|
|
1259 | $::CFG->{pickup} &= ~0x7; |
|
|
1260 | $::CFG->{pickup} |= int $value |
|
|
1261 | if $value; |
|
|
1262 | 1; |
|
|
1263 | }); |
|
|
1264 | $table->add (3, 18, new CFClient::UI::Button |
|
|
1265 | text => "set", |
|
|
1266 | on_activate => sub { |
|
|
1267 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
|
|
1268 | if defined $::CONN; |
|
|
1269 | 1; |
|
|
1270 | }); |
1213 | |
1271 | |
1214 | $table |
1272 | $table |
1215 | } |
1273 | } |
1216 | |
1274 | |
1217 | sub inventory_window { |
1275 | sub inventory_window { |
… | |
… | |
1508 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1566 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1509 | . "After pressing the combo the binding will be saved automatically and the " |
1567 | . "After pressing the combo the binding will be saved automatically and the " |
1510 | . "binding editor closes"); |
1568 | . "binding editor closes"); |
1511 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1569 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1512 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
1570 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
|
|
1571 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
|
|
1572 | "Some debuggign options. Do not ask."); |
1513 | |
1573 | |
1514 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1574 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1515 | |
1575 | |
1516 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1576 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1517 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
1577 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |