Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Development

Development::Development Forum for development topics and for those interested in EQEMu development. (Not a support forum)

Reply
 
Thread Tools Display Modes
  #1  
Old 12-29-2012, 05:20 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default SoD Client backporting zones up to RoF (.DLL injection)

Works with the Seeds of Destruction client. Requires MSDetours to compile..

Adds all of the zones up to RoF to the Seeds of Destruction client. If you use a program like WinMerge, and add the files, all of the new zones will magically start to load.

Simply compile and place in your Seeds of Destruction folder. Should work with no issues with third party programs that reference dinput8.dll, not 100% sure though.

Source:

myIDinput.cpp

Code:
#include "StdAfx.h"
#include "myIDinput.h"

// ---------------------------------------------------------------------------------------------------
myIDirectInput8::myIDirectInput8(IDirectInput8 *pOriginal)
{ m_pIDirectInput8 = pOriginal; }

myIDirectInput8::~myIDirectInput8(void)
{  }
	
HRESULT  myIDirectInput8::QueryInterface(REFIID riid, LPVOID * ppvObj)
{ 
	*ppvObj = NULL;

	// call this to increase AddRef at original object
	// and to check if such an interface is there

	HRESULT hRes = m_pIDirectInput8->QueryInterface(riid, ppvObj); 

	if (hRes == NOERROR) // if OK, send our "fake" address
	{
		*ppvObj = this;
	}
	
	return hRes;
}

ULONG    myIDirectInput8::AddRef(void)
{ return(m_pIDirectInput8->AddRef()); }

ULONG    myIDirectInput8::Release(void)
{ 
	extern myIDirectInput8* gl_pmyIDirectInput8;

	// call original routine
	ULONG count = m_pIDirectInput8->Release();
	
    // in case no further Ref is there, the Original Object has deleted itself
	// so do we here
	if (count == 0) 
	{
		// Debug
	    char tmp[150];
	    sprintf(tmp, "DI-PROXYDLL: myIDirectInput8::Release Deleting IDirectInput8 (ret=%i)", count);
        OutputDebugString(tmp);	
		
		gl_pmyIDirectInput8 = NULL;
  	    delete(this); 
	}

	return(count);
}

HRESULT  myIDirectInput8::CreateDevice(REFGUID a, LPDIRECTINPUTDEVICE8W *b, LPUNKNOWN c)
{ 
    // global var
	extern myIDirectInputDevice8* gl_pmyIDirectInputDevice8Array[];

	// we intercept this call and provide our own "fake" Device Object
	HRESULT hres = m_pIDirectInput8->CreateDevice( a,b,c);
    
	int i = 0;
	// find free Device slot
	for (i=0; i<MAXNUMBER_DEVICES; i++)
	{
		if (gl_pmyIDirectInputDevice8Array[i] == NULL) break;
	}

	// Debug
	char tmp[150];
	sprintf(tmp, "DI-PROXYDLL: myIDirectInput8::CreateDevice called. Filling device slot %i \r\n", i);
    OutputDebugString(tmp);	
	
	// Create our own Device object and store it in global pointer
	// note: the object will delete itself once Ref count is zero (similar to COM objects)
	gl_pmyIDirectInputDevice8Array[i] = new myIDirectInputDevice8(*b,i);
	
	// store our pointer (the fake one) for returning it to the calling progam
	*b = gl_pmyIDirectInputDevice8Array[i];		
	
	return(hres); 
}

HRESULT  myIDirectInput8::EnumDevices(DWORD a, LPDIENUMDEVICESCALLBACKW b, LPVOID c, DWORD d)
{ return(m_pIDirectInput8->EnumDevices(a, b, c, d)); }

HRESULT  myIDirectInput8::GetDeviceStatus(REFGUID a)
{ return(m_pIDirectInput8->GetDeviceStatus(a)); }

HRESULT  myIDirectInput8::RunControlPanel(HWND a, DWORD b)
{ return(m_pIDirectInput8->RunControlPanel(a, b)); }

HRESULT  myIDirectInput8::Initialize(HINSTANCE a, DWORD b)
{ return(m_pIDirectInput8->Initialize(a, b)); }

HRESULT  myIDirectInput8::FindDevice(REFGUID a, LPCWSTR b, LPGUID c)
{ return(m_pIDirectInput8->FindDevice(a, b, c)); }

HRESULT  myIDirectInput8::EnumDevicesBySemantics(LPCWSTR a, LPDIACTIONFORMATW b, LPDIENUMDEVICESBYSEMANTICSCBW c, LPVOID d, DWORD e)
{ return(m_pIDirectInput8->EnumDevicesBySemantics(a,b,c,d,e)); }

HRESULT  myIDirectInput8::ConfigureDevices(LPDICONFIGUREDEVICESCALLBACK a, LPDICONFIGUREDEVICESPARAMSW b, DWORD c, LPVOID d)
{ return(m_pIDirectInput8->ConfigureDevices(a,b,c,d)); }


// ---------------------------------------------------------------------------------------------------

myIDirectInputDevice8::myIDirectInputDevice8(IDirectInputDevice8 *pOriginal, int iInterfaceNumber)
{   
	m_iInterfaceNumber     = iInterfaceNumber;
	m_pIDirectInputDevice8 = pOriginal; 
}

myIDirectInputDevice8::~myIDirectInputDevice8(void)
{ }

HRESULT  myIDirectInputDevice8::QueryInterface(REFIID riid, LPVOID * ppvObj)
{ 
	*ppvObj = NULL;

	// call this to increase AddRef at original object
	// and to check if such an interface is there

	HRESULT hRes = m_pIDirectInputDevice8->QueryInterface(riid, ppvObj); 

	if (hRes == NOERROR) // if OK, send our "fake" address
	{
		*ppvObj = this;
	}
	
	return hRes;
}

ULONG    myIDirectInputDevice8::AddRef(void)
{ return(m_pIDirectInputDevice8->AddRef()); }

ULONG    myIDirectInputDevice8::Release(void)
{ 
    extern myIDirectInputDevice8* gl_pmyIDirectInputDevice8Array[];

	// call original routine
	ULONG count = m_pIDirectInputDevice8->Release();
	
    // in case no further Ref is there, the Original Object has deleted itself
	// so do we here
	if (count == 0) 
	{
		// Debug
	    char tmp[150];
	    sprintf(tmp, "DI-PROXYDLL: myIDirectInputDevice8::Release called. Clearing device slot %i \r\n", m_iInterfaceNumber);
        OutputDebugString(tmp);	

		gl_pmyIDirectInputDevice8Array[m_iInterfaceNumber] = NULL;
		delete(this); 
	}

	return(count);}

HRESULT  myIDirectInputDevice8::GetCapabilities(LPDIDEVCAPS a)
{ return(m_pIDirectInputDevice8->GetCapabilities(a)); }

HRESULT  myIDirectInputDevice8::EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKW a, LPVOID b, DWORD c)
{ return(m_pIDirectInputDevice8->EnumObjects(a,b,c)); }

HRESULT  myIDirectInputDevice8::GetProperty(REFGUID a,LPDIPROPHEADER b)
{ return(m_pIDirectInputDevice8->GetProperty(a,b)); }

HRESULT  myIDirectInputDevice8::SetProperty(REFGUID a,LPCDIPROPHEADER b)
{ return(m_pIDirectInputDevice8->SetProperty(a,b)); }

HRESULT  myIDirectInputDevice8::Acquire(void)
{ return(m_pIDirectInputDevice8->Acquire()); }

HRESULT  myIDirectInputDevice8::Unacquire(void)
{ return(m_pIDirectInputDevice8->Unacquire()); }

HRESULT  myIDirectInputDevice8::GetDeviceState(DWORD a,LPVOID b)
{ return(m_pIDirectInputDevice8->GetDeviceState(a,b));}

HRESULT  myIDirectInputDevice8::GetDeviceData(DWORD a,LPDIDEVICEOBJECTDATA b,LPDWORD c,DWORD d)
{ return(m_pIDirectInputDevice8->GetDeviceData(a,b,c,d)); }

HRESULT  myIDirectInputDevice8::SetDataFormat(LPCDIDATAFORMAT a)
{ return(m_pIDirectInputDevice8->SetDataFormat(a)); }

HRESULT  myIDirectInputDevice8::SetEventNotification(HANDLE a)
{ return(m_pIDirectInputDevice8->SetEventNotification(a)); }

HRESULT  myIDirectInputDevice8::SetCooperativeLevel(HWND a,DWORD b)
{ return(m_pIDirectInputDevice8->SetCooperativeLevel(a,b)); }

HRESULT  myIDirectInputDevice8::GetObjectInfo(LPDIDEVICEOBJECTINSTANCEW a,DWORD b,DWORD c)
{ return(m_pIDirectInputDevice8->GetObjectInfo(a,b,c)); }

HRESULT  myIDirectInputDevice8::GetDeviceInfo(LPDIDEVICEINSTANCEW a)
{ return(m_pIDirectInputDevice8->GetDeviceInfo(a)); }

HRESULT  myIDirectInputDevice8::RunControlPanel(HWND a,DWORD b)
{ return(m_pIDirectInputDevice8->RunControlPanel(a,b)); }

HRESULT  myIDirectInputDevice8::Initialize(HINSTANCE a,DWORD b,REFGUID c)
{ return(m_pIDirectInputDevice8->Initialize(a,b,c)); }

HRESULT  myIDirectInputDevice8::CreateEffect(REFGUID a,LPCDIEFFECT b,LPDIRECTINPUTEFFECT *c,LPUNKNOWN d)
{ return(m_pIDirectInputDevice8->CreateEffect(a,b,c,d)); }

HRESULT  myIDirectInputDevice8::EnumEffects(LPDIENUMEFFECTSCALLBACKW a,LPVOID b,DWORD c)
{ return(m_pIDirectInputDevice8->EnumEffects(a,b,c)); }

HRESULT  myIDirectInputDevice8::GetEffectInfo(LPDIEFFECTINFOW a,REFGUID b)
{ return(m_pIDirectInputDevice8->GetEffectInfo(a,b)); }

HRESULT  myIDirectInputDevice8::GetForceFeedbackState(LPDWORD a)
{ return(m_pIDirectInputDevice8->GetForceFeedbackState(a)); }

HRESULT  myIDirectInputDevice8::SendForceFeedbackCommand(DWORD a)
{ return(m_pIDirectInputDevice8->SendForceFeedbackCommand(a)); }

HRESULT  myIDirectInputDevice8::EnumCreatedEffectObjects(LPDIENUMCREATEDEFFECTOBJECTSCALLBACK a,LPVOID b,DWORD c)
{ return(m_pIDirectInputDevice8->EnumCreatedEffectObjects(a,b,c)); }

HRESULT  myIDirectInputDevice8::Escape(LPDIEFFESCAPE a)
{ return(m_pIDirectInputDevice8->Escape(a)); }

HRESULT  myIDirectInputDevice8::Poll(void)
{ return(m_pIDirectInputDevice8->Poll()); }

HRESULT  myIDirectInputDevice8::SendDeviceData(DWORD a,LPCDIDEVICEOBJECTDATA b,LPDWORD c,DWORD d)
{ return(m_pIDirectInputDevice8->SendDeviceData(a,b,c,d)); }

HRESULT  myIDirectInputDevice8::EnumEffectsInFile(LPCWSTR a,LPDIENUMEFFECTSINFILECALLBACK b,LPVOID c,DWORD d)
{ return(m_pIDirectInputDevice8->EnumEffectsInFile(a,b,c,d)); }

HRESULT  myIDirectInputDevice8::WriteEffectToFile(LPCWSTR a,DWORD b,LPDIFILEEFFECT c,DWORD d)
{ return(m_pIDirectInputDevice8->WriteEffectToFile(a,b,c,d)); }

HRESULT  myIDirectInputDevice8::BuildActionMap(LPDIACTIONFORMATW a,LPCWSTR b,DWORD c)
{ return(m_pIDirectInputDevice8->BuildActionMap(a,b,c)); }

HRESULT  myIDirectInputDevice8::SetActionMap(LPDIACTIONFORMATW a,LPCWSTR b,DWORD c)
{ return(m_pIDirectInputDevice8->SetActionMap(a,b,c)); }

HRESULT  myIDirectInputDevice8::GetImageInfo(LPDIDEVICEIMAGEINFOHEADERW a)
{ return(m_pIDirectInputDevice8->GetImageInfo(a)); }

// ---------------------------------------------------------------------------------------------------

myIDirectInputEffect::myIDirectInputEffect(IDirectInputEffect *pOriginal)
{ m_pIDirectInputEffect = pOriginal; }

myIDirectInputEffect::~myIDirectInputEffect(void)
{ }

HRESULT  myIDirectInputEffect::QueryInterface(REFIID riid, LPVOID * ppvObj)
{ return(m_pIDirectInputEffect->QueryInterface(riid, ppvObj)); }

ULONG    myIDirectInputEffect::AddRef(void)
{ return(m_pIDirectInputEffect->AddRef()); }

ULONG    myIDirectInputEffect::Release(void)
{ return(m_pIDirectInputEffect->Release()); }

HRESULT  myIDirectInputEffect::Initialize(HINSTANCE a,DWORD b,REFGUID c)
{ return(m_pIDirectInputEffect->Initialize(a,b,c)); }

HRESULT  myIDirectInputEffect::GetEffectGuid(LPGUID a)
{ return(m_pIDirectInputEffect->GetEffectGuid(a)); }

HRESULT  myIDirectInputEffect::GetParameters(LPDIEFFECT a,DWORD b)
{ return(m_pIDirectInputEffect->GetParameters(a,b)); }

HRESULT  myIDirectInputEffect::SetParameters(LPCDIEFFECT a,DWORD b)
{ return(m_pIDirectInputEffect->SetParameters(a,b)); }

HRESULT  myIDirectInputEffect::Start(DWORD a,DWORD b)
{ return(m_pIDirectInputEffect->Start(a,b)); }

HRESULT  myIDirectInputEffect::Stop(void)
{ return(m_pIDirectInputEffect->Stop()); }

HRESULT  myIDirectInputEffect::GetEffectStatus(LPDWORD a)
{ return(m_pIDirectInputEffect->GetEffectStatus(a)); }

HRESULT  myIDirectInputEffect::Download(void)
{ return(m_pIDirectInputEffect->Download()); }

HRESULT  myIDirectInputEffect::Unload(void)
{ return(m_pIDirectInputEffect->Unload()); }

HRESULT  myIDirectInputEffect::Escape(LPDIEFFESCAPE a)
{ return(m_pIDirectInputEffect->Escape(a)); }
myIDinput.h

Code:
#pragma once

class myIDirectInput8: public IDirectInput8
{
public:
    myIDirectInput8(IDirectInput8 *pOriginal);
    virtual ~myIDirectInput8(void);
	
	HRESULT  __stdcall QueryInterface(REFIID riid, LPVOID * ppvObj);
    ULONG    __stdcall AddRef(void);
    ULONG    __stdcall Release(void);

    HRESULT  __stdcall CreateDevice(REFGUID,LPDIRECTINPUTDEVICE8W *,LPUNKNOWN);
    HRESULT  __stdcall EnumDevices(DWORD,LPDIENUMDEVICESCALLBACKW,LPVOID,DWORD);
    HRESULT  __stdcall GetDeviceStatus(REFGUID);
    HRESULT  __stdcall RunControlPanel(HWND,DWORD);
    HRESULT  __stdcall Initialize(HINSTANCE,DWORD);
    HRESULT  __stdcall FindDevice(REFGUID,LPCWSTR,LPGUID);
    HRESULT  __stdcall EnumDevicesBySemantics(LPCWSTR,LPDIACTIONFORMATW,LPDIENUMDEVICESBYSEMANTICSCBW,LPVOID,DWORD);
    HRESULT  __stdcall ConfigureDevices(LPDICONFIGUREDEVICESCALLBACK,LPDICONFIGUREDEVICESPARAMSW,DWORD,LPVOID);

private:
    IDirectInput8 *m_pIDirectInput8;
};

class myIDirectInputDevice8: public IDirectInputDevice8
{
public:
    myIDirectInputDevice8(IDirectInputDevice8 *pOriginal, int iInterfaceNumber);
    virtual ~myIDirectInputDevice8(void);

	HRESULT  __stdcall QueryInterface(REFIID riid, LPVOID * ppvObj);
    ULONG    __stdcall AddRef(void);
    ULONG    __stdcall Release(void);
    
    HRESULT  __stdcall GetCapabilities(LPDIDEVCAPS);
    HRESULT  __stdcall EnumObjects(LPDIENUMDEVICEOBJECTSCALLBACKW,LPVOID,DWORD);
    HRESULT  __stdcall GetProperty(REFGUID,LPDIPROPHEADER);
    HRESULT  __stdcall SetProperty(REFGUID,LPCDIPROPHEADER);
    HRESULT  __stdcall Acquire(void);
    HRESULT  __stdcall Unacquire(void);
    HRESULT  __stdcall GetDeviceState(DWORD,LPVOID);
    HRESULT  __stdcall GetDeviceData(DWORD,LPDIDEVICEOBJECTDATA,LPDWORD,DWORD);
    HRESULT  __stdcall SetDataFormat(LPCDIDATAFORMAT);
    HRESULT  __stdcall SetEventNotification(HANDLE);
    HRESULT  __stdcall SetCooperativeLevel(HWND,DWORD);
    HRESULT  __stdcall GetObjectInfo(LPDIDEVICEOBJECTINSTANCEW,DWORD,DWORD);
    HRESULT  __stdcall GetDeviceInfo(LPDIDEVICEINSTANCEW);
    HRESULT  __stdcall RunControlPanel(HWND,DWORD);
    HRESULT  __stdcall Initialize(HINSTANCE,DWORD,REFGUID);
	
	HRESULT  __stdcall CreateEffect(REFGUID,LPCDIEFFECT,LPDIRECTINPUTEFFECT *,LPUNKNOWN);
    HRESULT  __stdcall EnumEffects(LPDIENUMEFFECTSCALLBACKW,LPVOID,DWORD);
    HRESULT  __stdcall GetEffectInfo(LPDIEFFECTINFOW,REFGUID);
    HRESULT  __stdcall GetForceFeedbackState(LPDWORD);
    HRESULT  __stdcall SendForceFeedbackCommand(DWORD);
    HRESULT  __stdcall EnumCreatedEffectObjects(LPDIENUMCREATEDEFFECTOBJECTSCALLBACK,LPVOID,DWORD);
    HRESULT  __stdcall Escape(LPDIEFFESCAPE);
    HRESULT  __stdcall Poll(void);
    HRESULT  __stdcall SendDeviceData(DWORD,LPCDIDEVICEOBJECTDATA,LPDWORD,DWORD);
    HRESULT  __stdcall EnumEffectsInFile(LPCWSTR,LPDIENUMEFFECTSINFILECALLBACK,LPVOID,DWORD);
    HRESULT  __stdcall WriteEffectToFile(LPCWSTR,DWORD,LPDIFILEEFFECT,DWORD);
    HRESULT  __stdcall BuildActionMap(LPDIACTIONFORMATW,LPCWSTR,DWORD);
    HRESULT  __stdcall SetActionMap(LPDIACTIONFORMATW,LPCWSTR,DWORD);
    HRESULT  __stdcall GetImageInfo(LPDIDEVICEIMAGEINFOHEADERW);

private:
    IDirectInputDevice8 *m_pIDirectInputDevice8;
	int                  m_iInterfaceNumber;
};

class myIDirectInputEffect: public IDirectInputEffect
{
public:
    myIDirectInputEffect(IDirectInputEffect *pOriginal);
    virtual ~myIDirectInputEffect(void);
	
	HRESULT  __stdcall QueryInterface(REFIID riid, LPVOID * ppvObj);
    ULONG    __stdcall AddRef(void);
    ULONG    __stdcall Release(void);

    HRESULT  __stdcall Initialize(HINSTANCE,DWORD,REFGUID);
    HRESULT  __stdcall GetEffectGuid(LPGUID);
    HRESULT  __stdcall GetParameters(LPDIEFFECT,DWORD);
    HRESULT  __stdcall SetParameters(LPCDIEFFECT,DWORD);
    HRESULT  __stdcall Start(DWORD,DWORD);
    HRESULT  __stdcall Stop(void);
    HRESULT  __stdcall GetEffectStatus(LPDWORD);
    HRESULT  __stdcall Download(void);
    HRESULT  __stdcall Unload(void);
    HRESULT  __stdcall Escape(LPDIEFFESCAPE);

private:
    IDirectInputEffect *m_pIDirectInputEffect;
};
 
//WINMMAPI MMRESULT WINAPI joyConfigChanged( DWORD dwFlags );
//void WINAPI ShowJoyCPL( HWND hWnd );
dllmain.cpp

Code:
#include <Windows.h>
#include <stdio.h>
#include <string>
#include "detours.h"
#pragma comment( lib, "detours.lib" )
#include "stdafx.h"
#include "DInputDll.h"

// global variables
#pragma data_seg (".dinput_shared")
myIDirectInputDevice8*     gl_pmyIDirectInputDevice8Array[MAXNUMBER_DEVICES];
myIDirectInput8*           gl_pmyIDirectInput8;
//myIDirectInputEffect*    gl_pmyIDirectInputEffect;
HINSTANCE                  gl_hOriginalDll;
HINSTANCE                  gl_hThisInstance;
#pragma data_seg ()

class EQWorldData {
public:
};

DWORD LogAddr = 0x006B0BB0;
DWORD WDataAddr = 0x00693E10;
DWORD WDataAddZoneAddr = 0x006939D0;
EQWorldData** pinstWorldData = (EQWorldData**)0x00A425C4;
DWORD DeconstructorAddr = 0x0071A640;
bool isWorldDataLoaded = false;
bool AddedZone = false;

void __cdecl WDataHook() {
	AddedZone = false;
	isWorldDataLoaded = false;
}

void WDataCheck()
{ 
	while (1==1)
	{
	while (isWorldDataLoaded==false)
	{

		while (*pinstWorldData == NULL)
		{
			Sleep(1000);
		}
		isWorldDataLoaded = true;
	}
	if(isWorldDataLoaded==true && AddedZone == false)
	{
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData, 0 , 5, "highpass", "Highhold Pass", 2247, 7, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 480, "brellsrest", "Brell's Rest", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 481, "fungalforest", "Fungal Forest", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 482, "underquarry", "The Underquarry", 1216, 32, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 483, "coolingchamber", "The Cooling Chamber", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 484, "shiningcity", "Kernagir, The Shining City", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 485, "arthicrex", "Arthicrex", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 486, "foundation", "The Foundation", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 487, "lichencreep", "Lichen Creep", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 488, "pellucid", "Pellucid Grotto", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 489, "stonesnake", "Volska's Husk", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 490, "brellstemple", "Brell's Temple", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 491, "convorteum", "The Convorteum", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,16, 492, "brellsarena", "Brell's Arena", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 493, "weddingchapel", "Wedding Chapel", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 494, "weddingchapeldark", "Wedding Chapel", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 495, "dragoncrypt", "Lair of the Fallen", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 700, "feerrott2", "The Feerrott", 1216, 32, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 701, "thulehouse1", "House of Thule", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 702, "thulehouse2", "House of Thule, Upper Floors", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 703, "housegarden", "The Grounds", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 704, "thulelibrary", "The Library", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 705, "well", "The Well", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 706, "fallen", "Erudin Burning", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 707, "morellcastle", "Morell's Castle", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 708, "somnium", "Sanctum Somnium", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 709, "alkabormare", "Al'Kabor's Nightmare", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 710, "miragulmare", "Miragul's Nightmare", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 711, "thuledream", "Fear Itself", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 712, "neighborhood", "Sunrise Hills", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,17, 713, "phylactery", "Miragul's Phylactery", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 714, "phinterior3a1", "House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 716, "phinterior3a2", "House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 717, "phinterior3a3", "House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 715, "phinterior1a1", "House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 718, "phinterior1a2", "House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 719, "phinterior1a3", "House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 719, "phinterior1a3", "House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 720, "phinterior1b1", "Dragon House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 723, "phinterior1d1", "Dragon House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 724, "argath", "Argath, Bastion of Illdaera", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 725, "arelis", "Valley of Lunanyn", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 726, "sarithcity", "Sarith, City of Tides", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 727, "rubak", "Rubak Oseka, Temple of the Sea", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 728, "beastdomain", "Beasts' Domain", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 729, "resplendent", "The Resplendent Temple", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 730, "pillarsalra", "Pillars of Alra", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 731, "windsong", "Windsong Sanctuary", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 732, "cityofbronze", "Erillion, City of Bronze", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 733, "sepulcher", "Sepulcher of Order", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 734, "eastsepulcher", "Sepulcher East", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 735, "westsepulcher", "Sepulcher West", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 736, "shadowedmount", "Shadowed Mount", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 737, "guildhalllrg", "Grand Guild Hall", 1216, -2139095040, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 738, "guildhallsml", "Greater Guild Hall", 1216, -2139095040, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 739, "plhogrinteriors1a1", "One Bedroom House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 740, "plhogrinteriors1a2", "One Bedroom House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 741, "plhogrinteriors3a1", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 742, "plhogrinteriors3a2", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 743, "plhogrinteriors3b1", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 744, "plhogrinteriors3b2", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 745, "plhdkeinteriors1a1", "One Bedroom House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 746, "plhdkeinteriors1a2", "One Bedroom House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 747, "plhdkeinteriors1a3", "One Bedroom House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 748, "plhdkeinteriors3a1", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 749, "plhdkeinteriors3a2", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 750, "plhdkeinteriors3a3", "Three Bedroom House Interior", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 751, "guildhall3", "Modest Guild Hall", 1216, -2139095040, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 754, "kaelshard", "Kael Drakkel: The King's Madness", 1216, 8213, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 755, "eastwastesshard", "East Wastes: Zeixshi-Kar's Awakening", 1216, 4227076, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,18, 756, "crystalshard", "The Crystal Caverns: Fragment of Fear", 1216, 4, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,19, 752, "shardslanding", "Shard's Landing", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,19, 753, "xorbb", "Valley of King Xorbb", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,19, 757, "breedinggrounds", "The Breeding Grounds", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,19, 758, "eviltree", "Evantil, the Vile Oak", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,19, 759, "grelleth", "Grelleth's Palace, the Chateau of Filth", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,19, 760, "chapterhouse", "Chapterhouse of the Fallen", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,0, 766, "phinteriortree", "Evantil's Abode", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,20, 763, "chelsith", "Chelsith Reborn", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,20, 764, "poshadow", "Plane of Shadow", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,20, 765, "heartoffear", "Heart of Fear", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,2, 761, "pomischief", "The Plane of Mischief", 1216, 0, 0, 0, 0);
	((int (__thiscall*) (LPVOID, int, int, const char*, const char*, int, unsigned long, int, int, int)) WDataAddZoneAddr) ((LPVOID)*pinstWorldData,1, 762, "burnedwoods", "The Burned Woods", 1216, 0, 0, 0, 0);


	AddedZone=true;
	}
	Sleep(1000);
	}
}


BOOL APIENTRY DllMain( HANDLE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
{
	// to avoid compiler lvl4 warnings 
    LPVOID lpDummy = lpReserved;
    lpDummy = NULL;
    
    switch (ul_reason_for_call)
	{
	    case DLL_PROCESS_ATTACH: 
			{
				InitInstance(hModule); 
				CreateThread(NULL, 0, (unsigned long (__stdcall *)(void *))WDataCheck, NULL, 0, NULL);
				//LogDet.Detour((PBYTE)LogAddr, ( PBYTE )LogHook);
				DetourFunction((PBYTE)DeconstructorAddr, (PBYTE)WDataHook);
				/*if(!AllocConsole())
				{
					return 0;
				}*/
				//SetConsoleTitle(TEXT("Console of the Gods"));
				//LogDet.Apply();
				
				break;
			}
	    case DLL_PROCESS_DETACH: ExitInstance(); break;
        
        case DLL_THREAD_ATTACH:  break;
	    case DLL_THREAD_DETACH:  break;
	}
    return TRUE;
}

// Exported function (faking dinput.dll's exports)
HRESULT WINAPI DirectInput8Create(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter)
{
	OutputDebugString("DI-PROXYDLL: In DirectInput8Create.\r\n");
	
	if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right dinput.dll"
	
	typedef HRESULT (WINAPI* DirectInputCreate_Type)(HINSTANCE hinst, DWORD dwVersion, REFIID riidltf, LPVOID *ppvOut, LPUNKNOWN punkOuter);
	DirectInputCreate_Type DirectInputCreate_fn = (DirectInputCreate_Type) GetProcAddress( gl_hOriginalDll, "DirectInput8Create");
    
    // Debug
	if (!DirectInputCreate_fn) 
    {
        OutputDebugString("DI-PROXYDLL: Pointer to original DirectInput8Create function not received ERROR ****\r\n");
        ::ExitProcess(0); // exit the hard way
    }

	// Debug
	char tmp[150];
	sprintf(tmp, "DI-PROXYDLL: DirectInput8Create called with DIRECTINPUT_VERSION=%o \r\n",dwVersion);
    OutputDebugString(tmp);
	
	// REVIEW REVIEW REVIEW Instance Handle ! Original or own ? 
	// REVIEW REVIEW REVIEW Check for UNICODE or ANSI (riidltf) !
	HINSTANCE dummy = hinst;
	dummy = NULL;

	// Create real Interface
	LPVOID pIDirectInput_orig;
	HRESULT hr = DirectInputCreate_fn(gl_hThisInstance, dwVersion, riidltf, (LPVOID*) &pIDirectInput_orig, punkOuter);
	
	// Create my IDirectInput object and store pointer to original object there.
	// note: the object will delete itself once Ref count is zero (similar to COM objects)
	
	if (gl_pmyIDirectInput8) gl_pmyIDirectInput8->AddRef();
	else gl_pmyIDirectInput8 = new myIDirectInput8((IDirectInput8*)pIDirectInput_orig);
	
	// Return pointer to hooking Object instead of "real one"
	*ppvOut = gl_pmyIDirectInput8;
	return(hr);
}

// Exported function (faking dinput.dll's exports)
HRESULT WINAPI DllCanUnloadNow(void)
{
	OutputDebugString("DI-PROXYDLL: In DllCanUnloadNow.\r\n");
	
	if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right dinput.dll"
	
	typedef HRESULT (WINAPI *DllCanUnloadNow_Type)(void);
	DllCanUnloadNow_Type DllCanUnloadNow_fn = (DllCanUnloadNow_Type) GetProcAddress( gl_hOriginalDll, "DllCanUnloadNow");
    
    // Debug
	if (!DllCanUnloadNow_fn) 
    {
        OutputDebugString("DI-PROXYDLL: Pointer to original DllCanUnloadNow function not received ERROR ****\r\n");
        ::ExitProcess(0); // exit the hard way
    }

	// Call original dll and return
	return(DllCanUnloadNow_fn());
}

HRESULT WINAPI DllGetClassObject (const CLSID &rclsid, const IID &riid, void **ppv)
{
	OutputDebugString("DI-PROXYDLL: In DllGetClassObject.\r\n");
	
	if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right dinput.dll"
	
	typedef HRESULT (WINAPI *DllGetClassObject_Type)(const CLSID &rclsid, const IID &riid, void **ppv);
	DllGetClassObject_Type DllGetClassObject_fn = (DllGetClassObject_Type) GetProcAddress( gl_hOriginalDll, "DllGetClassObject");
    
    // Debug
	if (!DllGetClassObject_fn) 
    {
        OutputDebugString("DI-PROXYDLL: Pointer to original DllGetClassObject function not received ERROR ****\r\n");
        ::ExitProcess(0); // exit the hard way
    }

	// Call original dll and return
	return(DllGetClassObject_fn(rclsid, riid, ppv));
}

HRESULT WINAPI DllRegisterServer (void)
{
	OutputDebugString("DI-PROXYDLL: In DllRegisterServer.\r\n");
	
	if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right dinput.dll"
	
	typedef HRESULT (WINAPI *DllRegisterServer_Type)(void);
	DllRegisterServer_Type DllRegisterServer_fn = (DllRegisterServer_Type) GetProcAddress( gl_hOriginalDll, "DllRegisterServer");
    
    // Debug
	if (!DllRegisterServer_fn) 
    {
        OutputDebugString("DI-PROXYDLL: Pointer to original DllRegisterServer function not received ERROR ****\r\n");
        ::ExitProcess(0); // exit the hard way
    }

	// Call original dll and return
	return(DllRegisterServer_fn());
}

HRESULT WINAPI DllUnregisterServer (void)
{
	OutputDebugString("DI-PROXYDLL: In DllUnregisterServer.\r\n");
	
	if (!gl_hOriginalDll) LoadOriginalDll(); // looking for the "right dinput.dll"
	
	typedef HRESULT (WINAPI *DllUnregisterServer_Type)(void);
	DllUnregisterServer_Type DllUnregisterServer_fn = (DllUnregisterServer_Type) GetProcAddress( gl_hOriginalDll, "DllUnregisterServer");
    
    // Debug
	if (!DllUnregisterServer_fn) 
    {
        OutputDebugString("DI-PROXYDLL: Pointer to original DllUnregisterServer function not received ERROR ****\r\n");
        ::ExitProcess(0); // exit the hard way
    }

	// Call original dll and return
	return(DllUnregisterServer_fn());
}

void InitInstance(HANDLE hModule) 
{
	OutputDebugString("DI-PROXYDLL: In InitInstance.\r\n");
	
	// Initialisation
    gl_pmyIDirectInput8       = NULL;
    
	for (int i=0; i<MAXNUMBER_DEVICES; i++) gl_pmyIDirectInputDevice8Array[i] = NULL;
	
    //gl_pmyIDirectInputEffect  = NULL
    gl_hOriginalDll           = NULL;
    gl_hThisInstance          = NULL;
	
	// Storing Instance handle into global var
	gl_hThisInstance = (HINSTANCE)  hModule;
}

void LoadOriginalDll(void)
{
    OutputDebugString("DI-PROXYDLL: In LoadOriginalDll.\r\n");
	
	char buffer[MAX_PATH];
    
    // Getting path to system dir and to dinput.dll
	::GetSystemDirectory(buffer,MAX_PATH);

	// Append dll name
	strcat(buffer,"\\dinput8.dll");
	
	// try to load the system's dinput.dll, if pointer empty
	if (!gl_hOriginalDll) gl_hOriginalDll = ::LoadLibrary(buffer);

	// Debug
	if (!gl_hOriginalDll)
	{
		OutputDebugString("DI-PROXYDLL: Original dinput8.dll not loaded ERROR ****\r\n");
		::ExitProcess(0); // exit the hard way
	}
}

void ExitInstance() 
{    
    OutputDebugString("DI-PROXYDLL: In ExitInstance.\r\n");
	
	// Release the system's dinput8.dll
	if (gl_hOriginalDll)
	{
		::FreeLibrary(gl_hOriginalDll);
	    gl_hOriginalDll = NULL;  
	}
}
//------------------------------------------------------------------------------------------------------------------------------------

// always return false on this shit
extern "C" __declspec(naked) void __stdcall __E__0__()
    {
    }
dinputdll.def
Code:
LIBRARY	"dinput8.dll"

EXPORTS
		DirectInput8Create  @1
		DllCanUnloadNow     PRIVATE
		DllGetClassObject   PRIVATE
		DllRegisterServer   PRIVATE
		DllUnregisterServer PRIVATE
Reply With Quote
  #2  
Old 12-29-2012, 05:21 AM
Secrets's Avatar
Secrets
Demi-God
 
Join Date: May 2007
Location: b
Posts: 1,447
Default

If you prefer a raw download,

http://www.sendspace.com/file/dd5ub3
Reply With Quote
  #3  
Old 12-29-2012, 06:01 AM
Noport
Opcode Ninja
 
Join Date: Mar 2009
Location: San francisco
Posts: 426
Default

Thank you! Secrets
Reply With Quote
  #4  
Old 12-29-2012, 06:36 AM
Noport
Opcode Ninja
 
Join Date: Mar 2009
Location: San francisco
Posts: 426
Default

mapconvert.vbs
Code:
' VBScript to convert SOE map files to SEQ map file.

' Run this file from the folder containing the maps to be converted.

' This will overwrite all the *.map files existing in that folder.



strComputer = "."

Set objWMIService = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")

Dim intVertical, intHorizontal

Set objExplorer = CreateObject("InternetExplorer.Application")

objExplorer.Navigate "about:blank"

objExplorer.ToolBar = 0

objExplorer.StatusBar = 0

objExplorer.Width = 400

objExplorer.Height = 200

objExplorer.Visible = 1

objExplorer.Document.Title = "Map Conversion in progress ..."

objExplorer.Document.Body.InnerHTML = "Starting Map Conversion."

WScript.Sleep 2000

Call Map_Convert

objExplorer.Document.Body.InnerHTML = "Map Conversion Complete."

Wscript.Sleep 2000

objExplorer.Quit

WScript.quit



' Combines layers and converts black lines to Grey

Sub Map_Convert()



	Dim r, g, b

	Dim x

	Dim sPath

	Dim longname

	Dim tocolor

    Dim mLines



	' Defaults used for Black Lines and Labels.  Set to 0 to have ignored.

	BlackLineColor = 43

	BlackLabelColor = 64

	' Color of labels that start with To....

	tocolor = 13



	' Set these to something other than 0 to use for all, otherwise they are ignored

	AllLineColor = 0

	AllLabelColor = 0



	' Set to 1 for connecting map lines - Will also remove extra sequential line points

	ConnectDots = 1

	Dim szColor(64)

	szColor(1) = "Black"

	szColor(2) = "DarkRed"

	szColor(3) = "Firebrick"

	szColor(4) = "Red"

	szColor(5) = "DarkGreen"

	szColor(6) = "Orange"

	szColor(7) = "DarkOrange"

	szColor(8) = "DarkOrange"

	szColor(9) = "Green"

	szColor(10) = "Chartreuse"

	szColor(11) = "Gold"

	szColor(12) = "Gold"

	szColor(13) = "LimeGreen"

	szColor(14) = "Chartreuse"

	szColor(15) = "Goldenrod"

	szColor(16) = "Yellow"

	szColor(17) = "DarkBlue"

	szColor(18) = "Magenta"

	szColor(19) = "DeepPink"

	szColor(20) = "DeepPink"

	szColor(21) = "DarkCyan"

	szColor(22) = "Grey"

	szColor(23) = "IndianRed"

	szColor(24) = "LightCoral"

	szColor(25) = "SpringGreen"

	szColor(26) = "LightGreen"

	szColor(27) = "DarkKhaki"

	szColor(28) = "Khaki"

	szColor(29) = "SpringGreen"

	szColor(30) = "PaleGreen"

	szColor(31) = "DarkOliveGreen"

	szColor(32) = "Khaki"

	szColor(33) = "MediumBlue"

	szColor(34) = "DarkViolet"

	szColor(35) = "Magenta"

	szColor(36) = "Maroon"

	szColor(37) = "RoyalBlue"

	szColor(38) = "SlateBlue"

	szColor(39) = "Orchid"

	szColor(40) = "HotPink"

	szColor(41) = "Turquoise"

	szColor(42) = "SkyBlue"

	szColor(43) = "LightGrey"

	szColor(44) = "LightPink"

	szColor(45) = "Cyan"

	szColor(46) = "Aquamarine"

	szColor(47) = "DarkSeaGreen"

	szColor(48) = "Beige"

	szColor(49) = "Blue"

	szColor(50) = "Purple"

	szColor(51) = "Purple"

	szColor(52) = "Magenta"

	szColor(53) = "DodgerBlue"

	szColor(54) = "SlateBlue"

	szColor(55) = "MediumPurple"

	szColor(56) = "Orchid"

	szColor(57) = "DeepSkyBlue"

	szColor(58) = "LightBlue"

	szColor(59) = "Plum"

	szColor(60) = "Cyan"

	szColor(61) = "CadetBlue"

	szColor(62) = "PaleTurquoise"

	szColor(63) = "LightCyan"

	szColor(64) = "White"

	

	set longname = CreateObject("Scripting.Dictionary")

	longname.CompareMode = vbTextCompare

	

	longname.Add "qeynos", "South Qeynos" 

	longname.Add "qeynos2", "North Qeynos" 

	longname.Add "qrg", "Surefall Glade" 

	longname.Add "qeytoqrg", "Qeynos Hills" 

	longname.Add "highpass", "Highpass Hold" 

	longname.Add "highkeep", "HighKeep" 

	longname.Add "freportn", "North Freeport" 

	longname.Add "freportw", "West Freeport" 

	longname.Add "freporte", "East Freeport" 

	longname.Add "runnyeye", "Clan RunnyEye" 

	longname.Add "qey2hh1", "West Karana" 

	longname.Add "northkarana", "North Karana" 

	longname.Add "southkarana", "South Karana" 

	longname.Add "eastkarana", "East Karana" 

	longname.Add "beholder", "Gorge of King Xorbb" 

	longname.Add "blackburrow", "BlackBurrow" 

	longname.Add "paw", "Infected Paw" 

	longname.Add "rivervale", "Rivervale" 

	longname.Add "kithicor", "Kithicor Forest" 

	longname.Add "commons", "West Commonlands" 

	longname.Add "ecommons", "East Commonlands" 

	longname.Add "erudnint", "Erudin Palace" 

	longname.Add "erudnext", "Erudin" 

	longname.Add "nektulos", "Nektulos Forest" 

	longname.Add "cshome", "Sunset Home" 

	longname.Add "lavastorm", "Lavastorm Mountains" 

	longname.Add "nektropos", "Nektropos" 

	longname.Add "halas", "Halas" 

	longname.Add "everfrost", "Everfrost Peaks" 

	longname.Add "soldunga", "Solusek's Eye" 

	longname.Add "soldungb", "Nagafen's Lair" 

	longname.Add "misty", "Misty Thicket" 

	longname.Add "nro", "North Ro" 

	longname.Add "sro", "South Ro" 

	longname.Add "befallen", "Befallen" 

	longname.Add "oasis", "Oasis of Marr" 

	longname.Add "tox", "Toxxulia Forest" 

	longname.Add "hole", "The Ruins of Old Paineel" 

	longname.Add "neriaka", "Neriak Foreign Quarter" 

	longname.Add "neriakb", "Neriak Commons" 

	longname.Add "neriakc", "Neriak Third Gate" 

	longname.Add "neriakd", "Neriak Palace" 

	longname.Add "najena", "Najena" 

	longname.Add "qcat", "Qeynos Catacombs" 

	longname.Add "innothule", "Innothule Swamp" 

	longname.Add "feerrott", "The Feerrott" 

	longname.Add "cazicthule", "Cazic-Thule" 

	longname.Add "oggok", "Oggok" 

	longname.Add "rathemtn", "Mountains of Rathe" 

	longname.Add "lakerathe", "Lake Rathetear" 

	longname.Add "grobb", "Gukta" 

	longname.Add "aviak", "Aviak Village" 

	longname.Add "gfaydark", "Greater Faydark" 

	longname.Add "akanon", "Ak'Anon" 

	longname.Add "steamfont", "Steamfont Mountains" 

	longname.Add "lfaydark", "Lesser Faydark" 

	longname.Add "crushbone", "Clan Crushbone" 

	longname.Add "mistmoore", "Castle Mistmoore" 

	longname.Add "kaladima", "Kaladim" 

	longname.Add "felwithea", "Felwithe" 

	longname.Add "felwitheb", "Felwithe" 

	longname.Add "unrest", "Estate of Unrest" 

	longname.Add "kedge", "Kedge Keep" 

	longname.Add "guktop", "Upper Guk" 

	longname.Add "gukbottom", "Lower Guk" 

	longname.Add "kaladimb", "Kaladim" 

	longname.Add "butcher", "Butcherblock Mountains" 

	longname.Add "oot", "Ocean of Tears" 

	longname.Add "cauldron", "Dagnor's Cauldron" 

	longname.Add "airplane", "Plane of Sky" 

	longname.Add "fearplane", "Plane of Fear" 

	longname.Add "permafrost", "Permafrost Keep" 

	longname.Add "kerraridge", "Kerra Isle" 

	longname.Add "paineel", "Paineel" 

	longname.Add "hateplane", "The Plane of Hate" 

	longname.Add "arena", "The Arena" 

	longname.Add "fieldofbone", "The Field of Bone" 

	longname.Add "warslikswood", "Warsliks Wood" 

	longname.Add "soltemple", "Temple of Solusek Ro" 

	longname.Add "droga", "Temple of Droga" 

	longname.Add "cabwest", "West Cabilis" 

	longname.Add "swampofnohope", "Swamp of No Hope" 

	longname.Add "firiona", "Firiona Vie" 

	longname.Add "lakeofillomen", "Lake of Ill Omen" 

	longname.Add "dreadlands", "Dreadlands" 

	longname.Add "burningwood", "Burning Woods" 

	longname.Add "kaesora", "Kaesora" 

	longname.Add "sebilis", "Old Sebilis" 

	longname.Add "citymist", "City of Mist" 

	longname.Add "skyfire", "Skyfire Mountains" 

	longname.Add "frontiermtns", "Frontier Mountains" 

	longname.Add "overthere", "The Overthere" 

	longname.Add "emeraldjungle", "The Emerald Jungle" 

	longname.Add "trakanon", "Trakanon's Teeth" 

	longname.Add "timorous", "Timorous Deep" 

	longname.Add "kurn", "Kurn's Tower" 

	longname.Add "erudsxing", "Erud's Crossing" 

	longname.Add "stonebrunt", "Stonebrunt Mountains" 

	longname.Add "warrens", "The Warrens" 

	longname.Add "karnor", "Karnor's Castle" 

	longname.Add "chardok", "Chardok" 

	longname.Add "dalnir", "Dalnir" 

	longname.Add "charasis", "Howling Stones" 

	longname.Add "cabeast", "East Cabilis" 

	longname.Add "nurga", "Mines of Nurga" 

	longname.Add "veeshan", "Veeshan's Peak" 

	longname.Add "veksar", "Veksar" 

	longname.Add "iceclad", "Iceclad Ocean" 

	longname.Add "frozenshadow", "Tower of Frozen Shadow" 

	longname.Add "velketor", "Velketor's Labyrinth" 

	longname.Add "kael", "Kael Drakkal" 

	longname.Add "skyshrine", "Skyshrine" 

	longname.Add "thurgadina", "Thurgadin" 

	longname.Add "eastwastes", "Eastern Wastes" 

	longname.Add "cobaltscar", "Cobalt Scar" 

	longname.Add "greatdivide", "Great Divide" 

	longname.Add "wakening", "The Wakening Land" 

	longname.Add "westwastes", "Western Wastes" 

	longname.Add "crystal", "Crystal Caverns" 

	longname.Add "necropolis", "Dragon Necropolis" 

	longname.Add "templeveeshan", "Temple of Veeshan" 

	longname.Add "sirens", "Siren's Grotto" 

	longname.Add "mischiefplane", "Plane of Mischief" 

	longname.Add "growthplane", "Plane of Growth" 

	longname.Add "sleeper", "Sleeper's Tomb" 

	longname.Add "thurgadinb", "Icewell Keep" 

	longname.Add "erudsxing2", "Marauder's Mire" 

	longname.Add "shadowhaven", "Shadow Haven" 

	longname.Add "bazaar", "The Bazaar" 

	longname.Add "nexus", "The Nexus" 

	longname.Add "echo", "Echo Caverns" 

	longname.Add "acrylia", "Acrylia Caverns" 

	longname.Add "sharvahl", "Shar Vahl" 

	longname.Add "paludal", "Paludal Caverns" 

	longname.Add "fungusgrove", "Fungus Grove" 

	longname.Add "vexthal", "Vex Thal" 

	longname.Add "sseru", "Sanctus Seru" 

	longname.Add "katta", "Katta Castellum" 

	longname.Add "netherbian", "Netherbian Lair" 

	longname.Add "ssratemple", "Ssraeshza Temple" 

	longname.Add "griegsend", "Grieg's End" 

	longname.Add "thedeep", "The Deep" 

	longname.Add "shadeweaver", "Shadeweaver's Thicket" 

	longname.Add "hollowshade", "Hollowshade Moor" 

	longname.Add "grimling", "Grimling Forest" 

	longname.Add "mseru", "Marus Seru" 

	longname.Add "letalis", "Mons Letalis" 

	longname.Add "twilight", "The Twilight Sea" 

	longname.Add "thegrey", "The Grey" 

	longname.Add "tenebrous", "The Tenebrous Mountains" 

	longname.Add "maiden", "The Maiden's Eye" 

	longname.Add "dawnshroud", "Dawnshroud Peaks" 

	longname.Add "scarlet", "The Scarlet Desert" 

	longname.Add "umbral", "The Umbral Plains" 

	longname.Add "akheva", "Akheva Ruins" 

	longname.Add "arena2", "The Arena" 

	longname.Add "jaggedpine", "The Jaggedpine Forest" 

	longname.Add "nedaria", "Nedaria's Landing" 

	longname.Add "tutorial", "Tutorial Zone" 

	longname.Add "load", "Loading" 

	longname.Add "load2", "Loading" 

	longname.Add "hateplaneb", "The Plane of Hate" 

	longname.Add "shadowrest", "Shadowrest" 

	longname.Add "tutoriala", "The Mines of Gloomingdeep" 

	longname.Add "tutorialb", "The Mines of Gloomingdeep" 

	longname.Add "clz", "Loading" 

	longname.Add "codecay", "Ruins of Lxanvom" 

	longname.Add "pojustice", "Plane of Justice" 

	longname.Add "poknowledge", "Plane of Knowledge" 

	longname.Add "potranquility", "Plane of Tranquility" 

	longname.Add "ponightmare", "Plane of Nightmare" 

	longname.Add "podisease", "Plane of Disease" 

	longname.Add "poinnovation", "Plane of Innovation" 

	longname.Add "potorment", "Plane of Torment" 

	longname.Add "povalor", "Plane of Valor" 

	longname.Add "bothunder", "Torden - The Bastion of Thunder" 

	longname.Add "postorms", "Plane of Storms" 

	longname.Add "hohonora", "Halls of Honor" 

	longname.Add "solrotower", "Solusek Ro's Tower" 

	longname.Add "powar", "Plane of War" 

	longname.Add "potactics", "Drunder - Fortress of Zek" 

	longname.Add "poair", "Eryslai - the Kingdom of Wind" 

	longname.Add "powater", "Reef of Coirnav" 

	longname.Add "pofire", "Doomfire - The Burning Lands" 

	longname.Add "poeartha", "Vegarlson - The Earthen Badlands" 

	longname.Add "potimea", "Plane of Time" 

	longname.Add "hohonorb", "Temple of Marr" 

	longname.Add "nightmareb", "Lair of Terris Thule" 

	longname.Add "poearthb", "Ragrax - Stronghold of the Twelve" 

	longname.Add "potimeb", "Plane of Time" 

	longname.Add "gunthak", "Gulf of Gunthak" 

	longname.Add "dulak", "Dulak's Harbor" 

	longname.Add "torgiran", "Torgiran Mines" 

	longname.Add "nadox", "Crypt of Nadox" 

	longname.Add "hatesfury", "Hate's Fury - The Scorned Maiden" 

	longname.Add "guka", "The Cauldron of Lost Souls" 

	longname.Add "ruja", "The Bloodied Quarries" 

	longname.Add "taka", "The Sunken Library" 

	longname.Add "mira", "The Silent Gallery" 

	longname.Add "mmca", "The Forlorn Caverns" 

	longname.Add "gukb", "The Drowning Crypt" 

	longname.Add "rujb", "The Halls of War" 

	longname.Add "takb", "The Shifting Tower" 

	longname.Add "mirb", "The Maw of the Menagerie" 

	longname.Add "mmcb", "The Dreary Grotto" 

	longname.Add "gukc", "The Ancient Aqueducts" 

	longname.Add "rujc", "The Wind Bridges" 

	longname.Add "takc", "The Fading Temple" 

	longname.Add "mirc", "The Spider Den" 

	longname.Add "mmcc", "The Asylum of Invoked Stone" 

	longname.Add "gukd", "The Mushroom Grove" 

	longname.Add "rujd", "The Gladiator Pits" 

	longname.Add "takd", "The Royal Observatory" 

	longname.Add "mird", "The Hushed Banquet" 

	longname.Add "mmcd", "The Chambers of Eternal Affliction" 

	longname.Add "guke", "The Foreboding Prison" 

	longname.Add "ruje", "The Drudge Hollows" 

	longname.Add "take", "The River of Recollection" 

	longname.Add "mire", "The Frosted Halls" 

	longname.Add "mmce", "The Sepulcher of the Damned" 

	longname.Add "gukf", "The Chapel of the Witnesses" 

	longname.Add "rujf", "The Fortified Lair of the Taskmasters" 

	longname.Add "takf", "The Sandfall Corridors" 

	longname.Add "mirf", "The Forgotten Wastes" 

	longname.Add "mmcf", "The Ritualistic Summoning Grounds" 

	longname.Add "gukg", "The Root Garden" 

	longname.Add "rujg", "The Hidden Vale" 

	longname.Add "takg", "The Balancing Chamber" 

	longname.Add "mirg", "The Heart of the Menagerie" 

	longname.Add "mmcg", "The Cesspits of Putrescence" 

	longname.Add "gukh", "The Accursed Sanctuary" 

	longname.Add "rujh", "The Blazing Forge" 

	longname.Add "takh", "The Sweeping Tides" 

	longname.Add "mirh", "The Morbid Laboratory" 

	longname.Add "mmch", "The Aisles of Blood" 

	longname.Add "ruji", "The Arena of Chance" 

	longname.Add "taki", "The Antiquated Palace" 

	longname.Add "miri", "The Theater of Imprisoned Horrors" 

	longname.Add "mmci", "The Halls of Sanguinary Rites" 

	longname.Add "rujj", "The Barracks of War" 

	longname.Add "takj", "The Prismatic Corridors" 

	longname.Add "mirj", "The Grand Library" 

	longname.Add "mmcj", "The Infernal Sanctuary" 

	longname.Add "chardokb", "The Halls of Betrayal" 

	longname.Add "soldungc", "The Caverns of Exile" 

	longname.Add "abysmal", "Abysmal Sea" 

	longname.Add "natimbi", "Natimbi - The Broken Shores" 

	longname.Add "qinimi", "Qinimi - Court of Nihilia" 

	longname.Add "riwwi", "Riwwi - Coliseum of Games" 

	longname.Add "barindu", "Barindu - Hanging Gardens" 

	longname.Add "ferubi", "Ferubi - Forgotten Temple of Taelosia" 

	longname.Add "snpool", "Sewers of Nihilia - Pool of Sludge" 

	longname.Add "snlair", "Sewers of Nihilia - Lair of Trapped Ones" 

	longname.Add "snplant", "Sewers of Nihilia - Purifying Plant" 

	longname.Add "sncrematory", "Sewers of Nihilia - the Crematory" 

	longname.Add "tipt", "Tipt - Treacherous Crags" 

	longname.Add "vxed", "Vxed - The Crumbling Caverns" 

	longname.Add "yxtta", "Yxtta - Pulpit of Exiles" 

	longname.Add "uqua", "Uqua - The Ocean God Chantry" 

	longname.Add "kodtaz", "Kod'Taz - Broken Trial Grounds" 

	longname.Add "ikkinz", "Ikkinz - Chambers of Destruction" 

	longname.Add "qvic", "Qvic - Prayer Grounds of Calling" 

	longname.Add "inktuta", "Inktu`Ta, The Unmasked Chapel" 

	longname.Add "txevu", "Txevu - Lair of the Elite" 

	longname.Add "tacvi", "Tacvi - Seat of the Slaver" 

	longname.Add "qvicb", "Qvic - the Hiden Vault" 

	longname.Add "wallofslaughter", "Wall of Slaughter" 

	longname.Add "bloodfields", "The Bloodfields" 

	longname.Add "draniksscar", "Dranik's Scar" 

	longname.Add "causeway", "Nobles' Causeway" 

	longname.Add "chambersa", "Muramite Proving Grounds" 

	longname.Add "chambersb", "Muramite Proving Grounds" 

	longname.Add "chambersc", "Muramite Proving Grounds" 

	longname.Add "chambersd", "Muramite Proving Grounds" 

	longname.Add "chamberse", "Muramite Proving Grounds" 

	longname.Add "chambersf", "Muramite Proving Grounds" 

	longname.Add "provinggrounds", "Muramite Proving Grounds" 

	longname.Add "anguish", "Asylum of Anguish" 

	longname.Add "dranikhollowsa", "Dranik's Hollows" 

	longname.Add "dranikhollowsb", "Dranik's Hollows" 

	longname.Add "dranikhollowsc", "Dranik's Hollows" 

	longname.Add "dranikhollowsd", "Dranik's Hollows" 

	longname.Add "dranikhollowse", "Dranik's Hollows" 

	longname.Add "dranikhollowsf", "Dranik's Hollows" 

	longname.Add "dranikhollowsg", "Dranik's Hollows" 

	longname.Add "dranikhollowsh", "Dranik's Hollows" 

	longname.Add "dranikhollowsi", "Dranik's Hollows" 

	longname.Add "dranikhollowsj", "Dranik's Hollows" 

	longname.Add "dranikcatacombsa", "Catacombs of Dranik" 

	longname.Add "dranikcatacombsb", "Catacombs of Dranik" 

	longname.Add "dranikcatacombsc", "Catacombs of Dranik" 

	longname.Add "draniksewersa", "Sewers of Dranik" 

	longname.Add "draniksewersb", "Sewers of Dranik" 

	longname.Add "draniksewersc", "Sewers of Dranik" 

	longname.Add "riftseekers", "Riftseekers' Sanctum" 

	longname.Add "harbingers", "Harbingers' Spire" 

	longname.Add "dranik", "The Ruined City of Dranik" 

	longname.Add "broodlands", "The Broodlands" 

	longname.Add "stillmoona", "Stillmoon Temple" 

	longname.Add "stillmoonb", "The Ascent" 

	longname.Add "thundercrest", "Thundercrest Isles" 

	longname.Add "delvea", "Lavaspinner's Lair" 

	longname.Add "delveb", "Tirranum's Delve"

	longname.Add "thenest", "The Accursed Nest" 

	longname.Add "guildlobby", "Guild Lobby" 

	longname.Add "guildhall", "Guild Hall" 

	longname.Add "barter", "Barter Hall" 

	longname.Add "illsalin", "The Ruins of Illsalin" 

	longname.Add "illsalina", "Imperial Bazaar" 

	longname.Add "illsalinb", "Temple of the Korlach" 

	longname.Add "illsalinc", "The Nargilor Pits" 

	longname.Add "dreadspire", "Dreadspire Keep" 

	longname.Add "dreadspirea", "The Torture Chamber"

	longname.Add "dreadspireb", "The Artifact Room"

	longname.Add "drachnidhive", "The Hive" 

	longname.Add "drachnidhivea", "Living Larder" 

	longname.Add "drachnidhiveb", "Coven of the Skinwalkers" 

	longname.Add "drachnidhivec", "Queen Sendaii's Lair" 

	longname.Add "westkorlach", "Stoneroot Falls" 

	longname.Add "westkorlacha", "Chambers of Xill" 

	longname.Add "westkorlachb", "Caverns of the Lost" 

	longname.Add "westkorlachc", "Lair of the Korlach" 

	longname.Add "eastkorlach", "Undershore" 

	longname.Add "eastkorlacha", "Snarlstone Dens" 

	longname.Add "shadowspine", "Shadowspine" 

	longname.Add "corathus", "Corathus Creep" 

	longname.Add "corathusa", "Sporali Caverns" 

	longname.Add "corathusb", "Corathus Lair" 

	longname.Add "nektulosa", "Shadowed Grove" 

	longname.Add "arcstone", "Arcstone" 

	longname.Add "relic", "Relic"

	longname.Add "skylance", "Skylance"

	longname.Add "devastation", "The Devastation"

	longname.Add "devastationa", "The Seething Wall"

	longname.Add "rage", "Sverag, Stronghold of Rage"

	longname.Add "ragea", "Razorthorn - Tower of Sullon Zek"

	longname.Add "takishruins", "Ruins of Takish-Hiz"

	longname.Add "takishruinsa", "The Root of Ro"

	longname.Add "elddar", "The Elddar Forest"

	longname.Add "elddara", "Tunare's Shrine"

	longname.Add "theater", "Theater of Blood"

	longname.Add "theatera", "Deathknell - Tower of Dissonance"

	longname.Add "freeporteast", "Freeport East"

	longname.Add "freeportwest", "Freeport West"

	longname.Add "freeportsewers", "Freeport Sewers"

	longname.Add "freeportacademy", "Academy of Arcane Sciences"

	longname.Add "freeporttemple", "Temple of Marr"

	longname.Add "freeportmilitia", "Freeport Militia House"

	longname.Add "freeportarena", "Arena"

	longname.Add "freeportcityhall", "City Hall"

	longname.Add "freeporttheater", "Theater"

	longname.Add "freeporthall", "Hall of Truth"

	longname.Add "northro", "North Ro"

	longname.Add "southro", "South Ro"

	longname.Add "crescent", "Crescent Reach" 

	longname.Add "moors", "Blightfire Moors" 

	longname.Add "stonehive", "Stone Hive" 

	longname.Add "mesa", "Koru`kar Mesa" 

	longname.Add "roost", "Blackfeather Roost" 

	longname.Add "steppes", "The Steppes" 

	longname.Add "icefall", "Icefall Glacier" 

	longname.Add "valdeholm", "Valdeholm" 

	longname.Add "frostcrypt", "Frostcrypt - Throne of the Shade King" 

	longname.Add "sunderock", "Sunderock Springs" 

	longname.Add "vergalid", "Vergalid Mines" 

	longname.Add "direwind", "Direwind Cliffs" 

	longname.Add "ashengate", "Ashengate - Reliquary of the Scale" 

	longname.Add "highpasshold", "Highpass Hold" 

	longname.Add "commonlands", "Commonlands" 

	longname.Add "oceanoftears", "Ocean of Tears" 

	longname.Add "kithforest", "Kithicor Forest" 

	longname.Add "befallenb", "Befallen" 

	longname.Add "highpasskeep", "HighKeep" 

	longname.Add "innothuleb", "Innothule Swamp" 

	longname.Add "toxxulia", "Toxxulia Forest" 

	longname.Add "mistythicket", "Misty Thicket" 

	longname.Add "kattacastrum", "Katta Castrum" 

	longname.Add "thalassius", "Thalassius - The Coral Keep" 

	longname.Add "atiiki", "Jewel of Atiiki" 

	longname.Add "zhisza", "Zhisza, the Shissar Sanctuary" 

	longname.Add "silyssar", "Silyssar - New Chelsith" 

	longname.Add "solteris", "Solteris - The Throne of Ro" 

	longname.Add "barren", "Barren Coast" 

	longname.Add "buriedsea", "The Buried Sea" 

	longname.Add "jardelshook", "Jardel's Hook" 

	longname.Add "monkeyrock", "Monkey Rock" 

	longname.Add "suncrest", "Suncrest Isle" 

	longname.Add "deadbone", "Deadbone Reef" 

	longname.Add "blacksail", "Blacksail Folly" 

	longname.Add "maidensgrave", "Maiden's Grave" 

	longname.Add "redfeather", "Redfeather Isle" 

	longname.Add "shipmvp", "The Open Sea" 

	longname.Add "shipmvu", "The Open Sea" 

	longname.Add "shippvu", "The Open Sea" 

	longname.Add "shipuvu", "The Open Sea" 

	longname.Add "shipmvm", "The Open Sea" 

	longname.Add "mechanotus", "Fortress Mechanotus" 

	longname.Add "mansion", "Meldrath's Majestic Mansion" 

	longname.Add "steamfactory", "The Steam Factory" 

	longname.Add "shipworkshop", "S.H.I.P. Workshop" 

	longname.Add "gyrospireb", "Gyrospire Beza" 

	longname.Add "gyrospirez", "Gyrospire Zeka" 

	longname.Add "dragonscale", "Dragonscale Hills" 

	longname.Add "lopingplains", "Loping Plains" 

	longname.Add "hillsofshade", "Hills of Shade" 

	longname.Add "bloodmoon", "Bloodmoon Keep" 

	longname.Add "crystallos", "Crystallos - Lair of the Awakened" 

	longname.Add "guardian", "The Mechamatic Guardian" 

	longname.Add "steamfontmts", "Steamfont Mountains" 

	longname.Add "cryptofshade", "Crypt of Shade" 

	longname.Add "dragonscalea", "Tinmizer's Wunderwerks"

	longname.Add "dragonscaleb", "Deepscar's Den"

	longname.Add "oldfieldofbone", "Field of Scale"

	longname.Add "oldkaesoraa", "Kaesora Library"

	longname.Add "oldkaesorab", "Hatchery Wing"

	longname.Add "oldkurn", "Kurn's Tower"

	longname.Add "oldkithicor", "Bloody Kithicor"

	longname.Add "oldcommons", "Old Commonlands"

	longname.Add "oldhighpass", "Highpass Hold"

	longname.Add "thevoida", "The Void"

	longname.Add "thevoidb", "The Void"

	longname.Add "thevoidc", "The Void"

	longname.Add "thevoidd", "The Void"

	longname.Add "thevoide", "The Void"

	longname.Add "thevoidf", "The Void"

	longname.Add "thevoidg", "The Void"

	longname.Add "oceangreenhills", "Oceangreen Hills"

	longname.Add "oceangreenvillage", "Oceangreen Village"

	longname.Add "oldblackburrow", "Blackburrow"

	longname.Add "bertoxtemple", "Temple of Bertoxxulous"

	longname.Add "discord", "Korafax - Home of the Riders"

	longname.Add "discordtower", "Citadel of the Worldslayer"

	longname.Add "oldbloodfield", "Old Bloodfields"

	longname.Add "precipiceofwar", "The Precipice of War"

	longname.Add "olddranik", "City of Dranik"

	longname.Add "toskirakk", "Toskirakk"

	longname.Add "korascian", "Korascian Warrens"

	longname.Add "rathechamber", "Rathe Council Chambers"

	longname.Add "arttest", "Art Testing Domain" 

	longname.Add "fhalls", "The Forgotten Halls" 

	longname.Add "apprentice", "Designer Apprentice" 

    longname.Add "crafthalls", "Ngreth's Den"
    longname.Add "brellsrest", "Brell's Rest"
    longname.Add "fungalforest", "Fungal Forest"
    longname.Add "underquarry", "The Underquarry"
    longname.Add "coolingchamber", "The Cooling Chamber"
    longname.Add "shiningcity", "Kernagir, The Shining City"
    longname.Add "arthicrex", "Arthicrex"
    longname.Add "foundation", "The Foundation"
    longname.Add "lichencreep", "Lichen Creep"
    longname.Add "pellucid", "Pellucid Grotto"
    longname.Add "stonesnake", "Volska's Husk"
    longname.Add "brellstemple", "Brell's Temple"
    longname.Add "convorteum", "The Convorteum"
    longname.Add "brellsarena", "Brell's Arena"
    longname.Add "weddingchapel", "Wedding Chapel"
    longname.Add "weddingchapeldark", "Wedding Chapel"
    longname.Add "dragoncrypt", "Lair of the Fallen"
    longname.Add "feerrott2", "The Feerrott"
    longname.Add "thulehouse1", "House of Thule"
    longname.Add "thulehouse2", "House of Thule, Upper Floors"
    longname.Add "housegarden", "The Grounds"
    longname.Add "thulelibrary", "The Library"
    longname.Add "well", "The Well"
    longname.Add "fallen", "Erudin Burning"
    longname.Add "morellcastle", "Morell's Castle"
    longname.Add "somnium", "Sanctum Somnium"
    longname.Add "alkabormare", "Al'Kabor's Nightmare"
    longname.Add "miragulmare", "Miragul's Nightmare"
    longname.Add "thuledream", "Fear Itself"
    longname.Add "neighborhood", "Sunrise Hills"
    longname.Add "phylactery", "Miragul's Phylactery"
    longname.Add "phinterior3a1", "House Interior"
    longname.Add "phinterior3a2", "House Interior"
    longname.Add "phinterior3a3", "House Interior"
    longname.Add "phinterior1a1", "House Interior"
    longname.Add "phinterior1a2", "House Interior"
    longname.Add "phinterior1a3", "House Interior"
    longname.Add "phinterior1b1", "Dragon House Interior"
    longname.Add "phinterior1d1", "Dragon House Interior"
    longname.Add "argath", "Argath, Bastion of Illdaera"
    longname.Add "arelis", "Valley of Lunanyn"
    longname.Add "sarithcity", "Sarith, City of Tides"
    longname.Add "rubak", "Rubak Oseka, Temple of the Sea"
    longname.Add "beastdomain", "Beasts' Domain"
    longname.Add "resplendent", "The Resplendent Temple"
    longname.Add "pillarsalra", "Pillars of Alra"
    longname.Add "windsong", "Windsong Sanctuary"
    longname.Add "cityofbronze", "Erillion, City of Bronze"
    longname.Add "sepulcher", "Sepulcher of Order"
    longname.Add "eastsepulcher", "Sepulcher East"
    longname.Add "westsepulcher", "Sepulcher West"
    longname.Add "shadowedmount", "Shadowed Mount"
    longname.Add "guildhalllrg", "Grand Guild Hall"
    longname.Add "guildhallsml", "Greater Guild Hall"
    longname.Add "plhogrinteriors1a1", "One Bedroom House Interior"
    longname.Add "plhogrinteriors1a2", "One Bedroom House Interior"
    longname.Add "plhogrinteriors3a1", "Three Bedroom House Interior"
    longname.Add "plhogrinteriors3a2", "Three Bedroom House Interior"
    longname.Add "plhogrinteriors3b1", "Three Bedroom House Interior"
    longname.Add "plhogrinteriors3b2", "Three Bedroom House Interior"
    longname.Add "plhdkeinteriors1a1", "One Bedroom House Interior"
    longname.Add "plhdkeinteriors1a2", "One Bedroom House Interior"
    longname.Add "plhdkeinteriors1a3", "One Bedroom House Interior"
    longname.Add "plhdkeinteriors3a1", "Three Bedroom House Interior"
    longname.Add "plhdkeinteriors3a2", "Three Bedroom House Interior"
    longname.Add "plhdkeinteriors3a3", "Three Bedroom House Interior"
    longname.Add "guildhall3", "Modest Guild Hall"
    longname.Add "kaelshard", "Kael Drakkel: The King's Madness"
    longname.Add "eastwastesshard", "East Wastes: Zeixshi-Kar's Awakening"
    longname.Add "crystalshard", "The Crystal Caverns: Fragment of Fear"
    longname.Add "shardslanding", "Shard's Landing"
    longname.Add "xorbb", "Valley of King Xorbb"
    longname.Add "breedinggrounds", "The Breeding Grounds"
    longname.Add "eviltree", "Evantil, the Vile Oak"
    longname.Add "grelleth", "Grelleth's Palace, the Chateau of Filth"
    longname.Add "chapterhouse", "Chapterhouse of the Fallen"
    longname.Add "pomischief", "The Plane of Mischief"
    longname.Add "burnedwoods", "The Burned Woods"
 

	Set fso = CreateObject("Scripting.FileSystemObject")

	ForReading = 1



	sPath = MID(Wscript.ScriptFullName,1,InStrRev(Wscript.ScriptFullName,"\")-1)



	Set Folder = fso.GetFolder(sPath)

	Set MapFiles = Folder.Files

	mCount = 0



	For Each myFile in MapFiles

        mLines = 0

		sExtension = Right(myFile, 6)

		if UCase(sExtension) = "_1.TXT" then

			mCount = mCount + 1

	  		strPath = myFile.Path

	  		Set Test = fso.GetFile(strPath)

		  	If Test.Size > 0 Then

				sZone = left(Test.Name, len(Test.Name) - 6)

				szPath = sPath & "\"

				szMapFile = szPath & sZone & ".map"

				objExplorer.Document.Body.InnerHTML = "Converting <b>" & sZone & "</b> from SOE to SEQ format."

		    		Dim fs, soemap, newmap

		    		Set fs = CreateObject("Scripting.FileSystemObject")

		    		Set newmap = fs.CreateTextFile(szMapFile, True, False)

		    		If longname.Exists(sZone) Then

		    			newmap.write (longname.Item(sZone) & "," & sZone & ",0,0") & chr(10)

		    		Else

		    			newmap.write (sZone & " map," & sZone & ",0,0") & chr(10)

		    		End If

				For w = 0 to 2
                    if w = 0 Then
                        sFileName = szPath & sZone & ".txt"
                    Else
    					sFileName = szPath & sZone & "_" & w & ".txt"
                    End If

					If fso.FileExists(sFileName) then

						Set soemap = fs.OpenTextFile(sFileName, 1, False)

						Do While soemap.AtEndOfStream <> True

							PreText = ""

							PreText = soemap.ReadLine

							' Line Handling

							If Left(PreText, 1) = "P" Then

								NextText = Replace(PreText, " ", "")

								PostText = Right(NextText, Len(NextText) - 1)

								LastText = Replace(PostText, ",to_", ",To_")

								L = Split(LastText, ",", -1)

								If UBound(L) > -1 Then

						    			' Have split line string - 9 parameters, 0-8

						    			' Convert Color into a 1-64 index

						    			r = DoColor(CLng(L(3)))

						    			g = DoColor(CLng(L(4)))

						    			b = DoColor(CLng(L(5)))

						    			Dim sTextString

						    			sTextString = Replace(L(7), "_", " ")

						    			iColorInd = (r) + (g * 4) + (b * 16) + 1

						    			' Convert Blacks to White for labels if set

									If BlackLabelColor > 0 Then

								    		If iColorInd = 1 Then iColorInd = BlackLabelColor

									End If

									If Len(sTextString) > 3 Then

										If Left(sTextString,3) = "To " then iColorInd = tocolor

									End If

									If AllLabelColor > 0 then iColorInd = AllLabelColor

									v = s = t = 0

						    			v = -1 * CLng(L(0))

						    			s = -1 * CLng(L(1))
									t = 1 * CLng(L(2))

						    			MapLabelOut = "P," & sTextString & "," & szColor(iColorInd) & "," & v & "," & s & "," & t

						    			newmap.write (MapLabelOut) & chr(10)

								End If

						  	End If

					  		If Left(PreText, 1) = "L" Then

								PostText = Replace(PreText, "L", "")

								LastText = Replace(PostText, " ", "")

								L = Split(LastText, ",", -1)

								If UBound(L) > -1 Then

									' Have split line string - 9 parameters, 0-8

									' Convert Color into a 1-64 index

									r = DoColor(CLng(L(6)))

									g = DoColor(CLng(L(7)))

						    			b = DoColor(CLng(L(8)))

							    		iColorInd = (r) + (g * 4) + (b * 16) + 1

						    			' Convert Blacks to Grey if set

									If BlackLineColor > 0 Then

							    			If iColorInd = 1 Then iColorInd = BlackLineColor

									End If

									If AllLineColor > 0 then iColorInd = AllLineColor

									x1 = y1 = z1 = x2 = y2 = z2 = 0

						    			x1 = -1 * CLng(L(0))

						    			y1 = -1 * CLng(L(1))

						    			z1 = 10 * CLng(L(2))

						    			x2 = -1 * CLng(L(3))

						    			y2 = -1 * CLng(L(4))

						    			z2 = 10 * CLng(L(5))

						    			maplineout = "M,line," & szColor(iColorInd) & ",2," & x1 & "," & y1 & "," & z1 & "," & x2 & "," & y2 & "," & z2

						    			newmap.write (maplineout) & chr(10)

                                        mLines = mLines + 1

								End If

					 	 	End If

				    		Loop

						soemap.Close

					End If

                    If (w = 0 and mLines > 0) Then

                        w = 2

                    End If

				Next

				newmap.Close

				If ConnectDots = 1 Then

					objExplorer.Document.Body.InnerHTML = "Converting <b>" & sZone & "</b> from SOE to SEQ format.<br>Connecting map lines."

					Call Remove_Dots (szMapFile, sZone)

		  			Call Connect_The_Dots (szMapFile, sZone)

				End If

			End If

		End If

	Next

	if mCount = 0 then

		objExplorer.Document.Body.InnerHTML = "No Maps Found to Process.<br>Run this file from the folder containing maps."

		WScript.Sleep 5000

	End If

End Sub



Function DoColor(iColor)

	If iColor < 69 Then

		DoColor = 0

	Else

		If iColor < 160 Then

			DoColor = 1

		Else

			If iColor < 240 Then

				DoColor = 2

			Else

		    		DoColor = 3

			End If

		End If

	End If

End Function



Sub Connect_The_Dots(FileName,sZone)

	Dim Outline, PreText, NextLine

	Dim fso

	' Set these for connecting lines.  If it is less than this between points, it is considered equivalent

	xyCoord = 2

	zCoord = 2

	Set fso = CreateObject("Scripting.FileSystemObject")

	sBackup = FileName & "~"

	sMapFile = FileName

	optsnum = 1

	lastchance = 0

	Do While optsnum > 0

		Set MyFile = fso.GetFile(FileName)

		MyFile.Copy(sBackup)

		optsnum = 0

		Dim fs, oldmap, newmap

		Set fs = CreateObject("Scripting.FileSystemObject")

		' Create New Map for Writing Optimized Map

		Set newmap = fs.CreateTextFile(sMapFile, True, False)

		' Open map for reading (backup file)

		Set oldmap = fs.OpenTextFile(sBackup, 1, False)

		If lastchance = 1 Then

			Do

				If oldmap.AtEndOfStream <> True Then

					PreText = ""

					PreText = oldmap.ReadLine

					newmap.write PreText & chr(10)

				Else

					Exit Do

				End If

			Loop Until Left(PreText,2) = "M,"

		End If

		Do While oldmap.AtEndOfStream <> True

			PreText = ""

			PreText = oldmap.ReadLine

			' Only do lines

			If Left(PreText, 2) = "M," Then

				x1 = y1 = z1 = x2 = y2 = z2 = nx1 = ny1 = nz1 = nx2 = ny2 = nz2 = 0

				L = Split(PreText, ",", -1)

				'Find number of coordinates in line

				num = (UBound(L) - 3) / 3

				pColor = L(2)

				x1 = CLng(L(4))

				y1 = CLng(L(5))

				z1 = CLng(L(6))

				x2 = CLng(L(num * 3 + 1))

				y2 = CLng(L(num * 3 + 2))

				z2 = CLng(L(num * 3 + 3))

				If oldmap.AtEndOfStream = True Then

					' At end of file, so write line and be done

					newmap.write PreText & chr(10)

			  	Else

					' Read next line, see if can add coordinates

					NextLine = oldmap.ReadLine

					If Left(NextLine, 2) = "M," Then

						M = Split(NextLine, ",", -1)

						nnum = (UBound(M) - 3) / 3

						nColor = L(2)

						nx1 = CLng(M(4))

						ny1 = CLng(M(5))

						nz1 = CLng(M(6))

						nx2 = CLng(M(nnum * 3 + 1))

						ny2 = CLng(M(nnum * 3 + 2))

						nz2 = CLng(M(nnum * 3 + 3))

						If (pColor = nColor) And (Abs(nx2 - x1) <= xyCoord) And (Abs(ny2 - y1) <= xyCoord) And (Abs(nz2 - z1) <= zCoord) Then

							optsnum = optsnum + 1

							'put 2nd point before first

							Outline = L(0) & "," & L(1) & "," & L(2) & "," & (num + nnum - 1)

							For tl = 1 To nnum

								Outline = Outline & "," & M(tl * 3 + 1) & "," & M(tl * 3 + 2) & "," & M(tl * 3 + 3)

							Next

							For tl = 2 To num

								Outline = Outline & "," & L(tl * 3 + 1) & "," & L(tl * 3 + 2) & "," & L(tl * 3 + 3)

							Next

							newmap.write Outline & chr(10)

						Else

							If (pColor = nColor) And (Abs(nx1 - x2) <= xyCoord) And (Abs(ny1 - y2) <= xyCoord) And (Abs(nz1 - z2) <= zCoord) Then

								optsnum = optsnum + 1

								' put 2nd point after first

								Outline = L(0) & "," & L(1) & "," & L(2) & "," & (num + nnum - 1)

								For tl = 1 To num

						    			Outline = Outline & "," & L(tl * 3 + 1) & "," & L(tl * 3 + 2) & "," & L(tl * 3 + 3)

								Next

								For tl = 2 To nnum

									Outline = Outline & "," & M(tl * 3 + 1) & "," & M(tl * 3 + 2) & "," & M(tl * 3 + 3)

								Next

								newmap.write Outline & chr(10)

					  		Else

								'   check lines back to back

								If (pColor = nColor) And (Abs(nx1 - x1) <= xyCoord) And (Abs(ny1 - y1) <= xyCoord) And (Abs(nz1 - z1) <= zCoord) Then

						    			optsnum = optsnum + 1

						    			' put 2nd point after first

						    			Outline = L(0) & "," & L(1) & "," & L(2) & "," & (num + nnum - 1)

									For tl = nnum To 1 Step -1

										Outline = Outline & "," & M(tl * 3 + 1) & "," & M(tl * 3 + 2) & "," & M(tl * 3 + 3)

									Next

									For tl = 2 To num

										Outline = Outline & "," & L(tl * 3 + 1) & "," & L(tl * 3 + 2) & "," & L(tl * 3 + 3)

									Next

									newmap.write Outline & chr(10)

								Else

									If (pColor = nColor) And (Abs(nx2 - x2) <= xyCoord) And (Abs(ny2 - y2) <= xyCoord) And (Abs(nz2 - z2) <= zCoord) Then

										optsnum = optsnum + 1

										' put 2nd point after first

										Outline = L(0) & "," & L(1) & "," & L(2) & "," & (num + nnum - 1)

										For tl = 1 To num

											Outline = Outline & "," & L(tl * 3 + 1) & "," & L(tl * 3 + 2) & "," & L(tl * 3 + 3)

										Next

										For tl = (nnum - 1) To 1 Step -1

											Outline = Outline & "," & M(tl * 3 + 1) & "," & M(tl * 3 + 2) & "," & M(tl * 3 + 3)

										Next

										newmap.write Outline & chr(10)

									Else

										newmap.write PreText & chr(10)

										newmap.write NextLine & chr(10)

									End If

								End If

							End If

						End If

					Else

						newmap.write PreText & chr(10)

						newmap.write NextLine & chr(10)

					End If

				End If

			Else

				newmap.write PreText & chr(10)

			End If

		Loop

		objExplorer.Document.Body.InnerHTML = "Converting <b>" & sZone & "</b> from SOE to SEQ format.<br>Connecting map lines.<br>This Pass: Lines Connected - " & optsnum

		If optsnum > 0 Then lastchance = 0

		If (optsnum = 0) and (lastchance = 0) Then

			lastchance = 1

			optsnum = 1

		End If

		newmap.Close

		oldmap.Close

	Loop

	Set MyFile = fso.GetFile(sBackup)

	MyFile.Delete

End Sub



Sub Remove_Dots(FileName,sZone)

	Dim Outline, PreText, NextLine

	Dim fso

	' Set these for connecting lines.  If it is less than this between points, it is considered equivalent

	Set fso = CreateObject("Scripting.FileSystemObject")

	sBackup = FileName & "~"

	sMapFile = FileName

	optsnum = 1

	lastchance = 0

	Do While optsnum > 0

		Set MyFile = fso.GetFile(FileName)

		MyFile.Copy(sBackup)

		optsnum = 0

		Dim fs, oldmap, newmap

		Set fs = CreateObject("Scripting.FileSystemObject")

		' Create New Map for Writing Optimized Map

		Set newmap = fs.CreateTextFile(sMapFile, True, False)

		' Open map for reading (backup file)

		Set oldmap = fs.OpenTextFile(sBackup, 1, False)

		If lastchance = 1 Then

			Do

				If oldmap.AtEndOfStream <> True Then

					PreText = ""

					PreText = oldmap.ReadLine

					newmap.write PreText & chr(10)

				Else

					Exit Do

				End If

			Loop Until Left(PreText,2) = "M,"

		End If

		Do While oldmap.AtEndOfStream <> True

			PreText = ""

			PreText = oldmap.ReadLine

			' Only do lines

			If Left(PreText, 2) = "M," Then

				x1 = y1 = z1 = x2 = y2 = z2 = nx1 = ny1 = nz1 = nx2 = ny2 = nz2 = 0

				L = Split(PreText, ",", -1)

				'Find number of coordinates in line

				num = (UBound(L) - 3) / 3

				pColor = L(2)

				x1 = CLng(L(4))

				y1 = CLng(L(5))

				z1 = CLng(L(6))

				x2 = CLng(L(num * 3 + 1))

				y2 = CLng(L(num * 3 + 2))

				z2 = CLng(L(num * 3 + 3))

				vx1 = CDbl(L(4))

				vy1 = CDbl(L(5))

				vz1 = CDbl(L(6))

				vx2 = CDbl(L(num * 3 + 1))

				vy2 = CDbl(L(num * 3 + 2))

				vz2 = CDbl(L(num * 3 + 3))

				If oldmap.AtEndOfStream = True Then

					' At end of file, so write line and be done

					newmap.write PreText & chr(10)

			  	Else

					' Read next line, see if can add coordinates

					NextLine = oldmap.ReadLine

					dotremoved = 0

					If Left(NextLine, 2) = "M," Then

						M = Split(NextLine, ",", -1)

						nnum = (UBound(M) - 3) / 3

						nColor = L(2)

						nx1 = CLng(M(4))

						ny1 = CLng(M(5))

						nz1 = CLng(M(6))

						nx2 = CLng(M(nnum * 3 + 1))

						ny2 = CLng(M(nnum * 3 + 2))

						nz2 = CLng(M(nnum * 3 + 3))

						nvx1 = CDbl(M(4))

						nvy1 = CDbl(M(5))

						nvz1 = CDbl(M(6))

						nvx2 = CDbl(M(nnum * 3 + 1))

						nvy2 = CDbl(M(nnum * 3 + 2))

						nvz2 = CDbl(M(nnum * 3 + 3))

						If (pColor = nColor) Then

							If ((nx2 - x1) = 0) And ((ny2 - y1) = 0) And ((nz2 - z1) = 0) Then

								' points are common, see if can remove one

								temp1 = ((vx2 - vx1) * (vx2 - vx1)) + ((vy2 - vy1) * (vy2 - vy1)) + ((vz2 - vz1) * (vz2 - vz1))

								temp2 = ((nvx2 - nvx1) * (nvx2 - nvx1)) + ((nvy2 - nvy1) * (nvy2 - nvy1)) + ((nvz2 - nvz1) * (nvz2 - nvz1))

								If (temp1 > 0) and (temp2 > 0) Then

									V1 = Sqr(temp1)

									V2 = Sqr(temp2)

									va = (vx2 - vx1) / V1

									vb = (vy2 - vy1) / V1

									vc = (vz2 - vz1) / V1

									nva = (nvx2 - nvx1) / V2

									nvb = (nvy2 - nvy1) / V2

									nvc = (nvz2 - nvz1) / V2

									if (va * nva + vb * nvb + vc * nvc) > 0.9999 Then

									'if (va = nva) and (vb = nvb) and (vc = nvc) Then

										' Have unit vectors of two lines in same direction

										' Remove the point

										optsnum = optsnum + 1

										'put 2nd point before first

										Outline = L(0) & "," & L(1) & "," & L(2) & ",2"

										Outline = Outline & "," & M(4) & "," & M(5) & "," & M(6)

										Outline = Outline & "," & L(7) & "," & L(8) & "," & L(9)

										dotremoved = 1

									End If

								End If

							End If

						Else

							If ((nx1 - x2) = 0) And ((ny1 - y2) = 0) And ((nz1 - z2) = 0) Then

								temp1 = ((vx2 - vx1) * (vx2 - vx1)) + ((vy2 - vy1) * (vy2 - vy1)) + ((vz2 - vz1) * (vz2 - vz1))

								temp2 = ((nvx2 - nvx1) * (nvx2 - nvx1)) + ((nvy2 - nvy1) * (nvy2 - nvy1)) + ((nvz2 - nvz1) * (nvz2 - nvz1))

								If (temp1 > 0) and (temp2 > 0) Then

									V1 = Sqr(temp1)

									V2 = Sqr(temp2)

									va = (vx2 - vx1) / V1

									vb = (vy2 - vy1) / V1

									vc = (vz2 - vz1) / V1

									nva = (nvx2 - nvx1) / V2

									nvb = (nvy2 - nvy1) / V2

									nvc = (nvz2 - nvz1) / V2

									if (va * nva + vb * nvb + vc * nvc) > 0.9999 Then

									'if (va = nva) and (vb = nvb) and (vc = nvc) Then

										' Have unit vectors of two lines in same direction

										' Remove the point

										optsnum = optsnum + 1

										Outline = L(0) & "," & L(1) & "," & L(2) & ",2"

						    				Outline = Outline & "," & L(4) & "," & L(5) & "," & L(6)

										Outline = Outline & "," & M(7) & "," & M(8) & "," & M(9)

										dotremoved = 1

									End if

								End if

					  		Else

								'   check lines back to back

								If ((nx1 - x1) = 0) And ((ny1 - y1) = 0) And ((nz1 - z1) = 0) Then

									temp1 = ((vx2 - vx1) * (vx2 - vx1)) + ((vy2 - vy1) * (vy2 - vy1)) + ((vz2 - vz1) * (vz2 - vz1))

									temp2 = ((nvx2 - nvx1) * (nvx2 - nvx1)) + ((nvy2 - nvy1) * (nvy2 - nvy1)) + ((nvz2 - nvz1) * (nvz2 - nvz1))

									If (temp1 > 0) and (temp2 > 0) Then

										V1 = Sqr(temp1)

										V2 = Sqr(temp2)

										va = (vx1 - vx2) / V1

										vb = (vy1 - vy2) / V1

										vc = (vz1 - vz2) / V1

										nva = (nvx2 - nvx1) / V2

										nvb = (nvy2 - nvy1) / V2

										nvc = (nvz2 - nvz1) / V2

										if (va * nva + vb * nvb + vc * nvc) > 0.9999 Then

										'if (va = nva) and (vb = nvb) and (vc = nvc) Then

											' Have unit vectors of two lines in same direction

											' Remove the point

						    					optsnum = optsnum + 1

						    					Outline = L(0) & "," & L(1) & "," & L(2) & ",2"

											Outline = Outline & "," & M(7) & "," & M(8) & "," & M(9)

											Outline = Outline & "," & L(7) & "," & L(8) & "," & L(9)

											dotremoved = 1

										End If

									End If

								Else

									If ((nx2 - x2) = 0) And ((ny2 - y2) = 0) And ((nz2 - z2) = 0) Then

										temp1 = ((vx2 - vx1) * (vx2 - vx1)) + ((vy2 - vy1) * (vy2 - vy1)) + ((vz2 - vz1) * (vz2 - vz1))

										temp2 = ((nvx2 - nvx1) * (nvx2 - nvx1)) + ((nvy2 - nvy1) * (nvy2 - nvy1)) + ((nvz2 - nvz1) * (nvz2 - nvz1))

										If (temp1 > 0) and (temp2 > 0) Then

											V1 = Sqr(temp1)

											V2 = Sqr(temp2)

											va = (vx2 - vx1) / V1

											vb = (vy2 - vy1) / V1

											vc = (vz2 - vz1) / V1

											nva = (nvx1 - nvx2) / V2

											nvb = (nvy1 - nvy2) / V2

											nvc = (nvz1 - nvz2) / V2

											if (va * nva + vb * nvb + vc * nvc) > 0.9999 Then

											'if (va = nva) and (vb = nvb) and (vc = nvc) Then

												optsnum = optsnum + 1

												Outline = L(0) & "," & L(1) & "," & L(2) & ",2"

												Outline = Outline & "," & L(4) & "," & L(5) & "," & L(6)

												Outline = Outline & "," & M(4) & "," & M(5) & "," & M(6)

												dotremoved = 1

											End If

										End If

									End If

								End If

							End If

						End If

					End If

					If dotremoved = 1 Then

						newmap.write Outline & chr(10)

					Else

						newmap.write PreText & chr(10)

						newmap.write NextLine & chr(10)

					End If

				End If

			Else

				newmap.write PreText & chr(10)

			End If

		Loop

		objExplorer.Document.Body.InnerHTML = "Converting <b>" & sZone & "</b> from SOE to SEQ format.<br>Connecting map lines.<br>This Pass: Points Removed - " & optsnum

		If optsnum > 0 Then lastchance = 0

		If (optsnum = 0) and (lastchance = 0) Then

			lastchance = 1

			optsnum = 1

		End If

		newmap.Close

		oldmap.Close

	Loop

	Set MyFile = fso.GetFile(sBackup)

	MyFile.Delete

End Sub
Reply With Quote
  #5  
Old 01-02-2013, 02:18 PM
FievelMousey
Hill Giant
 
Join Date: Jan 2004
Posts: 140
Default

Will this work for UF client and if not it possible can make one that will?


Thanks
Reply With Quote
  #6  
Old 01-02-2013, 03:12 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Quote:
Originally Posted by FievelMousey View Post
Will this work for UF client and if not it possible can make one that will?


Thanks
Underfoot can already use all of those zones with no modification as long as you have the zone files in the client directory.
Reply With Quote
  #7  
Old 01-02-2013, 03:41 PM
FievelMousey
Hill Giant
 
Join Date: Jan 2004
Posts: 140
Default

OK cool didnt know that and is there a list files needed be copied over make work be very helpful?
Reply With Quote
  #8  
Old 01-02-2013, 05:04 PM
lerxst2112
Demi-God
 
Join Date: Aug 2010
Posts: 1,742
Default

Download a copy of the F2P client for live and copy all the zone files over that don't already exist in your client.
Reply With Quote
  #9  
Old 02-14-2014, 11:42 AM
NatedogEZ's Avatar
NatedogEZ
Developer
 
Join Date: Dec 2012
Posts: 515
Default

Quote:
Originally Posted by lerxst2112 View Post
Download a copy of the F2P client for live and copy all the zone files over that don't already exist in your client.
Sorry for the necro... but.. this does not work for me.. does it actually work for anyone else?


Copying the RoF zones into the UF folder doesn't allow me to zone into the RoF zones at all.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 12:08 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3