… | |
… | |
110 | |
110 | |
111 | our $ALT_ENTER_MESSAGE; |
111 | our $ALT_ENTER_MESSAGE; |
112 | our $STATUSBOX; |
112 | our $STATUSBOX; |
113 | our $DEBUG_STATUS; |
113 | our $DEBUG_STATUS; |
114 | |
114 | |
115 | our $INV_WINDOW; |
|
|
116 | our $INV; |
115 | our $INV; |
117 | our $INVR; |
116 | our $INVR; |
118 | our $INV_RIGHT_HB; |
117 | our $INV_RIGHT_HB; |
|
|
118 | |
|
|
119 | our $PL_NOTEBOOK; |
|
|
120 | our $PL_WINDOW; |
119 | |
121 | |
120 | our $BIND_EDITOR; |
122 | our $BIND_EDITOR; |
121 | our $BIND_UPD_CB; |
123 | our $BIND_UPD_CB; |
122 | |
124 | |
123 | our $PICKUP_CFG; |
125 | our $PICKUP_CFG; |
… | |
… | |
373 | |
375 | |
374 | sub stop_game { |
376 | sub stop_game { |
375 | $LOGIN_BUTTON->set_text ("Login"); |
377 | $LOGIN_BUTTON->set_text ("Login"); |
376 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
378 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
377 | $SETUP_DIALOG->show; |
379 | $SETUP_DIALOG->show; |
378 | $INV_WINDOW->hide; |
380 | $PL_WINDOW->hide; |
379 | $SETUP_SPELLS->clear_spells; |
381 | $SETUP_SPELLS->clear_spells; |
380 | |
382 | |
381 | return unless $CONN; |
383 | return unless $CONN; |
382 | |
384 | |
383 | status "connection closed"; |
385 | status "connection closed"; |
… | |
… | |
653 | |
655 | |
654 | $table |
656 | $table |
655 | } |
657 | } |
656 | |
658 | |
657 | sub stats_window { |
659 | sub stats_window { |
658 | my $tgw = new CFClient::UI::FancyFrame |
660 | my $tgw = |
659 | y => $HEIGHT * (2/8), |
661 | new CFClient::UI::Window |
660 | x => "max", |
662 | child => my $vb = new CFClient::UI::VBox; |
661 | title => "Stats", |
|
|
662 | name => "stats_window", |
|
|
663 | has_close_button => 1; |
|
|
664 | |
663 | |
665 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
|
|
666 | $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, |
667 | can_hover => 1, can_events => 1, |
665 | can_hover => 1, can_events => 1, |
668 | 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."); |
669 | $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, |
670 | can_hover => 1, can_events => 1, |
668 | can_hover => 1, can_events => 1, |
… | |
… | |
1236 | ++$y; |
1234 | ++$y; |
1237 | |
1235 | |
1238 | my $mask = $_->[1]; |
1236 | my $mask = $_->[1]; |
1239 | $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); |
1240 | $table->add ($x+1, $y, new CFClient::UI::CheckBox |
1238 | $table->add ($x+1, $y, new CFClient::UI::CheckBox |
1241 | state => $CFG->{pickup} & $mask, |
1239 | state => $::CFG->{pickup} & $mask, |
1242 | on_changed => sub { |
1240 | on_changed => sub { |
1243 | my ($box, $value) = @_; |
1241 | my ($box, $value) = @_; |
1244 | |
1242 | |
1245 | if ($value) { |
1243 | if ($value) { |
1246 | $::CFG->{pickup} |= $mask; |
1244 | $::CFG->{pickup} |= $mask; |
… | |
… | |
1255 | }); |
1253 | }); |
1256 | } |
1254 | } |
1257 | } |
1255 | } |
1258 | |
1256 | |
1259 | $table->add (2, 18, new CFClient::UI::ValSlider |
1257 | $table->add (2, 18, new CFClient::UI::ValSlider |
1260 | range => [0, 0, 16, 1, 1], |
1258 | range => [$::CFG->{pickup} & 0xF, 0, 16, 1, 1], |
|
|
1259 | template => ">= 99", |
1261 | to_value => sub { ">= " . 5 * $_[0] }, |
1260 | to_value => sub { ">= " . 5 * $_[0] }, |
1262 | on_changed => sub { |
1261 | on_changed => sub { |
1263 | my ($slider, $value) = @_; |
1262 | my ($slider, $value) = @_; |
1264 | |
1263 | |
1265 | $::CFG->{pickup} &= ~0x7; |
1264 | $::CFG->{pickup} &= ~0xF; |
1266 | $::CFG->{pickup} |= int $value |
1265 | $::CFG->{pickup} |= int $value |
1267 | if $value; |
1266 | if $value; |
1268 | 1; |
1267 | 1; |
1269 | }); |
1268 | }); |
|
|
1269 | |
1270 | $table->add (3, 18, new CFClient::UI::Button |
1270 | $table->add (3, 18, new CFClient::UI::Button |
1271 | text => "set", |
1271 | text => "set", |
1272 | on_activate => sub { |
1272 | on_activate => sub { |
1273 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1273 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1274 | if defined $::CONN; |
1274 | if defined $::CONN; |
… | |
… | |
1276 | }); |
1276 | }); |
1277 | |
1277 | |
1278 | $table |
1278 | $table |
1279 | } |
1279 | } |
1280 | |
1280 | |
1281 | 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 { |
1282 | my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame |
1301 | my $plwin = $PL_WINDOW = new CFClient::UI::FancyFrame |
1283 | x => "center", |
1302 | x => "center", |
1284 | y => "center", |
1303 | y => "center", |
1285 | force_w => $WIDTH * 9/10, |
1304 | force_w => $WIDTH * 9/10, |
1286 | force_h => $HEIGHT * 9/10, |
1305 | force_h => $HEIGHT * 9/10, |
1287 | title => "Inventory", |
1306 | title => "Player", |
1288 | name => "inventory_window", |
|
|
1289 | has_close_button => 1, |
1307 | has_close_button => 1 |
1290 | ; |
1308 | ; |
1291 | |
1309 | |
1292 | $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 | ); |
1293 | |
1322 | |
1294 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
1323 | $ntb->add ( |
1295 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
1324 | Stats => $STATS_WINDOW = stats_window, |
1296 | $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 | ); |
1297 | |
1331 | |
1298 | $hb->add (my $vb2 = new CFClient::UI::VBox); |
1332 | $plwin->add ($ntb); |
1299 | |
1333 | $plwin |
1300 | $vb2->add ($INV_RIGHT_HB = new CFClient::UI::HBox); |
|
|
1301 | |
|
|
1302 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
|
|
1303 | |
|
|
1304 | # XXX: Call after $INVR = ... because set_opencont sets the items |
|
|
1305 | CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); |
|
|
1306 | |
|
|
1307 | $invwin |
|
|
1308 | } |
|
|
1309 | |
|
|
1310 | sub spell_setup { |
|
|
1311 | new CFClient::UI::SpellList |
|
|
1312 | } |
1334 | } |
1313 | |
1335 | |
1314 | sub update_bindings { |
1336 | sub update_bindings { |
1315 | $BIND_UPD_CB->() if $BIND_UPD_CB; |
1337 | $BIND_UPD_CB->() if $BIND_UPD_CB; |
1316 | } |
1338 | } |
… | |
… | |
1326 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1348 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1327 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1349 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1328 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
1350 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
1329 | |
1351 | |
1330 | my $lbl = join "; ", @$cmds; |
1352 | my $lbl = join "; ", @$cmds; |
1331 | my $nam = CFClient::Binder::keycombo_to_name ($mod, $sym); |
1353 | my $nam = CFClient::BindingEditor::keycombo_to_name ($mod, $sym); |
1332 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
1354 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
1333 | $hb->add (new CFClient::UI::Button |
1355 | $hb->add (new CFClient::UI::Button |
1334 | text => "delete", |
1356 | text => "delete", |
1335 | tooltip => "Deletes the binding", |
1357 | tooltip => "Deletes the binding", |
1336 | on_activate => sub { |
1358 | on_activate => sub { |
… | |
… | |
1603 | . "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 " |
1604 | . "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 " |
1605 | . "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. " |
1606 | . "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 " |
1607 | . "binding editor closes"); |
1629 | . "binding editor closes"); |
1608 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
|
|
1609 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
|
|
1610 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
1630 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
1611 | "Some debuggin' options. Do not ask."); |
1631 | "Some debuggin' options. Do not ask."); |
1612 | |
1632 | |
1613 | $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 |
1614 | |
1634 | |
… | |
… | |
1618 | $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, |
1619 | 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."); |
1620 | |
1640 | |
1621 | 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 |
1622 | |
1642 | |
1623 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => $STATS_WINDOW = stats_window, |
|
|
1624 | tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); |
|
|
1625 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => inventory_window, |
1643 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Player", other => player_window, |
1626 | 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."); |
1627 | . "You can also hit the <b>Tab</b>-key to show/hide the Inventory."); |
|
|
1628 | |
1645 | |
1629 | $BUTTONBAR->add (new CFClient::UI::Button |
1646 | $BUTTONBAR->add (new CFClient::UI::Button |
1630 | text => "Save Config", |
1647 | text => "Save Config", |
1631 | 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.", |
1632 | on_activate => sub { |
1649 | on_activate => sub { |