Attention all linked worlds!!! VaultSTER upgrade

Development for CoPaP
Post Reply
Orleron
Multiverse Scholar
Posts: 1247
Joined: Mon Nov 10, 2003 11:15 am
Location: Avlis
Contact:

Attention all linked worlds!!! VaultSTER upgrade

Post by Orleron »

Hala, Avlis, Mystara, Abyss, EA, Tairis'nadur:


The new version of VaultSTER has been in beta for awhile and seems reasonably stable now. Improvements will be made all along, of course, but I think it's good enough now to switch over CoPaP to the new version.

The new version of VaultSTER cannot link with the old version, so we kinda need to do this changeover all at once, in order to keep the links up.

I've given the go ahead to start the switchover on Avlis. Anyone else have any issues with doing the same right now?
Avlis: http://www.avlis.org

"My name is Orleron...a dungeonmaster...two years ago I got shot through a game client...I'm in a distant part of the internet aboard these servers of escaped mental patients...my players. I've made enemies, stupid, and annoying...now all I want to do is make CoPaP a reality, to warn Earth...Look inward(to your monitor) and share the newbies I've seen..."
Tristan_Durst
World Leader: Arborea
Posts: 236
Joined: Fri Oct 29, 2004 1:04 am

Post by Tristan_Durst »

Question: Is the new version Linux compatable? Was thinking when doing EQ upgrade to switch to Linux.

Thanks,
-Tristan
Orleron
Multiverse Scholar
Posts: 1247
Joined: Mon Nov 10, 2003 11:15 am
Location: Avlis
Contact:

Post by Orleron »

Seems so, though teleri can speak better about how well it works.
Avlis: http://www.avlis.org

"My name is Orleron...a dungeonmaster...two years ago I got shot through a game client...I'm in a distant part of the internet aboard these servers of escaped mental patients...my players. I've made enemies, stupid, and annoying...now all I want to do is make CoPaP a reality, to warn Earth...Look inward(to your monitor) and share the newbies I've seen..."
teleri
World Leader: The Outlands
Posts: 497
Joined: Thu Jul 01, 2004 2:24 pm
Location: Sigil
Contact:

Post by teleri »

yes the new version is linux compatable and works well. There are a few code changes that need to occur.

viewtopic.php?t=1024


specificaly this file portal_nwnx_inc.nss

This is the updated code.

Code: Select all

// FileName: portal_nwnx_inc.nss
// Name     : Portal include file
// Purpose  : Misc code for portalling between servers with NWNX Vaultster
// Authors  : Ingmar Stieger, JeroenB
// Modified : February 23, 2005

#include "vaultster_inc"
#include "aps_include"
#include "portal_include"
//void main(){}

// Constants

const int iMaxTries = 30;
const int IDLE = 0;
const int BUSY = 1;
const string SEND_SUCCESS = "0";
const string SEND_BUSY = "2";
const string SEND_ERROR = "3";

// Interface

string GetNWNXStatus();
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

string GetNWNXStatus()
{
    object oModule = GetModule();

    SetLocalString(oModule, "NWNX!SEND!STATUS", GetLocalString(oModule, "NWNX!ODBC!SPACER"));
    return 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 + ".bic";
}

void WaitForPortalReady(object oPlayer, object oPortal, string sServer, string sWaypoint)
{
    //string sNWNXStatus = GetNWNXStatus();
    int status = PortalStatus (oPlayer);

    if (status == VAULTSTER_STATUS_OK)
    {
        // file successfully sent
        DeleteLocalInt(oPlayer, "portal_tries");
        DeleteLocalInt(oPortal, "portal_state");
        ActivatePortal(oPlayer, GetIPAddress(sServer), GetPlayerPassword(sServer), sWaypoint,
                       TRUE);
    }
    else if (status == 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(oPortal, "portal_state");
        }
    }
    else if (status == 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(oPortal, "portal_state");
    }
}

void PortalPlayerNWNX(object oPlayer, object oPortal, string sServer, string sWaypoint)
{
    /*
     * Not neccessary here anymore. New vaultster can portal
     * multiple players at same time. Export is taken care of in
     * PortalPC function.
    if (GetLocalInt(oPortal, "portal_state") == BUSY)
    {
        SendMessageToPC(oPlayer, "Portal is currently occupied. Please try again later.");
        return;
    }

    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);

    /*
     * old format, should not be used anymore
    string sFilename = ConvertToFilename(GetName(oPlayer));
    string sJob = sServerIP + "|" + GetPCPlayerName(oPlayer) + "|" + sFilename;
    SetLocalString(GetModule(), "NWNX!SEND!SEND", sJob);
    */

    int ret = PortalPC (oPlayer, sServerIP);
    if (ret != VAULTSTER_OK) {
        SendMessageToPC (oPlayer, "Failed to portal.");
    }
    else {
        SendMessageToPC(oPlayer, "Trying to portal...");
        DelayCommand(5.0f, WaitForPortalReady(oPlayer, oPortal, sServer, sWaypoint));

        /*
         * Also not neccessary to set
        SetLocalInt(oPortal, "portal_state", BUSY);
        */
    }
}
Cheers,
teleri

Building the Outlands one GateTown at a Time
[url=http://www.greatring.net][color=blue][u][b]The Outlands[/color][/u][/b][/url]
[url=http://www.diterlizzi.com/art/games/planescape/index.html][color=blue][u][b]The Look of PlaneScape[/color][/u][/b][/url]
Post Reply