… | |
… | |
106 | our $INVR; |
106 | our $INVR; |
107 | our $INVR_LBL; |
107 | our $INVR_LBL; |
108 | our $OPENCONT; |
108 | our $OPENCONT; |
109 | |
109 | |
110 | sub status { |
110 | sub status { |
111 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 20, fg => [1, 1, 0, 1]); |
111 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
112 | } |
112 | } |
113 | |
113 | |
114 | sub debug { |
114 | sub debug { |
115 | $DEBUG_STATUS->set_text ($_[0]); |
115 | $DEBUG_STATUS->set_text ($_[0]); |
116 | my ($w, $h) = $DEBUG_STATUS->size_request; |
116 | my ($w, $h) = $DEBUG_STATUS->size_request; |
… | |
… | |
743 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); |
743 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); |
744 | $table->add (1, 7, new CFClient::UI::Slider |
744 | $table->add (1, 7, new CFClient::UI::Slider |
745 | req_w => 100, |
745 | req_w => 100, |
746 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
746 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
747 | tooltip => "This is the size of the portion of the map update the server sends you. " |
747 | tooltip => "This is the size of the portion of the map update the server sends you. " |
748 | . "If you set this to a high value you will be able to see further for example.", |
748 | . "If you set this to a high value you will be able to see further, " |
|
|
749 | . "but you also increase bandwidht requirements and latency. " |
|
|
750 | . "This option is only used once at log-in.", |
749 | connect_changed => sub { |
751 | connect_changed => sub { |
750 | my ($self, $value) = @_; |
752 | my ($self, $value) = @_; |
751 | |
753 | |
752 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
754 | $CFG->{mapsize} = $self->{range}[0] = $value = int $value; |
753 | }, |
755 | }, |
754 | ); |
756 | ); |
755 | |
757 | |
|
|
758 | $table->add (0, 8, new CFClient::UI::Label valign => 0, align => 1, text => "Face Prefetch"); |
|
|
759 | $table->add (1, 8, new CFClient::UI::CheckBox |
|
|
760 | state => $CFG->{face_prefetch}, |
|
|
761 | tooltip => "<b>Background Image Prefetch</b>\n\n" |
|
|
762 | . "If enabled, automatically pre-fetches images from the server. " |
|
|
763 | . "This might increase or create lag, but increases the chances " |
|
|
764 | . "of faces being ready for display when you encounter them. " |
|
|
765 | . "It also uses up server bandwidth on every connect, " |
|
|
766 | . "so only set it if you really need to prefetch images. " |
|
|
767 | . "This option can be set and unset any time.", |
|
|
768 | connect_changed => sub { $CFG->{face_prefetch} = $_[1] }, |
|
|
769 | ); |
|
|
770 | |
756 | $table->add (0, 8, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Count"); |
771 | $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Count"); |
757 | $table->add (1, 8, new CFClient::UI::Entry |
772 | $table->add (1, 9, new CFClient::UI::Entry |
758 | text => $CFG->{output_count}, |
773 | text => $CFG->{output_count}, |
759 | tooltip => "Should be set to 1 unless you know what you are doing", |
774 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
760 | connect_changed => sub { $CFG->{output_count} = $_[1] }, |
775 | connect_changed => sub { $CFG->{output_count} = $_[1] }, |
761 | ); |
776 | ); |
762 | |
777 | |
763 | $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
778 | $table->add (0, 10, new CFClient::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
764 | $table->add (1, 9, new CFClient::UI::Entry |
779 | $table->add (1, 10, new CFClient::UI::Entry |
765 | text => $CFG->{output_sync}, |
780 | text => $CFG->{output_sync}, |
766 | tooltip => "Should be set to 1 unless you know what you are doing", |
781 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
767 | connect_changed => sub { $CFG->{output_sync} = $_[1] }, |
782 | connect_changed => sub { $CFG->{output_sync} = $_[1] }, |
768 | ); |
783 | ); |
769 | |
784 | |
770 | $table->add (1, 10, $LOGIN_BUTTON = new CFClient::UI::Button |
785 | $table->add (1, 11, $LOGIN_BUTTON = new CFClient::UI::Button |
771 | expand => 1, |
786 | expand => 1, |
772 | align => 0, |
787 | align => 0, |
773 | text => "Login", |
788 | text => "Login", |
774 | connect_activate => sub { |
789 | connect_activate => sub { |
775 | $CONN ? stop_game |
790 | $CONN ? stop_game |
… | |
… | |
892 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
907 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
893 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
908 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
894 | |
909 | |
895 | for ( |
910 | for ( |
896 | [intro => "Introduction"], |
911 | [intro => "Introduction"], |
|
|
912 | [manual => "Manual"], |
897 | [command_help => "Commands"], |
913 | [command_help => "Commands"], |
898 | [skill_help => "Skills"], |
914 | [skill_help => "Skills"], |
899 | ) { |
915 | ) { |
900 | my ($pod, $label) = @$_; |
916 | my ($pod, $label) = @$_; |
901 | |
917 | |
… | |
… | |
1010 | tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
1026 | tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
1011 | |
1027 | |
1012 | make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D |
1028 | make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D |
1013 | |
1029 | |
1014 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window, |
1030 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window, |
1015 | tooltip => "Toggles the statistics window, where all your Stats and Resistances are beign displaye at all times."); |
1031 | tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); |
1016 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window, |
1032 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window, |
1017 | tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :)."); |
1033 | tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :)."); |
1018 | |
1034 | |
1019 | $BUTTONBAR->add (new CFClient::UI::Button |
1035 | $BUTTONBAR->add (new CFClient::UI::Button |
1020 | text => "Save Config", |
1036 | text => "Save Config", |
… | |
… | |
1480 | gotid: |
1496 | gotid: |
1481 | $face->{id} = $id; |
1497 | $face->{id} = $id; |
1482 | $MAP->set_face ($facenum => $id); |
1498 | $MAP->set_face ($facenum => $id); |
1483 | $self->{faceid}[$facenum] = $id;#d# |
1499 | $self->{faceid}[$facenum] = $id;#d# |
1484 | |
1500 | |
1485 | $TILECACHE->get ($id) || do { |
1501 | my $face = $TILECACHE->get ($id); |
|
|
1502 | |
|
|
1503 | if ($face) { |
|
|
1504 | $self->face_prefetch; |
|
|
1505 | $face |
|
|
1506 | } else { |
1486 | my $tex = $self->{noface}; |
1507 | my $tex = $self->{noface}; |
1487 | $MAP->set_texture ($id, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
1508 | $MAP->set_texture ($id, @$tex{qw(name w h s t)}, @{$tex->{minified}}); |
1488 | undef |
1509 | undef |
1489 | }; |
1510 | }; |
1490 | } |
1511 | } |
… | |
… | |
1537 | title => "Query", |
1558 | title => "Query", |
1538 | child => my $vbox = new CFClient::UI::VBox; |
1559 | child => my $vbox = new CFClient::UI::VBox; |
1539 | |
1560 | |
1540 | $vbox->add (new CFClient::UI::Label |
1561 | $vbox->add (new CFClient::UI::Label |
1541 | max_w => $::WIDTH * 0.4, |
1562 | max_w => $::WIDTH * 0.4, |
|
|
1563 | ellipsise => 0, |
1542 | text => $prompt); |
1564 | text => $prompt); |
1543 | |
1565 | |
1544 | if ($flags & Crossfire::Protocol::CS_QUERY_YESNO) { |
1566 | if ($flags & Crossfire::Protocol::CS_QUERY_YESNO) { |
1545 | $vbox->add (my $hbox = new CFClient::HBox); |
1567 | $vbox->add (my $hbox = new CFClient::HBox); |
1546 | $hbox->add (new CFClient::Button |
1568 | $hbox->add (new CFClient::Button |
… | |
… | |
1554 | $hbox->add (new CFClient::Button |
1576 | $hbox->add (new CFClient::Button |
1555 | text => "Yes", |
1577 | text => "Yes", |
1556 | connect_activate => sub { |
1578 | connect_activate => sub { |
1557 | $self->send ("reply y"); |
1579 | $self->send ("reply y"); |
1558 | $dialog->destroy; |
1580 | $dialog->destroy; |
1559 | $MAPWIDGET->focus_in; |
|
|
1560 | }, |
1581 | }, |
1561 | ); |
1582 | ); |
1562 | |
1583 | |
1563 | $dialog->focus_in; |
1584 | $dialog->focus_in; |
1564 | |
1585 | |
… | |
… | |
1566 | $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)"; |
1587 | $dialog->{tooltip} = "Press a key (click on the entry to make sure it has keyboard focus)"; |
1567 | $vbox->add (my $entry = new CFClient::UI::Entry |
1588 | $vbox->add (my $entry = new CFClient::UI::Entry |
1568 | connect_changed => sub { |
1589 | connect_changed => sub { |
1569 | $self->send ("reply $_[1]"); |
1590 | $self->send ("reply $_[1]"); |
1570 | $dialog->destroy; |
1591 | $dialog->destroy; |
1571 | $MAPWIDGET->focus_in; |
|
|
1572 | }, |
1592 | }, |
1573 | ); |
1593 | ); |
1574 | |
1594 | |
1575 | $entry->focus_in; |
1595 | $entry->focus_in; |
1576 | |
1596 | |
… | |
… | |
1580 | $vbox->add (my $entry = new CFClient::UI::Entry |
1600 | $vbox->add (my $entry = new CFClient::UI::Entry |
1581 | $flags & Crossfire::Protocol::CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (), |
1601 | $flags & Crossfire::Protocol::CS_QUERY_HIDEINPUT ? (hiddenchar => "*") : (), |
1582 | connect_activate => sub { |
1602 | connect_activate => sub { |
1583 | $self->send ("reply $_[1]"); |
1603 | $self->send ("reply $_[1]"); |
1584 | $dialog->destroy; |
1604 | $dialog->destroy; |
1585 | $MAPWIDGET->focus_in; |
|
|
1586 | }, |
1605 | }, |
1587 | ); |
1606 | ); |
1588 | |
1607 | |
1589 | $entry->focus_in; |
1608 | $entry->focus_in; |
1590 | } |
1609 | } |
… | |
… | |
1621 | join "\n", map "$time $_", split /\n/, $text); |
1640 | join "\n", map "$time $_", split /\n/, $text); |
1622 | |
1641 | |
1623 | $STATUSBOX->add ($text, |
1642 | $STATUSBOX->add ($text, |
1624 | group => $text, |
1643 | group => $text, |
1625 | fg => $color[$color], |
1644 | fg => $color[$color], |
1626 | timeout => 60, |
1645 | timeout => 10, |
1627 | tooltip_font => $::FONT_FIXED, |
1646 | tooltip_font => $::FONT_FIXED, |
1628 | ); |
1647 | ); |
1629 | } |
1648 | } |
1630 | |
1649 | |
1631 | sub conn::drawextinfo { |
1650 | sub conn::drawextinfo { |
… | |
… | |
1675 | sub conn::eof { |
1694 | sub conn::eof { |
1676 | $MAPWIDGET->clr_commands; |
1695 | $MAPWIDGET->clr_commands; |
1677 | |
1696 | |
1678 | stop_game; |
1697 | stop_game; |
1679 | } |
1698 | } |
|
|
1699 | |
|
|
1700 | sub conn::image_info { |
|
|
1701 | my ($self, $numfaces) = @_; |
|
|
1702 | |
|
|
1703 | $self->{num_faces} = $numfaces; |
|
|
1704 | $self->{face_prefetch} = [1 .. $numfaces]; |
|
|
1705 | $self->face_prefetch; |
|
|
1706 | } |
|
|
1707 | |
|
|
1708 | sub conn::face_prefetch { |
|
|
1709 | my ($self) = @_; |
|
|
1710 | |
|
|
1711 | return unless $CFG->{face_prefetch}; |
|
|
1712 | |
|
|
1713 | if ($self->{num_faces}) { |
|
|
1714 | return if @{ $self->{send_queue} || [] }; |
|
|
1715 | my $todo = @{ $self->{face_prefetch} } |
|
|
1716 | or return; |
|
|
1717 | |
|
|
1718 | my ($face) = splice @{ $self->{face_prefetch} }, 1 + rand @{ $self->{face_prefetch} }, 1, (); |
|
|
1719 | |
|
|
1720 | $self->send ("requestinfo image_sums $face $face"); |
|
|
1721 | |
|
|
1722 | $STATUSBOX->add (CFClient::UI::Label::escape "prefetching $todo", |
|
|
1723 | group => "prefetch", timeout => 2, fg => [1, 1, 0, 0.5]); |
|
|
1724 | } elsif (!exists $self->{num_faces}) { |
|
|
1725 | $self->send ("requestinfo image_info"); |
|
|
1726 | |
|
|
1727 | $self->{num_faces} = 0; |
|
|
1728 | |
|
|
1729 | $STATUSBOX->add (CFClient::UI::Label::escape "starting to prefetch", |
|
|
1730 | group => "prefetch", timeout => 2, fg => [1, 1, 0, 0.5]); |
|
|
1731 | } |
|
|
1732 | } |
|
|
1733 | |
|
|
1734 | # check once/second for faces that need to be prefetched |
|
|
1735 | |
|
|
1736 | Event->timer (after => 1, interval => 1, cb => sub { |
|
|
1737 | $CONN->face_prefetch |
|
|
1738 | if $CONN; |
|
|
1739 | }); |
1680 | |
1740 | |
1681 | sub update_floorbox { |
1741 | sub update_floorbox { |
1682 | $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { |
1742 | $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { |
1683 | return unless $CONN; |
1743 | return unless $CONN; |
1684 | |
1744 | |
… | |
… | |
1856 | host => "crossfire.schmorp.de", |
1916 | host => "crossfire.schmorp.de", |
1857 | say_command => 'say', |
1917 | say_command => 'say', |
1858 | audio_enable => 1, |
1918 | audio_enable => 1, |
1859 | bgm_enable => 1, |
1919 | bgm_enable => 1, |
1860 | bgm_volume => 0.25, |
1920 | bgm_volume => 0.25, |
|
|
1921 | face_prefetch => 0, |
1861 | output_sync => 1, |
1922 | output_sync => 1, |
1862 | output_count => 1, |
1923 | output_count => 1, |
1863 | ); |
1924 | ); |
1864 | |
1925 | |
1865 | while (my ($k, $v) = each %DEF_CFG) { |
1926 | while (my ($k, $v) = each %DEF_CFG) { |