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.77 by elmex, Wed Jun 21 12:59:23 2006 UTC vs.
Revision 1.84 by root, Sun Jul 2 18:52:05 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 {
693 [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."],
694 695
695 [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."],
696 [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."],
697 [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."],
698 [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."],
699 [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."],
700 [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."],
701 ) { 702 ) {
702 my ($col, $row, $id, $label, $template, $tooltip) = @$_; 703 my ($col, $row, $id, $label, $template, $tooltip) = @$_;
703 704
722 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)",
723 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)",
724 pois => "<b>Poison</b> (resistance to getting poisoned)", 725 pois => "<b>Poison</b> (resistance to getting poisoned)",
725 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)",
726 deat => "<b>Death</b> (resistance against death spells)", 727 deat => "<b>Death</b> (resistance against death spells)",
727 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.)",
728 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)",
729 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)",
730 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...",
731 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, ...)",
732 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, ...)",
749 ); 750 );
750 $tbl2->add ($col + 1, $row, new CFClient::UI::Image 751 $tbl2->add ($col + 1, $row, new CFClient::UI::Image
751 font => $FONT_FIXED, 752 font => $FONT_FIXED,
752 can_hover => 1, 753 can_hover => 1,
753 can_events => 1, 754 can_events => 1,
754 image => "ui/resist/resist_$_.png", 755 path => "ui/resist/resist_$_.png",
755 tooltip => $resist_names{$_}, 756 tooltip => $resist_names{$_},
756 ); 757 );
757 758
758 $row++; 759 $row++;
759 if ($row % 6 == 0) { 760 if ($row % 6 == 0) {
807 $STATWIDS->{st_pow} ->set_text (sprintf "%d" , $stats->{+CS_STAT_POW}); 808 $STATWIDS->{st_pow} ->set_text (sprintf "%d" , $stats->{+CS_STAT_POW});
808 $STATWIDS->{st_cha} ->set_text (sprintf "%d" , $stats->{+CS_STAT_CHA}); 809 $STATWIDS->{st_cha} ->set_text (sprintf "%d" , $stats->{+CS_STAT_CHA});
809 $STATWIDS->{st_wc} ->set_text (sprintf "%d" , $stats->{+CS_STAT_WC}); 810 $STATWIDS->{st_wc} ->set_text (sprintf "%d" , $stats->{+CS_STAT_WC});
810 $STATWIDS->{st_ac} ->set_text (sprintf "%d" , $stats->{+CS_STAT_AC}); 811 $STATWIDS->{st_ac} ->set_text (sprintf "%d" , $stats->{+CS_STAT_AC});
811 $STATWIDS->{st_dam} ->set_text (sprintf "%d" , $stats->{+CS_STAT_DAM}); 812 $STATWIDS->{st_dam} ->set_text (sprintf "%d" , $stats->{+CS_STAT_DAM});
812 $STATWIDS->{st_arm} ->set_text (sprintf "%d" , $stats->{+CS_STAT_ARMOUR}); 813 $STATWIDS->{st_arm} ->set_text (sprintf "%d" , $stats->{+CS_STAT_RES_PHYS});
813 $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); 814 $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED});
814 $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});
815 816
816 $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);
817 818
841} 842}
842 843
843my $METASERVER_ATIME; 844my $METASERVER_ATIME;
844 845
845sub update_metaserver { 846sub update_metaserver {
847 my ($metaserver_dialog) = @_;
848
849 $METASERVER = $metaserver_dialog
850 if defined $metaserver_dialog;
851
846 return if $METASERVER_ATIME > time; 852 return if $METASERVER_ATIME > time;
847 $METASERVER_ATIME = time + 60; 853 $METASERVER_ATIME = time + 60;
848 854
849 my $table = $METASERVER->{table}; 855 my $table = $METASERVER->{table};
850 $table->clear; 856 $table->clear;
938 } 944 }
939 }); 945 });
940} 946}
941 947
942sub 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
943 my $dialog = new CFClient::UI::FancyFrame 953 my $dialog = new CFClient::UI::FancyFrame
944 title => "Server List", 954 title => "Server List",
945 name => 'metaserver_dialog', 955 name => 'metaserver_dialog',
946 x => 'center', 956 x => 'center',
947 y => 'center', 957 y => 'center',
948 z => 3, 958 z => 3,
949 force_h => $::HEIGHT * 0.4, 959 force_h => $::HEIGHT * 0.4,
950 child => (my $vbox = new CFClient::UI::VBox), 960 child => $vbox,
961 has_close_button => 1,
962 table => $table,
951 on_visibility_change => sub { 963 on_visibility_change => sub {
952 update_metaserver if $_[1]; 964 update_metaserver ($_[0]) if $_[1];
953 0 965 0
954 }, 966 },
955 ; 967 ;
956
957 $dialog->{table} = new CFClient::UI::Table;
958
959 $vbox->add (new CFClient::UI::ScrolledWindow expand => 1, child => $dialog->{table});
960 968
961 $dialog 969 $dialog
962} 970}
963 971
964sub server_setup { 972sub server_setup {
979 my ($self, $value) = @_; 987 my ($self, $value) = @_;
980 $CFG->{profile}{default}{host} = $value; 988 $CFG->{profile}{default}{host} = $value;
981 0 989 0
982 } 990 }
983 ); 991 );
984
985 $METASERVER = metaserver_dialog;
986 992
987 $vbox->add (new CFClient::UI::Button 993 $vbox->add (new CFClient::UI::Button
988 expand => 1, 994 expand => 1,
989 text => "Server List", 995 text => "Server List",
990 other => $METASERVER, 996 other => $METASERVER,
1230 ++$y; 1236 ++$y;
1231 1237
1232 my $mask = $_->[1]; 1238 my $mask = $_->[1];
1233 $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); 1239 $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1);
1234 $table->add ($x+1, $y, new CFClient::UI::CheckBox 1240 $table->add ($x+1, $y, new CFClient::UI::CheckBox
1235 state => $CFG->{pickup} & $mask, 1241 state => $::CFG->{pickup} & $mask,
1236 on_changed => sub { 1242 on_changed => sub {
1237 my ($box, $value) = @_; 1243 my ($box, $value) = @_;
1238 1244
1239 if ($value) { 1245 if ($value) {
1240 $::CFG->{pickup} |= $mask; 1246 $::CFG->{pickup} |= $mask;
1249 }); 1255 });
1250 } 1256 }
1251 } 1257 }
1252 1258
1253 $table->add (2, 18, new CFClient::UI::ValSlider 1259 $table->add (2, 18, new CFClient::UI::ValSlider
1254 range => [0, 0, 16, 1, 1], 1260 range => [$::CFG->{pickup} & 0xF, 0, 16, 1, 1],
1261 template => ">= 99",
1255 to_value => sub { ">= " . 5 * $_[0] }, 1262 to_value => sub { ">= " . 5 * $_[0] },
1256 on_changed => sub { 1263 on_changed => sub {
1257 my ($slider, $value) = @_; 1264 my ($slider, $value) = @_;
1258 1265
1259 $::CFG->{pickup} &= ~0x7; 1266 $::CFG->{pickup} &= ~0xF;
1260 $::CFG->{pickup} |= int $value 1267 $::CFG->{pickup} |= int $value
1261 if $value; 1268 if $value;
1262 1; 1269 1;
1263 }); 1270 });
1271
1264 $table->add (3, 18, new CFClient::UI::Button 1272 $table->add (3, 18, new CFClient::UI::Button
1265 text => "set", 1273 text => "set",
1266 on_activate => sub { 1274 on_activate => sub {
1267 $::CONN->send_command ("pickup $::CFG->{pickup}") 1275 $::CONN->send_command ("pickup $::CFG->{pickup}")
1268 if defined $::CONN; 1276 if defined $::CONN;
1277 x => "center", 1285 x => "center",
1278 y => "center", 1286 y => "center",
1279 force_w => $WIDTH * 9/10, 1287 force_w => $WIDTH * 9/10,
1280 force_h => $HEIGHT * 9/10, 1288 force_h => $HEIGHT * 9/10,
1281 title => "Inventory", 1289 title => "Inventory",
1290 name => "inventory_window",
1282 has_close_button => 1, 1291 has_close_button => 1,
1283 ; 1292 ;
1284 1293
1285 $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); 1294 $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1);
1286 1295
1319 for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { 1328 for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) {
1320 my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; 1329 my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym};
1321 next unless ref $cmds eq 'ARRAY' and @$cmds > 0; 1330 next unless ref $cmds eq 'ARRAY' and @$cmds > 0;
1322 1331
1323 my $lbl = join "; ", @$cmds; 1332 my $lbl = join "; ", @$cmds;
1324 my $nam = CFClient::Binder::keycombo_to_name ($mod, $sym); 1333 my $nam = CFClient::BindingEditor::keycombo_to_name ($mod, $sym);
1325 $binding_list->add (my $hb = new CFClient::UI::HBox); 1334 $binding_list->add (my $hb = new CFClient::UI::HBox);
1326 $hb->add (new CFClient::UI::Button 1335 $hb->add (new CFClient::UI::Button
1327 text => "delete", 1336 text => "delete",
1328 tooltip => "Deletes the binding", 1337 tooltip => "Deletes the binding",
1329 on_activate => sub { 1338 on_activate => sub {
1435 $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); 1444 $buttons->add (new CFClient::UI::Label text => "Choose a document to display: ");
1436 $buttons->add (my $combo = new CFClient::UI::Combobox 1445 $buttons->add (my $combo = new CFClient::UI::Combobox
1437 value => undef, 1446 value => undef,
1438 options => [ 1447 options => [
1439 [intro => "Introduction"], 1448 [intro => "Introduction"],
1440 [manual => "Manual"], 1449 [manual => "Main Manual"],
1441 [skill_help => "Skills"], 1450 [skill_help => "Skill Reference"],
1442 [command_help => "Commands"], 1451 [command_help => "Command Reference"],
1443 [dmcommand_help => "DM Commands"], 1452 [dmcommand_help => "DM Commands"],
1444 [COPYING => "License Terms"], 1453 [COPYING => "License Terms"],
1445 ], 1454 ],
1446 on_changed => sub { 1455 on_changed => sub {
1447 my ($self, $pod) = @_; 1456 my ($self, $pod) = @_;
1448 1457
1449 my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", 1458 my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod",
1450 doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; 1459 doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] };
1451 1460
1452 $viewer->clear; 1461 $viewer->clear;
1462
1463# $viewer->add_paragraph ([1, 1, 1, 1], ["<big>Test</big>\n\n \x{fffc} \x{fffc}\n",
1464# (new CFClient::UI::Image path => "x.png", can_hover => 1, can_events => 1),
1465# (new CFClient::UI::Label text => "üüüü", can_hover => 1, can_events => 1, tooltip => "??"),
1466# ]);#d#
1453 1467
1454 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) 1468 $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0])
1455 for @$pom; 1469 for @$pom;
1456 1470
1457 $viewer->set_offset (0); 1471 $viewer->set_offset (0);
1472
1458 0 1473 0
1459 }, 1474 },
1460 on_visibility_change => sub { 1475 on_visibility_change => sub {
1461 my ($self, $visible) = @_; 1476 my ($self, $visible) = @_;
1462 return unless $visible; 1477 return unless $visible;
1509 z => 100, 1524 z => 100,
1510 force_x => "max", 1525 force_x => "max",
1511 force_y => 0; 1526 force_y => 0;
1512 $DEBUG_STATUS->show; 1527 $DEBUG_STATUS->show;
1513 1528
1514 $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); 1529 $BIND_EDITOR = new CFClient::BindingEditor (x => "max", y => 0);
1515 1530
1516 $STATUSBOX = new CFClient::UI::Statusbox; 1531 $STATUSBOX = new CFClient::UI::Statusbox;
1517 $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); 1532 $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]);
1518 1533
1519 (new CFClient::UI::Frame 1534 (new CFClient::UI::Frame
1569 z => 2, 1584 z => 2,
1570 force_w => $::WIDTH * 0.6, 1585 force_w => $::WIDTH * 0.6,
1571 force_h => $::HEIGHT * 0.6, 1586 force_h => $::HEIGHT * 0.6,
1572 has_close_button => 1, 1587 has_close_button => 1,
1573 ; 1588 ;
1589
1590 $METASERVER = metaserver_dialog;
1574 1591
1575 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, 1592 $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1,
1576 filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); 1593 filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1);
1577 1594
1578 $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, 1595 $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines