… | |
… | |
400 | (my $hb = new CFClient::UI::HBox), |
400 | (my $hb = new CFClient::UI::HBox), |
401 | ], |
401 | ], |
402 | ); |
402 | ); |
403 | |
403 | |
404 | $hb->add (my $hg = new CFClient::UI::Gauge type => 'hp', |
404 | $hb->add (my $hg = new CFClient::UI::Gauge type => 'hp', |
405 | tooltip => "Health points. Measures of how much damage you can take before dying. Hit points are determined from your level and are influenced by the value of your Con. Hp value may range between 1 to beyond 500 and higher values indicate a greater ability to withstand punishment."); |
405 | tooltip => "<b>Health points</b>. Measures of how much damage you can take before dying. Hit points are determined from your level and are influenced by the value of your Con. Hp value may range between 1 to beyond 500 and higher values indicate a greater ability to withstand punishment."); |
406 | $hb->add (my $mg = new CFClient::UI::Gauge type => 'mana', |
406 | $hb->add (my $mg = new CFClient::UI::Gauge type => 'mana', |
407 | tooltip => "Spell points. Measures of how much \"fuel\" you have for casting spells and incantations. Mana is calculated from your level and your Pow. Mana values can range between 1 to beyond 500 (glowing crystals can increase the current spell points beyond your normal maximum). Higher values indicate greater amounts of mana."); |
407 | tooltip => "<b>Spell points</b>. Measures of how much \"fuel\" you have for casting spells and incantations. Mana is calculated from your level and your Pow. Mana values can range between 1 to beyond 500 (glowing crystals can increase the current spell points beyond your normal maximum). Higher values indicate greater amounts of mana."); |
408 | $hb->add (my $gg = new CFClient::UI::Gauge type => 'grace', |
408 | $hb->add (my $gg = new CFClient::UI::Gauge type => 'grace', |
409 | tooltip => "Grace points - how favored you are by your god. In game terms, how much divine magic you can cast. Your level, Wis and Pow effect what the value of grace is. Prayong on an altar of your god can increase this value beyond your normal maximum. Grace can take on large positive and negative values. Positive values indicate favor by the gods."); |
409 | tooltip => "<b>Grace points</b> - how favored you are by your god. In game terms, how much divine magic you can cast. Your level, Wis and Pow effect what the value of grace is. Prayong on an altar of your god can increase this value beyond your normal maximum. Grace can take on large positive and negative values. Positive values indicate favor by the gods."); |
410 | $hb->add (my $fg = new CFClient::UI::Gauge type => 'food', |
410 | $hb->add (my $fg = new CFClient::UI::Gauge type => 'food', |
411 | tooltip => "Food. Ranges between 0 (starving) and 999 (satiated). At a value of 0 the character begins to die. Some magic can speed up or slow down the character digestion. Healing wounds will speed up digestion too."); |
411 | tooltip => "<b>Food</b>. Ranges between 0 (starving) and 999 (satiated). At a value of 0 the character begins to die. Some magic can speed up or slow down the character digestion. Healing wounds will speed up digestion too."); |
412 | |
412 | |
413 | $vbox->add (my $exp = new CFClient::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, |
413 | $vbox->add (my $exp = new CFClient::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, |
414 | tooltip => "Experience points and overall level - experience is increased as a reward for appropriate action (such as killing monsters) and may decrease as a result of a magical attack or dying. Level is directly derived from the experience value. As the level of the character increases, the character becomes able to succeed at more difficult tasks. A character's level starts at a value of 0 and may range up beyond 100."); |
414 | tooltip => "<b>Experience points and overall level</b> - experience is increased as a reward for appropriate action (such as killing monsters) and may decrease as a result of a magical attack or dying. Level is directly derived from the experience value. As the level of the character increases, the character becomes able to succeed at more difficult tasks. A character's level starts at a value of 0 and may range up beyond 100."); |
415 | $vbox->add (my $rng = new CFClient::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, |
415 | $vbox->add (my $rng = new CFClient::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, |
416 | tooltip => "Ranged attack - how you attack when you press shift-cursor (spell, skill, weapon etc.)"); |
416 | tooltip => "<b>Ranged attack</b> - how you attack when you press shift-cursor (spell, skill, weapon etc.)"); |
417 | |
417 | |
418 | $GAUGES = { |
418 | $GAUGES = { |
419 | exp => $exp, win => $win, range => $rng, |
419 | exp => $exp, win => $win, range => $rng, |
420 | food => $fg, mana => $mg, hp => $hg, grace => $gg |
420 | food => $fg, mana => $mg, hp => $hg, grace => $gg |
421 | }; |
421 | }; |
… | |
… | |
427 | |
427 | |
428 | sub make_stats_window { |
428 | sub make_stats_window { |
429 | my $tgw = new CFClient::UI::FancyFrame x => $WIDTH * 2/5, y => 0, title => "Stats"; |
429 | my $tgw = new CFClient::UI::FancyFrame x => $WIDTH * 2/5, y => 0, title => "Stats"; |
430 | |
430 | |
431 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
431 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
432 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1); |
432 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
|
|
433 | can_hover => 1, can_events => 1, |
|
|
434 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
433 | $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1); |
435 | $vb->add ($STATWIDS->{map} = new CFClient::UI::Label valign => 0, align => -1, text => "Map:", expand => 1, |
|
|
436 | can_hover => 1, can_events => 1, |
|
|
437 | tooltip => "The map you are currently on (if supported by the server)."); |
434 | |
438 | |
435 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
439 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
436 | |
|
|
437 | $hb->add (my $tbl = new CFClient::UI::Table expand => 1); |
440 | $hb->add (my $tbl = new CFClient::UI::Table expand => 1); |
438 | |
441 | |
439 | my $black = [0, 0, 0]; |
442 | my $black = [0, 0, 0]; |
440 | |
443 | |
441 | for ( |
444 | for ( |
442 | [0, 0, st_str => "Str", 30, "Physical Strength, determines damage dealt with weapons, how much you can carry, and how often you can attack"], |
445 | [0, 0, st_str => "Str", 30, "<b>Physical Strength</b>, determines damage dealt with weapons, how much you can carry, and how often you can attack"], |
443 | [0, 1, st_dex => "Dex", 30, "Dexterity, your physical agility. Determines chance of being hit and affects armor class and speed"], |
446 | [0, 1, st_dex => "Dex", 30, "<b>Dexterity</b>, your physical agility. Determines chance of being hit and affects armor class and speed"], |
444 | [0, 2, st_con => "Con", 30, "Constitution, physical health and toughness. Determines how many healthpoints you can have"], |
447 | [0, 2, st_con => "Con", 30, "<b>Constitution</b>, physical health and toughness. Determines how many healthpoints you can have"], |
445 | [0, 3, st_int => "Int", 30, "Intelligence, your ability to learn and use skills and incantations (both prayers and magic) and determines how much spell points you can have"], |
448 | [0, 3, st_int => "Int", 30, "<b>Intelligence</b>, your ability to learn and use skills and incantations (both prayers and magic) and determines how much spell points you can have"], |
446 | [0, 4, st_wis => "Wis", 30, "Wisdom, the ability to learn and use divine magic (prayers). Determines how many grace points you can have"], |
449 | [0, 4, st_wis => "Wis", 30, "<b>Wisdom</b>, the ability to learn and use divine magic (prayers). Determines how many grace points you can have"], |
447 | [0, 5, st_pow => "Pow", 30, "Power, your magical potential. Influences the strength of spell effects, and also how much your spell and grace points increase when leveling up"], |
450 | [0, 5, st_pow => "Pow", 30, "<b>Power</b>, your magical potential. Influences the strength of spell effects, and also how much your spell and grace points increase when leveling up"], |
448 | [0, 6, st_cha => "Cha", 30, "Charisma, how well you are received by NPCs. Affects buying and selling prices in shops."], |
451 | [0, 6, st_cha => "Cha", 30, "<b>Charisma</b>, how well you are received by NPCs. Affects buying and selling prices in shops."], |
449 | |
452 | |
450 | [2, 0, st_wc => "Wc", -120, "Weapon Class, 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."], |
453 | [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."], |
451 | [2, 1, st_ac => "Ac", -120, "Armour Class, 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."], |
454 | [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."], |
452 | [2, 2, st_dam => "Dam", 120, "Damage, how much damage your melee/missile attack inflicts. Higher values indicate a greater amount of damage will be inflicted with each attack."], |
455 | [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."], |
453 | [2, 3, st_arm => "Arm", 120, "Armour, 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."], |
456 | [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."], |
454 | [2, 4, st_spd => "Spd", 10.54, "Speed, 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."], |
457 | [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."], |
455 | [2, 5, st_wspd => "WSp", 10.54, "Weapon Speed, 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."], |
458 | [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."], |
456 | ) { |
459 | ) { |
457 | my ($col, $row, $id, $label, $template, $tooltip) = @$_; |
460 | my ($col, $row, $id, $label, $template, $tooltip) = @$_; |
458 | |
461 | |
459 | $tbl->add ($col , $row, $STATWIDS->{$id} = new CFClient::UI::Label |
462 | $tbl->add ($col , $row, $STATWIDS->{$id} = new CFClient::UI::Label |
460 | font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, align => +1, template => $template, tooltip => $tooltip); |
463 | font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, align => +1, template => $template, tooltip => $tooltip); |
… | |
… | |
781 | |
784 | |
782 | sub message_window { |
785 | sub message_window { |
783 | my $window = new CFClient::UI::FancyFrame |
786 | my $window = new CFClient::UI::FancyFrame |
784 | title => "Messages", |
787 | title => "Messages", |
785 | border_bg => [1, 1, 1, 1], |
788 | border_bg => [1, 1, 1, 1], |
786 | bg => [0, 0, 0, 0.5], |
789 | bg => [0, 0, 0, 0.75], |
787 | user_w => int $::WIDTH / 3, |
790 | user_w => int $::WIDTH / 3, |
788 | user_h => int $::HEIGHT / 5, |
791 | user_h => int $::HEIGHT / 5, |
789 | child => (my $vbox = new CFClient::UI::VBox); |
792 | child => (my $vbox = new CFClient::UI::VBox); |
790 | |
793 | |
791 | $vbox->add ($LOGVIEW); |
794 | $vbox->add ($LOGVIEW); |
792 | |
795 | |
793 | $vbox->add (my $input = new CFClient::UI::Entry |
796 | $vbox->add (my $input = new CFClient::UI::Entry |
|
|
797 | tooltip => "<b>Chat Box</b>. If you enter a text and press return/enter here, the current <i>communication command</i> " |
|
|
798 | . "from the client setup will be prepended (e.g. <b>shout</b>, <b>chat</b>...). " |
|
|
799 | . "If you prepend a slash (/), you will submit a command instead (similar to IRC). " |
|
|
800 | . "A better way to submit commands (and the occasional chat command) is often the map command completer.", |
794 | connect_focus_in => sub { |
801 | connect_focus_in => sub { |
795 | my ($input, $prev_focus) = @_; |
802 | my ($input, $prev_focus) = @_; |
796 | |
803 | |
797 | delete $input->{refocus_map}; |
804 | delete $input->{refocus_map}; |
798 | |
805 | |
… | |
… | |
892 | )->show; |
899 | )->show; |
893 | |
900 | |
894 | CFClient::UI::FancyFrame->new ( |
901 | CFClient::UI::FancyFrame->new ( |
895 | border_bg => [1, 1, 1, 192/255], |
902 | border_bg => [1, 1, 1, 192/255], |
896 | bg => [1, 1, 1, 0], |
903 | bg => [1, 1, 1, 0], |
897 | child => ($MAPMAP = new CFClient::MapWidget::MapMap), |
904 | child => ($MAPMAP = new CFClient::MapWidget::MapMap |
|
|
905 | tooltip => "<b>Map</b>. On servers that support this feature, this will display an overview of the surrounding areas.", |
|
|
906 | ), |
898 | )->show; |
907 | )->show; |
899 | |
908 | |
900 | $MAPWIDGET = new CFClient::MapWidget; |
909 | $MAPWIDGET = new CFClient::MapWidget; |
901 | $MAPWIDGET->connect (activate_console => sub { |
910 | $MAPWIDGET->connect (activate_console => sub { |
902 | my ($mapwidget, $preset) = @_; |
911 | my ($mapwidget, $preset) = @_; |
… | |
… | |
912 | }); |
921 | }); |
913 | $MAPWIDGET->show; |
922 | $MAPWIDGET->show; |
914 | $MAPWIDGET->focus_in; |
923 | $MAPWIDGET->focus_in; |
915 | |
924 | |
916 | $LOGVIEW = new CFClient::UI::TextView |
925 | $LOGVIEW = new CFClient::UI::TextView |
917 | expand => 1, |
926 | expand => 1, |
918 | font => $FONT_FIXED, |
927 | font => $FONT_FIXED, |
919 | fontsize => $::CFG->{log_fontsize}, |
928 | fontsize => $::CFG->{log_fontsize}, |
|
|
929 | can_hover => 1, |
|
|
930 | can_events => 1, |
|
|
931 | tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.", |
920 | ; |
932 | ; |
921 | |
933 | |
922 | $BUTTONBAR = new CFClient::UI::HBox; |
934 | $BUTTONBAR = new CFClient::UI::HBox; |
923 | |
935 | |
924 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); |
936 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup, |
|
|
937 | tooltip => "Toggles a dialog where you can configure various aspects of the client, such as graphics mode, performance, and audio options."); |
925 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); |
938 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup, |
|
|
939 | tooltip => "Toggles a dialog where you can configure the server to play on, your username, password and other server-related options."); |
926 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); |
940 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window, |
|
|
941 | tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
927 | |
942 | |
928 | 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 |
943 | 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 |
929 | |
944 | |
930 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window); |
945 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window, |
|
|
946 | tooltip => "Toggles the statistics window, where all your Stats and Resistances are beign displaye at all times."); |
931 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window); |
947 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window, |
|
|
948 | tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :)."); |
932 | |
949 | |
933 | $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { |
950 | $BUTTONBAR->add (new CFClient::UI::Button |
|
|
951 | text => "Save Config", |
|
|
952 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
|
|
953 | connect_activate => sub { |
934 | CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; |
954 | CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; |
935 | status "Configuration Saved"; |
955 | status "Configuration Saved"; |
|
|
956 | }, |
936 | }); |
957 | ); |
937 | |
958 | |
938 | $BUTTONBAR->show; |
959 | $BUTTONBAR->show; |
939 | |
960 | |
940 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
961 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
941 | |
962 | |
… | |
… | |
1676 | Event::unloop -1; |
1697 | Event::unloop -1; |
1677 | }, |
1698 | }, |
1678 | CFClient::SDL_VIDEORESIZE => sub { |
1699 | CFClient::SDL_VIDEORESIZE => sub { |
1679 | }, |
1700 | }, |
1680 | CFClient::SDL_VIDEOEXPOSE => sub { |
1701 | CFClient::SDL_VIDEOEXPOSE => sub { |
1681 | $WANT_REFRESH++; |
1702 | CFClient::UI::full_refresh; |
1682 | }, |
1703 | }, |
1683 | CFClient::SDL_ACTIVEEVENT => sub { |
1704 | CFClient::SDL_ACTIVEEVENT => sub { |
1684 | # printf "active %x %x\n", $SDL_EV->active_gain, $SDL_EV->active_state;#d# |
1705 | # printf "active %x %x\n", $SDL_EV->active_gain, $SDL_EV->active_state;#d# |
1685 | }, |
1706 | }, |
1686 | CFClient::SDL_KEYDOWN => sub { |
1707 | CFClient::SDL_KEYDOWN => sub { |