--- deliantra/Deliantra-Client/bin/pclient 2006/04/25 12:10:58 1.186 +++ deliantra/Deliantra-Client/bin/pclient 2006/04/28 18:06:13 1.192 @@ -72,6 +72,7 @@ our $FONT_FIXED; our $MAP; +our $MAPMAP; our $MAPWIDGET; our $BUTTONBAR; our $LOGVIEW; @@ -93,6 +94,9 @@ our $STATUS_LINE; our $DEBUG_STATUS; +our $INVWIN; +our $INV; + sub status { $STATUS_LINE->set_text ($_[0]); $STATUS_LINE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h} - $STATUS_LINE->{h}); @@ -315,6 +319,18 @@ } ); + $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Communication cmd"); + $table->add (1, $row++, my $saycmd = new CFClient::UI::Entry + text => $CFG->{say_command}, + tooltip => "This is the command that will be used if you write a line in the message window entry. " + ."Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " + ."But you could also set it to 'tell <playername>' to only chat with that user.", + connect_changed => sub { + my ($self, $value) = @_; + $CFG->{say_command} = $value; + } + ); + $dialog } @@ -423,23 +439,23 @@ my $col = 0; my %resist_names = ( - slow => "Slow", - holyw => "Holy Word", - conf => "Confusion", - fire => "Fire", + slow => "Slow (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.)", + holyw => "Holy Word (resistance you against getting the fear when someone whose god doesn't like you spells the holy word on you.)", + conf => "Confusion (If you are hit by confusion you will move into random directions, and likely into monsters.)", + fire => "Fire (just your resistance to fire spells like burning hands, dragonbreath, meteor swarm fire, ...)", depl => "Depletion (some monsters and other effects can cause stats depletion)", - magic => "Magic", + magic => "Magic (resistance to magic spells like magic missile or similar)", drain => "Draining (some monsters (e.g. vampires) and other effects can steal experience)", - acid => "Acid", - pois => "Poison", - para => "Paralysation", + acid => "Acid (resistance to acid, acid hurts pretty much and also corrodes your weapons)", + pois => "Poison (resistance to getting poisoned)", + para => "Paralysation (this resistance affects the chance you get paralysed)", deat => "Death (resistance against death spells)", - phys => "Physical", - blind => "Blind", - fear => "Fear", + phys => "Physical (this is the resistance against physical attacks, like when a monster hit you in melee combat)", + blind => "Blind (blind resistance affects the chance of a successful blinding attack)", + fear => "Fear (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)", tund => "Turn undead", - elec => "Electricity", - cold => "Cold", + elec => "Electricity (resistance againt electricity, spells like large lightning, small lightning, ...)", + cold => "Cold (this is your resistance against cold spells like icestorm, snowstorm, ...)", ghit => "Ghost hit (special attack used by ghosts and ghost-like beings)", ); for (qw/slow holyw conf fire depl magic @@ -693,18 +709,6 @@ } ); - $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "Def. say cmd"); - $table->add (1, 6, my $saycmd = new CFClient::UI::Entry - text => $CFG->{say_command}, - tooltip => "This is the command that will be used if you write a line in the message window entry. " - ."Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " - ."But you could also set it to 'tell <playername>' to only chat with that user.", - connect_changed => sub { - my ($self, $value) = @_; - $CFG->{say_command} = $value; - } - ); - $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); $table->add (1, 7, new CFClient::UI::Slider req_w => 100, @@ -779,6 +783,15 @@ $window } +sub make_inventory_window { + my $invwin = new CFClient::UI::FancyFrame user_w => 300, user_h => 300, title => "Inventory"; + $invwin->add (my $hb = new CFClient::UI::HBox); + $hb->add ($INV = new CFClient::UI::Inventory expand => 1); + $hb->add (my $rng = new CFClient::UI::Slider vertical => 1); + $INV->set_range ($rng); + $invwin +} + sub sdl_init { CFClient::SDL_Init and die "SDL::Init failed!\n"; @@ -819,8 +832,13 @@ $ALT_ENTER_MESSAGE->show; $ALT_ENTER_MESSAGE->move (0, $HEIGHT - $ALT_ENTER_MESSAGE->{h}); - $CFClient::UI::ROOT->add ($MAPWIDGET = new CFClient::MapWidget); - $MAPWIDGET->focus_in; + CFClient::UI::FancyFrame->new ( + border_bg => [1, 1, 1, 192/255], + bg => [1, 1, 1, 0], + child => ($MAPMAP = new CFClient::MapWidget::MapMap), + )->show; + + $MAPWIDGET = new CFClient::MapWidget; $MAPWIDGET->connect (activate_console => sub { my ($mapwidget, $preset) = @_; @@ -833,21 +851,27 @@ } } }); + $MAPWIDGET->show; + $MAPWIDGET->focus_in; - $CFClient::UI::ROOT->add ($BUTTONBAR = new CFClient::UI::HBox); + $BUTTONBAR = new CFClient::UI::HBox; $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); - $CFClient::UI::ROOT->add (make_gauge_window); # 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 + 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 + $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window); + $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window); $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; status "Configuration Saved"; }); + $BUTTONBAR->show; + $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup } @@ -1038,7 +1062,7 @@ my ($self, $gx, $gy, $path, $hash, $flags) = @_; # the server does not allow map paths > 6 - return if 6 <= length $path; + return if 7 <= length $path; my ($x0, $y0, $x1, $y1) = @{$self->{neigh_rect}}; @@ -1091,8 +1115,8 @@ my ($ox, $oy) = ($::MAP->ox, $::MAP->oy); - my $mapmapw = 250; - my $mapmaph = 250; + my $mapmapw = $MAPMAP->{w}; + my $mapmaph = $MAPMAP->{h}; $self->{neigh_rect} = [ $ox - $mapmapw * 0.5, $oy - $mapmapw * 0.5, @@ -1325,8 +1349,17 @@ } elsif ($ev->{button} == 2) { $CONN->send ("apply $item->{tag}"); } elsif ($ev->{button} == 3) { - # examine, lock, mark, maybe other things - warn "MENU not implemented yet\n"; + CFClient::UI::Menu->new ( + items => [ + ["examine", sub { $CONN->send ("examine $item->{tag}") }], + [ + $item->{flags} & Crossfire::Protocol::F_LOCKED ? "lock" : "unlock", + sub { $CONN->send ("lock $item->{tag}") }, + ], + ["mark", sub { $CONN->send ("mark $item->{tag}") }], + ["apply", sub { $CONN->send ("apply $item->{tag}") }], + ], + )->popup ($ev); } 1 @@ -1353,6 +1386,9 @@ my ($self, $id, $items) = @_; update_floorbox if $id == 0; + if ($self->{player}{tag} == $id) { + $INV->set_items ($self->{container}{$self->{player}{tag}}); + } # $self-<{player}{tag} => player inv #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; } @@ -1361,6 +1397,10 @@ my ($self, $id) = @_; update_floorbox if $id == 0; + if ($self->{player}{tag} == $id) { + $INV->set_items ($self->{container}{$id}); + } + # use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; } @@ -1369,6 +1409,9 @@ for (@items) { update_floorbox if $_->{container} == 0; + if ($self->{player}{tag} == $_->{container}) { + $INV->set_items ($self->{container}{$_->{container}}); + } } } @@ -1376,6 +1419,9 @@ my ($self, $item) = @_; update_floorbox if $item->{container} == 0; + if ($self->{player}{tag} == $item->{container}) { + $INV->set_items ($self->{container}{$item->{container}}); + } } %SDL_CB = (