--- deliantra/Deliantra-Client/bin/pclient 2006/04/24 06:57:39 1.175 +++ deliantra/Deliantra-Client/bin/pclient 2006/04/25 10:30:49 1.180 @@ -3,6 +3,29 @@ use strict; use utf8; +BEGIN { + if (%PAR::LibCache) { + @INC = grep ref, @INC; # weed out all paths except pars loader refs + + while (my ($filename, $zip) = each %PAR::LibCache) { + for ($zip->memberNames) { + next unless /^\/root\/(.*)/; + $zip->extractMember ($_, "$ENV{PAR_TEMP}/$1") + unless -e "$ENV{PAR_TEMP}/$1"; + } + } + + unshift @INC, $ENV{PAR_TEMP}; + + if ($^O eq "MSWin32") { + $ENV{GTK_RC_FILES} = "$ENV{PAR_TEMP}/share/themes/MS-Windows/gtk-2.0/gtkrc"; + } + } +} + +# need to do it again because that pile of garbage called PAR nukes it before main +unshift @INC, $ENV{PAR_TEMP}; + use Time::HiRes 'time'; use Event; @@ -15,6 +38,12 @@ use CFClient::UI; use CFClient::MapWidget; +$Event::DIED = sub { + CFClient::error $_[1]; +}; + +#$SIG{__WARN__} = sub { Carp::cluck $_[0] };#d# + our $VERSION = '0.1'; my $MAX_FPS = 60; @@ -364,35 +393,29 @@ my $black = [0, 0, 0]; - $tbl->add (0, 0, $STATWIDS->{st_str} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); - $tbl->add (0, 1, $STATWIDS->{st_dex} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); - $tbl->add (0, 2, $STATWIDS->{st_con} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); - $tbl->add (0, 3, $STATWIDS->{st_int} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); - $tbl->add (0, 4, $STATWIDS->{st_wis} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); - $tbl->add (0, 5, $STATWIDS->{st_pow} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); - $tbl->add (0, 6, $STATWIDS->{st_cha} = new CFClient::UI::Label valign => 0, align => +1, template => "30"); - - $tbl->add (1, 0, $STATWIDS->{st_str_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "Str"); - $tbl->add (1, 1, $STATWIDS->{st_dex_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "Dex"); - $tbl->add (1, 2, $STATWIDS->{st_con_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "Con"); - $tbl->add (1, 3, $STATWIDS->{st_int_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "Int"); - $tbl->add (1, 4, $STATWIDS->{st_wis_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "Wis"); - $tbl->add (1, 5, $STATWIDS->{st_pow_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "Pow"); - $tbl->add (1, 6, $STATWIDS->{st_cha_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "Cha"); - - $tbl->add (2, 0, $STATWIDS->{st_wc} = new CFClient::UI::Label valign => 0, align => +1, template => "-120"); - $tbl->add (2, 1, $STATWIDS->{st_ac} = new CFClient::UI::Label valign => 0, align => +1, template => "-120"); - $tbl->add (2, 2, $STATWIDS->{st_dam} = new CFClient::UI::Label valign => 0, align => +1, template => "120"); - $tbl->add (2, 3, $STATWIDS->{st_arm} = new CFClient::UI::Label valign => 0, align => +1, template => "120"); - $tbl->add (2, 4, $STATWIDS->{st_spd} = new CFClient::UI::Label valign => 0, align => +1, template => "10.54"); - $tbl->add (2, 5, $STATWIDS->{st_wspd} = new CFClient::UI::Label valign => 0, align => +1, template => "9"); - - $tbl->add (3, 0, $STATWIDS->{st_wc_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "Wc"); - $tbl->add (3, 1, $STATWIDS->{st_ac_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "Ac"); - $tbl->add (3, 2, $STATWIDS->{st_dam_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "Dam"); - $tbl->add (3, 3, $STATWIDS->{st_arm_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "Arm"); - $tbl->add (3, 4, $STATWIDS->{st_spd_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "Sp"); - $tbl->add (3, 5, $STATWIDS->{st_wspd_lbl} = new CFClient::UI::Label fg => $black, valign => 0, align => -1, text => "WSp"); + for ( + [0, 0, st_str => "Str", 30, "Physical Strength, determines damage dealt with weapons, how much you can carry, and how often you can attack"], + [0, 1, st_dex => "Dex", 30, "Dexterity, your physical agility. Determines chance of being hit and affects armor class and speed"], + [0, 2, st_con => "Con", 30, "Constitution, physical health and toughness. Determines how many healthpoints you can have"], + [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"], + [0, 4, st_wis => "Wis", 30, "Wisdom, the ability to learn and use divine magic (prayers). Determines how many grace points you can have"], + [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"], + [0, 6, st_cha => "Cha", 30, "Charisma, how well you are received by NPCs. Affects buying and selling prices in shops."], + + [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."], + [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."], + [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."], + [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."], + [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."], + [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."], + ) { + my ($col, $row, $id, $label, $template, $tooltip) = @$_; + + $tbl->add ($col , $row, $STATWIDS->{$id} = new CFClient::UI::Label + can_hover => 1, can_events => 1, valign => 0, align => +1, template => $template, tooltip => $tooltip); + $tbl->add ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new CFClient::UI::Label + can_hover => 1, can_events => 1, fg => $black, valign => 0, align => -1, text => $label, tooltip => $tooltip); + } $hb->add (my $tbl2 = new CFClient::UI::Table expand => 1); @@ -404,20 +427,20 @@ holyw => "Holy Word", conf => "Confusion", fire => "Fire", - depl => "Depletion", + depl => "Depletion (some monsters and other effects can cause stats depletion)", magic => "Magic", - drain => "Draining", + drain => "Draining (some monsters (e.g. vampires) and other effects can steal experience)", acid => "Acid", pois => "Poison", para => "Paralysation", - deat => "Death", + deat => "Death (resistance against death spells)", phys => "Physical", blind => "Blind", fear => "Fear", tund => "Turn undead", elec => "Electricity", cold => "Cold", - ghit => "Ghost hit", + ghit => "Ghost hit (special attack used by ghosts and ghost-like beings)", ); for (qw/slow holyw conf fire depl magic drain acid pois para deat phys @@ -426,16 +449,18 @@ $tbl2->add ($col, $row, $STATWIDS->{"res_$_"} = new CFClient::UI::Label - template => "-100%", - align => +1, - valign => 0, - tooltip => $resist_names{$_} + template => "-100%", + align => +1, + valign => 0, + can_events => 1, + can_hover => 1, + tooltip => $resist_names{$_}, ); $tbl2->add ($col + 1, $row, new CFClient::UI::Image - can_hover => 1, + can_hover => 1, can_events => 1, - image => "ui/resist/resist_$_.png", - tooltip => $resist_names{$_} + image => "ui/resist/resist_$_.png", + tooltip => $resist_names{$_}, ); $row++; @@ -532,26 +557,38 @@ $dialog } +my $METASERVER_ATIME; + sub update_metaserver { my ($HOST) = @_; - status "fetching metaserver list..."; + return if $METASERVER_ATIME > time; + $METASERVER_ATIME = time + 60; + + my $table = $METASERVER->{table}; + $table->clear; + $table->add (0, 0, my $label = new CFClient::UI::Label max_w => $WIDTH * 0.8, text => "fetching server list..."); my $buf; my $fh = new IO::Socket::INET PeerHost => $META_SERVER, Blocking => 0; + unless ($fh) { + $label->set_text ("unable to contact metaserver: $!"); + return; + } + Event->io (fd => $fh, poll => 'r', cb => sub { my $res = sysread $fh, $buf, 8192, length $buf; if (!defined $res) { $_[0]->w->cancel; - status "metaserver: $!"; + $label->set_text ("error while retrieving server list: $!"); } elsif ($res == 0) { $_[0]->w->cancel; status "server list retrieved"; - my $table = $METASERVER->{table}; + utf8::decode $buf if utf8::valid $buf; $table->clear; @@ -585,7 +622,7 @@ $y++; $table->add (0, $y, new CFClient::UI::VBox children => [ - (new CFClient::UI::Button text => " ", connect_activate => sub { + (new CFClient::UI::Button text => "Use", connect_activate => sub { $HOST->set_text ($CFG->{host} = $host); }), (new CFClient::UI::Empty expand => 1), @@ -814,6 +851,8 @@ sub video_shutdown { $CFClient::UI::ROOT->{children} = []; + undef $CFClient::UI::GRAB; + undef $CFClient::UI::HOVER; undef $SDL_ACTIVE; } @@ -1437,4 +1476,109 @@ END { CFClient::SDL_Quit } +=head1 pclient - Crossfire+ and Crossfire game client + +Pclient is a Crossfire+ and Crossfire game client. + +=head2 Features + +=over 4 + +=item Fullscreen Map + +PClient can uses a fullscreen map, which greatly enhances how much of the +game world you can see. + +=item Persistent Map Cache (Crossfire+ only) + +PClient can persistently cache all map data it received from the +server. This not only allows it to display an overview map, but also +ensures that once-explored areas will be available the next time you want +to explore more. + +=item Hardware acceleration + +Unlike most Crossfire clients, PClient take advantage of OpenGL hardware +acceleration. Most modern graphics cards have difficulties with 2D +acceleration, while 3D graphics is accelerated well. + +=item No arbitrary limits + +Unlike other Crossfire clients, pclient does not suffer from arbitrary +limits (like a fixed amount of face numbers). There are still limits, but +they are not arbitrarily low :) + +=back + +=head1 USAGE + +=head2 The Map + +The map is always displayed in the background, behind all other windows and UI elements. + +#TODO# middle-click scrolls +# +# keys: +# +# a apply +# keypad moves, kp_5 applies ranged attack to self + +Starting to type enters the I. In that mode, you can type +abbreviations or commands and have them executed as soon as they match a +valid command. This is best explained by a few examples: + +Typing B will display a list of commands with I in their +name, such as I and I. + +You can abbreviate commands by typing only the first character of every +word. For example, typing I will likely select I, while I will select I. Likewise, I +will likely select I and I will give you +I. + +=head2 The map overview + +#TODO# + +=head2 The Status area in the lower right corner + +#TODO# + +=head2 The I/I>Stats> window + +#TODO# + +=head1 FAQ + +=over 4 + +=item The client is very sluggish and slow, what can I do about this? + +Most likely, you don't have accelerated OpenGL support. Try to find a +newer driver, or a driver from your hardware vendor, that features OpenGL +support. + +If this is not an option, the following Setup options reduce the load and +will likely make the client playable with sofwtare rendering (it will +still be slow, though): + +=over 4 + +=item B