… | |
… | |
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" }; |
|
|
45 | $SIG{PIPE} = 'IGNORE'; |
44 | |
46 | |
45 | $Event::DIED = sub { |
47 | $Event::DIED = sub { |
46 | # TODO: display dialog box or so |
48 | # TODO: display dialog box or so |
47 | Carp::confess $_[1];#d#TODO: remove when stable |
49 | Carp::confess $_[1];#d#TODO: remove when stable |
48 | CFClient::error $_[1]; |
50 | CFClient::error $_[1]; |
… | |
… | |
84 | our $CONSOLE; |
86 | our $CONSOLE; |
85 | our $METASERVER; |
87 | our $METASERVER; |
86 | our $LOGIN_BUTTON; |
88 | our $LOGIN_BUTTON; |
87 | our $QUIT_DIALOG; |
89 | our $QUIT_DIALOG; |
88 | our $HOST_ENTRY; |
90 | our $HOST_ENTRY; |
|
|
91 | our $PICKUP_ENABLE; |
89 | our $SERVER_INFO; |
92 | our $SERVER_INFO; |
90 | |
93 | |
91 | our $SETUP_DIALOG; |
94 | our $SETUP_DIALOG; |
92 | our $SETUP_NOTEBOOK; |
95 | our $SETUP_NOTEBOOK; |
93 | our $SETUP_SERVER; |
96 | our $SETUP_SERVER; |
94 | our $SETUP_KEYBOARD; |
97 | our $SETUP_KEYBOARD; |
95 | our $SETUP_SPELLS; |
|
|
96 | |
98 | |
|
|
99 | our $PL_NOTEBOOK; |
97 | our $STATS_WINDOW; |
100 | our $PL_WINDOW; |
|
|
101 | |
|
|
102 | our $INVENTORY_PAGE; |
|
|
103 | our $STATS_PAGE; |
|
|
104 | our $SPELL_PAGE; |
|
|
105 | |
|
|
106 | our $HELP_WINDOW; |
98 | our $MESSAGE_WINDOW; |
107 | our $MESSAGE_WINDOW; |
99 | our $FLOORBOX; |
108 | our $FLOORBOX; |
100 | our $GAUGES; |
109 | our $GAUGES; |
101 | our $STATWIDS; |
110 | our $STATWIDS; |
102 | |
111 | |
… | |
… | |
109 | |
118 | |
110 | our $ALT_ENTER_MESSAGE; |
119 | our $ALT_ENTER_MESSAGE; |
111 | our $STATUSBOX; |
120 | our $STATUSBOX; |
112 | our $DEBUG_STATUS; |
121 | our $DEBUG_STATUS; |
113 | |
122 | |
114 | our $INV_WINDOW; |
|
|
115 | our $INV; |
123 | our $INV; |
116 | our $INVR; |
124 | our $INVR; |
117 | our $INV_RIGHT_HB; |
125 | our $INV_RIGHT_HB; |
118 | |
126 | |
119 | our $BIND_EDITOR; |
127 | our $BIND_EDITOR; |
|
|
128 | our $BIND_UPD_CB; |
120 | |
129 | |
121 | our $PICKUP_CFG; |
130 | our $PICKUP_CFG; |
122 | |
131 | |
123 | sub status { |
132 | sub status { |
124 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
133 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
… | |
… | |
219 | $conn->send ("reply $stat"); |
228 | $conn->send ("reply $stat"); |
220 | destroy_query_dialog $conn; |
229 | destroy_query_dialog $conn; |
221 | return; |
230 | return; |
222 | } |
231 | } |
223 | |
232 | |
224 | $STATS_WINDOW->show; |
233 | $STATS_PAGE->show; |
225 | $MESSAGE_WINDOW->hide; |
234 | $MESSAGE_WINDOW->hide; |
226 | |
235 | |
227 | unshift @dialog, new CFClient::UI::Label |
236 | unshift @dialog, new CFClient::UI::Label |
228 | max_w => $::WIDTH * 0.4, |
237 | max_w => $::WIDTH * 0.4, |
229 | ellipsise => 0, |
238 | ellipsise => 0, |
… | |
… | |
269 | # right: accept |
278 | # right: accept |
270 | $table->add (4, 0, new CFClient::UI::Button |
279 | $table->add (4, 0, new CFClient::UI::Button |
271 | text => "Accept", |
280 | text => "Accept", |
272 | on_activate => sub { |
281 | on_activate => sub { |
273 | $conn->send ("reply n"); |
282 | $conn->send ("reply n"); |
274 | $STATS_WINDOW->hide; |
283 | $STATS_PAGE->hide; |
275 | destroy_query_dialog $conn; |
284 | destroy_query_dialog $conn; |
276 | 0 |
285 | 0 |
277 | }, |
286 | }, |
278 | ); |
287 | ); |
279 | |
288 | |
… | |
… | |
371 | |
380 | |
372 | sub stop_game { |
381 | sub stop_game { |
373 | $LOGIN_BUTTON->set_text ("Login"); |
382 | $LOGIN_BUTTON->set_text ("Login"); |
374 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
383 | $SETUP_NOTEBOOK->set_current_page ($SETUP_SERVER); |
375 | $SETUP_DIALOG->show; |
384 | $SETUP_DIALOG->show; |
376 | $INV_WINDOW->hide; |
385 | $PL_WINDOW->hide; |
377 | $SETUP_SPELLS->clear_spells; |
386 | $SPELL_PAGE->clear_spells; |
378 | |
387 | |
379 | return unless $CONN; |
388 | return unless $CONN; |
380 | |
389 | |
381 | status "connection closed"; |
390 | status "connection closed"; |
382 | |
391 | |
383 | destroy_query_dialog $CONN; |
392 | destroy_query_dialog $CONN; |
384 | $CONN->destroy; |
393 | $CONN->destroy; |
385 | $CONN = 0; # false, does not autovivify |
394 | $CONN = 0; # false, does not autovivify |
|
|
395 | |
|
|
396 | undef $MAP; |
386 | } |
397 | } |
387 | |
398 | |
388 | sub graphics_setup { |
399 | sub graphics_setup { |
389 | my $vbox = new CFClient::UI::VBox; |
400 | my $vbox = new CFClient::UI::VBox; |
390 | |
401 | |
… | |
… | |
465 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
476 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
466 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant.", |
477 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant.", |
467 | on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
478 | on_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
468 | ); |
479 | ); |
469 | |
480 | |
470 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); |
|
|
471 | |
|
|
472 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
473 | range => [$CFG->{stat_fontsize}, 0.5, 2, 0, 0.1], |
|
|
474 | tooltip => "The font size used by the <b>statistics window</b> only. Changes are instant.", |
|
|
475 | on_changed => sub { |
|
|
476 | $CFG->{stat_fontsize} = $_[1]; |
|
|
477 | &set_stats_window_fontsize; |
|
|
478 | 0 |
|
|
479 | } |
|
|
480 | ); |
|
|
481 | |
|
|
482 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
481 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
483 | $table->add (1, $row++, new CFClient::UI::Slider |
482 | $table->add (1, $row++, new CFClient::UI::Slider |
484 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
483 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
485 | tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.", |
484 | tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.", |
486 | on_changed => sub { |
485 | on_changed => sub { |
… | |
… | |
555 | ); |
554 | ); |
556 | |
555 | |
557 | $vbox |
556 | $vbox |
558 | } |
557 | } |
559 | |
558 | |
560 | sub set_stats_window_fontsize { |
|
|
561 | for (values %{$STATWIDS}) { |
|
|
562 | $_->set_fontsize ($::CFG->{stat_fontsize}); |
|
|
563 | } |
|
|
564 | } |
|
|
565 | |
|
|
566 | sub set_gauge_window_fontsize { |
559 | sub set_gauge_window_fontsize { |
567 | for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) { |
560 | for (map { $GAUGES->{$_} } grep { $_ ne 'win' } keys %{$GAUGES}) { |
568 | $_->set_fontsize ($::CFG->{gauge_fontsize}); |
561 | $_->set_fontsize ($::CFG->{gauge_fontsize}); |
569 | } |
562 | } |
570 | } |
563 | } |
… | |
… | |
649 | |
642 | |
650 | $table |
643 | $table |
651 | } |
644 | } |
652 | |
645 | |
653 | sub stats_window { |
646 | sub stats_window { |
654 | my $tgw = new CFClient::UI::FancyFrame |
647 | my $vb = new CFClient::UI::VBox; |
655 | y => $HEIGHT * (2/8), |
|
|
656 | x => "max", |
|
|
657 | title => "Stats", |
|
|
658 | name => "stats_window", |
|
|
659 | has_close_button => 1; |
|
|
660 | |
648 | |
661 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
|
|
662 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
649 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
663 | can_hover => 1, can_events => 1, |
650 | can_hover => 1, can_events => 1, |
664 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
651 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
665 | $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1, |
652 | $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1, |
666 | can_hover => 1, can_events => 1, |
653 | can_hover => 1, can_events => 1, |
… | |
… | |
690 | [0, 6, st_cha => "Cha", 30, "<b>Charisma</b>, how well you are received by NPCs. Affects buying and selling prices in shops."], |
677 | [0, 6, st_cha => "Cha", 30, "<b>Charisma</b>, how well you are received by NPCs. Affects buying and selling prices in shops."], |
691 | |
678 | |
692 | [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."], |
679 | [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."], |
693 | [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."], |
680 | [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."], |
694 | [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."], |
681 | [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."], |
695 | [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."], |
682 | [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."], |
696 | [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."], |
683 | [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."], |
697 | [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."], |
684 | [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."], |
698 | ) { |
685 | ) { |
699 | my ($col, $row, $id, $label, $template, $tooltip) = @$_; |
686 | my ($col, $row, $id, $label, $template, $tooltip) = @$_; |
700 | |
687 | |
… | |
… | |
702 | font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, align => +1, template => $template, tooltip => $tooltip); |
689 | font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, align => +1, template => $template, tooltip => $tooltip); |
703 | $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFClient::UI::Label |
690 | $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFClient::UI::Label |
704 | font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, valign => 0, align => -1, text => $label, tooltip => $tooltip); |
691 | font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, valign => 0, align => -1, text => $label, tooltip => $tooltip); |
705 | } |
692 | } |
706 | |
693 | |
707 | $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1); |
694 | $vb->add (my $tbl2 = new CFClient::UI::Table expand => 1); |
708 | |
695 | |
709 | my $row = 0; |
696 | my $row = 0; |
710 | my $col = 0; |
697 | my $col = 0; |
711 | |
698 | |
712 | my %resist_names = ( |
699 | my %resist_names = ( |
|
|
700 | slow => ["Slow", |
713 | slow => "<b>Slow</b> (slows you down when you are hit by the spell. Monsters will have an opportunity to come near you faster and hit you more often.)", |
701 | "<b>Slow</b> (slows you down when you are hit by the spell. Monsters will have an opportunity to come near you faster and hit you more often.)"], |
|
|
702 | holyw => ["Holy Word", |
714 | holyw => "<b>Holy Word</b> (resistance you against getting the fear when someone whose god doesn't like you spells the holy word on you.)", |
703 | "<b>Holy Word</b> (resistance you against getting the fear when someone whose god doesn't like you spells the holy word on you.)"], |
|
|
704 | conf => ["Confusion", |
715 | conf => "<b>Confusion</b> (If you are hit by confusion you will move into random directions, and likely into monsters.)", |
705 | "<b>Confusion</b> (If you are hit by confusion you will move into random directions, and likely into monsters.)"], |
|
|
706 | fire => ["Fire", |
716 | fire => "<b>Fire</b> (just your resistance to fire spells like burning hands, dragonbreath, meteor swarm fire, ...)", |
707 | "<b>Fire</b> (just your resistance to fire spells like burning hands, dragonbreath, meteor swarm fire, ...)"], |
|
|
708 | depl => ["Depletion", |
717 | depl => "<b>Depletion</b> (some monsters and other effects can cause stats depletion)", |
709 | "<b>Depletion</b> (some monsters and other effects can cause stats depletion)"], |
|
|
710 | magic => ["Magic", |
718 | magic => "<b>Magic</b> (resistance to magic spells like magic missile or similar)", |
711 | "<b>Magic</b> (resistance to magic spells like magic missile or similar)"], |
|
|
712 | drain => ["Draining", |
719 | drain => "<b>Draining</b> (some monsters (e.g. vampires) and other effects can steal experience)", |
713 | "<b>Draining</b> (some monsters (e.g. vampires) and other effects can steal experience)"], |
|
|
714 | acid => ["Acid", |
720 | acid => "<b>Acid</b> (resistance to acid, acid hurts pretty much and also corrodes your weapons)", |
715 | "<b>Acid</b> (resistance to acid, acid hurts pretty much and also corrodes your weapons)"], |
|
|
716 | pois => ["Poison", |
721 | pois => "<b>Poison</b> (resistance to getting poisoned)", |
717 | "<b>Poison</b> (resistance to getting poisoned)"], |
|
|
718 | para => ["Paralysation", |
722 | para => "<b>Paralysation</b> (this resistance affects the chance you get paralysed)", |
719 | "<b>Paralysation</b> (this resistance affects the chance you get paralysed)"], |
|
|
720 | deat => ["Death", |
723 | deat => "<b>Death</b> (resistance against death spells)", |
721 | "<b>Death</b> (resistance against death spells)"], |
724 | phys => "<b>Physical</b> (this is the resistance against physical attacks, like when a monster hit you in melee combat)", |
722 | phys => ["Physical", |
|
|
723 | "<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.)"], |
|
|
724 | blind => ["Blind", |
725 | blind => "<b>Blind</b> (blind resistance affects the chance of a successful blinding attack)", |
725 | "<b>Blind</b> (blind resistance affects the chance of a successful blinding attack)"], |
|
|
726 | fear => ["Fear", |
726 | 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)", |
727 | "<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 | tund => ["Turn undead", |
727 | tund => "<b>Turn undead</b> (affects your resistancy to various forms of 'turn undead' spells. Only relevant when you are, in fact, undead...", |
729 | "<b>Turn undead</b> (affects your resistancy to various forms of 'turn undead' spells. Only relevant when you are, in fact, undead..."], |
|
|
730 | elec => ["Electricity", |
728 | elec => "<b>Electricity</b> (resistance against electricity, spells like large lightning, small lightning, ...)", |
731 | "<b>Electricity</b> (resistance against electricity, spells like large lightning, small lightning, ...)"], |
|
|
732 | cold => ["Cold", |
729 | cold => "<b>Cold</b> (this is your resistance against cold spells like icestorm, snowstorm, ...)", |
733 | "<b>Cold</b> (this is your resistance against cold spells like icestorm, snowstorm, ...)"], |
|
|
734 | ghit => ["Ghost hit", |
730 | ghit => "<b>Ghost hit</b> (special attack used by ghosts and ghost-like beings)", |
735 | "<b>Ghost hit</b> (special attack used by ghosts and ghost-like beings)"], |
731 | ); |
736 | ); |
732 | for (qw/slow holyw conf fire depl magic |
737 | for (qw/slow holyw conf fire depl magic |
733 | drain acid pois para deat phys |
738 | drain acid pois para deat phys |
734 | blind fear tund elec cold ghit/) |
739 | blind fear tund elec cold ghit/) |
735 | { |
740 | { |
… | |
… | |
740 | template => "-100%", |
745 | template => "-100%", |
741 | align => +1, |
746 | align => +1, |
742 | valign => 0, |
747 | valign => 0, |
743 | can_events => 1, |
748 | can_events => 1, |
744 | can_hover => 1, |
749 | can_hover => 1, |
745 | tooltip => $resist_names{$_}, |
750 | tooltip => $resist_names{$_}->[1], |
746 | ); |
751 | ); |
747 | $tbl2->add ($col + 1, $row, new CFClient::UI::Image |
752 | $tbl2->add ($col + 1, $row, new CFClient::UI::Image |
748 | font => $FONT_FIXED, |
753 | font => $FONT_FIXED, |
749 | can_hover => 1, |
754 | can_hover => 1, |
750 | can_events => 1, |
755 | can_events => 1, |
751 | image => "ui/resist/resist_$_.png", |
756 | path => "ui/resist/resist_$_.png", |
752 | tooltip => $resist_names{$_}, |
757 | tooltip => $resist_names{$_}->[1], |
|
|
758 | ); |
|
|
759 | $tbl2->add ($col + 2, $row, new CFClient::UI::Label |
|
|
760 | text => $resist_names{$_}->[0], |
|
|
761 | font => $FONT_FIXED, |
|
|
762 | can_hover => 1, |
|
|
763 | can_events => 1, |
|
|
764 | tooltip => $resist_names{$_}->[1], |
753 | ); |
765 | ); |
754 | |
766 | |
755 | $row++; |
767 | $row++; |
756 | if ($row % 6 == 0) { |
768 | if ($row % 6 == 0) { |
757 | $col += 2; |
769 | $col += 3; |
758 | $row = 0; |
770 | $row = 0; |
759 | } |
771 | } |
760 | } |
772 | } |
761 | |
773 | |
762 | &set_stats_window_fontsize; |
|
|
763 | update_stats_window ({}); |
774 | update_stats_window ({}); |
764 | |
775 | |
765 | $tgw |
776 | $vb |
|
|
777 | } |
|
|
778 | |
|
|
779 | sub skill_window { |
|
|
780 | my ($self) = @_; |
|
|
781 | $STATWIDS->{"_skill_tbl"} = new CFClient::UI::Table expand => 1; |
766 | } |
782 | } |
767 | |
783 | |
768 | sub formsep($) { |
784 | sub formsep($) { |
769 | scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 |
785 | scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 |
770 | } |
786 | } |
… | |
… | |
804 | $STATWIDS->{st_pow} ->set_text (sprintf "%d" , $stats->{+CS_STAT_POW}); |
820 | $STATWIDS->{st_pow} ->set_text (sprintf "%d" , $stats->{+CS_STAT_POW}); |
805 | $STATWIDS->{st_cha} ->set_text (sprintf "%d" , $stats->{+CS_STAT_CHA}); |
821 | $STATWIDS->{st_cha} ->set_text (sprintf "%d" , $stats->{+CS_STAT_CHA}); |
806 | $STATWIDS->{st_wc} ->set_text (sprintf "%d" , $stats->{+CS_STAT_WC}); |
822 | $STATWIDS->{st_wc} ->set_text (sprintf "%d" , $stats->{+CS_STAT_WC}); |
807 | $STATWIDS->{st_ac} ->set_text (sprintf "%d" , $stats->{+CS_STAT_AC}); |
823 | $STATWIDS->{st_ac} ->set_text (sprintf "%d" , $stats->{+CS_STAT_AC}); |
808 | $STATWIDS->{st_dam} ->set_text (sprintf "%d" , $stats->{+CS_STAT_DAM}); |
824 | $STATWIDS->{st_dam} ->set_text (sprintf "%d" , $stats->{+CS_STAT_DAM}); |
809 | $STATWIDS->{st_arm} ->set_text (sprintf "%d" , $stats->{+CS_STAT_ARMOUR}); |
825 | $STATWIDS->{st_arm} ->set_text (sprintf "%d" , $stats->{+CS_STAT_RES_PHYS}); |
810 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
826 | $STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); |
811 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); |
827 | $STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); |
812 | |
828 | |
813 | $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); |
829 | $STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); |
814 | |
830 | |
… | |
… | |
831 | deat => CS_STAT_RES_DEATH, |
847 | deat => CS_STAT_RES_DEATH, |
832 | holyw => CS_STAT_RES_HOLYWORD, |
848 | holyw => CS_STAT_RES_HOLYWORD, |
833 | blind => CS_STAT_RES_BLIND, |
849 | blind => CS_STAT_RES_BLIND, |
834 | ); |
850 | ); |
835 | |
851 | |
|
|
852 | if ($::CONN && !$STATWIDS->{_skill_tbl_init}) { |
|
|
853 | my $sktbl = $STATWIDS->{_skill_tbl}; |
|
|
854 | $sktbl->clear; |
|
|
855 | |
|
|
856 | $sktbl->add (0, 0, new CFClient::UI::Label text => "Exp.", align => 1); |
|
|
857 | $sktbl->add (1, 0, new CFClient::UI::Label text => "Level", align => 1); |
|
|
858 | $sktbl->add (2, 0, new CFClient::UI::Label text => "Skillname"); |
|
|
859 | |
|
|
860 | my @skills; |
|
|
861 | |
|
|
862 | for (my $i = CS_STAT_SKILLINFO; $i < CS_STAT_SKILLINFO+CS_NUM_SKILLS; $i++) { |
|
|
863 | push @skills, [$i, $::CONN->{skill_info}{$i}]; |
|
|
864 | } |
|
|
865 | |
|
|
866 | my $y = 1; |
|
|
867 | for (sort { $a->[1] cmp $b->[1] } @skills) { |
|
|
868 | my ($idx, $name) = @$_; |
|
|
869 | |
|
|
870 | unless (defined $STATWIDS->{"sk_xp_$idx"} || !$::CONN->{skill_info}{$idx}) { |
|
|
871 | $sktbl->add (0, $y, $STATWIDS->{"sk_xp_$idx"} = new CFClient::UI::Label text => "0", align => 1); |
|
|
872 | $sktbl->add (1, $y, $STATWIDS->{"sk_lvl_$idx"} = new CFClient::UI::Label text => "0", align => 1); |
|
|
873 | $sktbl->add (2, $y++, new CFClient::UI::Label text => $name); |
|
|
874 | } |
|
|
875 | } |
|
|
876 | |
|
|
877 | $STATWIDS->{_skill_tbl_init} = 1; |
|
|
878 | } |
|
|
879 | |
|
|
880 | for (my $i = CS_STAT_SKILLINFO; $i < CS_STAT_SKILLINFO+CS_NUM_SKILLS; $i++) { |
|
|
881 | if (exists $stats->{$i}) { |
|
|
882 | $STATWIDS->{"sk_xp_$i"}->set_text (formsep $stats->{$i}->[1]) |
|
|
883 | if $STATWIDS->{"sk_xp_$i"}; |
|
|
884 | $STATWIDS->{"sk_lvl_$i"}->set_text (sprintf "%d", $stats->{$i}->[0]) |
|
|
885 | if $STATWIDS->{"sk_lvl_$i"}; |
|
|
886 | } |
|
|
887 | } |
|
|
888 | |
836 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
889 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
837 | for keys %tbl; |
890 | for keys %tbl; |
838 | } |
891 | } |
839 | |
892 | |
840 | my $METASERVER_ATIME; |
893 | my $METASERVER_ATIME; |
841 | |
894 | |
842 | sub update_metaserver { |
895 | sub update_metaserver { |
|
|
896 | my ($metaserver_dialog) = @_; |
|
|
897 | |
|
|
898 | $METASERVER = $metaserver_dialog |
|
|
899 | if defined $metaserver_dialog; |
|
|
900 | |
843 | return if $METASERVER_ATIME > time; |
901 | return if $METASERVER_ATIME > time; |
844 | $METASERVER_ATIME = time + 60; |
902 | $METASERVER_ATIME = time + 60; |
845 | |
903 | |
846 | my $table = $METASERVER->{table}; |
904 | my $table = $METASERVER->{table}; |
847 | $table->clear; |
905 | $table->clear; |
… | |
… | |
935 | } |
993 | } |
936 | }); |
994 | }); |
937 | } |
995 | } |
938 | |
996 | |
939 | sub metaserver_dialog { |
997 | sub metaserver_dialog { |
|
|
998 | my $vbox = new CFClient::UI::VBox; |
|
|
999 | my $table = new CFClient::UI::Table; |
|
|
1000 | $vbox->add (new CFClient::UI::ScrolledWindow expand => 1, child => $table); |
|
|
1001 | |
940 | my $dialog = new CFClient::UI::FancyFrame |
1002 | my $dialog = new CFClient::UI::FancyFrame |
941 | title => "Server List", |
1003 | title => "Server List", |
942 | name => 'metaserver_dialog', |
1004 | name => 'metaserver_dialog', |
943 | x => 'center', |
1005 | x => 'center', |
944 | y => 'center', |
1006 | y => 'center', |
945 | z => 3, |
1007 | z => 3, |
946 | force_h => $::HEIGHT * 0.4, |
1008 | force_h => $::HEIGHT * 0.4, |
947 | child => (my $vbox = new CFClient::UI::VBox), |
1009 | child => $vbox, |
|
|
1010 | has_close_button => 1, |
|
|
1011 | table => $table, |
948 | on_visibility_change => sub { |
1012 | on_visibility_change => sub { |
949 | update_metaserver if $_[1]; |
1013 | update_metaserver ($_[0]) if $_[1]; |
950 | 0 |
1014 | 0 |
951 | }, |
1015 | }, |
952 | ; |
1016 | ; |
953 | |
|
|
954 | $dialog->{table} = new CFClient::UI::Table; |
|
|
955 | |
|
|
956 | $vbox->add (new CFClient::UI::ScrolledWindow expand => 1, child => $dialog->{table}); |
|
|
957 | |
1017 | |
958 | $dialog |
1018 | $dialog |
959 | } |
1019 | } |
960 | |
1020 | |
961 | sub server_setup { |
1021 | sub server_setup { |
… | |
… | |
976 | my ($self, $value) = @_; |
1036 | my ($self, $value) = @_; |
977 | $CFG->{profile}{default}{host} = $value; |
1037 | $CFG->{profile}{default}{host} = $value; |
978 | 0 |
1038 | 0 |
979 | } |
1039 | } |
980 | ); |
1040 | ); |
981 | |
|
|
982 | $METASERVER = metaserver_dialog; |
|
|
983 | |
1041 | |
984 | $vbox->add (new CFClient::UI::Button |
1042 | $vbox->add (new CFClient::UI::Button |
985 | expand => 1, |
1043 | expand => 1, |
986 | text => "Server List", |
1044 | text => "Server List", |
987 | other => $METASERVER, |
1045 | other => $METASERVER, |
… | |
… | |
1179 | sub autopickup_setup { |
1237 | sub autopickup_setup { |
1180 | my $table = new CFClient::UI::Table; |
1238 | my $table = new CFClient::UI::Table; |
1181 | |
1239 | |
1182 | for ( |
1240 | for ( |
1183 | ["General", 0, 0, |
1241 | ["General", 0, 0, |
1184 | ["Enable autopickup" => PICKUP_NEWMODE], |
1242 | ["Enable autopickup" => PICKUP_NEWMODE, \$PICKUP_ENABLE], |
1185 | ["Inhibit autopickup" => PICKUP_INHIBIT], |
1243 | ["Inhibit autopickup" => PICKUP_INHIBIT], |
1186 | ["Stop before pickup" => PICKUP_STOP], |
1244 | ["Stop before pickup" => PICKUP_STOP], |
1187 | ["Debug autopickup" => PICKUP_DEBUG], |
1245 | ["Debug autopickup" => PICKUP_DEBUG], |
1188 | ], |
1246 | ], |
1189 | ["Weapons", 0, 6, |
1247 | ["Weapons", 0, 6, |
… | |
… | |
1226 | for (@bits) { |
1284 | for (@bits) { |
1227 | ++$y; |
1285 | ++$y; |
1228 | |
1286 | |
1229 | my $mask = $_->[1]; |
1287 | my $mask = $_->[1]; |
1230 | $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); |
1288 | $table->add ($x , $y, new CFClient::UI::Label text => $_->[0], align => 1, expand => 1); |
1231 | $table->add ($x+1, $y, new CFClient::UI::CheckBox |
1289 | $table->add ($x+1, $y, my $checkbox = new CFClient::UI::CheckBox |
1232 | state => $CFG->{pickup} & $mask, |
1290 | state => $::CFG->{pickup} & $mask, |
1233 | on_changed => sub { |
1291 | on_changed => sub { |
1234 | my ($box, $value) = @_; |
1292 | my ($box, $value) = @_; |
1235 | |
1293 | |
1236 | if ($value) { |
1294 | if ($value) { |
1237 | $::CFG->{pickup} |= $mask; |
1295 | $::CFG->{pickup} |= $mask; |
… | |
… | |
1242 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1300 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1243 | if defined $::CONN; |
1301 | if defined $::CONN; |
1244 | |
1302 | |
1245 | 0 |
1303 | 0 |
1246 | }); |
1304 | }); |
|
|
1305 | |
|
|
1306 | ${$_->[2]} = $checkbox if $_->[2]; |
1247 | } |
1307 | } |
1248 | } |
1308 | } |
1249 | |
1309 | |
1250 | $table->add (2, 18, new CFClient::UI::ValSlider |
1310 | $table->add (2, 18, new CFClient::UI::ValSlider |
1251 | range => [0, 0, 16, 1, 1], |
1311 | range => [$::CFG->{pickup} & 0xF, 0, 16, 1, 1], |
|
|
1312 | template => ">= 99", |
1252 | to_value => sub { ">= " . 5 * $_[0] }, |
1313 | to_value => sub { ">= " . 5 * $_[0] }, |
1253 | on_changed => sub { |
1314 | on_changed => sub { |
1254 | my ($slider, $value) = @_; |
1315 | my ($slider, $value) = @_; |
1255 | |
1316 | |
1256 | $::CFG->{pickup} &= ~0x7; |
1317 | $::CFG->{pickup} &= ~0xF; |
1257 | $::CFG->{pickup} |= int $value |
1318 | $::CFG->{pickup} |= int $value |
1258 | if $value; |
1319 | if $value; |
1259 | 1; |
1320 | 1; |
1260 | }); |
1321 | }); |
|
|
1322 | |
1261 | $table->add (3, 18, new CFClient::UI::Button |
1323 | $table->add (3, 18, new CFClient::UI::Button |
1262 | text => "set", |
1324 | text => "set", |
1263 | on_activate => sub { |
1325 | on_activate => sub { |
1264 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1326 | $::CONN->send_command ("pickup $::CFG->{pickup}") |
1265 | if defined $::CONN; |
1327 | if defined $::CONN; |
… | |
… | |
1267 | }); |
1329 | }); |
1268 | |
1330 | |
1269 | $table |
1331 | $table |
1270 | } |
1332 | } |
1271 | |
1333 | |
1272 | sub inventory_window { |
1334 | sub inventory_widget { |
|
|
1335 | my $hb = new CFClient::UI::HBox homogeneous => 1; |
|
|
1336 | |
|
|
1337 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
|
|
1338 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
|
|
1339 | $vb1->add ($INV = new CFClient::UI::Inventory); |
|
|
1340 | |
|
|
1341 | $hb->add (my $vb2 = new CFClient::UI::VBox); |
|
|
1342 | |
|
|
1343 | $vb2->add ($INV_RIGHT_HB = new CFClient::UI::HBox); |
|
|
1344 | |
|
|
1345 | $vb2->add ($INVR = new CFClient::UI::Inventory); |
|
|
1346 | |
|
|
1347 | # XXX: Call after $INVR = ... because set_opencont sets the items |
|
|
1348 | CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); |
|
|
1349 | |
|
|
1350 | $hb |
|
|
1351 | } |
|
|
1352 | |
|
|
1353 | sub toggle_player_page { |
|
|
1354 | my ($widget) = @_; |
|
|
1355 | |
|
|
1356 | if ($PL_WINDOW->{visible} && $PL_NOTEBOOK->get_current_page == $widget) { |
|
|
1357 | $PL_WINDOW->hide; |
|
|
1358 | } else { |
|
|
1359 | $PL_NOTEBOOK->set_current_page ($widget); |
|
|
1360 | $PL_WINDOW->show; |
|
|
1361 | } |
|
|
1362 | } |
|
|
1363 | |
|
|
1364 | sub player_window { |
1273 | my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame |
1365 | my $plwin = $PL_WINDOW = new CFClient::UI::FancyFrame |
1274 | x => "center", |
1366 | x => "center", |
1275 | y => "center", |
1367 | y => "center", |
1276 | force_w => $WIDTH * 9/10, |
1368 | force_w => $WIDTH * 9/10, |
1277 | force_h => $HEIGHT * 9/10, |
1369 | force_h => $HEIGHT * 9/10, |
1278 | title => "Inventory", |
1370 | title => "Player", |
|
|
1371 | name => "playerbook", |
1279 | has_close_button => 1, |
1372 | has_close_button => 1 |
1280 | ; |
1373 | ; |
1281 | |
1374 | |
1282 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
1375 | my $ntb = |
|
|
1376 | $PL_NOTEBOOK = |
|
|
1377 | new CFClient::UI::Notebook |
|
|
1378 | expand => 1, |
|
|
1379 | debug => 1, |
|
|
1380 | filter => (new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1), |
|
|
1381 | ; |
1283 | |
1382 | |
1284 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
1383 | $ntb->add ( |
1285 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
1384 | "Stats" => $STATS_PAGE = stats_window, |
1286 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
1385 | "Shows statistics, where all your Stats and Resistances are shown." |
|
|
1386 | ); |
|
|
1387 | $ntb->add ( |
|
|
1388 | "Skills" => $STATS_PAGE = skill_window, |
|
|
1389 | "Shows all your Skills." |
|
|
1390 | ); |
|
|
1391 | $ntb->add ( |
|
|
1392 | Spellbook => $SPELL_PAGE = new CFClient::UI::SpellList, |
|
|
1393 | "Displays all spells you have and lets you edit keyboard shortcuts for them." |
|
|
1394 | ); |
|
|
1395 | $ntb->add ( |
|
|
1396 | Inventory => $INVENTORY_PAGE = inventory_widget, |
|
|
1397 | "Toggles the inventory window, where you can manage your loot (or treasures :). " |
|
|
1398 | . "You can also hit the <b>Tab</b>-key to show/hide the Inventory." |
|
|
1399 | ); |
1287 | |
1400 | |
1288 | $hb->add (my $vb2 = new CFClient::UI::VBox); |
1401 | $ntb->set_current_page ($INVENTORY_PAGE); |
1289 | |
1402 | |
1290 | $vb2->add ($INV_RIGHT_HB = new CFClient::UI::HBox); |
1403 | $plwin->add ($ntb); |
1291 | |
1404 | $plwin |
1292 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
|
|
1293 | |
|
|
1294 | # XXX: Call after $INVR = ... because set_opencont sets the items |
|
|
1295 | CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); |
|
|
1296 | |
|
|
1297 | $invwin |
|
|
1298 | } |
1405 | } |
1299 | |
1406 | |
1300 | sub spell_setup { |
1407 | sub update_bindings { |
1301 | new CFClient::UI::SpellList |
1408 | $BIND_UPD_CB->() if $BIND_UPD_CB; |
1302 | } |
1409 | } |
1303 | |
1410 | |
1304 | sub keyboard_setup { |
1411 | sub keyboard_setup { |
1305 | my $binding_list = new CFClient::UI::VBox; |
1412 | my $binding_list = new CFClient::UI::VBox; |
1306 | |
1413 | |
1307 | my $refresh; |
1414 | my $refresh; |
1308 | $refresh = sub { |
1415 | $refresh = $BIND_UPD_CB = sub { |
1309 | $binding_list->clear (); |
1416 | $binding_list->clear (); |
1310 | |
1417 | |
1311 | for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { |
1418 | for my $mod (keys %{$::CFG->{profile}{default}{bindings}}) { |
1312 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1419 | for my $sym (keys %{$::CFG->{profile}{default}{bindings}{$mod}}) { |
1313 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1420 | my $cmds = $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1314 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
1421 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
1315 | |
1422 | |
1316 | my $lbl = join "; ", @$cmds; |
1423 | my $lbl = join "; ", @$cmds; |
1317 | my $nam = CFClient::Binder::keycombo_to_name ($mod, $sym); |
1424 | my $nam = CFClient::BindingEditor::keycombo_to_name ($mod, $sym); |
1318 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
1425 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
1319 | $hb->add (new CFClient::UI::Button |
1426 | $hb->add (new CFClient::UI::Button |
1320 | text => "delete", |
1427 | text => "delete", |
1321 | tooltip => "Deletes the binding", |
1428 | tooltip => "Deletes the binding", |
1322 | on_activate => sub { |
1429 | on_activate => sub { |
… | |
… | |
1331 | on_activate => sub { |
1438 | on_activate => sub { |
1332 | $::BIND_EDITOR->set_binding ( |
1439 | $::BIND_EDITOR->set_binding ( |
1333 | $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, |
1440 | $mod, $sym, $::CFG->{profile}{default}{bindings}{$mod}{$sym}, |
1334 | sub { |
1441 | sub { |
1335 | my ($nmod, $nsym, $ncmds) = @_; |
1442 | my ($nmod, $nsym, $ncmds) = @_; |
1336 | delete $::CFG->{profile}{default}{bindings}{$mod}{$sym}; |
1443 | $::BIND_EDITOR->cfg_unbind ($mod, $sym); |
1337 | $::CFG->{profile}{default}{bindings}{$nmod}{$nsym} = $ncmds; |
1444 | $::BIND_EDITOR->cfg_bind ($nmod, $nsym, $ncmds); |
1338 | $refresh->(); |
1445 | $refresh->(); |
1339 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1446 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1340 | $SETUP_DIALOG->show; |
1447 | $SETUP_DIALOG->show; |
1341 | }, |
1448 | }, |
1342 | sub { |
1449 | sub { |
… | |
… | |
1376 | tooltip => "This button opens the binding editor with an empty binding.", |
1483 | tooltip => "This button opens the binding editor with an empty binding.", |
1377 | on_activate => sub { |
1484 | on_activate => sub { |
1378 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1485 | $::BIND_EDITOR->set_binding (undef, undef, [], |
1379 | sub { |
1486 | sub { |
1380 | my ($mod, $sym, $cmds) = @_; |
1487 | my ($mod, $sym, $cmds) = @_; |
1381 | $::CFG->{profile}{default}{bindings}{$mod}{$sym} = $cmds; |
1488 | $::BIND_EDITOR->cfg_bind ($mod, $sym, $cmds); |
1382 | $refresh->(); |
1489 | $refresh->(); |
1383 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1490 | $SETUP_NOTEBOOK->set_current_page ($SETUP_KEYBOARD); |
1384 | $SETUP_DIALOG->show; |
1491 | $SETUP_DIALOG->show; |
1385 | }, |
1492 | }, |
1386 | sub { |
1493 | sub { |
… | |
… | |
1415 | y => 'center', |
1522 | y => 'center', |
1416 | z => 2, |
1523 | z => 2, |
1417 | name => 'doc_browser', |
1524 | name => 'doc_browser', |
1418 | force_w => int $WIDTH * 7/8, |
1525 | force_w => int $WIDTH * 7/8, |
1419 | force_h => int $HEIGHT * 7/8, |
1526 | force_h => int $HEIGHT * 7/8, |
1420 | title => "Documentation"; |
1527 | title => "Help Browser", |
|
|
1528 | has_close_button => 1; |
1421 | |
1529 | |
1422 | $win->add (my $vbox = new CFClient::UI::VBox); |
1530 | $win->add (my $vbox = new CFClient::UI::VBox); |
1423 | |
1531 | |
1424 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1532 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1425 | $vbox->add (my $viewer = new CFClient::UI::TextScroller |
1533 | $vbox->add (my $viewer = new CFClient::UI::TextScroller |
… | |
… | |
1428 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
1536 | $buttons->add (new CFClient::UI::Label text => "Choose a document to display: "); |
1429 | $buttons->add (my $combo = new CFClient::UI::Combobox |
1537 | $buttons->add (my $combo = new CFClient::UI::Combobox |
1430 | value => undef, |
1538 | value => undef, |
1431 | options => [ |
1539 | options => [ |
1432 | [intro => "Introduction"], |
1540 | [intro => "Introduction"], |
1433 | [manual => "Manual"], |
1541 | [manual => "Main Manual"], |
1434 | [skill_help => "Skills"], |
1542 | [skill_help => "Skill Reference"], |
1435 | [command_help => "Commands"], |
1543 | [command_help => "Command Reference"], |
1436 | [dmcommand_help => "DM Commands"], |
1544 | [dmcommand_help => "DM Commands"], |
1437 | [COPYING => "License Terms"], |
1545 | [COPYING => "License Terms"], |
1438 | ], |
1546 | ], |
1439 | on_changed => sub { |
1547 | on_changed => sub { |
1440 | my ($self, $pod) = @_; |
1548 | my ($self, $pod) = @_; |
1441 | |
1549 | |
1442 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1550 | my $pom = CFClient::load_pod CFClient::find_rcfile "pod/$pod.pod", |
1443 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1551 | doc_viewer => 1, sub { CFClient::pod_to_pango_list $_[0] }; |
1444 | |
1552 | |
1445 | $viewer->clear; |
1553 | $viewer->clear; |
|
|
1554 | |
|
|
1555 | # $viewer->add_paragraph ([1, 1, 1, 1], ["<big>Test</big>\n\n \x{fffc} \x{fffc}\n", |
|
|
1556 | # (new CFClient::UI::Image path => "x.png", can_hover => 1, can_events => 1), |
|
|
1557 | # (new CFClient::UI::Label text => "üüüü", can_hover => 1, can_events => 1, tooltip => "??"), |
|
|
1558 | # ]);#d# |
1446 | |
1559 | |
1447 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1560 | $viewer->add_paragraph ([1, 1, 1, 1], $_->[1], $_->[0]) |
1448 | for @$pom; |
1561 | for @$pom; |
1449 | |
1562 | |
1450 | $viewer->set_offset (0); |
1563 | $viewer->set_offset (0); |
|
|
1564 | |
1451 | 0 |
1565 | 0 |
1452 | }, |
1566 | }, |
1453 | on_visibility_change => sub { |
1567 | on_visibility_change => sub { |
1454 | my ($self, $visible) = @_; |
1568 | my ($self, $visible) = @_; |
1455 | return unless $visible; |
1569 | return unless $visible; |
… | |
… | |
1502 | z => 100, |
1616 | z => 100, |
1503 | force_x => "max", |
1617 | force_x => "max", |
1504 | force_y => 0; |
1618 | force_y => 0; |
1505 | $DEBUG_STATUS->show; |
1619 | $DEBUG_STATUS->show; |
1506 | |
1620 | |
1507 | $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); |
1621 | $BIND_EDITOR = new CFClient::BindingEditor (x => "max", y => 0); |
1508 | |
1622 | |
1509 | $STATUSBOX = new CFClient::UI::Statusbox; |
1623 | $STATUSBOX = new CFClient::UI::Statusbox; |
1510 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); |
1624 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); |
1511 | |
1625 | |
1512 | (new CFClient::UI::Frame |
1626 | (new CFClient::UI::Frame |
… | |
… | |
1562 | z => 2, |
1676 | z => 2, |
1563 | force_w => $::WIDTH * 0.6, |
1677 | force_w => $::WIDTH * 0.6, |
1564 | force_h => $::HEIGHT * 0.6, |
1678 | force_h => $::HEIGHT * 0.6, |
1565 | has_close_button => 1, |
1679 | has_close_button => 1, |
1566 | ; |
1680 | ; |
|
|
1681 | |
|
|
1682 | $METASERVER = metaserver_dialog; |
1567 | |
1683 | |
1568 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, |
1684 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new CFClient::UI::Notebook expand => 1, debug => 1, |
1569 | filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1685 | filter => new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1570 | |
1686 | |
1571 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
1687 | $SETUP_NOTEBOOK->add (Server => $SETUP_SERVER = server_setup, |
… | |
… | |
1581 | . "There is a shortcut for making bindings: <b>Control-Insert</b> opens the binding editor " |
1697 | . "There is a shortcut for making bindings: <b>Control-Insert</b> opens the binding editor " |
1582 | . "with nothing set and the recording started. After doing the actions you " |
1698 | . "with nothing set and the recording started. After doing the actions you " |
1583 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1699 | . "want to record press <b>Insert</b> and you will be asked to press a key-combo. " |
1584 | . "After pressing the combo the binding will be saved automatically and the " |
1700 | . "After pressing the combo the binding will be saved automatically and the " |
1585 | . "binding editor closes"); |
1701 | . "binding editor closes"); |
1586 | $SETUP_NOTEBOOK->add (Spells => $SETUP_SPELLS = spell_setup, |
|
|
1587 | "Displays all spells you have and lets you edit keyboard shortcuts for them."); |
|
|
1588 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
1702 | $SETUP_NOTEBOOK->add (Debug => debug_setup, |
1589 | "Some debuggin' options. Do not ask."); |
1703 | "Some debuggin' options. Do not ask."); |
1590 | |
1704 | |
1591 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1705 | $BUTTONBAR = new CFClient::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
1592 | |
1706 | |
… | |
… | |
1596 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW = message_window, |
1710 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW = message_window, |
1597 | tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
1711 | tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
1598 | |
1712 | |
1599 | 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 |
1713 | 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 |
1600 | |
1714 | |
1601 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => $STATS_WINDOW = stats_window, |
|
|
1602 | tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); |
|
|
1603 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => inventory_window, |
1715 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Playerbook", other => player_window, |
1604 | tooltip => "Toggles the inventory window, where you can manage your loot (or treasures :). " |
1716 | tooltip => "Toggles the player view, where you can manage Inventory, Spells, Skills and see your Stats."); |
1605 | . "You can also hit the <b>Tab</b>-key to show/hide the Inventory."); |
|
|
1606 | |
1717 | |
1607 | $BUTTONBAR->add (new CFClient::UI::Button |
1718 | $BUTTONBAR->add (new CFClient::UI::Button |
1608 | text => "Save Config", |
1719 | text => "Save Config", |
1609 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1720 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1610 | on_activate => sub { |
1721 | on_activate => sub { |
… | |
… | |
1613 | status "Configuration Saved"; |
1724 | status "Configuration Saved"; |
1614 | 0 |
1725 | 0 |
1615 | }, |
1726 | }, |
1616 | ); |
1727 | ); |
1617 | |
1728 | |
1618 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => help_window, |
1729 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window, |
1619 | tooltip => "View Documentation"); |
1730 | tooltip => "View Documentation"); |
1620 | |
1731 | |
1621 | $BUTTONBAR->add (new CFClient::UI::Button |
1732 | $BUTTONBAR->add (new CFClient::UI::Button |
1622 | text => "Quit", |
1733 | text => "Quit", |
1623 | tooltip => "Terminates the program", |
1734 | tooltip => "Terminates the program", |