… | |
… | |
36 | |
36 | |
37 | use CFClient; |
37 | use CFClient; |
38 | use CFClient::OpenGL (); |
38 | use CFClient::OpenGL (); |
39 | use CFClient::Protocol; |
39 | use CFClient::Protocol; |
40 | use CFClient::UI; |
40 | use CFClient::UI; |
|
|
41 | use CFClient::BindingEditor; |
41 | use CFClient::MapWidget; |
42 | use CFClient::MapWidget; |
42 | |
43 | |
43 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
44 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
44 | |
45 | |
45 | $Event::DIED = sub { |
46 | $Event::DIED = sub { |
… | |
… | |
109 | |
110 | |
110 | our $ALT_ENTER_MESSAGE; |
111 | our $ALT_ENTER_MESSAGE; |
111 | our $STATUSBOX; |
112 | our $STATUSBOX; |
112 | our $DEBUG_STATUS; |
113 | our $DEBUG_STATUS; |
113 | |
114 | |
114 | our $INV_WINDOW; |
|
|
115 | our $INV; |
115 | our $INV; |
116 | our $INVR; |
116 | our $INVR; |
117 | our $INV_RIGHT_HB; |
117 | our $INV_RIGHT_HB; |
118 | |
118 | |
|
|
119 | our $PL_NOTEBOOK; |
|
|
120 | our $PL_WINDOW; |
|
|
121 | |
119 | our $BIND_EDITOR; |
122 | our $BIND_EDITOR; |
|
|
123 | our $BIND_UPD_CB; |
120 | |
124 | |
121 | our $PICKUP_CFG; |
125 | our $PICKUP_CFG; |
122 | |
126 | |
123 | sub status { |
127 | sub status { |
124 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
128 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
… | |
… | |
371 | |
375 | |
372 | sub stop_game { |
376 | sub stop_game { |
373 | $LOGIN_BUTTON->set_text ("Login"); |
377 | $LOGIN_BUTTON->set_text ("Login"); |
374 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
378 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
375 | $SETUP_DIALOG->show; |
379 | $SETUP_DIALOG->show; |
376 | $INV_WINDOW->hide; |
380 | $PL_WINDOW->hide; |
377 | $SETUP_SPELLS->clear_spells; |
381 | $SETUP_SPELLS->clear_spells; |
378 | |
382 | |
379 | return unless $CONN; |
383 | return unless $CONN; |
380 | |
384 | |
381 | status "connection closed"; |
385 | status "connection closed"; |
… | |
… | |
651 | |
655 | |
652 | $table |
656 | $table |
653 | } |
657 | } |
654 | |
658 | |
655 | sub stats_window { |
659 | sub stats_window { |
656 | my $tgw = new CFClient::UI::FancyFrame |
660 | my $tgw = |
657 | y => $HEIGHT * (2/8), |
661 | new CFClient::UI::Window |
658 | x => "max", |
662 | child => my $vb = new CFClient::UI::VBox; |
659 | title => "Stats", |
|
|
660 | name => "stats_window", |
|
|
661 | has_close_button => 1; |
|
|
662 | |
663 | |
663 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
|
|
664 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
664 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
665 | can_hover => 1, can_events => 1, |
665 | can_hover => 1, can_events => 1, |
666 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
666 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
667 | $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1, |
667 | $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1, |
668 | can_hover => 1, can_events => 1, |
668 | can_hover => 1, can_events => 1, |
… | |
… | |
692 | [0, 6, st_cha => "Cha", 30, "<b>Charisma</b>, how well you are received by NPCs. Affects buying and selling prices in shops."], |
692 | [0, 6, st_cha => "Cha", 30, "<b>Charisma</b>, how well you are received by NPCs. Affects buying and selling prices in shops."], |
693 | |
693 | |
694 | [2, 0, st_wc => "Wc", -120, "<b>Weapon Class</b>, effectiveness of melee/missile attacks. Lower is more potent. Current weapon, level and Str are some things which effect the value of Wc. The value of Wc may range between 25 and -72."], |
694 | [2, 0, st_wc => "Wc", -120, "<b>Weapon Class</b>, effectiveness of melee/missile attacks. Lower is more potent. Current weapon, level and Str are some things which effect the value of Wc. The value of Wc may range between 25 and -72."], |
695 | [2, 1, st_ac => "Ac", -120, "<b>Armour Class</b>, how protected you are from being hit by any attack. Lower values are better. Ac is based on your race and is modified by the Dex and current armour worn. For characters that cannot wear armour, Ac improves as their level increases."], |
695 | [2, 1, st_ac => "Ac", -120, "<b>Armour Class</b>, how protected you are from being hit by any attack. Lower values are better. Ac is based on your race and is modified by the Dex and current armour worn. For characters that cannot wear armour, Ac improves as their level increases."], |
696 | [2, 2, st_dam => "Dam", 120, "<b>Damage</b>, how much damage your melee/missile attack inflicts. Higher values indicate a greater amount of damage will be inflicted with each attack."], |
696 | [2, 2, st_dam => "Dam", 120, "<b>Damage</b>, how much damage your melee/missile attack inflicts. Higher values indicate a greater amount of damage will be inflicted with each attack."], |
697 | [2, 3, st_arm => "Arm", 120, "<b>Armour</b>, how much damage (from physical attacks) will be subtracted from successful hits made upon you. This value ranges between 0 to 99%. Current armour worn primarily determines Arm value."], |
697 | [2, 3, st_arm => "Arm", 120, "<b>Armour</b>, how much damage (from physical attacks) will be subtracted from successful hits made upon you. This value ranges between 0 to 99%. Current armour worn primarily determines Arm value. This is the same as the physical resistance."], |
698 | [2, 4, st_spd => "Spd", 10.54, "<b>Speed</b>, how fast you can move. The value of speed may range between nearly 0 (\"very slow\") to higher than 5 (\"lightning fast\"). Base speed is determined from the Dex and modified downward proportionally by the amount of weight carried which exceeds the Max Carry limit. The armour worn also sets the upper limit on speed."], |
698 | [2, 4, st_spd => "Spd", 10.54, "<b>Speed</b>, how fast you can move. The value of speed may range between nearly 0 (\"very slow\") to higher than 5 (\"lightning fast\"). Base speed is determined from the Dex and modified downward proportionally by the amount of weight carried which exceeds the Max Carry limit. The armour worn also sets the upper limit on speed."], |
699 | [2, 5, st_wspd => "WSp", 10.54, "<b>Weapon Speed</b>, how many attacks you may make per unit of time (0.120s). Higher values indicate faster attack speed. Current weapon and Dex effect the value of weapon speed."], |
699 | [2, 5, st_wspd => "WSp", 10.54, "<b>Weapon Speed</b>, how many attacks you may make per unit of time (0.120s). Higher values indicate faster attack speed. Current weapon and Dex effect the value of weapon speed."], |
700 | ) { |
700 | ) { |
701 | my ($col, $row, $id, $label, $template, $tooltip) = @$_; |
701 | my ($col, $row, $id, $label, $template, $tooltip) = @$_; |
702 | |
702 | |
… | |
… | |
721 | drain => "<b>Draining</b> (some monsters (e.g. vampires) and other effects can steal experience)", |
721 | drain => "<b>Draining</b> (some monsters (e.g. vampires) and other effects can steal experience)", |
722 | acid => "<b>Acid</b> (resistance to acid, acid hurts pretty much and also corrodes your weapons)", |
722 | acid => "<b>Acid</b> (resistance to acid, acid hurts pretty much and also corrodes your weapons)", |
723 | pois => "<b>Poison</b> (resistance to getting poisoned)", |
723 | pois => "<b>Poison</b> (resistance to getting poisoned)", |
724 | para => "<b>Paralysation</b> (this resistance affects the chance you get paralysed)", |
724 | para => "<b>Paralysation</b> (this resistance affects the chance you get paralysed)", |
725 | deat => "<b>Death</b> (resistance against death spells)", |
725 | deat => "<b>Death</b> (resistance against death spells)", |
726 | phys => "<b>Physical</b> (this is the resistance against physical attacks, like when a monster hit you in melee combat)", |
726 | phys => "<b>Physical</b> (this is the resistance against physical attacks, like when a monster hit you in melee combat. The value displayed here is also displayed in the 'Arm' field on the left.)", |
727 | blind => "<b>Blind</b> (blind resistance affects the chance of a successful blinding attack)", |
727 | blind => "<b>Blind</b> (blind resistance affects the chance of a successful blinding attack)", |
728 | fear => "<b>Fear</b> (this attack will drive you away from monsters who cast this and hit you successfully, being resistant to this helps a lot when fighting those monsters)", |
728 | fear => "<b>Fear</b> (this attack will drive you away from monsters who cast this and hit you successfully, being resistant to this helps a lot when fighting those monsters)", |
729 | tund => "<b>Turn undead</b> (affects your resistancy to various forms of 'turn undead' spells. Only relevant when you are, in fact, undead...", |
729 | tund => "<b>Turn undead</b> (affects your resistancy to various forms of 'turn undead' spells. Only relevant when you are, in fact, undead...", |
730 | elec => "<b>Electricity</b> (resistance against electricity, spells like large lightning, small lightning, ...)", |
730 | elec => "<b>Electricity</b> (resistance against electricity, spells like large lightning, small lightning, ...)", |
731 | cold => "<b>Cold</b> (this is your resistance against cold spells like icestorm, snowstorm, ...)", |
731 | cold => "<b>Cold</b> (this is your resistance against cold spells like icestorm, snowstorm, ...)", |
… | |
… | |
748 | ); |
748 | ); |
749 | $tbl2->add ($col + 1, $row, new CFClient::UI::Image |
749 | $tbl2->add ($col + 1, $row, new CFClient::UI::Image |
750 | font => $FONT_FIXED, |
750 | font => $FONT_FIXED, |
751 | can_hover => 1, |
751 | can_hover => 1, |
752 | can_events => 1, |
752 | can_events => 1, |
753 | image => "ui/resist/resist_$_.png", |
753 | path => "ui/resist/resist_$_.png", |
754 | tooltip => $resist_names{$_}, |
754 | tooltip => $resist_names{$_}, |
755 | ); |
755 | ); |
756 | |
756 | |
757 | $row++; |
757 | $row++; |
758 | if ($row % 6 == 0) { |
758 | if ($row % 6 == 0) { |
… | |
… | |
806 | $STATWIDS->{st_pow} ->set_text (sprintf "%d" , $stats->{+CS_STAT_POW}); |
806 | $STATWIDS->{st_pow} ->set_text (sprintf "%d" , $stats->{+CS_STAT_POW}); |
807 | $STATWIDS->{st_cha} ->set_text (sprintf "%d" , $stats->{+CS_STAT_CHA}); |
807 | $STATWIDS->{st_cha} ->set_text (sprintf "%d" , $stats->{+CS_STAT_CHA}); |
808 | $STATWIDS->{st_wc} ->set_text (sprintf "%d" , $stats->{+CS_STAT_WC}); |
808 | $STATWIDS->{st_wc} ->set_text (sprintf "%d" , $stats->{+CS_STAT_WC}); |
809 | $STATWIDS->{st_ac} ->set_text (sprintf "%d" , $stats->{+CS_STAT_AC}); |
809 | $STATWIDS->{st_ac} ->set_text (sprintf "%d" , $stats->{+CS_STAT_AC}); |
810 | $STATWIDS->{st_dam} ->set_text (sprintf "%d" , $stats->{+CS_STAT_DAM}); |
810 | $STATWIDS->{st_dam} ->set_text (sprintf "%d" , $stats->{+CS_STAT_DAM}); |
811 | $STATWIDS->{st_arm} ->set_text (sprintf "%d" , $stats->{+CS_STAT_ARMOUR}); |
811 | $STATWIDS->{st_arm} ->set_text (sprintf "%d" , $stats->{+CS_STAT_RES_PHYS}); |
812 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
812 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
813 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); |
813 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); |
814 | |
814 | |
815 | $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); |
815 | $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); |
816 | |
816 | |
… | |
… | |
840 | } |
840 | } |
841 | |
841 | |
842 | my $METASERVER_ATIME; |
842 | my $METASERVER_ATIME; |
843 | |
843 | |
844 | sub update_metaserver { |
844 | sub update_metaserver { |
|
|
845 | my ($metaserver_dialog) = @_; |
|
|
846 | |
|
|
847 | $METASERVER = $metaserver_dialog |
|
|
848 | if defined $metaserver_dialog; |
|
|
849 | |
845 | return if $METASERVER_ATIME > time; |
850 | return if $METASERVER_ATIME > time; |
846 | $METASERVER_ATIME = time + 60; |
851 | $METASERVER_ATIME = time + 60; |
847 | |
852 | |
848 | my $table = $METASERVER->{table}; |
853 | my $table = $METASERVER->{table}; |
849 | $table->clear; |
854 | $table->clear; |
… | |
… | |
937 | } |
942 | } |
938 | }); |
943 | }); |
939 | } |
944 | } |
940 | |
945 | |
941 | sub metaserver_dialog { |
946 | sub metaserver_dialog { |
|
|
947 | my $vbox = new CFClient::UI::VBox; |
|
|
948 | my $table = new CFClient::UI::Table; |
|
|
949 | $vbox->add (new CFClient::UI::ScrolledWindow expand => 1, child => $table); |
|
|
950 | |
942 | my $dialog = new CFClient::UI::FancyFrame |
951 | my $dialog = new CFClient::UI::FancyFrame |
943 | title => "Server List", |
952 | title => "Server List", |
944 | name => 'metaserver_dialog', |
953 | name => 'metaserver_dialog', |
945 | x => 'center', |
954 | x => 'center', |
946 | y => 'center', |
955 | y => 'center', |
947 | z => 3, |
956 | z => 3, |
948 | force_h => $::HEIGHT * 0.4, |
957 | force_h => $::HEIGHT * 0.4, |
949 | child => (my $vbox = new CFClient::UI::VBox), |
958 | child => $vbox, |
|
|
959 | has_close_button => 1, |
|
|
960 | table => $table, |
950 | on_visibility_change => sub { |
961 | on_visibility_change => sub { |
951 | update_metaserver if $_[1]; |
962 | update_metaserver ($_[0]) if $_[1]; |
952 | 0 |
963 | 0 |
953 | }, |
964 | }, |
954 | ; |
965 | ; |
955 | |
|
|
956 | $dialog->{table} = new CFClient::UI::Table; |
|
|
957 | |
|
|
958 | $vbox->add (new CFClient::UI::ScrolledWindow expand => 1, child => $dialog->{table}); |
|
|
959 | |
966 | |
960 | $dialog |
967 | $dialog |
961 | } |
968 | } |
962 | |
969 | |
963 | sub server_setup { |
970 | sub server_setup { |
… | |
… | |
978 | my ($self, $value) = @_; |
985 | my ($self, $value) = @_; |
979 | $CFG->{profile}{default}{host} = $value; |
986 | $CFG->{profile}{default}{host} = $value; |
980 | 0 |
987 | 0 |
981 | } |
988 | } |
982 | ); |
989 | ); |
983 | |
|
|
984 | $METASERVER = metaserver_dialog; |
|
|
985 | |
990 | |
986 | $vbox->add (new CFClient::UI::Button |
991 | $vbox->add (new CFClient::UI::Button |
987 | expand => 1, |
992 | expand => 1, |
988 | text => "Server List", |
993 | text => "Server List", |
989 | other => $METASERVER, |
994 | other => $METASERVER, |
… | |
… | |
1229 | ++$y; |
1234 | ++$y; |
1230 | |
1235 | |
1231 | my $mask = $_->[1]; |
1236 | my $mask = $_->[1]; |
1232 | $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); |
1237 | $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); |
1233 | $table->add ($x+1, $y, new CFClient::UI::CheckBox |
1238 | $table->add ($x+1, $y, new CFClient::UI::CheckBox |
1234 | state => $CFG->{pickup} & $mask, |
1239 | state => $::CFG->{pickup} & $mask, |
1235 | on_changed => sub { |
1240 | on_changed => sub { |
1236 | my ($box, $value) = @_; |
1241 | my ($box, $value) = @_; |
1237 | |
1242 | |
1238 | if ($value) { |
1243 | if ($value) { |
1239 | $::CFG->{pickup} |= $mask; |
1244 | $::CFG->{pickup} |= $mask; |
… | |
… | |
1248 | }); |
1253 | }); |
1249 | } |
1254 | } |
1250 | } |
1255 | } |
1251 | |
1256 | |
1252 | $table->add (2, 18, new CFClient::UI::ValSlider |
1257 | $table->add (2, 18, new CFClient::UI::ValSlider |
1253 | range => [0, 0, 16, 1, 1], |
1258 | range => [$::CFG->{pickup} & 0xF, 0, 16, 1, 1], |
|
|
1259 | template => ">= 99", |
1254 | to_value => sub { ">= " . 5 * $_[0] }, |
1260 | to_value => sub { ">= " . 5 * $_[0] }, |
1255 | on_changed => sub { |
1261 | on_changed => sub { |
1256 | my ($slider, $value) = @_; |
1262 | my ($slider, $value) = @_; |
1257 | |
1263 | |
1258 | $::CFG->{pickup} &= ~0x7; |
1264 | $::CFG->{pickup} &= ~0xF; |
1259 | $::CFG->{pickup} |= int $value |
1265 | $::CFG->{pickup} |= int $value |
1260 | if $value; |
1266 | if $value; |
1261 | 1; |
1267 | 1; |
1262 | }); |
1268 | }); |
|
|
1269 | |
1263 | $table->add (3, 18, new CFClient::UI::Button |
1270 | $table->add (3, 18, new CFClient::UI::Button |
1264 | text => "set", |
1271 | text => "set", |
1265 | on_activate => sub { |
1272 | on_activate => sub { |
1266 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1273 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1267 | if defined $::CONN; |
1274 | if defined $::CONN; |
… | |
… | |
1269 | }); |
1276 | }); |
1270 | |
1277 | |
1271 | $table |
1278 | $table |
1272 | } |
1279 | } |
1273 | |
1280 | |
1274 | sub inventory_window { |
1281 | sub inventory_widget { |
|
|
1282 | my $hb = new CFClient::UI::HBox homogeneous => 1; |
|
|
1283 | |
|
|
1284 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
|
|
1285 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
|
|
1286 | $vb1->add ($INV = new CFClient::UI::Inventory); |
|
|
1287 | |
|
|
1288 | $hb->add (my $vb2 = new CFClient::UI::VBox); |
|
|
1289 | |
|
|
1290 | $vb2->add ($INV_RIGHT_HB = new CFClient::UI::HBox); |
|
|
1291 | |
|
|
1292 | $vb2->add ($INVR = new CFClient::UI::Inventory); |
|
|
1293 | |
|
|
1294 | # XXX: Call after $INVR = ... because set_opencont sets the items |
|
|
1295 | CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); |
|
|
1296 | |
|
|
1297 | $hb |
|
|
1298 | } |
|
|
1299 | |
|
|
1300 | sub player_window { |
1275 | my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame |
1301 | my $plwin = $PL_WINDOW = new CFClient::UI::FancyFrame |
1276 | x => "center", |
1302 | x => "center", |
1277 | y => "center", |
1303 | y => "center", |
1278 | force_w => $WIDTH * 9/10, |
1304 | force_w => $WIDTH * 9/10, |
1279 | force_h => $HEIGHT * 9/10, |
1305 | force_h => $HEIGHT * 9/10, |
1280 | title => "Inventory", |
1306 | title => "Player", |
1281 | has_close_button => 1, |
1307 | has_close_button => 1 |
1282 | ; |
1308 | ; |
1283 | |
1309 | |
1284 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
1310 | my $ntb = |
|
|
1311 | $PL_NOTEBOOK = |
|
|
1312 | new CFClient::UI::Notebook |
|
|
1313 | expand => 1, |
|
|
1314 | debug => 1, |
|
|
1315 | filter => (new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1), |
|
|
1316 | ; |
|
|
1317 | $ntb->add ( |
|
|
1318 | Inventory => inventory_widget, |
|
|
1319 | "Toggles the inventory window, where you can manage your loot (or treasures :). " |
|
|
1320 | . "You can also hit the <b>Tab</b>-key to show/hide the Inventory." |
|
|
1321 | ); |
1285 | |
1322 | |
1286 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
1323 | $ntb->add ( |
1287 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
1324 | Stats => $STATS_WINDOW = stats_window, |
1288 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
1325 | "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times." |
|
|
1326 | ); |
|
|
1327 | $ntb->add ( |
|
|
1328 | Spells => $SETUP_SPELLS = new CFClient::UI::SpellList, |
|
|
1329 | "Displays all spells you have and lets you edit keyboard shortcuts for them." |
|
|
1330 | ); |
1289 | |
1331 | |
1290 | $hb->add (my $vb2 = new CFClient::UI::VBox); |
1332 | $plwin->add ($ntb); |
1291 | |
1333 | $plwin |
1292 | $vb2->add ($INV_RIGHT_HB = new CFClient::UI::HBox); |
|
|
1293 | |
|
|
1294 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
|
|
1295 | |
|
|
1296 | # XXX: Call after $INVR = ... because set_opencont sets the items |
|
|
1297 | CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); |
|
|
1298 | |
|
|
1299 | $invwin |
|
|
1300 | } |
1334 | } |
1301 | |
1335 | |
1302 | sub spell_setup { |
1336 | sub update_bindings { |
1303 | new CFClient::UI::SpellList |
1337 | $BIND_UPD_CB->() if $BIND_UPD_CB; |
1304 | } |
1338 | } |
1305 | |
1339 | |
1306 | sub keyboard_setup { |
1340 | sub keyboard_setup { |
1307 | my $binding_list = new CFClient::UI::VBox; |
1341 | my $binding_list = new CFClient::UI::VBox; |
1308 | |
1342 | |
1309 | my $refresh; |
1343 | my $refresh; |
1310 | $refresh = sub { |
1344 | $refresh = $BIND_UPD_CB = sub { |
1311 | $binding_list->clear (); |
1345 | $binding_list->clear (); |
1312 | |
1346 | |
1313 | for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { |
1347 | for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { |
1314 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1348 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1315 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1349 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1316 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
1350 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
1317 | |
1351 | |
1318 | my $lbl = join "; ", @$cmds; |
1352 | my $lbl = join "; ", @$cmds; |
1319 | my $nam = CFClient::Binder::keycombo_to_name ($mod, $sym); |
1353 | my $nam = CFClient::BindingEditor::keycombo_to_name ($mod, $sym); |
1320 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
1354 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
1321 | $hb->add (new CFClient::UI::Button |
1355 | $hb->add (new CFClient::UI::Button |
1322 | text => "delete", |
1356 | text => "delete", |
1323 | tooltip => "Deletes the binding", |
1357 | tooltip => "Deletes the binding", |
1324 | on_activate => sub { |
1358 | on_activate => sub { |
… | |
… | |
1333 | on_activate => sub { |
1367 | on_activate => sub { |
1334 | $::BIND_EDITOR->set_binding ( |
1368 | $::BIND_EDITOR->set_binding ( |
1335 | $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, |
1369 | $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, |
1336 | sub { |
1370 | sub { |
1337 | my ($nmod, $nsym, $ncmds) = @_; |
1371 | my ($nmod, $nsym, $ncmds) = @_; |
1338 | delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1372 | $::BIND_EDITOR->cfg_unbind ($mod, $sym); |
1339 | $::CFG->{profile}{default}{bindings}{$nmod}{$nsym} = $ncmds; |
1373 | $::BIND_EDITOR->cfg_bind ($nmod, $nsym, $ncmds); |
1340 | $refresh->(); |
1374 | $refresh->(); |
1341 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1375 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1342 | $SETUP_DIALOG->show; |
1376 | $SETUP_DIALOG->show; |
1343 | }, |
1377 | }, |
1344 | sub { |
1378 | sub { |
… | |
… | |
1378 | tooltip => "This button opens the binding editor with an empty binding.", |
1412 | tooltip => "This button opens the binding editor with an empty binding.", |
1379 | on_activate => sub { |
1413 | on_activate => sub { |
1380 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1414 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1381 | sub { |
1415 | sub { |
1382 | my ($mod, $sym, $cmds) = @_; |
1416 | my ($mod, $sym, $cmds) = @_; |
1383 | $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds; |
1417 | $::BIND_EDITOR->cfg_bind ($mod, $sym, $cmds); |
1384 | $refresh->(); |
1418 | $refresh->(); |
1385 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1419 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1386 | $SETUP_DIALOG->show; |
1420 | $SETUP_DIALOG->show; |
1387 | }, |
1421 | }, |
1388 | sub { |
1422 | sub { |
… | |
… | |
1430 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
1464 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
1431 | $buttons->add (my $combo = new CFClient::UI::Combobox |
1465 | $buttons->add (my $combo = new CFClient::UI::Combobox |
1432 | value => undef, |
1466 | value => undef, |
1433 | options => [ |
1467 | options => [ |
1434 | [intro => "Introduction"], |
1468 | [intro => "Introduction"], |
1435 | [manual => "Manual"], |
1469 | [manual => "Main Manual"], |
1436 | [skill_help => "Skills"], |
1470 | [skill_help => "Skill Reference"], |
1437 | [command_help => "Commands"], |
1471 | [command_help => "Command Reference"], |
1438 | [dmcommand_help => "DM Commands"], |
1472 | [dmcommand_help => "DM Commands"], |
1439 | [COPYING => "License Terms"], |
1473 | [COPYING => "License Terms"], |
1440 | ], |
1474 | ], |
1441 | on_changed => sub { |
1475 | on_changed => sub { |
1442 | my ($self, $pod) = @_; |
1476 | my ($self, $pod) = @_; |
1443 | |
1477 | |
1444 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1478 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1445 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1479 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1446 | |
1480 | |
1447 | $viewer->clear; |
1481 | $viewer->clear; |
|
|
1482 | |
|
|
1483 | # $viewer->add_paragraph ([1, 1, 1, 1], ["<big>Test</big>\n\n \x{fffc} \x{fffc}\n", |
|
|
1484 | # (new CFClient::UI::Image path => "x.png", can_hover => 1, can_events => 1), |
|
|
1485 | # (new CFClient::UI::Label text => "üüüü", can_hover => 1, can_events => 1, tooltip => "??"), |
|
|
1486 | # ]);#d# |
1448 | |
1487 | |
1449 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1488 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1450 | for @$pom; |
1489 | for @$pom; |
1451 | |
1490 | |
1452 | $viewer->set_offset (0); |
1491 | $viewer->set_offset (0); |
|
|
1492 | |
1453 | 0 |
1493 | 0 |
1454 | }, |
1494 | }, |
1455 | on_visibility_change => sub { |
1495 | on_visibility_change => sub { |
1456 | my ($self, $visible) = @_; |
1496 | my ($self, $visible) = @_; |
1457 | return unless $visible; |
1497 | return unless $visible; |
… | |
… | |
1504 | z => 100, |
1544 | z => 100, |
1505 | force_x => "max", |
1545 | force_x => "max", |
1506 | force_y => 0; |
1546 | force_y => 0; |
1507 | $DEBUG_STATUS->show; |
1547 | $DEBUG_STATUS->show; |
1508 | |
1548 | |
1509 | $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); |
1549 | $BIND_EDITOR = new CFClient::BindingEditor (x => "max", y => 0); |
1510 | |
1550 | |
1511 | $STATUSBOX = new CFClient::UI::Statusbox; |
1551 | $STATUSBOX = new CFClient::UI::Statusbox; |
1512 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); |
1552 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); |
1513 | |
1553 | |
1514 | (new CFClient::UI::Frame |
1554 | (new CFClient::UI::Frame |
… | |
… | |
1564 | z => 2, |
1604 | z => 2, |
1565 | force_w => $::WIDTH * 0.6, |
1605 | force_w => $::WIDTH * 0.6, |
1566 | force_h => $::HEIGHT * 0.6, |
1606 | force_h => $::HEIGHT * 0.6, |
1567 | has_close_button => 1, |
1607 | has_close_button => 1, |
1568 | ; |
1608 | ; |
|
|
1609 | |
|
|
1610 | $METASERVER = metaserver_dialog; |
1569 | |
1611 | |
1570 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, |
1612 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, |
1571 | filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1613 | filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1572 | |
1614 | |
1573 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1615 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
… | |
… | |
1583 | . "There is a shortcut for making bindings: <b>Control-Insert</b> opens the binding editor " |
1625 | . "There is a shortcut for making bindings: <b>Control-Insert</b> opens the binding editor " |
1584 | . "with nothing set and the recording started. After doing the actions you " |
1626 | . "with nothing set and the recording started. After doing the actions you " |
1585 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1627 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1586 | . "After pressing the combo the binding will be saved automatically and the " |
1628 | . "After pressing the combo the binding will be saved automatically and the " |
1587 | . "binding editor closes"); |
1629 | . "binding editor closes"); |
1588 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
|
|
1589 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
|
|
1590 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
1630 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
1591 | "Some debuggin' options. Do not ask."); |
1631 | "Some debuggin' options. Do not ask."); |
1592 | |
1632 | |
1593 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1633 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1594 | |
1634 | |
… | |
… | |
1598 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW = message_window, |
1638 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW = message_window, |
1599 | tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
1639 | tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
1600 | |
1640 | |
1601 | 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 |
1641 | 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 |
1602 | |
1642 | |
1603 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => $STATS_WINDOW = stats_window, |
|
|
1604 | tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); |
|
|
1605 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => inventory_window, |
1643 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Player", other => player_window, |
1606 | tooltip => "Toggles the inventory window, where you can manage your loot (or treasures :). " |
1644 | tooltip => "Toggles the player view, where you can manage Inventory, Spells, Skills and see your Stats."); |
1607 | . "You can also hit the <b>Tab</b>-key to show/hide the Inventory."); |
|
|
1608 | |
1645 | |
1609 | $BUTTONBAR->add (new CFClient::UI::Button |
1646 | $BUTTONBAR->add (new CFClient::UI::Button |
1610 | text => "Save Config", |
1647 | text => "Save Config", |
1611 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1648 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1612 | on_activate => sub { |
1649 | on_activate => sub { |