AFKMud 2.0 MySQL Database Help Files
------------------------------------

Prerequisite Requirements
-------------------------

A server environment in which you have access to MySQL, and have an existing database to use.
If you don't know if you have a database, contact your hosting admin.

The desire to begin moving away from flatfile storage of game data. :)

Terms of Use
------------

1. You may use this snippet in your code provided that any included
comment headers in the code are left intact. You may add your own, but
do not take mine out.

2. This snippet may not be posted for redistribution on any site
without obtaining prior written consent from the AFKMud team.

I am highly unlikely to notice any support requests or bug reports anywhere
outside of the forum at SmaugMuds.org. You can blame the general hostility
of the larger MUD community for this. So if you need to do that, you can
do it at http://www.smaugmuds.org but I won't see or respond to it anywhere else.

If you can't agree to these terms, don't use this code, and don't expect
me to help if something breaks while installing it. Harsh? Hardly. I'm
tired of people who come crawling to whine and complain when they haven't
bothered to comply with the terms first.

What this code does
-------------------

This code provides the support to store help files in a MySQL database.
The help data is then queried on the fly from within the mud, and can also
be manipulated from a website with the proper additional scripting support.

The intention of this code is to provide the first real step in beginning a move
from flatfile storage of game data over to more robust database storage.

It is not intended to demonstrate the BEST method for doing this, just one that does work.
Over time, additional database support will likely be made available, such as being
able to use PostgreSQL or some other database engine.

Installation Instructions
-------------------------

1. Verify that you have your database information setup properly. You will need the following:

  Database username
  Database password
  Database name
  Database server

  These can be set using the cset command from within the game and must match up what your host
  has provided for you.

2. Make a backup copy of your existing help.cpp and help.h files somewhere safe.

3. Upload the new help.cpp file to your src directory.

4. Make clean.

5. Reboot the mud.

6. Using cedit, create a helpconvert command. Then do cedit save cmdtable

7. Run the helpconvert command. Follow any instructions it givs you, and don't be surprised if it happens to crash.

8. If all goes well and you get confirmation that it converted everything, test to be sure help files come up.
The standard flatfile helps load, but are not accessible, so if this worked you'll see what you expect. Otherwise
you'll get back nothing.

9. In db.cpp,

Locate the following, and comment it out ( until you're sure you won't be needing it again ):

   log_string( "Loading helps..." );
   load_helps();

10. In comm.cpp, locate and remove the following line of code:

void free_helps(  );

Then in function cleanup_memory, locate and remove the following code:

   // Helps
   fprintf( stdout, "%s", "Helps.\n" );
   free_helps(  );

10. In the newly provided help.cpp file, locate the following line of code:

// When done with this conversion, it would be wise beyond belief to get rid of everything in this file from this point down.

When you are sure you won't be needing to convert the flat file into the database table, remove everything from that
point in the file to the bottom and recompile your code. After rebooting, get rid of the helpconvert command as well.

11. You can also optionally remove the help.h file at this point - it won't be required anymore.

At this point you're all set. Your help files should be getting served up by the database now.

This code has been installed and tested on AFKMud 2.0. If you are using an older
version of AFKMud, or using Smaug or some other codebase, then obtaining the necessary
database support files is up to you.

No guarantees are made that this code will be compatible with your codebase and any
modifications you may have made to it. No warranty of any kind is expressed or implied
by the use of this code, and we are not responsible for any damages which may result
from the application of this snippet to your codebase.