• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

Mq2Allwarp (All in one w/ source)

Joined
Feb 8, 2005
RedCents
8,901¢
Didn't see anything posted around here that is an all in one with source... So i'll post the one I have put together from cosmic and others. I just hate using other peoples pre-compiled dll's and im sure there are freaks like me out there so here ya all go ;)

Code:
// MQ2Allwarp.cpp : Compilation of /zone made by Cosmic and /warp made by Riddler/Siddin
// Directions for usage:
//////////////1///////////////////
// eqdata.h and replace
// /*0x1ec*/ FLOAT Unknown0x1ec[3];
// 
// with
// 
// /*0x1ec*/ FLOAT SafeYLoc;
// /*0x1f0*/ FLOAT SafeXLoc;
// /*0x1f4*/ FLOAT SafeZLoc;
//////////////2////////////////////
// MQ2Main.h
// #define CDisplay__MoveLocalPlayerToSafeCoords 0
// replace 0 with offset
// 0x0043B0FA 9/27
//////////////3////////////////////
// mq2commandapi.cpp and remove
// 
// if (!stricmp(Command,"/warp"))
// {
// Function=0;
// }
///////////////////////////////////
#include "../MQ2Plugin.h"

PreSetup("MQ2Allwarp");

#undef ExactLocation
#undef DoWarp
#undef Warp
#undef SafeYLoc
#undef SafeXLoc
#undef SafeZLoc
#undef ZoneToGoTo
#define LocalCEverQuest__DoTheZone		   0x4AB5A1

class LocalCEverQuest;
class LocalCEverQuest
{
public:
	__declspec(dllexport) char * LocalCEverQuest::DoTheZone(int,char *,int,int,float,float,float,int);
};

#ifdef LocalCEverQuest__DoTheZone
FUNCTION_AT_ADDRESS(char * LocalCEverQuest::DoTheZone(int,char *,int,int,float,float,float,int),LocalCEverQuest__DoTheZone);
#endif

LocalCEverQuest **ppLEQ;
#define pLEQ (*ppLEQ)

VOID ChainShift(PSPAWNINFO pChar, PCHAR szLine); 
VOID ChangeZones(PSPAWNINFO pChar, PCHAR szLine); 
VOID SimGate(PSPAWNINFO pChar, PCHAR szLine); 
VOID SimFade(PSPAWNINFO pChar, PCHAR szLine); 
VOID DoWarp(float y, float x, float z); 
VOID Warp(PSPAWNINFO pChar, PCHAR szLine); 
VOID ExactLocation(PSPAWNINFO pChar);
VOID waypoint(PSPAWNINFO pChar, PCHAR szLine); 
    int ChainShiftZone[100] = {0};
    int ChainShiftStatus = 0;
	int DestZone = 0;
	int DestType = 0;
	int ZoneReason = 0;
	float X = 0;
	float Y = 0;
	float Z = 0;
	int Heading = 0;
	bool ZoneChange = false;

VOID ChainShift(PSPAWNINFO pChar, PCHAR szLine)
{
	char szMsg[MAX_STRING] = {0};
	bool ZoneDetected = true;
	char ZoneCheckName[MAX_STRING] = {0};
	int ZoneFound = 0;
	ChainShiftStatus = 0;
        
	GetArg(ZoneCheckName,szLine,1);
	ZoneFound = GetZoneID(ZoneCheckName);

	while(ZoneDetected == true) {
		if(ZoneFound > 0) {
			ChainShiftZone[0]++;
			ChainShiftZone[ChainShiftZone[0]] = ZoneFound;
			GetArg(ZoneCheckName,szLine,(ChainShiftZone[0] + 1));
			ZoneFound = GetZoneID(ZoneCheckName);
		} else {
			ZoneDetected = false;
		}
	}

	if(ChainShiftZone[0] > 0) {
		ChainShiftStatus++;
		DestZone=ChainShiftZone[1];
		DestType=1;
		ZoneReason=0;
		Y=pChar->Y;
		X=pChar->X;
		Z=pChar->Z;
		Heading =(int)pChar->Heading;
		ZoneChange=true;
		return;
	}
}

VOID ChangeZones(PSPAWNINFO pChar, PCHAR szLine) 
{ 
	static int once=0;
	if (once==1)
	{
		once=0;
		return;
	}
	once=1;
	CHAR szMsg[MAX_STRING] = {0};
	DWORD ZoneToGoTo; 
	ZoneToGoTo = GetZoneID(szLine);

	if (ZoneToGoTo == -1) {
		WriteChatColor("Wrong Zone.ShortName, aborting!!",CONCOLOR_RED);
		once=0;
		return;
	}

	sprintf(szMsg,"Going to zone %s, id %d",szLine,ZoneToGoTo); 
	WriteChatColor(szMsg,USERCOLOR_DEFAULT); 
	char aa[100]="test";
	int heading = (int)pChar->Heading;
	pLEQ->DoTheZone(ZoneToGoTo,aa,1,0,pChar->Y,pChar->X,pChar->Z,heading);
	return;
} 

VOID SimGate(PSPAWNINFO pChar, PCHAR szLine) 
{ 
	static int once=0;
	if (once==1)
	{
		once=0;
		return;
	}
	once=1;

	CHAR szMsg[MAX_STRING] = {0};
	PCHARINFO2 pChar2 = GetCharInfo2();

	sprintf(szMsg,"Gating...");
	WriteChatColor(szMsg,USERCOLOR_DEFAULT); 
	char aa[100]="test";
	pLEQ->DoTheZone(pChar2->ZoneBoundID,aa,0,11,pChar2->ZoneBoundX,pChar2->ZoneBoundY,pChar2->ZoneBoundZ,0);
	return;
} 

VOID SimFade(PSPAWNINFO pChar, PCHAR szLine) 
{ 
	static int once=0;
	if (once==1)
	{
		once=0;
		return;
	}
	once=1;

	CHAR szMsg[MAX_STRING] = {0};

	sprintf(szMsg,"Fading..."); 
	WriteChatColor(szMsg,USERCOLOR_DEFAULT); 
	char aa[100]="test";
	int heading = (int)pChar->Heading;
	pLEQ->DoTheZone(pChar->Zone,aa,0,0,pChar->Y,pChar->X,pChar->Z,heading);
	return;
} 

VOID ExactLocation(PSPAWNINFO pChar, PCHAR szLine) 
{  CHAR LocMsg[MAX_STRING] = {0}; 
   sprintf(LocMsg, "Your location is %3.6f, %3.6f, %3.6f", pChar->Y, pChar->X, pChar->Z); 
   WriteChatColor(LocMsg); 
   return; 
} 

VOID Warp(PSPAWNINFO pChar, PCHAR szLine) 
{ 
   static float LastY; 
   static float LastX; 
   static float LastZ; 
   bRunNextCommand = TRUE; 
   PSPAWNINFO psTarget = NULL; 
   PZONEINFO Zone = (PZONEINFO)pZoneInfo; 
    CHAR command[MAX_STRING]; GetArg(command,szLine,1); 
   CHAR Y[MAX_STRING]; GetArg(Y,szLine,2); 
   CHAR X[MAX_STRING]; GetArg(X,szLine,3); 
   CHAR Z[MAX_STRING]; GetArg(Z,szLine,4); 
   if ( 
      stricmp(command, "succor") != 0 && 
      stricmp(command, "loc") != 0 && 
      stricmp(command, "last") != 0 && 
      stricmp(command, "target") != 0 && 
      stricmp(command, "dir") != 0 &&
      stricmp(command, "wp") != 0
   ) { 
      WriteChatColor("Usage: /warp <succor|last|loc <y x z>|dir <dist>| target|wp name>", CONCOLOR_RED); 
      return; 
      } else { 
      if (!stricmp(command,"target"))  { 
         if (ppTarget && pTarget) { 
         psTarget = (PSPAWNINFO)pTarget; 
         } 
         if (!psTarget) { 
            WriteChatColor("You must have a target for /warp target.", CONCOLOR_RED); 
            return; 
         } 
         float TargetZ = float (psTarget->Z); 
         float TargetY = float (psTarget->Y); 
         float TargetX = float (psTarget->X); 
                        LastY = TargetY; 
         LastX = TargetX; 
         LastZ = TargetZ; 
         DoWarp(TargetY, TargetX, TargetZ); 
      } else if (!stricmp(command,"succor"))  { 
         static float north = 0; 
         ((PSPAWNINFO)pCharSpawn)->Heading = north; 
         DWORD MLPTSC = CDisplay__MoveLocalPlayerToSafeCoords; 
         __asm call dword ptr [MLPTSC]; 
         return; 
      } else if (!stricmp(command,"loc")) { 
      if ((Y[0] == 0) || (X[0] == 0) || (Z[0] == 0)) 
      { 
         WriteChatColor("You must provide <y> <x> <z> if going to a location.", CONCOLOR_RED); 
         return; 
      } 
         LastY = (float)atof(Y); 
         LastX = (float)atof(X); 
         LastZ = (float)atof(Z); 
      DoWarp((float)atof(Y), (float)atof(X), (float)atof(Z)); 
      return; 
      } else if (!stricmp(command,"last")) { 
      if ((LastY==0) || (LastX==0) || (LastZ==0)) 
      { 
         WriteChatColor("You must have warped before to use this command!.", CONCOLOR_RED); 
         return; 
      } 
      DoWarp(LastY, LastX, LastZ); 
      return; 
      } else if (!stricmp(command,"dir")) { 
      if (Y[0]==0) { 
         WriteChatColor("You MUST provide <dist> if going in your current direction.", CONCOLOR_RED); 
         return; 
      } 
      FLOAT angle = (FLOAT)((pChar->Heading)*0.0123); 
      FLOAT dissafegoto = (FLOAT)atof(Y); 
      DoWarp(pChar->Y + (FLOAT)(dissafegoto * cos(angle)), pChar->X + (FLOAT)(dissafegoto * sin(angle)), pChar->Z); 
      return; 
                } 
//////Waypoint//////////
   { 
      char szLoc[MAX_STRING] = {0}; 
      char szName[MAX_STRING] = {0}; 
      char WaypointsINI[MAX_STRING] = {0}; 
      char szBuf[MAX_STRING] = {0};
      char szHeading[MAX_STRING] = {0};
      char szDestWarpX[MAX_STRING] = {0}; 
      char szDestWarpY[MAX_STRING] = {0}; 
      char szDestWarpZ[MAX_STRING] = {0}; 
      char szMsg[MAX_STRING] = {0}; 


      sprintf(WaypointsINI,"%s\\waypoints.ini",gszINIPath); 
      GetArg(szName, szLine, 2); 

      if(!strnicmp(szName, "", 1)) 
      { 
         WriteChatColor("You didn't specify a waypoint.", COLOR_LIGHTGREY); 
      } 
      else 
      { 
         GetPrivateProfileString(Zone->ShortName,szName,"",szLoc,MAX_STRING,WaypointsINI); 
          
         if (!strnicmp(szLoc, "", 1)) 
         { 
            sprintf(szMsg, "Waypoint \'%s\' does not exist.", szName); 
            WriteChatColor(szMsg, COLOR_LIGHTGREY); 
         } 
         else 
         { 
            // get destination locs 
            GetArg(szDestWarpX, szLoc, 2); 
            GetArg(szDestWarpY, szLoc, 1); 
            GetArg(szDestWarpZ, szLoc, 3); 
             
            // get heading 
            GetArg(szBuf, szLoc, 4); 
            GetArg(szHeading,szBuf,1,0,0,0,':'); 
			DoWarp((float)atof(szDestWarpY), (float)atof(szDestWarpX), (float)atof(szDestWarpZ));
            } 
			}
         } 
//////Waypoint end/////////
   } 
} 


