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.76 by root, Tue Jun 20 08:49:40 2006 UTC vs.
Revision 1.82 by elmex, Wed Jun 28 10:37:19 2006 UTC

36 36
37use CFClient; 37use CFClient;
38use CFClient::OpenGL (); 38use CFClient::OpenGL ();
39use CFClient::Protocol; 39use CFClient::Protocol;
40use CFClient::UI; 40use CFClient::UI;
41use CFClient::BindingEditor;
41use CFClient::MapWidget; 42use 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 {
115our $INV; 116our $INV;
116our $INVR; 117our $INVR;
117our $INV_RIGHT_HB; 118our $INV_RIGHT_HB;
118 119
119our $BIND_EDITOR; 120our $BIND_EDITOR;
121our $BIND_UPD_CB;
120 122
121our $PICKUP_CFG; 123our $PICKUP_CFG;
122 124
123sub status { 125sub status {
124 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); 126 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 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."], 694 [0, 6, st_cha => "Cha", 30, "<b>Charisma</b>, how well you are received by NPCs. Affects buying and selling prices in shops."],
693 695
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."], 696 [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."], 697 [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."], 698 [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."], 699 [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."], 700 [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."], 701 [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 ) { 702 ) {
701 my ($col, $row, $id, $label, $template, $tooltip) = @$_; 703 my ($col, $row, $id, $label, $template, $tooltip) = @$_;
702 704
721 drain => "<b>Draining</b> (some monsters (e.g. vampires) and other effects can steal experience)", 723 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)", 724 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)", 725 pois => "<b>Poison</b> (resistance to getting poisoned)",
724 para => "<b>Paralysation</b> (this resistance affects the chance you get paralysed)", 726 para => "<b>Paralysation</b> (this resistance affects the chance you get paralysed)",
725 deat => "<b>Death</b> (resistance against death spells)", 727 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)", 728 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)", 729 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)", 730 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...", 731 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, ...)", 732 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, ...)", 733 cold => "<b>Cold</b> (this is your resistance against cold spells like icestorm, snowstorm, ...)",
748 ); 750 );
749 $tbl2->add ($col + 1, $row, new CFClient::UI::Image 751 $tbl2->add ($col + 1, $row, new CFClient::UI::Image
750 font => $FONT_FIXED, 752 font => $FONT_FIXED,
751 can_hover => 1, 753 can_hover => 1,
752 can_events => 1, 754 can_events => 1,
753 image => "ui/resist/resist_$_.png", 755 path => "ui/resist/resist_$_.png",
754 tooltip => $resist_names{$_}, 756 tooltip => $resist_names{$_},
755 ); 757 );
756 758
757 $row++; 759 $row++;
758 if ($row % 6 == 0) { 760 if ($row % 6 == 0) {
806 $STATWIDS->{st_pow} ->set_text (sprintf "%d" , $stats->{+CS_STAT_POW}); 808 $STATWIDS->{st_pow} ->set_text (sprintf "%d" , $stats->{+CS_STAT_POW});
807 $STATWIDS->{st_cha} ->set_text (sprintf "%d" , $stats->{+CS_STAT_CHA}); 809 $STATWIDS->{st_cha} ->set_text (sprintf "%d" , $stats->{+CS_STAT_CHA});
808 $STATWIDS->{st_wc} ->set_text (sprintf "%d" , $stats->{+CS_STAT_WC}); 810 $STATWIDS->{st_wc} ->set_text (sprintf "%d" , $stats->{+CS_STAT_WC});
809 $STATWIDS->{st_ac} ->set_text (sprintf "%d" , $stats->{+CS_STAT_AC}); 811 $STATWIDS->{st_ac} ->set_text (sprintf "%d" , $stats->{+CS_STAT_AC});
810 $STATWIDS->{st_dam} ->set_text (sprintf "%d" , $stats->{+CS_STAT_DAM}); 812 $STATWIDS->{st_dam} ->set_text (sprintf "%d" , $stats->{+CS_STAT_DAM});
811 $STATWIDS->{st_arm} ->set_text (sprintf "%d" , $stats->{+CS_STAT_ARMOUR}); 813 $STATWIDS->{st_arm} ->set_text (sprintf "%d" , $stats->{+CS_STAT_RES_PHYS});
812 $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); 814 $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED});
813 $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); 815 $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP});
814 816
815 $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); 817 $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000);
816 818
840} 842}
841 843
842my $METASERVER_ATIME; 844my $METASERVER_ATIME;
843 845
844sub update_metaserver { 846sub update_metaserver {
847 my ($metaserver_dialog) = @_;
848
849 $METASERVER = $metaserver_dialog
850 if defined $metaserver_dialog;
851
845 return if $METASERVER_ATIME > time; 852 return if $METASERVER_ATIME > time;
846 $METASERVER_ATIME = time + 60; 853 $METASERVER_ATIME = time + 60;
847 854
848 my $table = $METASERVER->{table}; 855 my $table = $METASERVER->{table};
849 $table->clear; 856 $table->clear;
937 } 944 }
938 }); 945 });
939} 946}
940 947
941sub metaserver_dialog { 948sub metaserver_dialog {
949 my $vbox = new CFClient::UI::VBox;
950 my $table = new CFClient::UI::Table;
951 $vbox->add (new CFClient::UI::ScrolledWindow expand => 1, child => $table);
952
942 my $dialog = new CFClient::UI::FancyFrame 953 my $dialog = new CFClient::UI::FancyFrame
943 title => "Server List", 954 title => "Server List",
944 name => 'metaserver_dialog', 955 name => 'metaserver_dialog',
945 x => 'center', 956 x => 'center',
946 y => 'center', 957 y => 'center',
947 z => 3, 958 z => 3,
948 force_h => $::HEIGHT * 0.4, 959 force_h => $::HEIGHT * 0.4,
949 child => (my $vbox = new CFClient::UI::VBox), 960 child => $vbox,
961 has_close_button => 1,
962 table => $table,
950 on_visibility_change => sub { 963 on_visibility_change => sub {
951 update_metaserver if $_[1]; 964 update_metaserver ($_[0]) if $_[1];
952 0 965 0
953 }, 966 },
954 ; 967 ;
955
956 $dialog->{table} = new CFClient::UI::Table;
957
958 $vbox->add (new CFClient::UI::ScrolledWindow expand => 1, child => $dialog->{table});
959 968
960 $dialog 969 $dialog
961} 970}
962 971
963sub server_setup { 972sub server_setup {
978 my ($self, $value) = @_; 987 my ($self, $value) = @_;
979 $CFG->{profile}{default}{host} = $value; 988 $CFG->{profile}{default}{host} = $value;
980 0 989 0
981 } 990 }
982 ); 991 );
983
984 $METASERVER = metaserver_dialog;
985 992
986 $vbox->add (new CFClient::UI::Button 993 $vbox->add (new CFClient::UI::Button
987 expand => 1, 994 expand => 1,
988 text => "Server List", 995 text => "Server List",
989 other => $METASERVER, 996 other => $METASERVER,
1276 x => "center", 1283 x => "center",
1277 y => "center", 1284 y => "center",
1278 force_w => $WIDTH * 9/10, 1285 force_w => $WIDTH * 9/10,
1279 force_h => $HEIGHT * 9/10, 1286 force_h => $HEIGHT * 9/10,
1280 title => "Inventory", 1287 title => "Inventory",
1288 name => "inventory_window",
1281 has_close_button => 1, 1289 has_close_button => 1,
1282 ; 1290 ;
1283 1291
1284 $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); 1292 $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1);
1285 1293
1301 1309
1302sub spell_setup { 1310sub spell_setup {
1303 new CFClient::UI::SpellList 1311 new CFClient::UI::SpellList
1304} 1312}
1305 1313
1314sub update_bindings {
1315 $BIND_UPD_CB->() if $BIND_UPD_CB;
1316}
1317
1306sub keyboard_setup { 1318sub keyboard_setup {
1307 my $binding_list = new CFClient::UI::VBox; 1319 my $binding_list = new CFClient::UI::VBox;
1308 1320
1309 my $refresh; 1321 my $refresh;
1310 $refresh = sub { 1322 $refresh = $BIND_UPD_CB = sub {
1311 $binding_list->clear (); 1323 $binding_list->clear ();
1312 1324
1313 for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { 1325 for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) {
1314 for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { 1326 for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) {
1315 my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; 1327 my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym};
1333 on_activate => sub { 1345 on_activate => sub {
1334 $::BIND_EDITOR->set_binding ( 1346 $::BIND_EDITOR->set_binding (
1335 $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, 1347 $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym},
1336 sub { 1348 sub {
1337 my ($nmod, $nsym, $ncmds) = @_; 1349 my ($nmod, $nsym, $ncmds) = @_;
1338 delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; 1350 $::BIND_EDITOR->cfg_unbind ($mod, $sym);
1339 $::CFG->{profile}{default}{bindings}{$nmod}{$nsym} = $ncmds; 1351 $::BIND_EDITOR->cfg_bind ($nmod, $nsym, $ncmds);
1340 $refresh->(); 1352 $refresh->();
1341 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); 1353 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD);
1342 $SETUP_DIALOG->show; 1354 $SETUP_DIALOG->show;
1343 }, 1355 },
1344 sub { 1356 sub {
1378 tooltip => "This button opens the binding editor with an empty binding.", 1390 tooltip => "This button opens the binding editor with an empty binding.",
1379 on_activate => sub { 1391 on_activate => sub {
1380 $::BIND_EDITOR->set_binding (undef, undef, [], 1392 $::BIND_EDITOR->set_binding (undef, undef, [],
1381 sub { 1393 sub {
1382 my ($mod, $sym, $cmds) = @_; 1394 my ($mod, $sym, $cmds) = @_;
1383 $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds; 1395 $::BIND_EDITOR->cfg_bind ($mod, $sym, $cmds);
1384 $refresh->(); 1396 $refresh->();
1385 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); 1397 $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD);
1386 $SETUP_DIALOG->show; 1398 $SETUP_DIALOG->show;
1387 }, 1399 },
1388 sub { 1400 sub {
1430 $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); 1442 $buttons->add (new CFClient::UI::Label text => "Choose a document to display: ");
1431 $buttons->add (my $combo = new CFClient::UI::Combobox 1443 $buttons->add (my $combo = new CFClient::UI::Combobox
1432 value => undef, 1444 value => undef,
1433 options => [ 1445 options => [
1434 [intro => "Introduction"], 1446 [intro => "Introduction"],
1435 [manual => "Manual"], 1447 [manual => "Main Manual"],
1436 [skill_help => "Skills"], 1448 [skill_help => "Skill Reference"],
1437 [command_help => "Commands"], 1449 [command_help => "Command Reference"],
1438 [dmcommand_help => "DM Commands"], 1450 [dmcommand_help => "DM Commands"],
1439 [COPYING => "License Terms"], 1451 [COPYING => "License Terms"],
1440 ], 1452 ],
1441 on_changed => sub { 1453 on_changed => sub {
1442 my ($self, $pod) = @_; 1454 my ($self, $pod) = @_;
1443 1455
1444 my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", 1456 my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod",
1445 doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; 1457 doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] };
1446 1458
1447 $viewer->clear; 1459 $viewer->clear;
1460
1461# $viewer->add_paragraph ([1, 1, 1, 1], ["<big>Test</big>\n\n \x{fffc} \x{fffc}\n",
1462# (new CFClient::UI::Image path => "x.png", can_hover => 1, can_events => 1),
1463# (new CFClient::UI::Label text => "üüüü", can_hover => 1, can_events => 1, tooltip => "??"),
1464# ]);#d#
1448 1465
1449 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) 1466 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0])
1450 for @$pom; 1467 for @$pom;
1451 1468
1452 $viewer->set_offset (0); 1469 $viewer->set_offset (0);
1470
1453 0 1471 0
1454 }, 1472 },
1455 on_visibility_change => sub { 1473 on_visibility_change => sub {
1456 my ($self, $visible) = @_; 1474 my ($self, $visible) = @_;
1457 return unless $visible; 1475 return unless $visible;
1504 z => 100, 1522 z => 100,
1505 force_x => "max", 1523 force_x => "max",
1506 force_y => 0; 1524 force_y => 0;
1507 $DEBUG_STATUS->show; 1525 $DEBUG_STATUS->show;
1508 1526
1509 $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); 1527 $BIND_EDITOR = new CFClient::BindingEditor (x => "max", y => 0);
1510 1528
1511 $STATUSBOX = new CFClient::UI::Statusbox; 1529 $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]); 1530 $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]);
1513 1531
1514 (new CFClient::UI::Frame 1532 (new CFClient::UI::Frame
1564 z => 2, 1582 z => 2,
1565 force_w => $::WIDTH * 0.6, 1583 force_w => $::WIDTH * 0.6,
1566 force_h => $::HEIGHT * 0.6, 1584 force_h => $::HEIGHT * 0.6,
1567 has_close_button => 1, 1585 has_close_button => 1,
1568 ; 1586 ;
1587
1588 $METASERVER = metaserver_dialog;
1569 1589
1570 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, 1590 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1,
1571 filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); 1591 filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1);
1572 1592
1573 $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, 1593 $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines