ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/ext/login.ext
(Generate patch)

Comparing deliantra/server/ext/login.ext (file contents):
Revision 1.11 by root, Sun Jan 7 02:39:14 2007 UTC vs.
Revision 1.13 by root, Sun Jan 7 23:10:42 2007 UTC

158 nuke_str $pass; 158 nuke_str $pass;
159 # password matches, wonderful 159 # password matches, wonderful
160 my $pl = cf::player::find $user or next; 160 my $pl = cf::player::find $user or next;
161 $pl->connect ($ns); 161 $pl->connect ($ns);
162 check_clean_save $pl; 162 check_clean_save $pl;
163 $pl->{clean_save} = 1;
163 last; 164 last;
164 } elsif (can_cleanup $buf, $mtime) { 165 } elsif (can_cleanup $buf, $mtime) {
165 Coro::Timer::sleep 1; 166 Coro::Timer::sleep 1;
166 167
167 $ns->send_drawinfo ( 168 $ns->send_drawinfo (
255 last; 256 last;
256 } 257 }
257 }); 258 });
258} 259}
259 260
260# "Quitting will delete your character PERMANENTLY. If you are sure you want to do this, then use the quit_character command instead of quit." 261cf::register_command quit => sub {
261# "Quitting will delete your character.\nAre you sure you want to quit (y/n):" 262 my ($ob, $arg) = @_;
262# quit, quit_character, save 263
264 $ob->reply (undef,
265 "Quitting will delete your character PERMANENTLY: It will be gone forever and any progress will be lost. "
266 . "If you are sure you want to do this, then use the quit_character command instead of quit.",
267 cf::NDI_UNIQUE | cf::NDI_RED);
268};
269
270cf::register_command quit_character => sub {
271 my ($ob, $arg) = @_;
272
273 my $pl = $ob->contr;
274
275 $pl->ns->query (cf::CS_QUERY_SINGLECHAR, "Do you want to PERMANENTLY delete your character and all associated data (y/n)?", sub {
276 if ($_[0] !~ /^[yY]/) {
277 $ob->reply (undef,
278 "Ok, not not quitting then.",
279 cf::NDI_UNIQUE | cf::NDI_RED);
280 } else {
281 $ob->reply (undef,
282 "Ok, quitting, hope to see you again.",
283 cf::NDI_UNIQUE | cf::NDI_RED);
284 $pl->ns->flush;
285 $pl->quit_character;
286 }
287 });
288};
263 289
264cf::object->attach ( 290cf::object->attach (
265 type => cf::SAVEBED, 291 type => cf::SAVEBED,
266 on_apply => sub { 292 on_apply => sub {
267 my ($bed, $ob) = @_; 293 my ($bed, $ob) = @_;
282 if ($_[0] !~ /^[yY]/) { 308 if ($_[0] !~ /^[yY]/) {
283 $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1); 309 $pl->invoke (cf::EVENT_PLAYER_LOGOUT, 1);
284 $pl->deactivate; 310 $pl->deactivate;
285 $pl->ns->destroy; 311 $pl->ns->destroy;
286 } else { 312 } else {
287 cf::async { 313 cf::async { $pl->save };
288 $pl->{clean_save} = 1;
289 $pl->save;
290 };
291 } 314 }
292 }); 315 });
293 }, 316 },
294); 317);
295 318

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines