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

Comparing deliantra/Deliantra-Client/DC.pm (file contents):
Revision 1.113 by root, Mon Aug 14 01:21:01 2006 UTC vs.
Revision 1.120 by root, Wed Sep 20 16:01:07 2006 UTC

13=cut 13=cut
14 14
15package CFPlus; 15package CFPlus;
16 16
17BEGIN { 17BEGIN {
18 $VERSION = '0.2'; 18 $VERSION = '0.52';
19 19
20 use XSLoader; 20 use XSLoader;
21 XSLoader::load "CFPlus", $VERSION; 21 XSLoader::load "CFPlus", $VERSION;
22} 22}
23 23
69my %DB_SYNC; 69my %DB_SYNC;
70 70
71sub put($$$) { 71sub put($$$) {
72 my ($db, $key, $data) = @_; 72 my ($db, $key, $data) = @_;
73 73
74 my $hkey = $db + 0;
75 Scalar::Util::weaken $db;
74 $DB_SYNC{$db} = AnyEvent->timer (after => 5, cb => sub { $db->db_sync }); 76 $DB_SYNC{$hkey} ||= AnyEvent->timer (after => 5, cb => sub {
77 delete $DB_SYNC{$hkey};
78 $db->db_sync if $db;
79 });
75 80
76 $db->db_put ($key => $data) 81 $db->db_put ($key => $data)
77} 82}
78 83
79package CFPlus; 84package CFPlus;
281 &::open_string_query ("Text to inscribe", sub { 286 &::open_string_query ("Text to inscribe", sub {
282 my ($entry, $txt) = @_; 287 my ($entry, $txt) = @_;
283 $::CONN->send ("mark ". pack "N", $self->{tag}); 288 $::CONN->send ("mark ". pack "N", $self->{tag});
284 $::CONN->send ("command use_skill inscription $txt"); 289 $::CONN->send ("command use_skill inscription $txt");
285 }); 290 });
291 }
292 ],
293 ["rename", # first try of an easier use of flint&steel
294 sub {
295 &::open_string_query ("Rename item to:", sub {
296 my ($entry, $txt) = @_;
297 $::CONN->send ("mark ". pack "N", $self->{tag});
298 $::CONN->send ("command rename to <$txt>");
299 }, $self->{name},
300 "If you input no name or erase the current custom name, the custom name will be unset");
286 } 301 }
287 ], 302 ],
288 ["apply", sub { $::CONN->send ("apply $self->{tag}") }], 303 ["apply", sub { $::CONN->send ("apply $self->{tag}") }],
289 ( 304 (
290 $self->{flags} & F_LOCKED 305 $self->{flags} & F_LOCKED

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines