ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/pclient
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/pclient (file contents):
Revision 1.172 by root, Mon Apr 24 03:43:52 2006 UTC vs.
Revision 1.173 by root, Mon Apr 24 06:05:36 2006 UTC

47our $BUTTONBAR; 47our $BUTTONBAR;
48our $LOGVIEW; 48our $LOGVIEW;
49our $CONSOLE; 49our $CONSOLE;
50our $METASERVER; 50our $METASERVER;
51 51
52our $FLOORBOX;
52our $GAUGES; 53our $GAUGES;
53our $STATWIDS; 54our $STATWIDS;
54 55
55our $SDL_ACTIVE; 56our $SDL_ACTIVE;
56our %SDL_CB; 57our %SDL_CB;
308# my $gw = int ($WIDTH * $CFG->{gauge_w_size}); 309# my $gw = int ($WIDTH * $CFG->{gauge_w_size});
309 310
310 my $win = new CFClient::UI::Frame ( 311 my $win = new CFClient::UI::Frame (
311 y => $HEIGHT - $gh, x => 0, user_w => $WIDTH, user_h => $gh 312 y => $HEIGHT - $gh, x => 0, user_w => $WIDTH, user_h => $gh
312 ); 313 );
313 $win->add (my $vb = new CFClient::UI::VBox); 314 $win->add (my $hbox = new CFClient::UI::HBox
314 315 children => [
315 $vb->add (my $hb1 = new CFClient::UI::HBox expand => 1); 316 (new CFClient::UI::HBox expand => 1),
317 ($FLOORBOX = new CFClient::UI::VBox),
318 (my $vbox = new CFClient::UI::VBox),
319 ],
320 );
316 321
322 $vbox->add (new CFClient::UI::HBox
323 expand => 1,
324 children => [
317 $hb1->add (new CFClient::UI::Empty expand => 1); 325 (new CFClient::UI::Empty expand => 1),
318 $hb1->add (my $hb = new CFClient::UI::HBox); 326 (my $hb = new CFClient::UI::HBox),
327 ],
328 );
329
319 $hb->add (my $hg = new CFClient::UI::Gauge type => 'hp', 330 $hb->add (my $hg = new CFClient::UI::Gauge type => 'hp',
320 tooltip => "Health points - depletes when you get wounded, refills when you heal or idle"); 331 tooltip => "Health points - depletes when you get wounded, refills when you heal or idle");
321 $hb->add (my $mg = new CFClient::UI::Gauge type => 'mana', 332 $hb->add (my $mg = new CFClient::UI::Gauge type => 'mana',
322 tooltip => "Spell points - deplete when you cast wizard spells, refills when you idle"); 333 tooltip => "Spell points - deplete when you cast wizard spells, refills when you idle");
323 $hb->add (my $gg = new CFClient::UI::Gauge type => 'grace', 334 $hb->add (my $gg = new CFClient::UI::Gauge type => 'grace',
324 tooltip => "Grace points - deplete when you cast priest spells, refills when you pray"); 335 tooltip => "Grace points - deplete when you cast priest spells, refills when you pray");
325 $hb->add (my $fg = new CFClient::UI::Gauge type => 'food', 336 $hb->add (my $fg = new CFClient::UI::Gauge type => 'food',
326 tooltip => "Food - depletes with time, faster when you heal or build mana, refills when you eat healthy food"); 337 tooltip => "Food - depletes with time, faster when you heal or build mana, refills when you eat healthy food");
327 338
328 $vb->add (my $hb2 = new CFClient::UI::HBox);
329
330 $hb2->add (new CFClient::UI::Empty expand => 1);
331 $hb2->add (my $vb2 = new CFClient::UI::VBox);
332 $vb2->add (my $exp = new CFClient::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, 339 $vbox->add (my $exp = new CFClient::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1,
333 tooltip => "Experience points and level - increases when you kill monsters or successfully use skills"); 340 tooltip => "Experience points and level - increases when you kill monsters or successfully use skills");
334 $vb2->add (my $rng = new CFClient::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, 341 $vbox->add (my $rng = new CFClient::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1,
335 tooltip => "Ranged attack - how you attack when you press shift-cursor (spell, skill, weapon etc.)"); 342 tooltip => "Ranged attack - how you attack when you press shift-cursor (spell, skill, weapon etc.)");
336 343
337 $GAUGES = { 344 $GAUGES = {
338 exp => $exp, win => $win, range => $rng, 345 exp => $exp, win => $win, range => $rng,
339 food => $fg, mana => $mg, hp => $hg, grace => $gg 346 food => $fg, mana => $mg, hp => $hg, grace => $gg
648 $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "Def. say cmd"); 655 $table->add (0, 6, new CFClient::UI::Label valign => 0, align => 1, text => "Def. say cmd");
649 $table->add (1, 6, my $saycmd = new CFClient::UI::Entry 656 $table->add (1, 6, my $saycmd = new CFClient::UI::Entry
650 text => $CFG->{say_command}, 657 text => $CFG->{say_command},
651 tooltip => "This is the command that will be used if you write a line in the message window entry. " 658 tooltip => "This is the command that will be used if you write a line in the message window entry. "
652 ."Usually you want to enter something like 'say' or 'shout' or 'gsay' here. " 659 ."Usually you want to enter something like 'say' or 'shout' or 'gsay' here. "
653 ."But you could also set it to 'tell <playername>' to only chat with that user.", 660 ."But you could also set it to 'tell &lt;playername&gt;' to only chat with that user.",
654 connect_changed => sub { 661 connect_changed => sub {
655 my ($self, $value) = @_; 662 my ($self, $value) = @_;
656 $CFG->{say_command} = $value; 663 $CFG->{say_command} = $value;
657 } 664 }
658 ); 665 );
1093 } 1100 }
1094 1101
1095gotid: 1102gotid:
1096 $face->{id} = $id; 1103 $face->{id} = $id;
1097 $MAP->set_face ($facenum => $id); 1104 $MAP->set_face ($facenum => $id);
1105 $self->{faceid}[$facenum] = $id;#d#
1098 $TILECACHE->get ($id) 1106 $TILECACHE->get ($id)
1099} 1107}
1100 1108
1101sub conn::face_update { 1109sub conn::face_update {
1102 my ($self, $facenum, $face) = @_; 1110 my ($self, $facenum, $face) = @_;
1110 my ($self, $id, $data) = @_; 1118 my ($self, $id, $data) = @_;
1111 1119
1112 $self->{texture}[$id] ||= do { 1120 $self->{texture}[$id] ||= do {
1113 my $tex = 1121 my $tex =
1114 new_from_image CFClient::Texture 1122 new_from_image CFClient::Texture
1115 $data, minify => 1; 1123 $data, minify => 1, mipmap => 1;
1116 1124
1117 $MAP->set_texture ($id, @$tex{qw(name w h s t)}, @{$tex->{minified}}); 1125 $MAP->set_texture ($id, @$tex{qw(name w h s t)}, @{$tex->{minified}});
1118 $MAPWIDGET->update; 1126 $MAPWIDGET->update;
1119 1127
1120 $tex 1128 $tex
1243 $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'"); 1251 $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'");
1244 $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'"); 1252 $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'");
1245 } 1253 }
1246} 1254}
1247 1255
1256sub update_floorbox {
1257 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub {
1258 $FLOORBOX->clear;
1259 $FLOORBOX->add (new CFClient::UI::Empty expand => 1);
1260
1261 my @items = values %{ $CONN->{container}{0} };
1262
1263 # we basically have to use the same sorting as everybody else
1264 @items = sort { $a->{type} <=> $b->{type} } @items;
1265
1266 for my $item (reverse @items) {
1267 my $desc = $item->{nrof} < 2
1268 ? $item->{name}
1269 : "$item->{nrof} $item->{name_pl}";
1270 # todo: animation widget, face widget, weight(?) etc.
1271 $FLOORBOX->add (my $hbox = new CFClient::UI::HBox
1272 tooltip => (CFClient::UI::Label->escape ($desc)
1273 . "\n<small>leftclick - pick up\nmiddle click - apply\nrightclick - menu</small>"),
1274 can_hover => 1,
1275 can_events => 1,
1276 );
1277
1278 $hbox->add (new CFClient::UI::Face
1279 face => $item->{face},
1280 anim => $item->{anim},
1281 animspeed => $item->{animspeed},
1282 );
1283
1284 $hbox->add (new CFClient::UI::Label
1285 text => $desc,
1286 );
1287 }
1288 });
1289 refresh;
1290}
1291
1248sub conn::container_add { 1292sub conn::container_add {
1249 my ($self, $id, $items) = @_; 1293 my ($self, $id, $items) = @_;
1250 1294
1251 # 0 floor 1295 update_floorbox if $id == 0;
1252 # $self-<{player}{tag} => player inv 1296 # $self-<{player}{tag} => player inv
1253 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; 1297 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}};
1254} 1298}
1255 1299
1256sub conn::container_clear { 1300sub conn::container_clear {
1257 my ($self, $id) = @_; 1301 my ($self, $id) = @_;
1302
1303 update_floorbox if $id == 0;
1258# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; 1304# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
1305}
1306
1307sub conn::item_delete {
1308 my ($self, @items) = @_;
1309
1310 for (@items) {
1311 update_floorbox if $_->{container} == 0;
1312 }
1313}
1314
1315sub conn::item_update {
1316 my ($self, $item) = @_;
1317
1318 update_floorbox if $item->{container} == 0;
1259} 1319}
1260 1320
1261%SDL_CB = ( 1321%SDL_CB = (
1262 CFClient::SDL_QUIT => sub { 1322 CFClient::SDL_QUIT => sub {
1263 Event::unloop -1; 1323 Event::unloop -1;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines