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.85 by elmex, Sun Jul 2 19:32:56 2006 UTC vs.
Revision 1.89 by elmex, Sun Jul 9 21:11:48 2006 UTC

85our $CONSOLE; 85our $CONSOLE;
86our $METASERVER; 86our $METASERVER;
87our $LOGIN_BUTTON; 87our $LOGIN_BUTTON;
88our $QUIT_DIALOG; 88our $QUIT_DIALOG;
89our $HOST_ENTRY; 89our $HOST_ENTRY;
90our $PICKUP_ENABLE;
90our $SERVER_INFO; 91our $SERVER_INFO;
91 92
92our $SETUP_DIALOG; 93our $SETUP_DIALOG;
93our $SETUP_NOTEBOOK; 94our $SETUP_NOTEBOOK;
94our $SETUP_SERVER; 95our $SETUP_SERVER;
95our $SETUP_KEYBOARD; 96our $SETUP_KEYBOARD;
96our $SETUP_SPELLS;
97 97
98our $PL_NOTEBOOK;
98our $STATS_WINDOW; 99our $PL_WINDOW;
100
101our $INVENTORY_PAGE;
102our $STATS_PAGE;
103our $SPELL_PAGE;
104
105our $HELP_WINDOW;
99our $MESSAGE_WINDOW; 106our $MESSAGE_WINDOW;
100our $FLOORBOX; 107our $FLOORBOX;
101our $GAUGES; 108our $GAUGES;
102our $STATWIDS; 109our $STATWIDS;
103 110
113our $DEBUG_STATUS; 120our $DEBUG_STATUS;
114 121
115our $INV; 122our $INV;
116our $INVR; 123our $INVR;
117our $INV_RIGHT_HB; 124our $INV_RIGHT_HB;
118
119our $PL_NOTEBOOK;
120our $PL_WINDOW;
121 125
122our $BIND_EDITOR; 126our $BIND_EDITOR;
123our $BIND_UPD_CB; 127our $BIND_UPD_CB;
124 128
125our $PICKUP_CFG; 129our $PICKUP_CFG;
223 $conn->send ("reply $stat"); 227 $conn->send ("reply $stat");
224 destroy_query_dialog $conn; 228 destroy_query_dialog $conn;
225 return; 229 return;
226 } 230 }
227 231
228 $STATS_WINDOW->show; 232 $STATS_PAGE->show;
229 $MESSAGE_WINDOW->hide; 233 $MESSAGE_WINDOW->hide;
230 234
231 unshift @dialog, new CFClient::UI::Label 235 unshift @dialog, new CFClient::UI::Label
232 max_w => $::WIDTH * 0.4, 236 max_w => $::WIDTH * 0.4,
233 ellipsise => 0, 237 ellipsise => 0,
273 # right: accept 277 # right: accept
274 $table->add (4, 0, new CFClient::UI::Button 278 $table->add (4, 0, new CFClient::UI::Button
275 text => "Accept", 279 text => "Accept",
276 on_activate => sub { 280 on_activate => sub {
277 $conn->send ("reply n"); 281 $conn->send ("reply n");
278 $STATS_WINDOW->hide; 282 $STATS_PAGE->hide;
279 destroy_query_dialog $conn; 283 destroy_query_dialog $conn;
280 0 284 0
281 }, 285 },
282 ); 286 );
283 287
376sub stop_game { 380sub stop_game {
377 $LOGIN_BUTTON->set_text ("Login"); 381 $LOGIN_BUTTON->set_text ("Login");
378 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); 382 $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER);
379 $SETUP_DIALOG->show; 383 $SETUP_DIALOG->show;
380 $PL_WINDOW->hide; 384 $PL_WINDOW->hide;
381 $SETUP_SPELLS->clear_spells; 385 $SPELL_PAGE->clear_spells;
382 386
383 return unless $CONN; 387 return unless $CONN;
384 388
385 status "connection closed"; 389 status "connection closed";
386 390
471 range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], 475 range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1],
472 tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant.", 476 tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant.",
473 on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, 477 on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 },
474 ); 478 );
475 479
476 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize");
477
478 $table->add (1, $row++, new CFClient::UI::Slider
479 range => [$CFG->{stat_fontsize}, 0.5, 2, 0, 0.1],
480 tooltip => "The font size used by the <b>statistics window</b> only. Changes are instant.",
481 on_changed => sub {
482 $CFG->{stat_fontsize} = $_[1];
483 &set_stats_window_fontsize;
484 0
485 }
486 );
487
488 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); 480 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize");
489 $table->add (1, $row++, new CFClient::UI::Slider 481 $table->add (1, $row++, new CFClient::UI::Slider
490 range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], 482 range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1],
491 tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.", 483 tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.",
492 on_changed => sub { 484 on_changed => sub {
561 ); 553 );
562 554
563 $vbox 555 $vbox
564} 556}
565 557
566sub set_stats_window_fontsize {
567 for (values %{$STATWIDS}) {
568 $_->set_fontsize ($::CFG->{stat_fontsize});
569 }
570}
571
572sub set_gauge_window_fontsize { 558sub set_gauge_window_fontsize {
573 for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) { 559 for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) {
574 $_->set_fontsize ($::CFG->{gauge_fontsize}); 560 $_->set_fontsize ($::CFG->{gauge_fontsize});
575 } 561 }
576} 562}
655 641
656 $table 642 $table
657} 643}
658 644
659sub stats_window { 645sub stats_window {
660 my $tgw =
661 new CFClient::UI::Window
662 child => my $vb = new CFClient::UI::VBox; 646 my $vb = new CFClient::UI::VBox;
663 647
664 $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, 648 $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1,
665 can_hover => 1, can_events => 1, 649 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."); 650 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, 651 $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1,
759 $col += 2; 743 $col += 2;
760 $row = 0; 744 $row = 0;
761 } 745 }
762 } 746 }
763 747
764 &set_stats_window_fontsize; 748 $vb->add (my $tbl3 = new CFClient::UI::Table expand => 1);
749 $STATWIDS->{"_skill_tbl"} = $tbl3;
750
765 update_stats_window ({}); 751 update_stats_window ({});
766 752
767 $tgw 753 $vb
768} 754}
769 755
770sub formsep($) { 756sub formsep($) {
771 scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 757 scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1
772} 758}
832 depl => CS_STAT_RES_DEPLETE, 818 depl => CS_STAT_RES_DEPLETE,
833 deat => CS_STAT_RES_DEATH, 819 deat => CS_STAT_RES_DEATH,
834 holyw => CS_STAT_RES_HOLYWORD, 820 holyw => CS_STAT_RES_HOLYWORD,
835 blind => CS_STAT_RES_BLIND, 821 blind => CS_STAT_RES_BLIND,
836 ); 822 );
823
824 if ($::CONN && !$STATWIDS->{_skill_tbl_init}) {
825 my $sktbl = $STATWIDS->{_skill_tbl};
826 $sktbl->clear;
827
828 $sktbl->add (0, 0, new CFClient::UI::Label text => "Exp.", align => 1);
829 $sktbl->add (1, 0, new CFClient::UI::Label text => "Level", align => 1);
830 $sktbl->add (2, 0, new CFClient::UI::Label text => "Skillname");
831
832 my @skills;
833
834 for (my $i = CS_STAT_SKILLINFO; $i < CS_STAT_SKILLINFO+CS_NUM_SKILLS; $i++) {
835 push @skills, [$i, $::CONN->{skill_info}{$i}];
836 }
837
838 my $y = 1;
839 for (sort { $a->[1] cmp $b->[1] } @skills) {
840 my ($idx, $name) = @$_;
841
842 unless (defined $STATWIDS->{"sk_xp_$idx"} || !$::CONN->{skill_info}{$idx}) {
843 $sktbl->add (0, $y, $STATWIDS->{"sk_xp_$idx"} = new CFClient::UI::Label text => "0", align => 1);
844 $sktbl->add (1, $y, $STATWIDS->{"sk_lvl_$idx"} = new CFClient::UI::Label text => "0", align => 1);
845 $sktbl->add (2, $y++, new CFClient::UI::Label text => $name);
846 }
847 }
848
849 $STATWIDS->{_skill_tbl_init} = 1;
850 }
851
852 for (my $i = CS_STAT_SKILLINFO; $i < CS_STAT_SKILLINFO+CS_NUM_SKILLS; $i++) {
853 if (exists $stats->{$i}) {
854 $STATWIDS->{"sk_xp_$i"}->set_text (formsep $stats->{$i}->[1])
855 if $STATWIDS->{"sk_xp_$i"};
856 $STATWIDS->{"sk_lvl_$i"}->set_text (sprintf "%d", $stats->{$i}->[0])
857 if $STATWIDS->{"sk_lvl_$i"};
858 }
859 }
837 860
838 $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) 861 $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}})
839 for keys %tbl; 862 for keys %tbl;
840} 863}
841 864
1186sub autopickup_setup { 1209sub autopickup_setup {
1187 my $table = new CFClient::UI::Table; 1210 my $table = new CFClient::UI::Table;
1188 1211
1189 for ( 1212 for (
1190 ["General", 0, 0, 1213 ["General", 0, 0,
1191 ["Enable autopickup" => PICKUP_NEWMODE], 1214 ["Enable autopickup" => PICKUP_NEWMODE, \$PICKUP_ENABLE],
1192 ["Inhibit autopickup" => PICKUP_INHIBIT], 1215 ["Inhibit autopickup" => PICKUP_INHIBIT],
1193 ["Stop before pickup" => PICKUP_STOP], 1216 ["Stop before pickup" => PICKUP_STOP],
1194 ["Debug autopickup" => PICKUP_DEBUG], 1217 ["Debug autopickup" => PICKUP_DEBUG],
1195 ], 1218 ],
1196 ["Weapons", 0, 6, 1219 ["Weapons", 0, 6,
1233 for (@bits) { 1256 for (@bits) {
1234 ++$y; 1257 ++$y;
1235 1258
1236 my $mask = $_->[1]; 1259 my $mask = $_->[1];
1237 $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); 1260 $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1);
1238 $table->add ($x+1, $y, new CFClient::UI::CheckBox 1261 $table->add ($x+1, $y, my $checkbox = new CFClient::UI::CheckBox
1239 state => $::CFG->{pickup} & $mask, 1262 state => $::CFG->{pickup} & $mask,
1240 on_changed => sub { 1263 on_changed => sub {
1241 my ($box, $value) = @_; 1264 my ($box, $value) = @_;
1242 1265
1243 if ($value) { 1266 if ($value) {
1249 $::CONN->send_command ("pickup $::CFG->{pickup}") 1272 $::CONN->send_command ("pickup $::CFG->{pickup}")
1250 if defined $::CONN; 1273 if defined $::CONN;
1251 1274
1252 0 1275 0
1253 }); 1276 });
1277
1278 ${$_->[2]} = $checkbox if $_->[2];
1254 } 1279 }
1255 } 1280 }
1256 1281
1257 $table->add (2, 18, new CFClient::UI::ValSlider 1282 $table->add (2, 18, new CFClient::UI::ValSlider
1258 range => [$::CFG->{pickup} & 0xF, 0, 16, 1, 1], 1283 range => [$::CFG->{pickup} & 0xF, 0, 16, 1, 1],
1293 1318
1294 # XXX: Call after $INVR = ... because set_opencont sets the items 1319 # XXX: Call after $INVR = ... because set_opencont sets the items
1295 CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); 1320 CFClient::Protocol::set_opencont ($::CONN, 0, "Floor");
1296 1321
1297 $hb 1322 $hb
1323}
1324
1325sub toggle_player_page {
1326 my ($widget) = @_;
1327
1328 if ($PL_WINDOW->{visible} && $PL_NOTEBOOK->get_current_page == $widget) {
1329 $PL_WINDOW->hide;
1330 } else {
1331 $PL_NOTEBOOK->set_current_page ($widget);
1332 $PL_WINDOW->show;
1333 }
1298} 1334}
1299 1335
1300sub player_window { 1336sub player_window {
1301 my $plwin = $PL_WINDOW = new CFClient::UI::FancyFrame 1337 my $plwin = $PL_WINDOW = new CFClient::UI::FancyFrame
1302 x => "center", 1338 x => "center",
1312 new CFClient::UI::Notebook 1348 new CFClient::UI::Notebook
1313 expand => 1, 1349 expand => 1,
1314 debug => 1, 1350 debug => 1,
1315 filter => (new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1), 1351 filter => (new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1),
1316 ; 1352 ;
1353
1317 $ntb->add ( 1354 $ntb->add (
1355 "Stats &amp; Skills" => $STATS_PAGE = stats_window,
1356 "Shows statistics and skill window, where all your Stats, Resistances and Skills are shown."
1357 );
1358 $ntb->add (
1359 Spellbook => $SPELL_PAGE = new CFClient::UI::SpellList,
1360 "Displays all spells you have and lets you edit keyboard shortcuts for them."
1361 );
1362 $ntb->add (
1318 Inventory => inventory_widget, 1363 Inventory => $INVENTORY_PAGE = inventory_widget,
1319 "Toggles the inventory window, where you can manage your loot (or treasures :). " 1364 "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." 1365 . "You can also hit the <b>Tab</b>-key to show/hide the Inventory."
1321 ); 1366 );
1322 1367
1323 $ntb->add ( 1368 $ntb->set_current_page ($INVENTORY_PAGE);
1324 Stats => $STATS_WINDOW = stats_window,
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 );
1331 1369
1332 $plwin->add ($ntb); 1370 $plwin->add ($ntb);
1333 $plwin 1371 $plwin
1334} 1372}
1335 1373
1451 y => 'center', 1489 y => 'center',
1452 z => 2, 1490 z => 2,
1453 name => 'doc_browser', 1491 name => 'doc_browser',
1454 force_w => int $WIDTH * 7/8, 1492 force_w => int $WIDTH * 7/8,
1455 force_h => int $HEIGHT * 7/8, 1493 force_h => int $HEIGHT * 7/8,
1456 title => "Documentation"; 1494 title => "Help Browser",
1495 has_close_button => 1;
1457 1496
1458 $win->add (my $vbox = new CFClient::UI::VBox); 1497 $win->add (my $vbox = new CFClient::UI::VBox);
1459 1498
1460 $vbox->add (my $buttons = new CFClient::UI::HBox); 1499 $vbox->add (my $buttons = new CFClient::UI::HBox);
1461 $vbox->add (my $viewer = new CFClient::UI::TextScroller 1500 $vbox->add (my $viewer = new CFClient::UI::TextScroller
1638 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW = message_window, 1677 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW = message_window,
1639 tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); 1678 tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server.");
1640 1679
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 1680 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
1642 1681
1643 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Player", other => player_window, 1682 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Playerbook", other => player_window,
1644 tooltip => "Toggles the player view, where you can manage Inventory, Spells, Skills and see your Stats."); 1683 tooltip => "Toggles the player view, where you can manage Inventory, Spells, Skills and see your Stats.");
1645 1684
1646 $BUTTONBAR->add (new CFClient::UI::Button 1685 $BUTTONBAR->add (new CFClient::UI::Button
1647 text => "Save Config", 1686 text => "Save Config",
1648 tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", 1687 tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.",
1652 status "Configuration Saved"; 1691 status "Configuration Saved";
1653 0 1692 0
1654 }, 1693 },
1655 ); 1694 );
1656 1695
1657 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window, 1696 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window,
1658 tooltip => "View Documentation"); 1697 tooltip => "View Documentation");
1659 1698
1660 $BUTTONBAR->add (new CFClient::UI::Button 1699 $BUTTONBAR->add (new CFClient::UI::Button
1661 text => "Quit", 1700 text => "Quit",
1662 tooltip => "Terminates the program", 1701 tooltip => "Terminates the program",

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines