--- deliantra/Deliantra-Client/bin/cfplus 2006/06/06 03:05:16 1.61
+++ deliantra/Deliantra-Client/bin/cfplus 2006/06/13 10:28:38 1.70
@@ -86,6 +86,7 @@
our $LOGIN_BUTTON;
our $QUIT_DIALOG;
our $HOST_ENTRY;
+our $SERVER_INFO;
our $SETUP_DIALOG;
our $SETUP_NOTEBOOK;
@@ -239,13 +240,13 @@
my ($sw1, $sw2) = map +(new CFClient::UI::Combobox
value => $_,
options => [
- [Str => 1, "Strength ($conn->{stat}{+CS_STAT_STR})"],
- [Dex => 2, "Dexterity ($conn->{stat}{+CS_STAT_DEX})"],
- [Con => 3, "Constitution ($conn->{stat}{+CS_STAT_CON})"],
- [Int => 4, "Intelligence ($conn->{stat}{+CS_STAT_INT})"],
- [Wis => 5, "Wisdom ($conn->{stat}{+CS_STAT_WIS})"],
- [Pow => 6, "Power ($conn->{stat}{+CS_STAT_POW})"],
- [Cha => 7, "Charisma ($conn->{stat}{+CS_STAT_CHA})"],
+ [1 => "Str", "Strength ($conn->{stat}{+CS_STAT_STR})"],
+ [2 => "Dex", "Dexterity ($conn->{stat}{+CS_STAT_DEX})"],
+ [3 => "Con", "Constitution ($conn->{stat}{+CS_STAT_CON})"],
+ [4 => "Int", "Intelligence ($conn->{stat}{+CS_STAT_INT})"],
+ [5 => "Wis", "Wisdom ($conn->{stat}{+CS_STAT_WIS})"],
+ [6 => "Pow", "Power ($conn->{stat}{+CS_STAT_POW})"],
+ [7 => "Cha", "Charisma ($conn->{stat}{+CS_STAT_CHA})"],
],
), 1 .. 2;
@@ -364,6 +365,7 @@
$SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER);
$SETUP_DIALOG->show;
$INV_WINDOW->hide;
+ $SETUP_SPELLS->clear_spells;
return unless $CONN;
@@ -627,6 +629,33 @@
$win
}
+sub debug_setup {
+ my $table = new CFClient::UI::Table;
+
+ $table->add (0, 0, new CFClient::UI::Label text => "Widget Borders");
+ $table->add (1, 0, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 1 });
+ $table->add (0, 1, new CFClient::UI::Label text => "Tooltip Widget Info");
+ $table->add (1, 1, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2 });
+ $table->add (0, 2, new CFClient::UI::Label text => "Show FPS");
+ $table->add (1, 2, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4 });
+ $table->add (0, 3, new CFClient::UI::Label text => "Suppress Tooltips");
+ $table->add (1, 3, new CFClient::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8 });
+
+ my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05);
+
+ for my $x (0..2) {
+ for my $y (0 .. 2) {
+ $table->add ($x + 3, $y,
+ new CFClient::UI::Entry
+ text => $default_smooth[$x * 3 + $y],
+ on_changed => sub { $MAP->{smooth_matrix}[$x * 3 + $y] = $_[1] if $MAP; 0 },
+ );
+ }
+ }
+
+
+ $table
+}
sub stats_window {
my $tgw = new CFClient::UI::FancyFrame
@@ -848,9 +877,19 @@
$table->clear;
- my @col = qw(Use #Users Host Uptime Version Description);
- $table->add ($_, 0, new CFClient::UI::Label align => 0, fg => [1, 1, 0], text => $col[$_])
- for 0 .. $#col;
+ my @tip = (
+ "The current number of users logged in on the server.",
+ "The hostname of the server.",
+ "The time this server has been running without being restarted.",
+ "The server software version - a '+' indicates a Crossfire+ server.",
+ "Short information about this server provided by its admins.",
+ );
+ my @col = qw(#Users Host Uptime Version Description);
+ $table->add ($_, 0, new CFClient::UI::Label
+ can_hover => 1, can_events => 1,
+ align => 0, fg => [1, 1, 0],
+ text => $col[$_], tooltip => $tip[$_])
+ for 0 .. $#col;
my @align = qw(1 0 1 1 -1);
@@ -877,16 +916,26 @@
$y++;
- $table->add (0, $y, new CFClient::UI::VBox children => [
- (new CFClient::UI::Button text => "Use", on_activate => sub {
- $HOST_ENTRY->set_text ($CFG->{host} = $host);
- $METASERVER->toggle_visibility;
- }),
+ $table->add (scalar @$m, $y, new CFClient::UI::VBox children => [
+ (new CFClient::UI::Button
+ text => "Use",
+ tooltip => "Put this server into the Host:Port field",
+ on_activate => sub {
+ $HOST_ENTRY->set_text ($CFG->{host} = $host);
+ $METASERVER->hide;
+ },
+ ),
(new CFClient::UI::Empty expand => 1),
]);
- $table->add ($_ + 1, $y, new CFClient::UI::Label
- ellipsise => 0, align => $align[$_], text => $m->[$_], fontsize => 0.8)
+ $table->add ($_, $y, new CFClient::UI::Label
+ ellipsise => 0,
+ align => $align[$_],
+ text => $m->[$_],
+ tooltip => $tip[$_],
+ can_hover => 1,
+ can_events => 1,
+ fontsize => 0.8)
for 0 .. $#$m;
}
}
@@ -895,18 +944,21 @@
sub metaserver_dialog {
my $dialog = new CFClient::UI::FancyFrame
- title => "Server List",
- name => 'metaserver_dialog',
- x => 'center',
- y => 'center',
- z => 3,
- child => (my $vbox = new CFClient::UI::VBox),
+ title => "Server List",
+ name => 'metaserver_dialog',
+ x => 'center',
+ y => 'center',
+ z => 3,
+ force_h => $::HEIGHT * 0.4,
+ child => (my $vbox = new CFClient::UI::VBox),
on_visibility_change => sub {
update_metaserver if $_[1];
},
;
- $vbox->add ($dialog->{table} = new CFClient::UI::Table);
+ $dialog->{table} = new CFClient::UI::Table;
+
+ $vbox->add (new CFClient::UI::ScrolledWindow expand => 1, child => $dialog->{table});
$dialog
}
@@ -939,6 +991,7 @@
other => $METASERVER,
tooltip => "Show a list of available crossfire servers",
on_activate => sub { $METASERVER->toggle_visibility },
+ on_visibility_change => sub { $METASERVER->hide unless $_[1] },
);
}
@@ -1027,6 +1080,15 @@
}
);
+ $vbox->add (new CFClient::UI::Label
+ text => "Server Info",
+ fontsize => 1.2,
+ padding_y => 8,
+ fg => [1, 1, 0, 1],
+ );
+
+ $vbox->add ($SERVER_INFO = new CFClient::UI::Label ellipsise => 0);
+
$vbox
}
@@ -1160,6 +1222,7 @@
["Ignore cursed" => PICKUP_NOT_CURSED],
["Jewelery" => PICKUP_JEWELS],
],
+ ["Weight/Value ratio", 2, 17]
)
{
my ($title, $x, $y, @bits) = @$_;
@@ -1174,17 +1237,38 @@
state => $CFG->{pickup} & $mask,
on_changed => sub {
my ($box, $value) = @_;
+
if ($value) {
$::CFG->{pickup} |= $mask;
} else {
- $::CFG->{pickup} = $::CFG->{pickup} & ~$mask;
+ $::CFG->{pickup} &= ~$mask;
}
- $::CONN->send (sprintf "command pickup %u", $::CFG->{pickup})
+
+ $::CONN->send_command ("pickup $::CFG->{pickup}")
if defined $::CONN;
});
}
}
+ $table->add (2, 18, new CFClient::UI::ValSlider
+ range => [0, 0, 16, 1, 1],
+ to_value => sub { ">= " . 5 * $_[0] },
+ on_changed => sub {
+ my ($slider, $value) = @_;
+
+ $::CFG->{pickup} &= ~0x7;
+ $::CFG->{pickup} |= int $value
+ if $value;
+ 1;
+ });
+ $table->add (3, 18, new CFClient::UI::Button
+ text => "set",
+ on_activate => sub {
+ $::CONN->send_command ("pickup $::CFG->{pickup}")
+ if defined $::CONN;
+ 1;
+ });
+
$table
}
@@ -1311,7 +1395,7 @@
$vb
}
-sub make_help_window {
+sub help_window {
my $win = new CFClient::UI::FancyFrame
x => 'center',
y => 'center',
@@ -1324,33 +1408,40 @@
$win->add (my $vbox = new CFClient::UI::VBox);
$vbox->add (my $buttons = new CFClient::UI::HBox);
- $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8);
+ $vbox->add (my $viewer = new CFClient::UI::TextScroller
+ expand => 1, fontsize => 0.8, padding_x => 4);
- for (
- [intro => "Introduction"],
- [manual => "Manual"],
- [command_help => "Commands"],
- [skill_help => "Skills"],
- ) {
- my ($pod, $label) = @$_;
-
- $buttons->add (new CFClient::UI::Button
- text => $label,
- on_activate => sub {
- my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod",
- doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] };
+ $buttons->add (new CFClient::UI::Label text => "Choose a document to display: ");
+ $buttons->add (my $combo = new CFClient::UI::Combobox
+ value => undef,
+ options => [
+ [intro => "Introduction"],
+ [manual => "Manual"],
+ [skill_help => "Skills"],
+ [command_help => "Commands"],
+ [dmcommand_help => "DM Commands"],
+ [COPYING => "License Terms"],
+ ],
+ on_changed => sub {
+ my ($self, $pod) = @_;
- $viewer->clear;
-
- $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0])
- for @$pom;
+ my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod",
+ doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] };
- $viewer->set_offset (0);
- },
- );
- }
+ $viewer->clear;
+
+ $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0])
+ for @$pom;
- $viewer->add_paragraph ([1, 1, 0, 1], "Use one of the buttons above to display a document.");
+ $viewer->set_offset (0);
+ },
+ on_visibility_change => sub {
+ my ($self, $visible) = @_;
+ return unless $visible;
+ return if $self->{value};
+ $self->set_value ("intro");
+ },
+ );
$win
}
@@ -1416,6 +1507,7 @@
y => $FONTSIZE + 8,
border_bg => [1, 1, 1, 192/255],
bg => [1, 1, 1, 0],
+ no_close_button => 1,
child => ($MAPMAP = new CFClient::MapWidget::MapMap
tooltip => "Map. On servers that support this feature, this will display an overview of the surrounding areas.",
),
@@ -1437,7 +1529,7 @@
$MAPWIDGET->show;
$MAPWIDGET->focus_in;
- $LOGVIEW = new CFClient::UI::TextView
+ $LOGVIEW = new CFClient::UI::TextScroller
expand => 1,
font => $FONT_FIXED,
fontsize => $::CFG->{log_fontsize},
@@ -1477,6 +1569,8 @@
. "binding editor closes");
$SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup,
"Displays all spells you have and lets you edit keyboard shortcuts for them.");
+ $SETUP_NOTEBOOK->add (Debug => debug_setup,
+ "Some debuggign options. Do not ask.");
$BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top
@@ -1504,7 +1598,7 @@
},
);
- $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window,
+ $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window,
tooltip => "View Documentation");
$BUTTONBAR->add (new CFClient::UI::Button
@@ -1775,6 +1869,7 @@
face_prefetch => 0,
output_sync => 1,
output_count => 1,
+ pickup => 0,
);
while (my ($k, $v) = each %DEF_CFG) {
@@ -1831,6 +1926,8 @@
}
Event::loop;
+#CFClient::SDL_Quit;
+#CFClient::_exit 0;
END { CFClient::SDL_Quit }