VOID DoWarp(float y, float x, float z) 
{ 

        PZONEINFO Zone = (PZONEINFO)pZoneInfo; 
   float SafeY = Zone->SafeYLoc; 
   float SafeX = Zone->SafeXLoc; 
   float SafeZ = Zone->SafeZLoc; 

   Zone->SafeYLoc = y; 
   Zone->SafeXLoc = x; 
   Zone->SafeZLoc = z; 

   CHAR szMsg[MAX_STRING] = {0}; 
   sprintf(szMsg, "Warping to: %3.2f, %3.2f, %3.2f.", Zone->SafeYLoc, Zone->SafeXLoc, Zone->SafeZLoc); 
   WriteChatColor(szMsg, COLOR_PURPLE); 

   DWORD MLPTSC = CDisplay__MoveLocalPlayerToSafeCoords; 
   __asm call dword ptr [MLPTSC]; 

   Zone->SafeYLoc = SafeY; 
   Zone->SafeXLoc = SafeX; 
   Zone->SafeZLoc = SafeZ; 
} 

VOID waypoint(PSPAWNINFO pChar, PCHAR szLine) 
{ 
   PZONEINFO Zone = (PZONEINFO)pZoneInfo; 
   CHAR WaypointsINI[MAX_STRING] = {0}; 
   CHAR szTemp[10] = {0}; 
   CHAR szData[MAX_STRING] = {0}; 
   CHAR szDesc[MAX_STRING] = {0}; 
   CHAR szName[MAX_STRING] = {0}; 
   CHAR szCommand[MAX_STRING] = {0}; 
   CHAR szBuffer[MAX_STRING] = {0}; 
   CHAR szMsg[MAX_STRING] = {0}; 
   CHAR WaypointList[MAX_STRING*10] = {0}; 
   PCHAR pWaypointList = WaypointList; 
   CHAR szKey[MAX_STRING] = {0}; 
   CHAR szValue[MAX_STRING] = {0}; 

   sprintf(WaypointsINI,"%s\\waypoints.ini",gszINIPath); 
    
   GetArg(szCommand, szLine, 1); 

   if (!strnicmp(szCommand, "add", 3)) 
   { 
      GetArg(szName, szLine, 2); 
       
      if(!strnicmp(szName, "", 1)) 
      { 
         WriteChatColor("You didn't specify a name for the waypoint.", COLOR_LIGHTGREY); 
      }          
      else 
      { 
         GetPrivateProfileString(Zone->ShortName,szName,"",szBuffer,MAX_STRING,WaypointsINI); 

         if (!strnicmp(szBuffer, "", 1)) 
         { 
            GetArg(szDesc, szLine, 3); 
             
            sprintf(szData, "%1.2f %1.2f %1.2f %1.2f:%s", pChar->Y, pChar->X, pChar->Z, (float)pChar->Heading*0.703125f, szDesc); 
            WritePrivateProfileString(Zone->ShortName,szName,szData,WaypointsINI); 
            sprintf(szMsg, "Waypoint \'%s\' added.", szName); 
            WriteChatColor(szMsg, COLOR_LIGHTGREY); 
         } 
         else 
         { 
            sprintf(szMsg, "Waypoint \'%s\' already exists.", szName); 
            WriteChatColor(szMsg, COLOR_LIGHTGREY); 
         } 
      } 
   } 
   else if (!strnicmp(szCommand, "delete", 6)) 
   { 
      GetArg(szName, szLine, 2); 
       
      if(!strnicmp(szName, "", 1)) 
      { 
         WriteChatColor("You didn't specify a waypoint to delete.", COLOR_LIGHTGREY); 
      }          
      else 
      { 
         GetPrivateProfileString(Zone->ShortName,szName,"",szBuffer,MAX_STRING,WaypointsINI); 

         if (!strnicmp(szBuffer, "", 1)) 
         { 
            sprintf(szMsg, "Waypoint \'%s\' does not exist.", szName); 
            WriteChatColor(szMsg, COLOR_LIGHTGREY); 
         } 
         else 
         { 
            WritePrivateProfileString(Zone->ShortName,szName,"",WaypointsINI); 
          
            // rewrite the section minus the deleted waypoint 
            GetPrivateProfileSection(Zone->ShortName,WaypointList,MAX_STRING*10,WaypointsINI)        ; 
            WritePrivateProfileSection(Zone->ShortName,"",WaypointsINI); 
            pWaypointList = WaypointList; 
                         
            while (pWaypointList[0]!=0) 
            { 
               GetArg(szKey,pWaypointList,1,0,0,0,'='); 
               GetArg(szValue,pWaypointList,2,0,0,0,'='); 
               if (strnicmp(szValue, "", 1)) 
               { 
                  WritePrivateProfileString(Zone->ShortName,szKey,szValue,WaypointsINI); 
               } 
               pWaypointList+=strlen(pWaypointList)+1; 
            } 

            sprintf(szMsg, "Waypoint \'%s\' deleted.", szName); 
            WriteChatColor(szMsg, COLOR_LIGHTGREY); 
         } 
      } 
   } 
   else if (!strnicmp(szCommand, "list", 4)) 
   { 
      GetPrivateProfileSection(Zone->ShortName,WaypointList,MAX_STRING*10,WaypointsINI)        ; 
      pWaypointList = WaypointList; 

      sprintf(szMsg, "Waypoints for %s", Zone->LongName); 
      WriteChatColor(szMsg, CONCOLOR_YELLOW); 
       
      while (pWaypointList[0]!=0) 
      { 
         GetArg(szName,pWaypointList,1,0,0,0,'='); 
         GetArg(szData,pWaypointList,2,0,0,0,'='); 
         GetArg(szDesc,szData,2,0,0,0,':'); 
          
         if (strnicmp(szDesc,"",1)) 
         { 
            sprintf(szMsg, "- %s   ( %s )", szName, szDesc); 
         } 
         else 
         { 
            sprintf(szMsg, "- %s", szName); 
         } 
         WriteChatColor(szMsg, COLOR_LIGHTGREY); 
         pWaypointList+=strlen(pWaypointList)+1; 
      } 
   } 
   else 
   { 
      WriteChatColor("Invalid syntax.  Usage:", COLOR_LIGHTGREY); 
      WriteChatColor("/waypoint add name", COLOR_LIGHTGREY); 
      WriteChatColor("/waypoint delete name", COLOR_LIGHTGREY); 
      WriteChatColor("/waypoint list", COLOR_LIGHTGREY); 
   } 
}

PLUGIN_API VOID OnZoned(PSPAWNINFO pChar, PCHAR szLine)
{
	CHAR szMsg[MAX_STRING] = {0};
	if(ChainShiftZone[0] > 0) {
		ChainShiftStatus++;
		if(ChainShiftStatus > ChainShiftZone[0]) {
			ChainShiftZone[0] = 0;
		}
		DestZone=ChainShiftZone[ChainShiftStatus];
		DestType=1;
		ZoneReason=0;
		Y=pChar->Y;
		X=pChar->X;
		Z=pChar->Z;
		Heading =(int)pChar->Heading;
		ZoneChange=true;
		return;
	}
}

// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
	DebugSpewAlways("Initializing MQ2Allwarp");

	ppLEQ=(LocalCEverQuest**)pinstCEverQuest;
    AddCommand("/warp",Warp); 
    AddCommand("/exactloc",ExactLocation);
    AddCommand("/waypoint", waypoint);
	AddCommand("/zone",ChangeZones); 
	AddCommand("/gate",SimGate); 
	AddCommand("/fade",SimFade); 
    AddCommand("/chainshift",ChainShift);
}

// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
	DebugSpewAlways("Shutting down MQ2Allwarp");
    RemoveCommand("/warp"); 
    RemoveCommand("/exactloc"); 
    RemoveCommand("/waypoint");
	RemoveCommand("/zone");
	RemoveCommand("/gate");
	RemoveCommand("/fade");
    RemoveCommand("/chainshift");
}

Enjoy,
Noob
 
Last edited:
Also if you recieve any compile error's its probably due to this line

Rich (BB code):
FUNCTION_AT_ADDRESS(char * LocalCEverQuest::DoTheZone(int,char *,int,int,float,float,float,int),LocalCEverQuest__  DoTheZone);

Notice the space in ,LocalCEverQuest__ DoTheZone);
It should read like ,LocalCEverQuest__DoTheZone);

stupid message boards /slap
 
Here, TP's chain zoning added to it.

Rich (BB code):
// MQ2Allwarp.cpp : Compilation of /zone made by Cosmic and /warp made by Riddler/Siddin
// Directions for usage:
//////////////1///////////////////
// eqdata.h and replace
// /*0x1ec*/ FLOAT Unknown0x1ec[3];
// 
// with
// 
// /*0x1ec*/ FLOAT SafeYLoc;
// /*0x1f0*/ FLOAT SafeXLoc;
// /*0x1f4*/ FLOAT SafeZLoc;
//////////////2////////////////////
// MQ2Main.h
// #define CDisplay__MoveLocalPlayerToSafeCoords 0
// replace 0 with offset
// 0x0043B0FA 9/27
//////////////3////////////////////
// mq2commandapi.cpp and remove
// 
// if (!stricmp(Command,"/warp"))
// {
// Function=0;
// }
///////////////////////////////////
#include "../MQ2Plugin.h"

PreSetup("MQ2Allwarp");

#undef ExactLocation
#undef DoWarp
#undef Warp
#undef SafeYLoc
#undef SafeXLoc
#undef SafeZLoc
#undef ZoneToGoTo
#define LocalCEverQuest__DoTheZone		   0x4AB5A1

