… | |
… | |
930 | |
930 | |
931 | $QUIT_DIALOG->show; |
931 | $QUIT_DIALOG->show; |
932 | } |
932 | } |
933 | |
933 | |
934 | sub autopickup_setup { |
934 | sub autopickup_setup { |
935 | my $vb = new CFClient::UI::VBox; |
935 | my $table = new CFClient::UI::Table; |
936 | |
|
|
937 | $vb->add (my $gen_tbl = new CFClient::UI::Table expand => 1); |
|
|
938 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
|
|
939 | $hb->add (my $ltbl = new CFClient::UI::Table expand => 1); |
|
|
940 | $hb->add (my $rtbl = new CFClient::UI::Table expand => 1); |
|
|
941 | |
|
|
942 | my $tbl = 0; |
|
|
943 | my $tblrow = 0; |
|
|
944 | |
936 | |
945 | for ( |
937 | for ( |
946 | ["General", $gen_tbl], |
938 | ["General", 0, 0, |
947 | ["Enable autopickup" => CFClient::Pickup::PU_NEWMODE], |
939 | ["Enable autopickup" => CFClient::Pickup::PU_NEWMODE], |
948 | ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT], |
940 | ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT], |
949 | ["Stop before pickup" => CFClient::Pickup::PU_STOP], |
941 | ["Stop before pickup" => CFClient::Pickup::PU_STOP], |
950 | ["Debug autopickup" => CFClient::Pickup::PU_DEBUG], |
942 | ["Debug autopickup" => CFClient::Pickup::PU_DEBUG], |
|
|
943 | ], |
951 | ["Weapons", $ltbl], |
944 | ["Weapons", 0, 6, |
952 | ["All weapons" => CFClient::Pickup::PU_ALLWEAPON], |
945 | ["All weapons" => CFClient::Pickup::PU_ALLWEAPON], |
953 | ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON], |
946 | ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON], |
954 | ["Bows" => CFClient::Pickup::PU_BOW], |
947 | ["Bows" => CFClient::Pickup::PU_BOW], |
955 | ["Arrows" => CFClient::Pickup::PU_ARROW], |
948 | ["Arrows" => CFClient::Pickup::PU_ARROW], |
|
|
949 | ], |
956 | ["Armour"], |
950 | ["Armour", 0, 12, |
957 | ["Helmets" => CFClient::Pickup::PU_HELMET], |
951 | ["Helmets" => CFClient::Pickup::PU_HELMET], |
958 | ["Shields" => CFClient::Pickup::PU_SHIELD], |
952 | ["Shields" => CFClient::Pickup::PU_SHIELD], |
959 | ["Body Armour" => CFClient::Pickup::PU_ARMOUR], |
953 | ["Body Armour" => CFClient::Pickup::PU_ARMOUR], |
960 | ["Boots" => CFClient::Pickup::PU_BOOTS], |
954 | ["Boots" => CFClient::Pickup::PU_BOOTS], |
961 | ["Gloves" => CFClient::Pickup::PU_GLOVES], |
955 | ["Gloves" => CFClient::Pickup::PU_GLOVES], |
962 | ["Cloaks" => CFClient::Pickup::PU_CLOAK], |
956 | ["Cloaks" => CFClient::Pickup::PU_CLOAK], |
|
|
957 | ], |
|
|
958 | |
963 | ["Readables", $rtbl], |
959 | ["Readables", 2, 2, |
964 | ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK], |
960 | ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK], |
965 | ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL], |
961 | ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL], |
966 | ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES], |
962 | ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES], |
|
|
963 | ], |
967 | ["Misc"], |
964 | ["Misc", 2, 7, |
968 | ["Food" => CFClient::Pickup::PU_FOOD], |
965 | ["Food" => CFClient::Pickup::PU_FOOD], |
969 | ["Drinks" => CFClient::Pickup::PU_DRINK], |
966 | ["Drinks" => CFClient::Pickup::PU_DRINK], |
970 | ["Valuables (Money, Gems)" => CFClient::Pickup::PU_VALUABLES], |
967 | ["Valuables (Money, Gems)" => CFClient::Pickup::PU_VALUABLES], |
971 | ["Keys" => CFClient::Pickup::PU_KEY], |
968 | ["Keys" => CFClient::Pickup::PU_KEY], |
972 | ["Magical Items" => CFClient::Pickup::PU_MAGICAL], |
969 | ["Magical Items" => CFClient::Pickup::PU_MAGICAL], |
973 | ["Potions" => CFClient::Pickup::PU_POTION], |
970 | ["Potions" => CFClient::Pickup::PU_POTION], |
974 | ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE], |
971 | ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE], |
975 | ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED], |
972 | ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED], |
976 | ["Jewelery" => CFClient::Pickup::PU_JEWELS], |
973 | ["Jewelery" => CFClient::Pickup::PU_JEWELS], |
|
|
974 | ], |
977 | ) |
975 | ) |
978 | { |
976 | { |
979 | if (ref $_->[1]) { |
977 | my ($title, $x, $y, @bits) = @$_; |
980 | $tbl = $_->[1]; |
|
|
981 | $tblrow = 0; |
|
|
982 | $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1); |
978 | $table->add ($x, $y, new CFClient::UI::Label text => $title, align => 1, fg => [1, 1, 0]); |
983 | } elsif (not defined $_->[1]) { |
979 | |
984 | $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1); |
980 | for (@bits) { |
985 | } else { |
981 | ++$y; |
|
|
982 | |
986 | my $mask = $_->[1]; |
983 | my $mask = $_->[1]; |
987 | $tbl->add (0, $tblrow, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); |
984 | $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); |
988 | $tbl->add (1, $tblrow++, new CFClient::UI::CheckBox |
985 | $table->add ($x+1, $y, new CFClient::UI::CheckBox |
989 | state => $CFG->{pickup} & $mask, |
986 | state => $CFG->{pickup} & $mask, |
990 | on_changed => sub { |
987 | on_changed => sub { |
991 | my ($box, $value) = @_; |
988 | my ($box, $value) = @_; |
992 | if ($value) { |
989 | if ($value) { |
993 | $::CFG->{pickup} |= $mask; |
990 | $::CFG->{pickup} |= $mask; |
… | |
… | |
998 | if defined $::CONN; |
995 | if defined $::CONN; |
999 | }); |
996 | }); |
1000 | } |
997 | } |
1001 | } |
998 | } |
1002 | |
999 | |
1003 | $vb |
1000 | $table |
1004 | } |
1001 | } |
1005 | |
1002 | |
1006 | sub make_inventory_window { |
1003 | sub make_inventory_window { |
1007 | my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame |
1004 | my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame |
1008 | x => "center", |
1005 | x => "center", |
… | |
… | |
1300 | 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 |
1297 | 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 |
1301 | |
1298 | |
1302 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window, |
1299 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window, |
1303 | tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); |
1300 | tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); |
1304 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window, |
1301 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window, |
1305 | tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :)." |
1302 | tooltip => "Toggles the inventory window, where you can manage your loot (or treasures :). " |
1306 | ."You can also hit the <b>Tab</b>-key to show/hide the Inventory."); |
1303 | ."You can also hit the <b>Tab</b>-key to show/hide the Inventory."); |
1307 | |
1304 | |
1308 | $BUTTONBAR->add (new CFClient::UI::Button |
1305 | $BUTTONBAR->add (new CFClient::UI::Button |
1309 | text => "Save Config", |
1306 | text => "Save Config", |
1310 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1307 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |