--- deliantra/Deliantra-Client/bin/cfplus 2006/06/02 02:21:48 1.41 +++ deliantra/Deliantra-Client/bin/cfplus 2006/06/02 21:46:45 1.48 @@ -110,6 +110,7 @@ our $BIND_EDITOR; our $SPELL_LIST; +our $PICKUP_CFG; sub status { $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); @@ -558,8 +559,8 @@ $tgw } -sub formsep { - reverse join ",", grep length, split /(...)/, reverse $_[0] * 1 +sub formsep($) { + scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 } sub update_stats_window { @@ -872,12 +873,7 @@ my ($input, $text) = @_; $input->set_text (''); - if ($text =~ /^\/bind\s+(.*)$/) { - CFClient::Binder::open_binding_dialog (sub { - my ($mod, $sym) = @_; - $::CFG->{bindings}->{$mod}->{$sym} = [$1]; - }); - } elsif ($text =~ /^\/(.*)/) { + if ($text =~ /^\/(.*)/) { $::CONN->user_send ($1); } else { my $say_cmd = $::CFG->{say_command} || 'say'; @@ -932,6 +928,85 @@ $QUIT_DIALOG->show; } +sub make_pickup_cfg_window { + $PICKUP_CFG = new CFClient::UI::FancyFrame + title => "Autopickup configuration", + x => "center", + y => "center", + force_w => $WIDTH * 6/10, + force_h => $HEIGHT * 9/10; + + + $PICKUP_CFG->add (my $vb = new CFClient::UI::VBox); + $vb->add (my $gen_tbl = new CFClient::UI::Table expand => 1); + $vb->add (my $hb = new CFClient::UI::HBox expand => 1); + $hb->add (my $ltbl = new CFClient::UI::Table expand => 1); + $hb->add (my $rtbl = new CFClient::UI::Table expand => 1); + + my $tbl = 0; + my $tblrow = 0; + + for ( + ["General", $gen_tbl], + ["Enable autopickup" => CFClient::Pickup::PU_NEWMODE], + ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT], + ["Stop before pickup" => CFClient::Pickup::PU_STOP], + ["Debug autopickup" => CFClient::Pickup::PU_DEBUG], + ["Weapons", $ltbl], + ["All weapons" => CFClient::Pickup::PU_ALLWEAPON], + ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON], + ["Bows" => CFClient::Pickup::PU_BOW], + ["Arrows" => CFClient::Pickup::PU_ARROW], + ["Armour"], + ["Helmets" => CFClient::Pickup::PU_HELMET], + ["Shields" => CFClient::Pickup::PU_SHIELD], + ["Body Armour" => CFClient::Pickup::PU_ARMOUR], + ["Boots" => CFClient::Pickup::PU_BOOTS], + ["Gloves" => CFClient::Pickup::PU_GLOVES], + ["Cloaks" => CFClient::Pickup::PU_CLOAK], + ["Readables", $rtbl], + ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK], + ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL], + ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES], + ["Misc"], + ["Food" => CFClient::Pickup::PU_FOOD], + ["Drinks" => CFClient::Pickup::PU_DRINK], + ["Valuables (Money, Gems)" => CFClient::Pickup::PU_VALUABLES], + ["Keys" => CFClient::Pickup::PU_KEY], + ["Magical Items" => CFClient::Pickup::PU_MAGICAL], + ["Potions" => CFClient::Pickup::PU_POTION], + ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE], + ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED], + ["Jewelery" => CFClient::Pickup::PU_JEWELS], + ) + { + if (ref $_->[1]) { + $tbl = $_->[1]; + $tblrow = 0; + $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1); + } elsif (not defined $_->[1]) { + $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1); + } else { + my $mask = $_->[1]; + $tbl->add (0, $tblrow, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); + $tbl->add (1, $tblrow++, new CFClient::UI::CheckBox + state => $CFG->{pickup} & $mask, + on_changed => sub { + my ($box, $value) = @_; + if ($value) { + $::CFG->{pickup} |= $mask; + } else { + $::CFG->{pickup} = $::CFG->{pickup} & ~$mask; + } + $::CONN->send (sprintf "command pickup %u", $::CFG->{pickup}) + if defined $::CONN; + }); + } + } + + $PICKUP_CFG +} + sub make_inventory_window { my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame x => "center", @@ -1159,6 +1234,8 @@ )->show; CFClient::UI::FancyFrame->new ( + title => "Map", + name => "mapmap", x => 0, y => $FONTSIZE + 8, border_bg => [1, 1, 1, 192/255], @@ -1239,6 +1316,12 @@ other => make_spell_list, tooltip => "The spell list"); + $BUTTONBAR->add (new CFClient::UI::Flopper + text => "Pickup", + other => make_pickup_cfg_window, + tooltip => "The pickup dialog"); + + $BUTTONBAR->add (new CFClient::UI::Button text => "Quit", tooltip => "Terminates the program",