ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Protocol.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Protocol.pm (file contents):
Revision 1.63 by root, Sun Jul 23 04:46:02 2006 UTC vs.
Revision 1.64 by root, Sun Jul 23 08:58:44 2006 UTC

242 $::STATWIDS->{st_dam} ->set_text (sprintf "%d" , $stats->{+CS_STAT_DAM}); 242 $::STATWIDS->{st_dam} ->set_text (sprintf "%d" , $stats->{+CS_STAT_DAM});
243 $::STATWIDS->{st_arm} ->set_text (sprintf "%d" , $stats->{+CS_STAT_RES_PHYS}); 243 $::STATWIDS->{st_arm} ->set_text (sprintf "%d" , $stats->{+CS_STAT_RES_PHYS});
244 $::STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED}); 244 $::STATWIDS->{st_spd} ->set_text (sprintf "%.1f", $stats->{+CS_STAT_SPEED});
245 $::STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP}); 245 $::STATWIDS->{st_wspd}->set_text (sprintf "%.1f", $stats->{+CS_STAT_WEAP_SP});
246 246
247 $::STATWIDS->{m_weight}->set_text (sprintf "Max weight: %.1fkg", $stats->{+CS_STAT_WEIGHT_LIM} / 1000); 247 $self->update_weight;
248 248
249 $::STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$RES_TBL{$_}}) 249 $::STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$RES_TBL{$_}})
250 for keys %RES_TBL; 250 for keys %RES_TBL;
251 251
252 my $sktbl = $::STATWIDS->{skill_tbl}; 252 my $sktbl = $::STATWIDS->{skill_tbl};
832 } 832 }
833} 833}
834 834
835sub player_update { 835sub player_update {
836 my ($self, $player) = @_; 836 my ($self, $player) = @_;
837
838 $self->update_weight;
839}
840
841sub update_weight {
842 my ($self) = @_;
843
844 my $weight = .001 * $self->{player}{weight};
845 my $limit = .001 * $self->{stat}{+CS_STAT_WEIGHT_LIM};
846
837 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); 847 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $weight);
848 $::STATWIDS->{m_weight}->set_text (sprintf "%.1fkg", $limit);
849 $::STATWIDS->{i_weight}->set_text (sprintf "%.1f/%.1fkg", $weight, $limit);
838} 850}
839 851
840sub update_server_info { 852sub update_server_info {
841 my ($self) = @_; 853 my ($self) = @_;
842 854
912 name => "npc_dialog", 924 name => "npc_dialog",
913 force_w => $::WIDTH * 0.7, 925 force_w => $::WIDTH * 0.7,
914 force_h => $::HEIGHT * 0.7, 926 force_h => $::HEIGHT * 0.7,
915 title => "NPC Dialog", 927 title => "NPC Dialog",
916 kw => { hi => 0, yes => 0, no => 0 }, 928 kw => { hi => 0, yes => 0, no => 0 },
929 has_close_button => 1,
917 @_, 930 @_,
918 ); 931 );
919 932
920 Scalar::Util::weaken (my $this = $self); 933 Scalar::Util::weaken (my $this = $self);
934
935 $self->connect (delete => sub { $this->destroy; 1 });
921 936
922 # better use a pane... 937 # better use a pane...
923 $self->add (my $hbox = new CFClient::UI::HBox); 938 $self->add (my $hbox = new CFClient::UI::HBox);
924 $hbox->add ($self->{textview} = new CFClient::UI::TextScroller expand => 1); 939 $hbox->add ($self->{textview} = new CFClient::UI::TextScroller expand => 1);
925 940
947 $vbox->add ($self->{options} = new CFClient::UI::VBox); 962 $vbox->add ($self->{options} = new CFClient::UI::VBox);
948 963
949 $self->{bye_button} = new CFClient::UI::Button 964 $self->{bye_button} = new CFClient::UI::Button
950 text => "Bye (close)", 965 text => "Bye (close)",
951 tooltip => "Use this button to end talking to the NPC. This also closes the dialog window.", 966 tooltip => "Use this button to end talking to the NPC. This also closes the dialog window.",
952 on_activate => sub { $this->destroy; 0 }, 967 on_activate => sub { $this->destroy; 1 },
953 ; 968 ;
954 969
955 $self->update_options; 970 $self->update_options;
956 971
957 $self->{token} = $self->{conn}->ext_token; 972 $self->{token} = $self->{conn}->ext_token;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines