IMC2 4.23c MUD-Net
------------------

Original IMC2 Code Copyright 1996,1997 Oliver Jowett <oliver@jowett.manawatu.planet.co.nz>
IMC2 Gold versions 1.00-2.00g Copyright 1999-2001 MudWorld www.mudworld.org
IMC2 MUD-Net versions 3.00 through 3.10 MUD-Net Copyright 2002-2003 Roger Libiez ( Samson )
Additional code for 3.10 Copyright 2002 Orion Elder
Version 3.10 and above is registered with the United States Copyright Office.
TX 5-555-584.
Version 4.20 through 4.23c MUD-Net Copyright 2003 Roger Libiez ( Samson )
Additional code for 4.23c Copyright 2003 provided by Xorith@Shards of Reality.

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

1. Read and comply with the terms of the GPL, which is included in the file
"COPYING". Since the GPL allows for the acceptance of monetary payment, this
code cannot be legally distributed as part of a DikuMud or DikuMud derived
codebase.

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

This code allows your mud to connect to an interlinked mud chat network.
Decentralized hubs then router traffic between the various muds which are
connected to them. This version is a cleaned up and enhanced version of the
code. Security problems and some general ugliness have been fixed and the
code consolidated down to these 3 files for easier maintenance. It now
also compiles cleanly on many different codebases with a few simple compiler
flag changes. Main drawbacks being that the protocol itself is largely
undocumented.

This code will peacefully coexist with the Intermud-3 code, and some of you
may already be members of that network. You may install this alongside as
you see fit, but unless you have some pressing need to be situated on
both networks it is recommended that the Intermud-3 code be used instead.
Biased opinion? Perhaps, but it's been my experience that the design of
the Intermud-3 network is vastly superior to the *ahem* hackish nature
of the current IMC2 network(s).

No channels have been included with this package due to the ability to connect
automatically with any appropriately configured network. Channel information
will be delivered to your mud by the hub you connect to. Some networks may also
have a premade channel file you can download.

   Regarding the 4.00 and 4.01 client version numbers. Initially it was planned for the
Continuum and Vulcan lines to be labeled as 3.14 and 3.15, respectively. However, Ntanel thought
there would be confusion, flamewars, or other issues with doing so and asked for it to be raised
to 4.x. As it turned out, the flamewars erupted because of this change. When this was brought to
light, the developers of the Continuum line chose to leave the false increase in place and
as of this writing they continue to do so for marketing reasons. The version increase does not
accurately reflect changes to the code. To correct for THIS confusion, since people mistakenly
believe it to be "better" than the 3.22b client code, the 3.22b client code has had its version
number "corrected" to reflect the true nature of changes and fixes involved in the development of
that branch. So until this marketing move is corrected to reflect the truth, the client code has
been raised to version 4.23c to compensate for this. If someday the decision is made to fix the
increase, then the MUD-Net client will follow suit. Should be noted that 4.00 and 4.01 clients
*DO NOT* support autosetup and therefore *WILL* still need to apply for a connection.

This code has been tested and works on the following STOCK codebases:

Smaug 1.02a ( See Smaug102a.txt ) + the following derivitives:
  Smaug 1.4a
  Star Wars Reality 1.0 and 2.0 - see swr.txt
  CalareyMud 1.0
  CalareyMud 2.0 and 3.0 - See cm23.txt
  ResortMud 4.0b, ResortMud 4.1

Rom 2.4b6 + the following derivitives:
  RoT 1.4
  DoC ( RoT derivative )
  Paradox
  Rogue 2.1a
  Wurm 2.8c
  Tartarus 1.0
  QuickMUD
  Anatolia 2.1b2
  Oblivion 1.2 Alpha - see Oblivion.txt
  Sundermud 1.0 - see Sunder.txt
  EmberMUD 0.9.44a - see Ember.txt

AckMUD! 4.3.1

Merc 2.2 + the following derivitives:
  Mythran 3.1.6b
  Envy 2.2 - see Envy.txt
  EOS2 - see EOS2.txt
  Nimud 4 - see Nimud.txt
  Godwars Dystopia - see Dystopia.txt
  Godwars Deluxe - see GWDeluxe.txt

UltraEnvy 0.87j + the following derivitives:
  Greed 0.99.7 - see Greed.txt

CircleMud 3.0bpl20 - Requires special config, see Circle3.txt

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

0 ( Yes, ZERO - IE preinstall steps )

***
If upgrading 3.20 or 3.21:

Drop the 3 source files into your source directory.
Adjust imccfg.h as needed.
Recompile the mud.
***

***
If upgrading from 3.10:

Drop the 3 source files into your source directory.
Perform step 6 of the install. Slight changes to this part.
Adjust imccfg.h as needed.
Recompile the mud.
You should not need to mess with your config files.
***

***
If upgrading from 3.00:

Drop the 3 source files into your source directory.
Go over the install steps one by one and adjust your installation as necessary.
Pay special attention to step 6.
Adjust imccfg.h as needed.
Recompile the mud.
You should not need to mess with your config files.
***

***
If upgrading from any version below 3.00 ( IE: 2.00g or 1.03g etc ):

Remove any and all referrence to existing IMC2 code within your codebase.
This will no doubt be a very tedious process, but it really does need to be done.
ALL of it, every last C and H file. Many Merc derived codebases have been
packaged with some form of it over the years( in violation of the GPL ). Trust us here.
GET RID OF THE OLD CODE - If you don't think it's there, check anyway.

Keep your 'config' file in a safe place - you'll need the information in
it to port over to this code when your done. DONT LOSE IT!

You may safely delete the 'icec' file, current channel information is in the
imc.channels file which came with this code.

Also delete the following if they are present: 'lock' 'mail-ids' 'mail-list' and 'mail-queue'
These files will no longer be required.
***

NOTE: These directions are only a guide - they have to be somewhat general to support
more than one codebase. It should not be TOO difficult to figure out the intent.

1. In your main directory, create an 'imc' directory if it does not yet exist.
   In that directory, place the imc.config, imc.channels, and imc.ignores files.
   Transfer them as ascii files.

   STOP NOW IF YOU ARE RUNNING CIRCLE 3.0! Open Circle.txt - You cannot continue with these directions!

2. Place imc.c, imc.h, and imccfg.h files in your src directory.

   STOP NOW IF YOU ARE RUNNING AFKMUD AND SKIP TO STEP 9!

   Then in your Makefile, someplace above the main list of C_FLAGS,
   include the following:

#IMC2 - Comment out to disable IMC2 support
IMC = 1

   Then directly below the list of C and/or O files, add the following:
   [Note: BSD users - put a period in front of the word ifdef, and in front of the word endif]

ifdef IMC
   C_FILES := imc.c $(C_FILES)
   O_FILES := imc.o $(O_FILES)
   C_FLAGS := $(C_FLAGS) -DIMC <codebase flag>
endif

   Substitute one of the following for codebase flag:

   -DIMCSMAUG, -DIMCROM, -DIMCACK, -DIMCMERC, -DIMCUENVY

3a. SMAUG: Open mud.h

   Locate the following:

/*
 * Structure for extended bitvectors -- Thoric
 */
struct extended_bitvector
{
    unsigned int		bits[XBI]; /* Needs to be unsigned to compile in Redhat 6 - Samson */
};

   Directly below that, add the following:

#ifdef IMC
   #include "imc.h"
#endif

   Continue to step 3e

3b. ROM: Open merc.h and locate the following code:

#define IMPLEMENTOR		MAX_LEVEL
#define	CREATOR			(MAX_LEVEL - 1)
#define SUPREME			(MAX_LEVEL - 2)
#define DEITY			(MAX_LEVEL - 3)
#define GOD			(MAX_LEVEL - 4)
#define IMMORTAL		(MAX_LEVEL - 5)
#define DEMI			(MAX_LEVEL - 6)
#define ANGEL			(MAX_LEVEL - 7)
#define AVATAR			(MAX_LEVEL - 8)
#define HERO			LEVEL_HERO

   Directly below that, add the following:

#ifdef IMC
   #include "imc.h"
#endif

   Continue to step 3e

3c. ACK: Open ack.h and locate the following:

#ifndef DEC_STRFUNS_H
#include "strfuns.h"
#endif

#ifndef DEC_ACT_MOB_H
#include "act_mob.h"
#endif

   Directly below that, add the following:

#ifdef IMC
   #include "imc.h"