class LocalCEverQuest;
class LocalCEverQuest
{
public:
	__declspec(dllexport) char * LocalCEverQuest::DoTheZone(int,char *,int,int,float,float,float,int);
};

#ifdef LocalCEverQuest__DoTheZone
FUNCTION_AT_ADDRESS(char * LocalCEverQuest::DoTheZone(int,char *,int,int,float,float,float,int),LocalCEverQuest__  DoTheZone);
#endif

LocalCEverQuest **ppLEQ;
#define pLEQ (*ppLEQ)

VOID ChainShift(PSPAWNINFO pChar, PCHAR szLine); 
VOID ChangeZones(PSPAWNINFO pChar, PCHAR szLine); 
VOID SimGate(PSPAWNINFO pChar, PCHAR szLine); 
VOID SimFade(PSPAWNINFO pChar, PCHAR szLine); 
VOID DoWarp(float y, float x, float z); 
VOID Warp(PSPAWNINFO pChar, PCHAR szLine); 
VOID ExactLocation(PSPAWNINFO pChar);
VOID waypoint(PSPAWNINFO pChar, PCHAR szLine); 
int ChainShiftZone[100] = {0};
int ChainShiftStatus = 0;
int DestZone = 0;
int DestType = 0;
int ZoneReason = 0;
float X = 0;
float Y = 0;
float Z = 0;
int Heading = 0;
bool ZoneChange = false;

PLUGIN_API VOID OnZoned(PSPAWNINFO pChar, PCHAR szLine)
{
	CHAR szMsg[MAX_STRING] = {0};
	if(ChainShiftZone[0] > 0) {
		ChainShiftStatus++;
		if(ChainShiftStatus > ChainShiftZone[0]) {
			ChainShiftZone[0] = 0;
		}
		DestZone=ChainShiftZone[ChainShiftStatus];
		DestType=1;
		ZoneReason=0;
		Y=pChar->Y;
		X=pChar->X;
		Z=pChar->Z;
		Heading =(int)pChar->Heading;
		ZoneChange=true;
		return;
	}
}

VOID ChainShift(PSPAWNINFO pChar, PCHAR szLine)
{
	char szMsg[MAX_STRING] = {0};
	bool ZoneDetected = true;
	char ZoneCheckName[MAX_STRING] = {0};
	int ZoneFound = 0;
	ChainShiftStatus = 0;

	GetArg(ZoneCheckName,szLine,1);
	ZoneFound = GetZoneID(ZoneCheckName);

	while(ZoneDetected == true) {
		if(ZoneFound > 0) {
			ChainShiftZone[0]++;
			ChainShiftZone[ChainShiftZone[0]] = ZoneFound;
			GetArg(ZoneCheckName,szLine,(ChainShiftZone[0] + 1));
			ZoneFound = GetZoneID(ZoneCheckName);
		} else {
			ZoneDetected = false;
		}
	}

	if(ChainShiftZone[0] > 0) {
		ChainShiftStatus++;
		DestZone=ChainShiftZone[1];
		DestType=1;
		ZoneReason=0;
		Y=pChar->Y;
		X=pChar->X;
		Z=pChar->Z;
		Heading =(int)pChar->Heading;
		ZoneChange=true;
		return;
	}
}

VOID ChangeZones(PSPAWNINFO pChar, PCHAR szLine) 
{ 
	static int once=0;
	if (once==1)
	{
		once=0;
		return;
	}
	once=1;
	CHAR szMsg[MAX_STRING] = {0};
	DWORD ZoneToGoTo; 
	ZoneToGoTo = GetZoneID(szLine);

	if (ZoneToGoTo == -1) {
		WriteChatColor("Wrong Zone.ShortName, aborting!!",CONCOLOR_RED);
		once=0;
		return;
	}

	sprintf(szMsg,"Going to zone %s, id %d",szLine,ZoneToGoTo); 
	WriteChatColor(szMsg,USERCOLOR_DEFAULT); 
	char aa[100]="test";
	int heading = (int)pChar->Heading;
	pLEQ->DoTheZone(ZoneToGoTo,aa,1,0,pChar->Y,pChar->X,pChar->Z,heading);
	return;
} 

VOID SimGate(PSPAWNINFO pChar, PCHAR szLine) 
{ 
	static int once=0;
	if (once==1)
	{
		once=0;
		return;
	}
	once=1;

	CHAR szMsg[MAX_STRING] = {0};
	PCHARINFO2 pChar2 = GetCharInfo2();

	sprintf(szMsg,"Gating...");
	WriteChatColor(szMsg,USERCOLOR_DEFAULT); 
	char aa[100]="test";
	pLEQ->DoTheZone(pChar2->ZoneBoundID,aa,0,11,pChar2->ZoneBoundX,pChar2->ZoneBoundY,pChar2->ZoneBoundZ,0);
	return;
} 

VOID SimFade(PSPAWNINFO pChar, PCHAR szLine) 
{ 
	static int once=0;
	if (once==1)
	{
		once=0;
		return;
	}
	once=1;

	CHAR szMsg[MAX_STRING] = {0};

	sprintf(szMsg,"Fading..."); 
	WriteChatColor(szMsg,USERCOLOR_DEFAULT); 
	char aa[100]="test";
	int heading = (int)pChar->Heading;
	pLEQ->DoTheZone(pChar->Zone,aa,0,0,pChar->Y,pChar->X,pChar->Z,heading);
	return;
} 

VOID ExactLocation(PSPAWNINFO pChar, PCHAR szLine) 
{  CHAR LocMsg[MAX_STRING] = {0}; 
   sprintf(LocMsg, "Your location is %3.6f, %3.6f, %3.6f", pChar->Y, pChar->X, pChar->Z); 
   WriteChatColor(LocMsg); 
   return; 
} 

VOID Warp(PSPAWNINFO pChar, PCHAR szLine) 
{ 
   static float LastY; 
   static float LastX; 
   static float LastZ; 
   bRunNextCommand = TRUE; 
   PSPAWNINFO psTarget = NULL; 
   PZONEINFO Zone = (PZONEINFO)pZoneInfo; 
    CHAR command[MAX_STRING]; GetArg(command,szLine,1); 
   CHAR Y[MAX_STRING]; GetArg(Y,szLine,2); 
   CHAR X[MAX_STRING]; GetArg(X,szLine,3); 
   CHAR Z[MAX_STRING]; GetArg(Z,szLine,4); 
   if ( 
      stricmp(command, "succor") != 0 && 
      stricmp(command, "loc") != 0 && 
      stricmp(command, "last") != 0 && 
      stricmp(command, "target") != 0 && 
      stricmp(command, "dir") != 0 &&
      stricmp(command, "wp") != 0
   ) { 
      WriteChatColor("Usage: /warp <succor|last|loc <y x z>|dir <dist>| target|wp name>", CONCOLOR_RED); 
      return; 
      } else { 
      if (!stricmp(command,"target"))  { 
         if (ppTarget && pTarget) { 
         psTarget = (PSPAWNINFO)pTarget; 
         } 
         if (!psTarget) { 
            WriteChatColor("You must have a target for /warp target.", CONCOLOR_RED); 
            return; 
         } 
         float TargetZ = float (psTarget->Z); 
         float TargetY = float (psTarget->Y); 
         float TargetX = float (psTarget->X); 
                        LastY = TargetY; 
         LastX = TargetX; 
         LastZ = TargetZ; 
         DoWarp(TargetY, TargetX, TargetZ); 
      } else if (!stricmp(command,"succor"))  { 
         static float north = 0; 
         ((PSPAWNINFO)pCharSpawn)->Heading = north; 
         DWORD MLPTSC = CDisplay__MoveLocalPlayerToSafeCoords; 
         __asm call dword ptr [MLPTSC]; 
         return; 
      } else if (!stricmp(command,"loc")) { 
      if ((Y[0] == 0) || (X[0] == 0) || (Z[0] == 0)) 
      { 
         WriteChatColor("You must provide <y> <x> <z> if going to a location.", CONCOLOR_RED); 
         return; 
      } 
         LastY = (float)atof(Y); 
         LastX = (float)atof(X); 
         LastZ = (float)atof(Z); 
      DoWarp((float)atof(Y), (float)atof(X), (float)atof(Z)); 
      return; 
      } else if (!stricmp(command,"last")) { 
      if ((LastY==0) || (LastX==0) || (LastZ==0)) 
      { 
         WriteChatColor("You must have warped before to use this command!.", CONCOLOR_RED); 
         return; 
      } 
      DoWarp(LastY, LastX, LastZ); 
      return; 
      } else if (!stricmp(command,"dir")) { 
      if (Y[0]==0) { 
         WriteChatColor("You MUST provide <dist> if going in your current direction.", CONCOLOR_RED); 
         return; 
      } 
      FLOAT angle = (FLOAT)((pChar->Heading)*0.0123); 
      FLOAT dissafegoto = (FLOAT)atof(Y); 
      DoWarp(pChar->Y + (FLOAT)(dissafegoto * cos(angle)), pChar->X + (FLOAT)(dissafegoto * sin(angle)), pChar->Z); 
      return; 
                } 
//////Waypoint//////////
   { 
      char szLoc[MAX_STRING] = {0}; 
      char szName[MAX_STRING] = {0}; 
      char WaypointsINI[MAX_STRING] = {0}; 
      char szBuf[MAX_STRING] = {0};
      char szHeading[MAX_STRING] = {0};
      char szDestWarpX[MAX_STRING] = {0}; 
      char szDestWarpY[MAX_STRING] = {0}; 
      char szDestWarpZ[MAX_STRING] = {0}; 
      char szMsg[MAX_STRING] = {0}; 


      sprintf(WaypointsINI,"%s\\waypoints.ini",gszINIPath); 
      GetArg(szName, szLine, 2); 

      if(!strnicmp(szName, "", 1)) 
      { 
         WriteChatColor("You didn't specify a waypoint.", COLOR_LIGHTGREY); 
      } 
      else 
      { 
         GetPrivateProfileString(Zone->ShortName,szName,"",szLoc,MAX_STRING,WaypointsINI); 
          
         if (!strnicmp(szLoc, "", 1)) 
         { 
            sprintf(szMsg, "Waypoint \'%s\' does not exist.", szName); 
            WriteChatColor(szMsg, COLOR_LIGHTGREY); 
         } 
         else 
         { 
            // get destination locs 
            GetArg(szDestWarpX, szLoc, 2); 
            GetArg(szDestWarpY, szLoc, 1); 
            GetArg(szDestWarpZ, szLoc, 3); 
             
            // get heading 
            GetArg(szBuf, szLoc, 4); 
            GetArg(szHeading,szBuf,1,0,0,0,':'); 
			DoWarp((float)atof(szDestWarpY), (float)atof(szDestWarpX), (float)atof(szDestWarpZ));
            } 
			}
         } 
//////Waypoint end/////////
   } 
} 


VOID DoWarp(float y, float x, float z) 
{ 

        PZONEINFO Zone = (PZONEINFO)pZoneInfo; 
   float SafeY = Zone->SafeYLoc; 
   float SafeX = Zone->SafeXLoc; 
   float SafeZ = Zone->SafeZLoc; 

   Zone->SafeYLoc = y; 
   Zone->SafeXLoc = x; 
   Zone->SafeZLoc = z; 

   CHAR szMsg[MAX_STRING] = {0}; 
   sprintf(szMsg, "Warping to: %3.2f, %3.2f, %3.2f.", Zone->SafeYLoc, Zone->SafeXLoc, Zone->SafeZLoc); 
   WriteChatColor(szMsg, COLOR_PURPLE); 

   DWORD MLPTSC = CDisplay__MoveLocalPlayerToSafeCoords; 
   __asm call dword ptr [MLPTSC]; 

   Zone->SafeYLoc = SafeY; 
   Zone->SafeXLoc = SafeX; 
   Zone->SafeZLoc = SafeZ; 
} 

VOID waypoint(PSPAWNINFO pChar, PCHAR szLine) 
{ 
   PZONEINFO Zone = (PZONEINFO)pZoneInfo; 
   CHAR WaypointsINI[MAX_STRING] = {0}; 
   CHAR szTemp[10] = {0}; 
   CHAR szData[MAX_STRING] = {0}; 
   CHAR szDesc[MAX_STRING] = {0}; 
   CHAR szName[MAX_STRING] = {0}; 
   CHAR szCommand[MAX_STRING] = {0}; 
   CHAR szBuffer[MAX_STRING] = {0}; 
   CHAR szMsg[MAX_STRING] = {0}; 
   CHAR WaypointList[MAX_STRING*10] = {0}; 
   PCHAR pWaypointList = WaypointList; 
   CHAR szKey[MAX_STRING] = {0}; 
   CHAR szValue[MAX_STRING] = {0}; 

   sprintf(WaypointsINI,"%s\\waypoints.ini",gszINIPath); 
    
   GetArg(szCommand, szLine, 1); 

   if (!strnicmp(szCommand, "add", 3)) 
   { 
      GetArg(szName, szLine, 2); 
       
      if(!strnicmp(szName, "", 1)) 
      { 
         WriteChatColor("You didn't specify a name for the waypoint.", COLOR_LIGHTGREY); 
      }          
      else 
      { 
         GetPrivateProfileString(Zone->ShortName,szName,"",szBuffer,MAX_STRING,WaypointsINI); 

         if (!strnicmp(szBuffer, "", 1)) 
         { 
            GetArg(szDesc, szLine, 3); 
             
            sprintf(szData, "%1.2f %1.2f %1.2f %1.2f:%s", pChar->Y, pChar->X, pChar->Z, (float)pChar->Heading*0.703125f, szDesc); 
            WritePrivateProfileString(Zone->ShortName,szName,szData,WaypointsINI); 
            sprintf(szMsg, "Waypoint \'%s\' added.", szName); 
            WriteChatColor(szMsg, COLOR_LIGHTGREY); 
         } 
         else 
         { 
            sprintf(szMsg, "Waypoint \'%s\' already exists.", szName); 
            WriteChatColor(szMsg, COLOR_LIGHTGREY); 
         } 
      } 
   } 
   else if (!strnicmp(szCommand, "delete", 6)) 
   { 
      GetArg(szName, szLine, 2); 
       
      if(!strnicmp(szName, "", 1)) 
      { 
         WriteChatColor("You didn't specify a waypoint to delete.", COLOR_LIGHTGREY); 
      }          
      else 
      { 
         GetPrivateProfileString(Zone->ShortName,szName,"",szBuffer,MAX_STRING,WaypointsINI); 

         if (!strnicmp(szBuffer, "", 1)) 
         { 
            sprintf(szMsg, "Waypoint \'%s\' does not exist.", szName); 
            WriteChatColor(szMsg, COLOR_LIGHTGREY); 
         } 
         else 
         { 
            WritePrivateProfileString(Zone->ShortName,szName,"",WaypointsINI); 
          
            // rewrite the section minus the deleted waypoint 
            GetPrivateProfileSection(Zone->ShortName,WaypointList,MAX_STRING*10,WaypointsINI)        ; 
            WritePrivateProfileSection(Zone->ShortName,"",WaypointsINI); 
            pWaypointList = WaypointList; 
                         
            while (pWaypointList[0]!=0) 
            { 
               GetArg(szKey,pWaypointList,1,0,0,0,'='); 
               GetArg(szValue,pWaypointList,2,0,0,0,'='); 
               if (strnicmp(szValue, "", 1)) 
               { 
                  WritePrivateProfileString(Zone->ShortName,szKey,szValue,WaypointsINI); 
               } 
               pWaypointList+=strlen(pWaypointList)+1; 
            } 

            sprintf(szMsg, "Waypoint \'%s\' deleted.", szName); 
            WriteChatColor(szMsg, COLOR_LIGHTGREY); 
         } 
      } 
   } 
   else if (!strnicmp(szCommand, "list", 4)) 
   { 
      GetPrivateProfileSection(Zone->ShortName,WaypointList,MAX_STRING*10,WaypointsINI)        ; 
      pWaypointList = WaypointList; 

      sprintf(szMsg, "Waypoints for %s", Zone->LongName); 
      WriteChatColor(szMsg, CONCOLOR_YELLOW); 
       
      while (pWaypointList[0]!=0) 
      { 
         GetArg(szName,pWaypointList,1,0,0,0,'='); 
         GetArg(szData,pWaypointList,2,0,0,0,'='); 
         GetArg(szDesc,szData,2,0,0,0,':'); 
          
         if (strnicmp(szDesc,"",1)) 
         { 
            sprintf(szMsg, "- %s   ( %s )", szName, szDesc); 
         } 
         else 
         { 
            sprintf(szMsg, "- %s", szName); 
         } 
         WriteChatColor(szMsg, COLOR_LIGHTGREY); 
         pWaypointList+=strlen(pWaypointList)+1; 
      } 
   } 
   else 
   { 
      WriteChatColor("Invalid syntax.  Usage:", COLOR_LIGHTGREY); 
      WriteChatColor("/waypoint add name", COLOR_LIGHTGREY); 
      WriteChatColor("/waypoint delete name", COLOR_LIGHTGREY); 
      WriteChatColor("/waypoint list", COLOR_LIGHTGREY); 
   } 
}

// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
	DebugSpewAlways("Initializing MQ2Allwarp");

	ppLEQ=(LocalCEverQuest**)pinstCEverQuest;
    AddCommand("/chainshift",ChainShift);
    AddCommand("/warp",Warp); 
    AddCommand("/exactloc",ExactLocation);
    AddCommand("/waypoint", waypoint);
	AddCommand("/zone",ChangeZones); 
	AddCommand("/gate",SimGate); 
	AddCommand("/fade",SimFade); 
}

// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
	DebugSpewAlways("Shutting down MQ2Allwarp");
    RemoveCommand("/warp"); 
    RemoveCommand("/exactloc"); 
    RemoveCommand("/waypoint");
	RemoveCommand("/zone");
	RemoveCommand("/gate");
	RemoveCommand("/fade");
        RemoveCommand("/chainshift");
}
 
Last edited:
Hehe if you cut and paste cade's code make sure on remove command you change it from /chainzone to /chainshift....

Thanks,
Noob.
 
I am getting these errors when I try and compile.

Rich (BB code):
MQ2Allwarp.cpp(46) : error C2400: inline assembler syntax error in 'second operand'; found 'newline'
MQ2Allwarp.cpp(71) : error C2065: 'DestZone' : undeclared identifier
MQ2Allwarp.cpp(72) : error C2065: 'DestType' : undeclared identifier
MQ2Allwarp.cpp(73) : error C2065: 'ZoneReason' : undeclared identifier
MQ2Allwarp.cpp(74) : error C2065: 'Y' : undeclared identifier
MQ2Allwarp.cpp(75) : error C2065: 'X' : undeclared identifier
MQ2Allwarp.cpp(76) : error C2065: 'Z' : undeclared identifier
MQ2Allwarp.cpp(77) : error C2065: 'Heading' : undeclared identifier
MQ2Allwarp.cpp(78) : error C2065: 'ZoneChange' : undeclared identifier
MQ2Allwarp.cpp(107) : error C3861: 'DestZone': identifier not found, even with argument-dependent lookup
MQ2Allwarp.cpp(108) : error C3861: 'DestType': identifier not found, even with argument-dependent lookup
MQ2Allwarp.cpp(109) : error C3861: 'ZoneReason': identifier not found, even with argument-dependent lookup
MQ2Allwarp.cpp(110) : error C3861: 'Y': identifier not found, even with argument-dependent lookup
MQ2Allwarp.cpp(111) : error C3861: 'X': identifier not found, even with argument-dependent lookup
MQ2Allwarp.cpp(112) : error C3861: 'Z': identifier not found, even with argument-dependent lookup
MQ2Allwarp.cpp(113) : error C3861: 'Heading': identifier not found, even with argument-dependent lookup
MQ2Allwarp.cpp(114) : error C3861: 'ZoneChange': identifier not found, even with argument-dependent lookup

any ideas? (C++ is not a strong point with me, all of my knowledge is JAVA 2)
 
looks like these are missing up above on Cades Edit...?

int DestZone = 0;
int DestType = 0;
int ZoneReason = 0;
float X = 0;
float Y = 0;
float Z = 0;
int Heading = 0;
bool ZoneChange = false;
 
And just because I have nothing better to do than frustrate others, here's an error that I am getting still...

Rich (BB code):
MQ2Allwarp.cpp(46) : error C2400: inline assembler syntax error in 'second operand'; found 'newline'

This sounds dumb, but I am hoping that this error is due to me screwing something up lol. I hate to point things out when I'm not contributing. :(
 
It's more of a spacebar error than a spelling error...
 
Line 46 is this

FUNCTION_AT_ADDRESS(char * LocalCEverQuest::DoTheZone(int,char *,int,int,float,float,float,int),LocalCEverQuest__DoTheZone);

On my second reply there it said to make sure there is no space in that line... so make sure you edited it correctly....
 
looks like my problem was caught between my chair and keyboard... I forgot to actually read the second post down and remove the spaces on line 46 :rolleyes:
 
Mq2Allwarp (All in one w/ source)

Users who are viewing this thread

Back
Top
Cart