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.40 by root, Fri Jun 2 02:12:04 2006 UTC vs.
Revision 1.47 by root, Fri Jun 2 21:36:12 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
710} 711}
711 712
712sub metaserver_dialog { 713sub metaserver_dialog {
713 my $dialog = new CFClient::UI::FancyFrame 714 my $dialog = new CFClient::UI::FancyFrame
714 title => "Server List", 715 title => "Server List",
716 name => 'metaserver_dialog',
715 x => 'center', 717 x => 'center',
716 y => 'center', 718 y => 'center',
717 child => (my $vbox = new CFClient::UI::VBox), 719 child => (my $vbox = new CFClient::UI::VBox),
718 on_visibility_change => sub { 720 on_visibility_change => sub {
719 update_metaserver if $_[1]; 721 update_metaserver if $_[1];
869 }, 871 },
870 on_activate => sub { 872 on_activate => sub {
871 my ($input, $text) = @_; 873 my ($input, $text) = @_;
872 $input->set_text (''); 874 $input->set_text ('');
873 875
874 if ($text =~ /^\/bind\s+(.*)$/) {
875 CFClient::Binder::open_binding_dialog (sub {
876 my ($mod, $sym) = @_;
877 $::CFG->{bindings}->{$mod}->{$sym} = [$1];
878 });
879 } elsif ($text =~ /^\/(.*)/) { 876 if ($text =~ /^\/(.*)/) {
880 $::CONN->user_send ($1); 877 $::CONN->user_send ($1);
881 } else { 878 } else {
882 my $say_cmd = $::CFG->{say_command} || 'say'; 879 my $say_cmd = $::CFG->{say_command} || 'say';
883 $::CONN->user_send ("$say_cmd $text"); 880 $::CONN->user_send ("$say_cmd $text");
884 } 881 }
927 on_activate => sub { exit }, 924 on_activate => sub { exit },
928 ); 925 );
929 } 926 }
930 927
931 $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
932} 1008}
933 1009
934sub make_inventory_window { 1010sub make_inventory_window {
935 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame 1011 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame
936 x => "center", 1012 x => "center",
1060 $BIND_WINDOW 1136 $BIND_WINDOW
1061} 1137}
1062 1138
1063sub make_help_window { 1139sub make_help_window {
1064 my $win = new CFClient::UI::FancyFrame 1140 my $win = new CFClient::UI::FancyFrame
1141 x => 'center',
1142 y => 'center',
1143 name => 'doc_browser',
1065 def_w => int $WIDTH * 7/8, 1144 force_w => int $WIDTH * 7/8,
1066 def_h => int $HEIGHT * 7/8, 1145 force_h => int $HEIGHT * 7/8,
1067 title => "Documentation"; 1146 title => "Documentation";
1068 1147
1069 $win->add (my $vbox = new CFClient::UI::VBox); 1148 $win->add (my $vbox = new CFClient::UI::VBox);
1070 1149
1071 $vbox->add (my $buttons = new CFClient::UI::HBox); 1150 $vbox->add (my $buttons = new CFClient::UI::HBox);
1072 $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); 1151 $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8);
1153 force_y => "max", 1232 force_y => "max",
1154 child => $STATUSBOX, 1233 child => $STATUSBOX,
1155 )->show; 1234 )->show;
1156 1235
1157 CFClient::UI::FancyFrame->new ( 1236 CFClient::UI::FancyFrame->new (
1237 title => "Map",
1238 name => "mapmap",
1158 x => 0, 1239 x => 0,
1159 y => $FONTSIZE + 8, 1240 y => $FONTSIZE + 8,
1160 border_bg => [1, 1, 1, 192/255], 1241 border_bg => [1, 1, 1, 192/255],
1161 bg => [1, 1, 1, 0], 1242 bg => [1, 1, 1, 0],
1162 child => ($MAPMAP = new CFClient::MapWidget::MapMap 1243 child => ($MAPMAP = new CFClient::MapWidget::MapMap
1232 1313
1233 $BUTTONBAR->add (new CFClient::UI::Flopper 1314 $BUTTONBAR->add (new CFClient::UI::Flopper
1234 text => "Spells", 1315 text => "Spells",
1235 other => make_spell_list, 1316 other => make_spell_list,
1236 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
1237 1324
1238 $BUTTONBAR->add (new CFClient::UI::Button 1325 $BUTTONBAR->add (new CFClient::UI::Button
1239 text => "Quit", 1326 text => "Quit",
1240 tooltip => "Terminates the program", 1327 tooltip => "Terminates the program",
1241 on_activate => sub { 1328 on_activate => sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines