… | |
… | |
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; |
… | |
… | |
237 | |
238 | |
238 | # center: swap stats |
239 | # center: swap stats |
239 | my ($sw1, $sw2) = map +(new CFClient::UI::Combobox |
240 | my ($sw1, $sw2) = map +(new CFClient::UI::Combobox |
240 | value => $_, |
241 | value => $_, |
241 | options => [ |
242 | options => [ |
242 | [Str => 1, "Strength ($conn->{stat}{+CS_STAT_STR})"], |
243 | [1 => "Str", "Strength ($conn->{stat}{+CS_STAT_STR})"], |
243 | [Dex => 2, "Dexterity ($conn->{stat}{+CS_STAT_DEX})"], |
244 | [2 => "Dex", "Dexterity ($conn->{stat}{+CS_STAT_DEX})"], |
244 | [Con => 3, "Constitution ($conn->{stat}{+CS_STAT_CON})"], |
245 | [3 => "Con", "Constitution ($conn->{stat}{+CS_STAT_CON})"], |
245 | [Int => 4, "Intelligence ($conn->{stat}{+CS_STAT_INT})"], |
246 | [4 => "Int", "Intelligence ($conn->{stat}{+CS_STAT_INT})"], |
246 | [Wis => 5, "Wisdom ($conn->{stat}{+CS_STAT_WIS})"], |
247 | [5 => "Wis", "Wisdom ($conn->{stat}{+CS_STAT_WIS})"], |
247 | [Pow => 6, "Power ($conn->{stat}{+CS_STAT_POW})"], |
248 | [6 => "Pow", "Power ($conn->{stat}{+CS_STAT_POW})"], |
248 | [Cha => 7, "Charisma ($conn->{stat}{+CS_STAT_CHA})"], |
249 | [7 => "Cha", "Charisma ($conn->{stat}{+CS_STAT_CHA})"], |
249 | ], |
250 | ], |
250 | ), 1 .. 2; |
251 | ), 1 .. 2; |
251 | |
252 | |
252 | $table->add (2, 0, new CFClient::UI::Button |
253 | $table->add (2, 0, new CFClient::UI::Button |
253 | text => "Swap Stats", |
254 | text => "Swap Stats", |
… | |
… | |
625 | &set_gauge_window_fontsize; |
626 | &set_gauge_window_fontsize; |
626 | |
627 | |
627 | $win |
628 | $win |
628 | } |
629 | } |
629 | |
630 | |
|
|
631 | sub debug_setup { |
|
|
632 | my $table = new CFClient::UI::Table; |
|
|
633 | |
|
|
634 | $table->add (0, 0, new CFClient::UI::Label text => "Widget Borders"); |
|
|
635 | $table->add (1, 0, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 1 }); |
|
|
636 | $table->add (0, 1, new CFClient::UI::Label text => "Tooltip Widget Info"); |
|
|
637 | $table->add (1, 1, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2 }); |
|
|
638 | $table->add (0, 2, new CFClient::UI::Label text => "Show FPS"); |
|
|
639 | $table->add (1, 2, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4 }); |
|
|
640 | $table->add (0, 3, new CFClient::UI::Label text => "Suppress Tooltips"); |
|
|
641 | $table->add (1, 3, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8 }); |
|
|
642 | |
|
|
643 | my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); |
|
|
644 | |
|
|
645 | for my $x (0..2) { |
|
|
646 | for my $y (0 .. 2) { |
|
|
647 | $table->add ($x + 3, $y, |
|
|
648 | new CFClient::UI::Entry |
|
|
649 | text => $default_smooth[$x * 3 + $y], |
|
|
650 | on_changed => sub { $MAP->{smooth_matrix}[$x * 3 + $y] = $_[1] if $MAP; 0 }, |
|
|
651 | ); |
|
|
652 | } |
|
|
653 | } |
|
|
654 | |
|
|
655 | |
|
|
656 | $table |
|
|
657 | } |
630 | |
658 | |
631 | sub stats_window { |
659 | sub stats_window { |
632 | my $tgw = new CFClient::UI::FancyFrame |
660 | my $tgw = new CFClient::UI::FancyFrame |
633 | y => $HEIGHT * (2/8), |
661 | y => $HEIGHT * (2/8), |
634 | x => "max", |
662 | x => "max", |
… | |
… | |
1049 | my ($self, $value) = @_; |
1077 | my ($self, $value) = @_; |
1050 | $CFG->{say_command} = $value; |
1078 | $CFG->{say_command} = $value; |
1051 | } |
1079 | } |
1052 | ); |
1080 | ); |
1053 | |
1081 | |
|
|
1082 | $vbox->add (new CFClient::UI::Label |
|
|
1083 | text => "Server Info", |
|
|
1084 | fontsize => 1.2, |
|
|
1085 | padding_y => 8, |
|
|
1086 | fg => [1, 1, 0, 1], |
|
|
1087 | ); |
|
|
1088 | |
|
|
1089 | $vbox->add ($SERVER_INFO = new CFClient::UI::Label ellipsise => 0); |
|
|
1090 | |
1054 | $vbox |
1091 | $vbox |
1055 | } |
1092 | } |
1056 | |
1093 | |
1057 | sub message_window { |
1094 | sub message_window { |
1058 | my $window = new CFClient::UI::FancyFrame |
1095 | my $window = new CFClient::UI::FancyFrame |
… | |
… | |
1182 | ["Potions" => PICKUP_POTION], |
1219 | ["Potions" => PICKUP_POTION], |
1183 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
1220 | ["Magic Devices" => PICKUP_MAGIC_DEVICE], |
1184 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
1221 | ["Ignore cursed" => PICKUP_NOT_CURSED], |
1185 | ["Jewelery" => PICKUP_JEWELS], |
1222 | ["Jewelery" => PICKUP_JEWELS], |
1186 | ], |
1223 | ], |
|
|
1224 | ["Weight/Value ratio", 2, 17] |
1187 | ) |
1225 | ) |
1188 | { |
1226 | { |
1189 | my ($title, $x, $y, @bits) = @$_; |
1227 | my ($title, $x, $y, @bits) = @$_; |
1190 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
1228 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
1191 | |
1229 | |
… | |
… | |
1208 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1246 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1209 | if defined $::CONN; |
1247 | if defined $::CONN; |
1210 | }); |
1248 | }); |
1211 | } |
1249 | } |
1212 | } |
1250 | } |
|
|
1251 | |
|
|
1252 | $table->add (2, 18, new CFClient::UI::ValSlider |
|
|
1253 | range => [0, 0, 16, 1, 1], |
|
|
1254 | to_value => sub { ">= " . 5 * $_[0] }, |
|
|
1255 | on_changed => sub { |
|
|
1256 | my ($slider, $value) = @_; |
|
|
1257 | |
|
|
1258 | $::CFG->{pickup} &= ~0x7; |
|
|
1259 | $::CFG->{pickup} |= int $value |
|
|
1260 | if $value; |
|
|
1261 | 1; |
|
|
1262 | }); |
|
|
1263 | $table->add (3, 18, new CFClient::UI::Button |
|
|
1264 | text => "set", |
|
|
1265 | on_activate => sub { |
|
|
1266 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
|
|
1267 | if defined $::CONN; |
|
|
1268 | 1; |
|
|
1269 | }); |
1213 | |
1270 | |
1214 | $table |
1271 | $table |
1215 | } |
1272 | } |
1216 | |
1273 | |
1217 | sub inventory_window { |
1274 | sub inventory_window { |
… | |
… | |
1335 | $refresh->(); |
1392 | $refresh->(); |
1336 | |
1393 | |
1337 | $vb |
1394 | $vb |
1338 | } |
1395 | } |
1339 | |
1396 | |
1340 | sub make_help_window { |
1397 | sub help_window { |
1341 | my $win = new CFClient::UI::FancyFrame |
1398 | my $win = new CFClient::UI::FancyFrame |
1342 | x => 'center', |
1399 | x => 'center', |
1343 | y => 'center', |
1400 | y => 'center', |
1344 | z => 2, |
1401 | z => 2, |
1345 | name => 'doc_browser', |
1402 | name => 'doc_browser', |
… | |
… | |
1348 | title => "Documentation"; |
1405 | title => "Documentation"; |
1349 | |
1406 | |
1350 | $win->add (my $vbox = new CFClient::UI::VBox); |
1407 | $win->add (my $vbox = new CFClient::UI::VBox); |
1351 | |
1408 | |
1352 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1409 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1353 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
1410 | $vbox->add (my $viewer = new CFClient::UI::TextScroller |
|
|
1411 | expand => 1, fontsize => 0.8, padding_x => 4); |
1354 | |
1412 | |
1355 | for ( |
1413 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
|
|
1414 | $buttons->add (my $combo = new CFClient::UI::Combobox |
|
|
1415 | value => undef, |
|
|
1416 | options => [ |
1356 | [intro => "Introduction"], |
1417 | [intro => "Introduction"], |
1357 | [manual => "Manual"], |
1418 | [manual => "Manual"], |
|
|
1419 | [skill_help => "Skills"], |
1358 | [command_help => "Commands"], |
1420 | [command_help => "Commands"], |
1359 | [skill_help => "Skills"], |
1421 | [dmcommand_help => "DM Commands"], |
1360 | ) { |
1422 | [COPYING => "License Terms"], |
1361 | my ($pod, $label) = @$_; |
1423 | ], |
|
|
1424 | on_changed => sub { |
|
|
1425 | my ($self, $pod) = @_; |
1362 | |
1426 | |
1363 | $buttons->add (new CFClient::UI::Button |
|
|
1364 | text => $label, |
|
|
1365 | on_activate => sub { |
|
|
1366 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1427 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1367 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1428 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1368 | |
1429 | |
1369 | $viewer->clear; |
1430 | $viewer->clear; |
1370 | |
1431 | |
1371 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1432 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1372 | for @$pom; |
1433 | for @$pom; |
1373 | |
1434 | |
1374 | $viewer->set_offset (0); |
1435 | $viewer->set_offset (0); |
1375 | }, |
1436 | }, |
|
|
1437 | on_visibility_change => sub { |
|
|
1438 | my ($self, $visible) = @_; |
|
|
1439 | return unless $visible; |
|
|
1440 | return if $self->{value}; |
|
|
1441 | $self->set_value ("intro"); |
|
|
1442 | }, |
1376 | ); |
1443 | ); |
1377 | } |
|
|
1378 | |
|
|
1379 | $viewer->add_paragraph ([1, 1, 0, 1], "<big>Use one of the buttons above to display a document.</big>"); |
|
|
1380 | |
1444 | |
1381 | $win |
1445 | $win |
1382 | } |
1446 | } |
1383 | |
1447 | |
1384 | sub sdl_init { |
1448 | sub sdl_init { |
… | |
… | |
1461 | } |
1525 | } |
1462 | }); |
1526 | }); |
1463 | $MAPWIDGET->show; |
1527 | $MAPWIDGET->show; |
1464 | $MAPWIDGET->focus_in; |
1528 | $MAPWIDGET->focus_in; |
1465 | |
1529 | |
1466 | $LOGVIEW = new CFClient::UI::TextView |
1530 | $LOGVIEW = new CFClient::UI::TextScroller |
1467 | expand => 1, |
1531 | expand => 1, |
1468 | font => $FONT_FIXED, |
1532 | font => $FONT_FIXED, |
1469 | fontsize => $::CFG->{log_fontsize}, |
1533 | fontsize => $::CFG->{log_fontsize}, |
1470 | indent => -4, |
1534 | indent => -4, |
1471 | can_hover => 1, |
1535 | can_hover => 1, |
… | |
… | |
1501 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1565 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1502 | . "After pressing the combo the binding will be saved automatically and the " |
1566 | . "After pressing the combo the binding will be saved automatically and the " |
1503 | . "binding editor closes"); |
1567 | . "binding editor closes"); |
1504 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1568 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
1505 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
1569 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
|
|
1570 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
|
|
1571 | "Some debuggign options. Do not ask."); |
1506 | |
1572 | |
1507 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1573 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1508 | |
1574 | |
1509 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1575 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
1510 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
1576 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
… | |
… | |
1528 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1594 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1529 | status "Configuration Saved"; |
1595 | status "Configuration Saved"; |
1530 | }, |
1596 | }, |
1531 | ); |
1597 | ); |
1532 | |
1598 | |
1533 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, |
1599 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window, |
1534 | tooltip => "View Documentation"); |
1600 | tooltip => "View Documentation"); |
1535 | |
1601 | |
1536 | $BUTTONBAR->add (new CFClient::UI::Button |
1602 | $BUTTONBAR->add (new CFClient::UI::Button |
1537 | text => "Quit", |
1603 | text => "Quit", |
1538 | tooltip => "Terminates the program", |
1604 | tooltip => "Terminates the program", |