• 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

MQ2Cobalt

Cobalt

Member
Joined
Sep 20, 2005
RedCents
20¢
MQ2Cobalt v1.0.0

Created By: Cobalt
Purpose: First plugin ever written and updated over the years. Nothing new here, but some people wanted the ability to zone to a taget in zone.
Usage: /zone <zonename/targetname> <zonetype> <zonereason> <y> <x> <z>
/warp <s/t/y> <x> <z>
/fade
/gate

It's a bit more technical to use. Reason = 0, Type = 1 for succor 0 for specified coords.

I'll updated it if anyone needs anything put into it. But there's nothing new from other plugins, cept target zoning and exposing reason/type. Enjoy.

Use at your own risk!

Rich (BB code):
/***************************
			FLOAT	SafeYLoc;
			FLOAT	SafeXLoc;
			FLOAT	SafeZLoc;
***************************/

#include "../MQ2Plugin.h"

PreSetup("MQ2Cobalt");

#define LocalCEverQuest__DoTheZone		   0x4C6D60
#undef CDisplay__MoveLocalPlayerToSafeCoords
#define CDisplay__MoveLocalPlayerToSafeCoords 0x4580D0

//0x457E10

DWORD MLPTSC = CDisplay__MoveLocalPlayerToSafeCoords;

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 CZone(PSPAWNINFO pChar, PCHAR szLine);
VOID CFade(PSPAWNINFO pChar, PCHAR szLine); 
VOID CGate(PSPAWNINFO pChar, PCHAR szLine);

bool g_bZoneChange		= false;
int g_iZoneDest			= 0;
int g_iZoneDestType		= 0;
int g_iZoneReason		= 0;
float g_fLocY			= 0;
float g_fLocX			= 0;
float g_fLocZ			= 0;
int g_iHeading			= 0;

VOID CZone(PSPAWNINFO pChar, PCHAR szLine) 
{ 
	CHAR szBuffer[MAX_STRING] = {0};
	CHAR szArg1[MAX_STRING] ={0};
	CHAR szZoneDestType[MAX_STRING]={0};
	CHAR szZoneReason[MAX_STRING]={0};
	CHAR szLocX[MAX_STRING]={0};
	CHAR szLocY[MAX_STRING]={0};
	CHAR szLocZ[MAX_STRING]={0};
	
	GetArg(szArg1,szLine,1);
	GetArg(szZoneDestType,szLine,2);
	GetArg(szZoneReason,szLine,3);
	GetArg(szLocY,szLine,4);
	GetArg(szLocX,szLine,5);
	GetArg(szLocZ,szLine,6);

	g_iZoneDest		= GetZoneID(szArg1);
	g_iZoneDestType = atoi(szZoneDestType);
	g_iZoneReason	= atoi(szZoneReason);
	g_iHeading		= (int)pChar->Heading;
	g_bZoneChange	= true;
	g_fLocX			= (float)atof(szLocX);
	g_fLocY			= (float)atof(szLocY);
	g_fLocZ			= (float)atof(szLocZ);

	if (g_iZoneDest == -1)
	{
		PSPAWNINFO psTarget = NULL;
		Target(pChar, szArg1);

		if (ppTarget && pTarget)
		{
			psTarget = (PSPAWNINFO)pTarget;
		}
		if (psTarget)
		{
			g_fLocX = psTarget->X;
			g_fLocY = psTarget->Y;
			g_fLocZ = psTarget->Z;
			g_iZoneDest = pChar->Zone;
			if (g_iZoneDest == -1)
			{
				g_bZoneChange	= false;
				WriteChatColor("Invalid Zone or Target Name...",CONCOLOR_YELLOW);
				return;
			}
		}
		if (!psTarget)
		{
			g_bZoneChange	= false;
			WriteChatColor("Invalid Zone or Target Name...",CONCOLOR_YELLOW);
			return;
		}
	}
}

