VaultSTER Installation

From Nwnx

Contents

Authors: Rorrim, Orleron

Source: CoPaP Devwiki

Obtaining VaultSTER

Please head over to http://www.nwnx.org to receive the copy of Vaultster necessary to connect to other CoPaP servers. CoPaP tries to always use the latest version of VaulSTER available. You will not be able to use older versions to connect.

Installing VaultSTER

Installation is very easy. Copy the following files into your NWN directory:

send.dll
zlib.dll

Configuring VaultSTER

You will need to modify your copy of NWNX.ini. An example is shown below (notes are given in italics):

[VAULTSTER] Port = 5100

Path = (path to servervault. default should be c:\ everwinternights\ wn\\servervault)

Key = abcdefgh

Password = AVLIS

Startserver = 1

Validateclient = 0 (this will be set to 1 when the bug is fixed)

Count = 3 (or however many servers you are connected to)

Server1 = 24.224.162.19

Server2 = travellers.dnsalias.net

Server3 = rockhome.ath.cx

These three are just examples. Put whichever servers you are connected to into this list.



In the example above:

  • Port is the port to accept incoming Vaultster connections. Don't forget to open in on your firewall.
  • Path is the physical path to the server vault directory
  • Key is the key used in the encryption algorithm. It must be exactly eight characters.
  • Password is the password used in the application handshake.
  • Startserver indicates whether Vaulster should start automatically or not. A value of 0 here prevents it from starting automatically requiring scripts in the actual module to enable it. This is useful if more than one module is being run from the directory but not all of them need Vaulster.
  • Validateclient indicates whether you want to use the Validate Client feature. If this equals one, VaultSTER will check to make sure incoming players are coming from servers that are already on your list. It prevents people from being able to randomly make a portal to your server without you knowing about it.

Upgrading VaultSTER from a Previous Version

Okay, here's a step by step.

First, make sure you have installed, and are successfully running the latest NWNX. Once this is done, you may need to edit the nwnx.ini to switch from the default SQLite, to either the ODBC connection or direct MySQL connection, whichever you were already using.

Next, install the latest Vaultster:

1. Copy the contents of the vaultster.ini to the bottom of your nwnx.ini. Also make sure that you change the server count to the number of servers you will be connected to, and enter the addresses of those servers in the provided format. Also, until the problem is found and resolved, change Validate Client to 0.

2. If you use portal_inc already, you have two options.

A. You can replace the existing code with the following code, and also rename the vaultster.dll to send.dll: // Name  : Portal include file // Purpose  : Misc code for portalling between servers with NWNX Vaultster // Authors  : Ingmar Stieger // Modified : December 14, 2003 // January 13, 2005, By Mistcaller to add crafting xp transfer. // May 7, 2005 Adapted code for updated Vaultster version

  1. include "aps_include"
  2. include "portal_include"
  3. include "data_trans_inc"

// void main(){}

// Error codes returned by VaultSter const int VAULTSTER_OK = 0; const int VAULTSTER_FAILED = -1; const int VAULTSTER_SERVERBUSY = -2; const int VAULTSTER_NOPLAYER = -3; const int VAULTSTER_INTERNALERROR = -4;

// Status messages const int VAULTSTER_STATUS_OK = 0; const int VAULTSTER_STATUS_BUSY = 2; const int VAULTSTER_STATUS_ERROR= 3;

// Constants

const int iMaxTries = 30; const int IDLE = 0; const int BUSY = 1;

// Interface

string GetNWNXStatus(); int PortalStatus (object oPC); void WaitForPortalReady(object oPlayer, object oPortal, string sServer, string sWaypoint); string ConvertToFilename(string sPlayerName); void PortalPlayerNWNX(object oPlayer, object oPortal, string sServer, string sWaypoint);

// Implementation

int PortalStatus (object oPC) {

   // get the portal id from the player
   int id = GetLocalInt(oPC, "VAULTSTER_ID");
   if (id == 0)
       return VAULTSTER_STATUS_ERROR;
   // get the status from Vaultster
   object oModule = GetModule();
   SetLocalString(oModule, "NWNX!SEND!STATUS", IntToString(id-1));
   return StringToInt(GetLocalString(oModule, "NWNX!SEND!STATUS"));

}

string ConvertToFilename(string sPlayerName) {

   string sRes;
   string sChar;
   int i, j;
   int iLen = GetStringLength(sPlayerName);
   if (iLen > 16)
       iLen = 16;
   for (i = 0; i < iLen; i++)
   {
       sChar = GetSubString(sPlayerName, i + j, 1);
       if ((sChar != " ") && (sChar != "."))
           sRes += sChar;
       else
       {
           i--;
           j++;
       }
   }
   return sRes;

}

void WaitForPortalReady(object oPlayer, object oPortal, string sServer, string sWaypoint) {

   int iNWNXStatus = PortalStatus(oPlayer);
   if (iNWNXStatus == VAULTSTER_STATUS_OK)
   {
       // file successfully sent
       DeleteLocalInt(oPlayer, "portal_tries");
       DeleteLocalInt(oPlayer, "VAULTSTER_ID");
       ActivatePortal(oPlayer, GetIPAddress(sServer), GetPlayerPassword(sServer), sWaypoint, TRUE);
   }
   else if (iNWNXStatus == VAULTSTER_STATUS_BUSY)
   {
       // busy sending file, wait and try again later (at most 20 times)
       int iTries = GetLocalInt(oPlayer, "portal_tries");
       if (iTries < iMaxTries)
       {
           DelayCommand(2.0f, WaitForPortalReady(oPlayer, oPortal, sServer, sWaypoint));
           if ((iTries % 4) == 0)
               SendMessageToPC(oPlayer, "hold on...");
           SetLocalInt(oPlayer, "portal_tries", iTries + 1);
       }
       else
       {
           SendMessageToPC(oPlayer,
                           "Your character file could not be transfered successfully (still busy). Portaling aborted.");
           DeleteLocalInt(oPlayer, "portal_tries");
           DeleteLocalInt(oPlayer, "VAULTSTER_ID");
       }
   }
   else if (iNWNXStatus == VAULTSTER_STATUS_ERROR)
   {
       // an error occured
       SendMessageToPC(oPlayer,
                       "Your character file could not be transfered successfully (an error occured). Portaling aborted.");
       DeleteLocalInt(oPlayer, "portal_tries");
       DeleteLocalInt(oPlayer, "VAULTSTER_ID");
   }

}

void PortalPlayerNWNX(object oPlayer, object oPortal, string sServer, string sWaypoint) {

   // Crafting XP transfer (Mistcaller, Jan 05)
   SetLocalHideString(oPlayer,"EnterViaPortal", sServer);
   TransferCraftingSkillsToHide(oPlayer);
   ExportSingleCharacter(oPlayer);
   // get ip address from database and remove any port definition
   string sServerIP = GetIPAddress(sServer);
   int iPos = FindSubString(sServerIP, ":");
   if (iPos != -1)
       sServerIP = GetStringLeft(sServerIP, iPos);
   string sFilename = ConvertToFilename(GetName(oPlayer));
   string sJob = sServerIP + "|" + GetPCPlayerName(oPlayer) + "|" + sFilename;
   SetLocalString(GetModule(), "NWNX!SEND!SEND", sJob);
   SetLocalInt(oPlayer, "VAULTSTER_ID", StringToInt(GetLocalString(GetModule(), "NWNX!SEND!SEND")) + 1);
   SendMessageToPC(oPlayer, "Trying to portal...");
   DelayCommand(5.0f, WaitForPortalReady(oPlayer, oPortal, sServer, sWaypoint));

}


B. You can use Teleri's code found here: http://www.copap.org/viewtopic.php?t=1093 and edit the line Code:

   return sRes + ".bic";

And change it to: Code:

   return sRes;

And import the vaultster_inc from the ERF provided with the Vaultster package.


Creating a Portal for VaultSTER

Once you have done everything above, the next step is to set up your database.

Create a new table called "servers", and give it the following properties:

name varchar(100) Null = No address varchar(100) Null = No dmpassword varchar(100) Null = No playerpassword varchar(100) Null = No


Type in the information into that new table for each server you wish to connect to. Name is the name of the server. You can call it whatever you want, but you will have to use this same name in your portal script (see below). Address is the IP or domain address for the server, with the port number. So for Avlis-Mikona it would be avlis.blackdagger.net:5121, for example. dmpassword is the DM Password for that server. This is optional. You can enter a "****" here if you wish. playerpassword is the player password for that server. This is not optional. You must have it for the portal to work.



Once the database is set up, you must now create a portal in game. A portal can be ANYTHING that is used, opened, closed, stepped on, or an area transition.

In this example, we will create an area transition.

Make your area transition normally, but do not put anything in the area transition target.

Open up the area transition properties. Click on the Scripts tab. Create a new script in the OnClick event of the Area Transition.

Your script should look like this (notes are in italics) :

// Name  : World portal ABC to server Xyz // Authors  : Ingmar Stieger // Modified : August 31, 2003

  1. include "aps_include"
  2. include "portal_include"
  3. include "portal_inc"

void main() {

   object oPortal = OBJECT_SELF;
   object oPlayer = GetClickingObject();
   if (!GetIsObjectValid(oPlayer))
       return;
  PortalPlayerNWNX(oPlayer, oPortal, "DESTINATION SERVER NAME", "DESTINATION SERVER WAYPOINT TAG");

}


NOTE: If you are doing this for a portal or usable object, you must change the GetClickingObject() to GetLastUsedBy(), or it will not work and nothing will happen when you use the portal.


Once the area transition is laid down, and VaultSTER is installed correctly, you need to reboot NWNX and your server. Check in the logs.# directory to make sure there is a file called vaultster.txt.

That file will look something like this:

[04/14/05 21:59:16] NWNX2 Vaultster version 1.4.2 for Windows. [04/14/05 21:59:16] Copyright 2004 (C) Jeroen Broekhuizen

[04/14/05 21:59:16] Loading in 1 known servers. [04/14/05 21:59:16] Added avlis.blackdagger.net [04/14/05 21:59:16] o Server started on port 5100.


If you see that last line, it means it's working properly.



The next thing you need to do is open up port 5100 on your firewall. Make sure it's set to "TCP" and not "UDP".



If you completed all these steps without forgetting any of them, the portal should work... provided that both the sender and receiver have set their VaultSTER's up correctly.

Personal tools