[Package Index | Mudlib Index | Effect Index]

File /obj/handlers/book_handler.c

This handler object deals with all the books that have been published. It keeps a save file of every book and a current book number. It will allow for easy finding again of preprinted books and for the easy removal of any books that happen to contain things like quest solutions and stuff.

See also:
/std/book.c and /std/print_shop.c

Written by Pinkfish

Started Sun Feb 1 20:24:33 CST 1998

Includes

This class includes the following files /include/language.h and /include/book_handler.h

Method index

Public Functions

These are functions that everyone can access.

add_banished_book
int add_banished_book(int book_num,
                      string reason)

This method banishes a book number for a certain reason.

Parameters:
book_num - the book number to banish
reason - the reason it was banished

Returns:
1 on success and 0 on failure.

See also:
query_banished_book() and query_all_banished_books()


add_book
int add_book(object book,
             int num,
             string pl_name)

Adds a newly minted book into our nice list of stuff. This returns the book number for this book. You can use this to add a book if you already know its book number, if it does not match to the saved book number then it will return a new number. If it does match it will return the same number.

Parameters:
book - the book to add
num - the possible book number it already has

See also:
check_book_same()


check_book_same
int check_book_same(object book,
                    int num)

Checks to see if the passed in book is the same as the current book number that is set on it. We only look at the text and ignore the type and language with which it is written.

Parameters:
book - the book to check
num - the book number to check against

See also:
compare_pages() and add_book()


compare_page
int compare_page(string page1,
                 string page2)

Compares the open pages of two books to see if the text is the same. It ignores language and style of writing. This would also work on two pieces of paper.

Parameters:
page1 - the first book
page2 - the second book

See also:
check_book_same() and add_book()


compare_pages
int compare_pages(string * pages1,
                  string * pages2)

This method will try and figure out the percentage changed between the two page arrays.

Parameters:
pages1 - the first page array
pages2 - the second page array

Returns:
the percentage the same


load_it
void load_it()

Loads the state information from the save file.

See also:
load_it()


query_all_banished_books
mapping query_all_banished_books()

This method returns all the banished books. The keys are the numbers which are banished and the values are the reason for the banishment.

Returns:
the banished books mapping

See also:
add_banished_book() and query_banished_book()


query_banished_book
string query_banished_book(int book_num)

This method returns the banish string for the book.

Parameters:
book_num - the book number to check

Returns:
the banish reason, or 0 if none

See also:
add_banished_book() and query_all_banished_books()


query_book_exists
int query_book_exists(int book_num)

This tests to see if the given book number exists.

Parameters:
book_num - the number to test.

Returns:
1 if it exists, 0 if it does not.


query_book_owner
string query_book_owner(int book_num)

This method returns the owner associated with the book of a given number.

Parameters:
book_num - the book number to get the pages for

Returns:
the owner of the book

See also:
query_book_pages()


query_book_pages
string * query_book_pages(int book_num)

This method returns the pages associated with the book of a given number.

Parameters:
book_num - the book number to get the pages for

Returns:
the pages for the book

See also:
query_book_owner()


query_pages
string * query_pages(object book)

This method returns the array of useful pages in a book. It removes torn out pages and pages which are added by specific things in the game, like the print shop adding a fly leaf. It just returns the text for the pages, since this is what we are interested in.

Parameters:
book - the book to get the pages from

Returns:
the array of pages


save_it
void save_it()

Saves the current state information to the save file.

See also:
save_it()