VOID CWarp(PSPAWNINFO pChar,PCHAR szLine)
{
   CHAR szBuffer[MAX_STRING] = {0};
   PZONEINFO TheZone = (PZONEINFO) pZoneInfo;
   FLOAT OldSafeCoords[3];

   CHAR Arg1[MAX_STRING] = {0};
   CHAR Arg2[MAX_STRING] = {0};
   CHAR Arg3[MAX_STRING] = {0};

   if (szLine[0] == 0)
   {
      WriteChatColor("Not a valid warp.", CONCOLOR_RED);
      return;
   }

   GetArg(Arg1, szLine, 1, false);
   GetArg(Arg2, szLine, 2, false);
   GetArg(Arg3, szLine, 3, false);

   OldSafeCoords[0] = TheZone->SafeYLoc;
   OldSafeCoords[1] = TheZone->SafeXLoc;
   OldSafeCoords[2] = TheZone->SafeZLoc;

   if (!strcmpi(Arg1, "s") || !strcmpi(Arg1, "safe") || !strcmpi(Arg1, "succor"))
   {
      sprintf(szBuffer, "Succor Point Warp (%.0f, %.0f, %.0f).", TheZone->SafeYLoc, TheZone->SafeXLoc, TheZone->SafeZLoc);
   }
   else if ((!strcmpi(Arg1, "t") || !strcmpi(Arg1, "target")) && pTarget)
   {
      TheZone->SafeYLoc = ((PSPAWNINFO)pTarget)->Y;
      TheZone->SafeXLoc = ((PSPAWNINFO)pTarget)->X;
      TheZone->SafeZLoc = ((PSPAWNINFO)pTarget)->Z;
      
	  sprintf(szBuffer, "Target Warp: %s (%.0f, %.0f, %.0f).", ((PSPAWNINFO)pTarget)->Name, TheZone->SafeYLoc, TheZone->SafeXLoc, TheZone->SafeZLoc);
   }
   else if (*Arg1 && *Arg2 && *Arg3)
   {
      TheZone->SafeYLoc = (float)atof(Arg1);
      TheZone->SafeXLoc = (float)atof(Arg2);
      TheZone->SafeZLoc = (float)atof(Arg3);

      sprintf(szBuffer, "Transporting you to the location you specified (%.0f, %.0f, %.0f).", TheZone->SafeYLoc, TheZone->SafeXLoc, TheZone->SafeZLoc);
   }

   WriteChatColor(szBuffer, CONCOLOR_YELLOW);

   __asm {
      call dword ptr [MLPTSC];
   }

   TheZone->SafeYLoc = OldSafeCoords[0];
   TheZone->SafeXLoc = OldSafeCoords[1];
   TheZone->SafeZLoc = OldSafeCoords[2];
}

VOID CGate(PSPAWNINFO pChar, PCHAR szLine) 
{ 
	CHAR szMsg[MAX_STRING] = {0};
	PCHARINFO2 pChar2 = GetCharInfo2();

	sprintf(szMsg,"Gating...");
	WriteChatColor(szMsg,USERCOLOR_DEFAULT);

	g_iZoneDest = pChar2->ZoneBoundID;
	g_iZoneDestType = 0;
	g_iZoneReason = 11;
	g_fLocY = pChar2->ZoneBoundY;
	g_fLocX = pChar2->ZoneBoundX;
	g_fLocZ = pChar2->ZoneBoundZ;
	g_iHeading = 0;
	g_bZoneChange = true;

	return;
} 

VOID CFade(PSPAWNINFO pChar, PCHAR szLine) 
{ 
	CHAR szMsg[MAX_STRING] = {0};
	if (pChar->Instance != 0)
	{
		g_iZoneDest = *((int *)(&(pChar->Instance)-1));
	}
	else
	{
		g_iZoneDest = pChar->Zone;
	}
	
	sprintf(szMsg,"Fading...");
	WriteChatColor(szMsg,USERCOLOR_DEFAULT); 
	
	g_iZoneDestType	= 0;
	g_iZoneReason	= 0;
	g_fLocY = pChar->Y;
	g_fLocX = pChar->X;
	g_fLocZ = pChar->Z;
	g_iHeading = (int)pChar->Heading;
	g_bZoneChange = true;
	return;
}

PLUGIN_API VOID OnPulse(VOID)
{
	CHAR szBuffer[MAX_STRING] = {0};
	char szJunk[100]="test";
	
	if(g_bZoneChange)
	{
		g_bZoneChange=false;
		sprintf(szBuffer,"Zone ID: %d Type: %d Reason: %d X: %.00f Y: %.00f Z: %.00f Heading: %d", g_iZoneDest, g_iZoneDestType, g_iZoneReason, g_fLocX, g_fLocY, g_fLocZ, g_iHeading); 
		WriteChatColor(szBuffer,USERCOLOR_DEFAULT);
		pLEQ->DoTheZone(g_iZoneDest,szJunk,g_iZoneDestType,g_iZoneReason,g_fLocY,g_fLocX,g_fLocZ,g_iHeading);
	}
	return; 
}

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

	ppLEQ=(LocalCEverQuest**)pinstCEverQuest;
	AddCommand("/zone",CZone); 
	AddCommand("/gate",CGate); 
	AddCommand("/fade",CFade); 
	AddCommand("/warp",CWarp);
}

// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
	DebugSpewAlways("Shutting down MQ2Cobalt");

	RemoveCommand("/zone");
	RemoveCommand("/gate");
	RemoveCommand("/fade");
	RemoveCommand("/warp");
}
 
Cobalt said:
MQ2Cobalt v1.0.0

Created By: Cobalt
Purpose: First plugin ever written and updated over the years. Nothing new here, but some people wanted the ability to zone to a taget in zone.
Usage: /zone <zonename/targetname> <zonetype> <zonereason> <y> <x> <z>
/warp <s/t/y> <x> <z>
/fade
/gate

It's a bit more technical to use. Reason = 0, Type = 1 for succor 0 for specified coords.

I'll updated it if anyone needs anything put into it. But there's nothing new from other plugins, cept target zoning and exposing reason/type. Enjoy.

Use at your own risk!

Darn... I thought for sure this would be the long awaited Cobalt version of mq2mission :cool:
 
Looks good, now if only I could learn how to compile/write plugins myself lol.
 
good job Cobalt

can you give examples for usage pls

/warp Y X Z is easy .... but what is warp S / T ?





/zone <zonename/targetname> <zonetype> <zonereason> <y> <x> <z>

/zone <zonename> - does it only zone to adjacent zones or does chain zoning work?

/zone <Targetname> y X Z??? or do i need the zone type and reason?

what are some appropriate zonetype?

same for zonereason?





Just some simple questions for the simple users


<--- is tard!!


8-)


thanks C


Army
 
Warrene said:
s=Succor, t = Target?

sounds logical .. so does that mean i can /warp S and get succored?


just looking for a little calarification on a great plugin 8-)

Army
 
armysoldier said:
good job Cobalt

/warp Y X Z is easy .... but what is warp S / T ?

/warp s - warps you to the safe/succor spot in your current zone.
/warp t - warp to your target

armysoldier said:
/zone <zonename> - does it only zone to adjacent zones or does chain zoning work?

/zone <Targetname> y X Z??? or do i need the zone type and reason?

what are some appropriate zonetype?

same for zonereason?

/zone ${Target.ShortName} - to zone to a target or manually enter a name if you know it. ie) /zone Cobalt
/zone poknowledge - same as /zone poknowledge 0 or zone to nothing or aka 0.0 0.0 0.0 (since floats are set to null if you don't specify a loc)
/zone poknowledge 1 - to zone to succor point (normal zone plugins do this)
/zone poknowledge 0 0 123.0 456.0 789.0 - zone to a specific location

Don't mess with reason. Reason is listed in piggyzone code or MQ2 somewhere can be GM summon etc. I've heard you can get flagged using the GM summon so don't.
For Type use 0 to specify a location to zone to and 1 to use the default succor coords.

Again nothing fancy here. Just exposed what was already in available plugins in a technical manner. (Type and Reason)
 
MQ2Cobalt

Users who are viewing this thread

Back
Top
Cart