ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.42 by root, Fri Jun 2 06:22:55 2006 UTC vs.
Revision 1.46 by elmex, Fri Jun 2 18:46:16 2006 UTC

108 108
109our $BIND_WINDOW; 109our $BIND_WINDOW;
110our $BIND_EDITOR; 110our $BIND_EDITOR;
111 111
112our $SPELL_LIST; 112our $SPELL_LIST;
113our $PICKUP_CFG;
113 114
114sub status { 115sub status {
115 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); 116 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
116} 117}
117 118
870 }, 871 },
871 on_activate => sub { 872 on_activate => sub {
872 my ($input, $text) = @_; 873 my ($input, $text) = @_;
873 $input->set_text (''); 874 $input->set_text ('');
874 875
875 if ($text =~ /^\/bind\s+(.*)$/) {
876 CFClient::Binder::open_binding_dialog (sub {
877 my ($mod, $sym) = @_;
878 $::CFG->{bindings}->{$mod}->{$sym} = [$1];
879 });
880 } elsif ($text =~ /^\/(.*)/) { 876 if ($text =~ /^\/(.*)/) {
881 $::CONN->user_send ($1); 877 $::CONN->user_send ($1);
882 } else { 878 } else {
883 my $say_cmd = $::CFG->{say_command} || 'say'; 879 my $say_cmd = $::CFG->{say_command} || 'say';
884 $::CONN->user_send ("$say_cmd $text"); 880 $::CONN->user_send ("$say_cmd $text");
885 } 881 }
928 on_activate => sub { exit }, 924 on_activate => sub { exit },
929 ); 925 );
930 } 926 }
931 927
932 $QUIT_DIALOG->show; 928 $QUIT_DIALOG->show;
929}
930
931sub make_pickup_cfg_window {
932 $PICKUP_CFG = new CFClient::UI::FancyFrame
933 title => "Autopickup configuration",
934 x => "center",
935 y => "center",
936 force_w => $WIDTH * 6/10,
937 force_h => $HEIGHT * 9/10;
938
939
940 $PICKUP_CFG->add (my $vb = new CFClient::UI::VBox);
941 $vb->add (my $gen_tbl = new CFClient::UI::Table expand => 1);
942 $vb->add (my $hb = new CFClient::UI::HBox expand => 1);
943 $hb->add (my $ltbl = new CFClient::UI::Table expand => 1);
944 $hb->add (my $rtbl = new CFClient::UI::Table expand => 1);
945
946 my $tbl = 0;
947 my $tblrow = 0;
948
949 for (
950 ["General", $gen_tbl],
951 ["Enable autopickup" => CFClient::Pickup::PU_NEWMODE],
952 ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT],
953 ["Stop before pickup" => CFClient::Pickup::PU_STOP],
954 ["Debug autopickup" => CFClient::Pickup::PU_DEBUG],
955 ["Weapons", $ltbl],
956 ["All weapons" => CFClient::Pickup::PU_ALLWEAPON],
957 ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON],
958 ["Bows" => CFClient::Pickup::PU_BOW],
959 ["Arrows" => CFClient::Pickup::PU_ARROW],
960 ["Armour"],
961 ["Helmets" => CFClient::Pickup::PU_HELMET],
962 ["Shields" => CFClient::Pickup::PU_SHIELD],
963 ["Body Armour" => CFClient::Pickup::PU_ARMOUR],
964 ["Boots" => CFClient::Pickup::PU_BOOTS],
965 ["Gloves" => CFClient::Pickup::PU_GLOVES],
966 ["Cloaks" => CFClient::Pickup::PU_CLOAK],
967 ["Readables", $rtbl],
968 ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK],
969 ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL],
970 ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES],
971 ["Misc"],
972 ["Food" => CFClient::Pickup::PU_FOOD],
973 ["Drinks" => CFClient::Pickup::PU_DRINK],
974 ["Valuables (Money, Gems)" => CFClient::Pickup::PU_VALUABLES],
975 ["Keys" => CFClient::Pickup::PU_KEY],
976 ["Magical Items" => CFClient::Pickup::PU_MAGICAL],
977 ["Potions" => CFClient::Pickup::PU_POTION],
978 ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE],
979 ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED],
980 ["Jewelery" => CFClient::Pickup::PU_JEWELS],
981 )
982 {
983 if (ref $_->[1]) {
984 $tbl = $_->[1];
985 $tblrow = 0;
986 $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1);
987 } elsif (not defined $_->[1]) {
988 $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1);
989 } else {
990 my $mask = $_->[1];
991 $tbl->add (0, $tblrow, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1);
992 $tbl->add (1, $tblrow++, new CFClient::UI::CheckBox
993 state => $CFG->{pickup} & $mask,
994 on_changed => sub {
995 my ($box, $value) = @_;
996 if ($value) {
997 $::CFG->{pickup} |= $mask;
998 } else {
999 $::CFG->{pickup} = $::CFG->{pickup} & ~$mask;
1000 }
1001 $::CONN->send (sprintf "command pickup %u", $::CFG->{pickup})
1002 if defined $::CONN;
1003 });
1004 }
1005 }
1006
1007 $PICKUP_CFG
933} 1008}
934 1009
935sub make_inventory_window { 1010sub make_inventory_window {
936 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame 1011 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame
937 x => "center", 1012 x => "center",
1238 1313
1239 $BUTTONBAR->add (new CFClient::UI::Flopper 1314 $BUTTONBAR->add (new CFClient::UI::Flopper
1240 text => "Spells", 1315 text => "Spells",
1241 other => make_spell_list, 1316 other => make_spell_list,
1242 tooltip => "The spell list"); 1317 tooltip => "The spell list");
1318
1319 $BUTTONBAR->add (new CFClient::UI::Flopper
1320 text => "Pickup",
1321 other => make_pickup_cfg_window,
1322 tooltip => "The pickup dialog");
1323
1243 1324
1244 $BUTTONBAR->add (new CFClient::UI::Button 1325 $BUTTONBAR->add (new CFClient::UI::Button
1245 text => "Quit", 1326 text => "Quit",
1246 tooltip => "Terminates the program", 1327 tooltip => "Terminates the program",
1247 on_activate => sub { 1328 on_activate => sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines