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.45 by elmex, Fri Jun 2 16:52:49 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];
927 on_activate => sub { exit }, 929 on_activate => sub { exit },
928 ); 930 );
929 } 931 }
930 932
931 $QUIT_DIALOG->show; 933 $QUIT_DIALOG->show;
934}
935
936sub make_pickup_cfg_window {
937 $PICKUP_CFG = new CFClient::UI::FancyFrame
938 title => "Autopickup configuration",
939 x => "center",
940 y => "center",
941 force_w => $WIDTH * 6/10,
942 force_h => $HEIGHT * 9/10;
943
944
945 $PICKUP_CFG->add (my $vb = new CFClient::UI::VBox);
946 $vb->add (my $gen_tbl = new CFClient::UI::Table expand => 1);
947 $vb->add (my $hb = new CFClient::UI::HBox expand => 1);
948 $hb->add (my $ltbl = new CFClient::UI::Table expand => 1);
949 $hb->add (my $rtbl = new CFClient::UI::Table expand => 1);
950
951 my $tbl = 0;
952 my $tblrow = 0;
953
954 for (
955 ["General", $gen_tbl],
956 ["Enable autopickup" => CFClient::Pickup::PU_NEWMODE],
957 ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT],
958 ["Stop before pickup" => CFClient::Pickup::PU_STOP],
959 ["Debug autopickup" => CFClient::Pickup::PU_DEBUG],
960 ["Weapons", $ltbl],
961 ["All weapons" => CFClient::Pickup::PU_ALLWEAPON],
962 ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON],
963 ["Bows" => CFClient::Pickup::PU_BOW],
964 ["Arrows" => CFClient::Pickup::PU_ARROW],
965 ["Armour"],
966 ["Helmets" => CFClient::Pickup::PU_HELMET],
967 ["Shields" => CFClient::Pickup::PU_SHIELD],
968 ["Body Armour" => CFClient::Pickup::PU_ARMOUR],
969 ["Boots" => CFClient::Pickup::PU_BOOTS],
970 ["Gloves" => CFClient::Pickup::PU_GLOVES],
971 ["Cloaks" => CFClient::Pickup::PU_CLOAK],
972 ["Readables", $rtbl],
973 ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK],
974 ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL],
975 ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES],
976 ["Misc"],
977 ["Food" => CFClient::Pickup::PU_FOOD],
978 ["Drinks" => CFClient::Pickup::PU_DRINK],
979 ["Valuables (Money, Gems)" => CFClient::Pickup::PU_VALUABLES],
980 ["Keys" => CFClient::Pickup::PU_KEY],
981 ["Magical Items" => CFClient::Pickup::PU_MAGICAL],
982 ["Potions" => CFClient::Pickup::PU_POTION],
983 ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE],
984 ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED],
985 ["Jewelery" => CFClient::Pickup::PU_JEWELS],
986 )
987 {
988 if (ref $_->[1]) {
989 $tbl = $_->[1];
990 $tblrow = 0;
991 $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1);
992 } elsif (not defined $_->[1]) {
993 $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => -1);
994 } else {
995 my $mask = $_->[1];
996 $tbl->add (0, $tblrow, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1);
997 $tbl->add (1, $tblrow++, new CFClient::UI::CheckBox
998 state => $CFG->{pickup} & $mask,
999 on_changed => sub {
1000 my ($box, $value) = @_;
1001 if ($value) {
1002 $::CFG->{pickup} |= $mask;
1003 } else {
1004 $::CFG->{pickup} = $::CFG->{pickup} & ~$mask;
1005 }
1006 $::CONN->send (sprintf "command pickup %u", $::CFG->{pickup})
1007 if defined $::CONN;
1008 });
1009 }
1010 }
1011
1012 $PICKUP_CFG
932} 1013}
933 1014
934sub make_inventory_window { 1015sub make_inventory_window {
935 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame 1016 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame
936 x => "center", 1017 x => "center",
1060 $BIND_WINDOW 1141 $BIND_WINDOW
1061} 1142}
1062 1143
1063sub make_help_window { 1144sub make_help_window {
1064 my $win = new CFClient::UI::FancyFrame 1145 my $win = new CFClient::UI::FancyFrame
1146 x => 'center',
1147 y => 'center',
1148 name => 'doc_browser',
1065 def_w => int $WIDTH * 7/8, 1149 force_w => int $WIDTH * 7/8,
1066 def_h => int $HEIGHT * 7/8, 1150 force_h => int $HEIGHT * 7/8,
1067 title => "Documentation"; 1151 title => "Documentation";
1068 1152
1069 $win->add (my $vbox = new CFClient::UI::VBox); 1153 $win->add (my $vbox = new CFClient::UI::VBox);
1070 1154
1071 $vbox->add (my $buttons = new CFClient::UI::HBox); 1155 $vbox->add (my $buttons = new CFClient::UI::HBox);
1072 $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); 1156 $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8);
1153 force_y => "max", 1237 force_y => "max",
1154 child => $STATUSBOX, 1238 child => $STATUSBOX,
1155 )->show; 1239 )->show;
1156 1240
1157 CFClient::UI::FancyFrame->new ( 1241 CFClient::UI::FancyFrame->new (
1242 title => "Mini Map",
1243 name => "mapmap",
1158 x => 0, 1244 x => 0,
1159 y => $FONTSIZE + 8, 1245 y => $FONTSIZE + 8,
1160 border_bg => [1, 1, 1, 192/255], 1246 border_bg => [1, 1, 1, 192/255],
1161 bg => [1, 1, 1, 0], 1247 bg => [1, 1, 1, 0],
1162 child => ($MAPMAP = new CFClient::MapWidget::MapMap 1248 child => ($MAPMAP = new CFClient::MapWidget::MapMap
1232 1318
1233 $BUTTONBAR->add (new CFClient::UI::Flopper 1319 $BUTTONBAR->add (new CFClient::UI::Flopper
1234 text => "Spells", 1320 text => "Spells",
1235 other => make_spell_list, 1321 other => make_spell_list,
1236 tooltip => "The spell list"); 1322 tooltip => "The spell list");
1323
1324 $BUTTONBAR->add (new CFClient::UI::Flopper
1325 text => "Pickup",
1326 other => make_pickup_cfg_window,
1327 tooltip => "The pickup dialog");
1328
1237 1329
1238 $BUTTONBAR->add (new CFClient::UI::Button 1330 $BUTTONBAR->add (new CFClient::UI::Button
1239 text => "Quit", 1331 text => "Quit",
1240 tooltip => "Terminates the program", 1332 tooltip => "Terminates the program",
1241 on_activate => sub { 1333 on_activate => sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines