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

Comparing deliantra/server/ext/books.ext (file contents):
Revision 1.1 by root, Thu May 24 03:33:29 2007 UTC vs.
Revision 1.4 by root, Tue Sep 23 04:29:11 2008 UTC

1#! perl # MANDATORY 1#! perl # mandatory
2 2
3our @BOOKS; 3our @BOOKS;
4 4
5sub reload() { 5sub reload() {
6 @BOOKS = (); 6 @BOOKS = ();
23 } 23 }
24 24
25 @BOOKS = @books; 25 @BOOKS = @books;
26} 26}
27 27
28cf::sync_job {
29 reload; 28reload;
30};
31 29
32sub make_book { 30sub make_book {
33 my ($book, $level) = @_; 31 my ($book, $level) = @_;
34 32
35 return unless @BOOKS; 33 return unless @BOOKS;
36 34
37 my ($title, @body) = @{$BOOKS[rand @BOOKS]}; 35 my ($title, @body) = @{$BOOKS[rand @BOOKS]};
38 36
37 # half-assed attempt to make it a single line text-only title
39 $title = cf::pod::as_text [$title]; 38 $title = cf::pod::as_cfpod [$title];
40 $title =~ s/\n/ /g; 39 $title =~ s/\n/ /g;
41 $title =~ s/ +$//; 40 $title =~ s/ +$//;
41 $title =~ s/B<([^>]*)>/$1/g;
42 42
43 $book->name ($title); 43 $book->name ($title);
44 $book->name_pl ($title); 44 $book->name_pl ($title);
45 $book->title (undef); 45 $book->title (undef);
46 $book->msg (cf::pod::as_text \@body); 46 $book->msg (cf::pod::as_cfpod \@body);
47} 47}
48 48

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines