… | |
… | |
40 | use CFClient::UI; |
40 | use CFClient::UI; |
41 | use CFClient::BindingEditor; |
41 | use CFClient::BindingEditor; |
42 | use CFClient::MapWidget; |
42 | use CFClient::MapWidget; |
43 | |
43 | |
44 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
44 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
|
|
45 | $SIG{PIPE} = 'IGNORE'; |
45 | |
46 | |
46 | $Event::DIED = sub { |
47 | $Event::DIED = sub { |
47 | # TODO: display dialog box or so |
48 | # TODO: display dialog box or so |
48 | Carp::confess $_[1];#d#TODO: remove when stable |
49 | Carp::confess $_[1];#d#TODO: remove when stable |
49 | CFClient::error $_[1]; |
50 | CFClient::error $_[1]; |
… | |
… | |
688 | 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); |
689 | $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 |
690 | 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); |
691 | } |
692 | } |
692 | |
693 | |
693 | $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1); |
694 | $vb->add (my $tbl2 = new CFClient::UI::Table expand => 1); |
694 | |
695 | |
695 | my $row = 0; |
696 | my $row = 0; |
696 | my $col = 0; |
697 | my $col = 0; |
697 | |
698 | |
698 | my %resist_names = ( |
699 | my %resist_names = ( |
|
|
700 | slow => ["Slow", |
699 | 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", |
700 | 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", |
701 | 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", |
702 | 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", |
703 | 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", |
704 | 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", |
705 | 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", |
706 | 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", |
707 | pois => "<b>Poison</b> (resistance to getting poisoned)", |
717 | "<b>Poison</b> (resistance to getting poisoned)"], |
|
|
718 | para => ["Paralysation", |
708 | 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", |
709 | deat => "<b>Death</b> (resistance against death spells)", |
721 | "<b>Death</b> (resistance against death spells)"], |
|
|
722 | phys => ["Physical", |
710 | 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.)", |
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", |
711 | 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", |
712 | 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", |
713 | 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", |
714 | 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", |
715 | 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", |
716 | 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)"], |
717 | ); |
736 | ); |
718 | for (qw/slow holyw conf fire depl magic |
737 | for (qw/slow holyw conf fire depl magic |
719 | drain acid pois para deat phys |
738 | drain acid pois para deat phys |
720 | blind fear tund elec cold ghit/) |
739 | blind fear tund elec cold ghit/) |
721 | { |
740 | { |
… | |
… | |
726 | template => "-100%", |
745 | template => "-100%", |
727 | align => +1, |
746 | align => +1, |
728 | valign => 0, |
747 | valign => 0, |
729 | can_events => 1, |
748 | can_events => 1, |
730 | can_hover => 1, |
749 | can_hover => 1, |
731 | tooltip => $resist_names{$_}, |
750 | tooltip => $resist_names{$_}->[1], |
732 | ); |
751 | ); |
733 | $tbl2->add ($col + 1, $row, new CFClient::UI::Image |
752 | $tbl2->add ($col + 1, $row, new CFClient::UI::Image |
734 | font => $FONT_FIXED, |
753 | font => $FONT_FIXED, |
735 | can_hover => 1, |
754 | can_hover => 1, |
736 | can_events => 1, |
755 | can_events => 1, |
737 | path => "ui/resist/resist_$_.png", |
756 | path => "ui/resist/resist_$_.png", |
738 | 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], |
739 | ); |
765 | ); |
740 | |
766 | |
741 | $row++; |
767 | $row++; |
742 | if ($row % 6 == 0) { |
768 | if ($row % 6 == 0) { |
743 | $col += 2; |
769 | $col += 3; |
744 | $row = 0; |
770 | $row = 0; |
745 | } |
771 | } |
746 | } |
772 | } |
747 | |
773 | |
748 | $vb->add (my $tbl3 = new CFClient::UI::Table expand => 1); |
|
|
749 | $STATWIDS->{"_skill_tbl"} = $tbl3; |
|
|
750 | |
|
|
751 | update_stats_window ({}); |
774 | update_stats_window ({}); |
752 | |
775 | |
753 | $vb |
776 | $vb |
|
|
777 | } |
|
|
778 | |
|
|
779 | sub skill_window { |
|
|
780 | my ($self) = @_; |
|
|
781 | $STATWIDS->{"_skill_tbl"} = new CFClient::UI::Table expand => 1; |
754 | } |
782 | } |
755 | |
783 | |
756 | sub formsep($) { |
784 | sub formsep($) { |
757 | scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 |
785 | scalar reverse join ",", unpack "(A3)*", reverse $_[0] * 1 |
758 | } |
786 | } |
… | |
… | |
1113 | sub message_window { |
1141 | sub message_window { |
1114 | my $window = new CFClient::UI::FancyFrame |
1142 | my $window = new CFClient::UI::FancyFrame |
1115 | name => "message_window", |
1143 | name => "message_window", |
1116 | title => "Messages", |
1144 | title => "Messages", |
1117 | border_bg => [1, 1, 1, 1], |
1145 | border_bg => [1, 1, 1, 1], |
1118 | bg => [0, 0, 0, 0.75], |
|
|
1119 | x => "max", |
1146 | x => "max", |
1120 | y => 0, |
1147 | y => 0, |
1121 | force_w => $::WIDTH * 0.4, |
1148 | force_w => $::WIDTH * 0.4, |
1122 | force_h => $::HEIGHT * 0.5, |
1149 | force_h => $::HEIGHT * 0.5, |
1123 | child => (my $vbox = new CFClient::UI::VBox), |
1150 | child => (my $vbox = new CFClient::UI::VBox), |
… | |
… | |
1351 | debug => 1, |
1378 | debug => 1, |
1352 | filter => (new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1), |
1379 | filter => (new CFClient::UI::ScrolledWindow expand => 1, scroll_y => 1), |
1353 | ; |
1380 | ; |
1354 | |
1381 | |
1355 | $ntb->add ( |
1382 | $ntb->add ( |
1356 | "Stats & Skills" => $STATS_PAGE = stats_window, |
1383 | "Stats" => $STATS_PAGE = stats_window, |
1357 | "Shows statistics and skill window, where all your Stats, Resistances and Skills are shown." |
1384 | "Shows statistics, where all your Stats and Resistances are shown." |
|
|
1385 | ); |
|
|
1386 | $ntb->add ( |
|
|
1387 | "Skills" => $STATS_PAGE = skill_window, |
|
|
1388 | "Shows all your Skills." |
1358 | ); |
1389 | ); |
1359 | $ntb->add ( |
1390 | $ntb->add ( |
1360 | Spellbook => $SPELL_PAGE = new CFClient::UI::SpellList, |
1391 | Spellbook => $SPELL_PAGE = new CFClient::UI::SpellList, |
1361 | "Displays all spells you have and lets you edit keyboard shortcuts for them." |
1392 | "Displays all spells you have and lets you edit keyboard shortcuts for them." |
1362 | ); |
1393 | ); |