#endif

   Continue to step 3e

3d. MERC: Open merc.h and locate the following code:

#define PULSE_PER_SECOND	    4
#define PULSE_VIOLENCE		  ( 3 * PULSE_PER_SECOND)
#define PULSE_MOBILE		  ( 4 * PULSE_PER_SECOND)
#define PULSE_TICK		  (30 * PULSE_PER_SECOND)
#define PULSE_AREA		  (60 * PULSE_PER_SECOND)

   Directly below that, add the following:

#ifdef IMC
   #include "imc.h"
#endif

   Continue to step 3e

3e. Locate your pc_data struct, which should be in one of your main *.h files.

   Add the following to the end of it:

#ifdef IMC
    IMC_CHARDATA *imcchardata;
#endif

4. Open interp.c and locate the following section:

if ( !check_social( ch, command, argument )

   Add the following condition to whatever series of ifchecks exist there:

#ifdef IMC
	&&   !imc_command_hook( ch, command, argument )
#endif

5. Open comm.c and locate the following in main() :

    log_string("Initializing socket");
    control  = init_socket( port   );
    control2 = init_socket( port+1 );
    conclient= init_socket( port+10);
    conjava  = init_socket( port+20);

   Add the following beneath that:

#ifdef IMC
    imc_startup( FALSE ); // FALSE arg, so the autoconnect setting can govern it.
#endif

   Then further down in main(), locate the following:

   close( control );

   Add the following beneath that:

#ifdef IMC
   imc_shutdown( FALSE );
#endif

   Then in game_loop(), locate the following:
   [Look for game_loop_unix on Merc, Rom, and ACK]

	/*
	 * Autonomous game motion.
	 */
	update_handler( );

   Directly ABOVE that, add the following:

#ifdef IMC
	imc_loop();
#endif

6. Open save.c and locate fread_char:

   In the case 'I': section, and right before the final break; add the follwing:
   [Merc22 does not have a case 'I': section, so you'll need to make one.]

#ifdef IMC
           if( ( fMatch = imc_loadchar( ch, fp, word ) ) )
                break;
#endif

   Then in fwrite_char, locate:

    fprintf( fp, "End\n\n" );

   Directly ABOVE that, add:

#ifdef IMC
    imc_savechar( ch, fp );
#endif

   Then in load_char_obj(), locate the following:

    found = FALSE;
    sprintf( strsave, "%s%c/%s", PLAYER_DIR, tolower(name[0]), capitalize( name ) );

   Directly ABOVE that, add the following:

#ifdef IMC
    imc_initchar( ch );
#endif

7. Open db.c [On some bases, this will be located in recycle.c]

   Locate free_char:

   Directly before the pc_data information is disposed, add:

#ifdef IMC
	imc_freechardata( ch );
#endif

8. For users of copyover/hotboot ONLY:

   Locate do_copyover, and just before the buffers for the execl call are
   allocated, add the following:

#ifdef IMC
   imc_shutdown( FALSE );
#endif

9. Make clean, recompile.

If this is a NEW install, read step 10a and then stop.
If this is an UPGRADE to an existing install for a client BELOW 3.00, skip to 10b.
If this is an upgrade to a 3.x install, stop now. You are DONE.

10a. At this point, the code should have compiled.

   Getting connected to a network depends on the policies in place at the one you've
   chosen to join.

   If they are running 3.20 hubs, you should be able to connect without an application
   provided they have the information available and are not private or full.

   If not, then there will be an application proceedure somewhere on their site.
   Fill it out according to whatever they're asking for.

10b. After you reboot, using the 'imcconfig' command, set your configuration info up.
    In your old config file ( you DID keep it, yes? ), find your 'Connection' line.

    It will look something like this:

Connection Hub8:hub8.imc2.org:9010:skunkboy:lives:0:0:reconnect

    Under the imc config options, each of these needs to be entered separately.
    Connectpwd1 is the 4th parameter in the line, Connectpwd2 is the 5th.
    Ignore everything past the 5th parameter since those values are no longer used.

    Once you have this information set, you should be able to turn the connection on.
    Try it. If something fails, it may crash the mud, but you can always contact us
    and ask for help. Send a copy of your OLD config and NEW config files and we can
    sort out whatever the problem may be.
