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.9 by elmex, Mon May 29 19:30:28 2006 UTC vs.
Revision 1.15 by root, Thu Jun 1 18:56:05 2006 UTC

268 unless ($id) { 268 unless ($id) {
269 # create new id for face 269 # create new id for face
270 # I love transactions 270 # I love transactions
271 for (1..100) { 271 for (1..100) {
272 my $txn = $CFClient::DB_ENV->txn_begin; 272 my $txn = $CFClient::DB_ENV->txn_begin;
273 my $status = $self->{facemap}->db_get (id => $id, BerkeleyDB::DB_RMW); 273 my $status = $self->{facemap}->db_get (id => $id);
274 if ($status == 0 || $status == BerkeleyDB::DB_NOTFOUND) { 274 if ($status == 0 || $status == BerkeleyDB::DB_NOTFOUND) {
275 $id = ($id || 16) + 1; 275 $id = ($id || 16) + 1;
276 if ($self->{facemap}->put (id => $id) == 0 276 if ($self->{facemap}->put (id => $id) == 0
277 && $self->{facemap}->put ($hash => $id) == 0) { 277 && $self->{facemap}->put ($hash => $id) == 0) {
278 $txn->txn_commit; 278 $txn->txn_commit;
279 279
280 goto gotid; 280 goto gotid;
281 } 281 }
282 } 282 }
283 $txn->abort; 283 $txn->txn_abort;
284 } 284 }
285 285
286 CFClient::fatal "maximum number of transaction retries reached - database problems?"; 286 CFClient::fatal "maximum number of transaction retries reached - database problems?";
287 } 287 }
288 288
339 339
340 $prompt = $LAST_QUERY unless length $prompt; 340 $prompt = $LAST_QUERY unless length $prompt;
341 $LAST_QUERY = $prompt; 341 $LAST_QUERY = $prompt;
342 342
343 my $dialog = new CFClient::UI::FancyFrame 343 my $dialog = new CFClient::UI::FancyFrame
344 x => "center",
345 y => "center",
344 title => "Query", 346 title => "Query",
345 child => my $vbox = new CFClient::UI::VBox, 347 child => my $vbox = new CFClient::UI::VBox,
346 on_visibility_change => sub {
347 my ($self, $visible) = @_;
348 $self->center if $visible;
349 },
350 ; 348 ;
351 349
352 $vbox->add (new CFClient::UI::Label 350 $vbox->add (new CFClient::UI::Label
353 max_w => $::WIDTH * 0.4, 351 max_w => $::WIDTH * 0.4,
354 ellipsise => 0, 352 ellipsise => 0,
447sub spell_add { 445sub spell_add {
448 my ($self, $spell) = @_; 446 my ($self, $spell) = @_;
449 447
450 # TODO 448 # TODO
451 # create a widget dynamically, using spell face (CF::Protocol downloads them) 449 # create a widget dynamically, using spell face (CF::Protocol downloads them)
450 $::SPELL_LIST->add_spell ($spell);
451
452 $self->{map_widget}->add_command ("invoke $spell->{name}", CFClient::UI::Label::escape $spell->{message}); 452 $self->{map_widget}->add_command ("invoke $spell->{name}", CFClient::UI::Label::escape $spell->{message});
453 $self->{map_widget}->add_command ("cast $spell->{name}", CFClient::UI::Label::escape $spell->{message}); 453 $self->{map_widget}->add_command ("cast $spell->{name}", CFClient::UI::Label::escape $spell->{message});
454} 454}
455 455
456sub spell_delete { 456sub spell_delete {
457 my ($self, $spell) = @_; 457 my ($self, $spell) = @_;
458 $::SPELL_LIST->remove_spell ($spell);
458} 459}
459 460
460sub addme_success { 461sub addme_success {
461 my ($self) = @_; 462 my ($self) = @_;
462
463 $self->send ("command output-sync $::CFG->{output_sync}");
464 $self->send ("command output-count $::CFG->{output_count}");
465 463
466 my $parser = new Pod::POM; 464 my $parser = new Pod::POM;
467 my $pod = $parser->parse_file (CFClient::find_rcfile "pod/skill_help.pod"); 465 my $pod = $parser->parse_file (CFClient::find_rcfile "pod/skill_help.pod");
468 466
469 my %skill_tooltip; 467 my %skill_tooltip;
552} 550}
553 551
554sub set_opencont { 552sub set_opencont {
555 my ($conn, $tag, $name) = @_; 553 my ($conn, $tag, $name) = @_;
556 $conn->{open_container} = $tag; 554 $conn->{open_container} = $tag;
557 $::INVR_LBL->set_text ($name); 555
556 $::INV_RIGHT_HB->clear ();
557 $::INV_RIGHT_HB->add (new CFClient::UI::Label align => 0, expand => 1, text => $name);
558
559 if ($tag != 0) { # Floor isn't closable, is it?
560 $::INV_RIGHT_HB->add (new CFClient::UI::Button
561 text => "Close container",
562 tooltip => "Close the currently open container (if one is open)",
563 on_activate => sub {
564 $::CONN->send ("apply $tag") # $::CONN->{open_container}")
565 if $tag != 0;
566 #if $CONN->{open_container} != 0;
567 },
568 );
569 }
570
558 $::INVR->set_items ($conn->{container}{$tag}); 571 $::INVR->set_items ($conn->{container}{$tag});
559} 572}
560 573
561sub update_container { 574sub update_container {
562 my ($tag) = @_; 575 my ($tag) = @_;
591 if ($tag == 0) { 604 if ($tag == 0) {
592 update_floorbox; 605 update_floorbox;
593 update_container (0); 606 update_container (0);
594 } elsif ($tag == $self->{player}{tag}) { 607 } elsif ($tag == $self->{player}{tag}) {
595 $::INV->set_items ($self->{container}{$tag}) 608 $::INV->set_items ($self->{container}{$tag})
609 } else {
610 update_container ($tag);
596 } 611 }
597 612
598# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; 613# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
599} 614}
600 615
608 update_floorbox; 623 update_floorbox;
609 update_container ($_->{tag}); 624 update_container ($_->{tag});
610 } elsif ($_->{container} == $self->{player}{tag}) { 625 } elsif ($_->{container} == $self->{player}{tag}) {
611 $::INV->set_items ($self->{container}{$self->{player}{tag}}) 626 $::INV->set_items ($self->{container}{$self->{player}{tag}})
612 } else { 627 } else {
613 update_container ($_->{tag}); 628 update_container ($_->{container});
614 } 629 }
615 } 630 }
616} 631}
617 632
618sub item_update { 633sub item_update {
643} 658}
644 659
645sub player_update { 660sub player_update {
646 my ($self, $player) = @_; 661 my ($self, $player) = @_;
647 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000); 662 $::STATWIDS->{weight}->set_text (sprintf "Weight: %.1fkg", $player->{weight} / 1000);
663
664 # do it here because it is ignored earlier, and there is no "login" event
665 $self->send_command ("output-sync $::CFG->{output_sync}");
666 $self->send_command ("output-count $::CFG->{output_count}");
648} 667}
649 668
6501; 6691;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines