Machiavelli
New member
- Joined
- Nov 14, 2004
- RedCents
- 10¢
Hello. Like to warp? Me too.
Compile this like you would any other plugin. This works for the Oct. 13th patch.
MQ2Warp.cpp
Struct Changes
Open up MQ2Main\EQData.h
Go to line 1201 (This is the line as of our latest MQ2 Release), it will look like
Delete that line and add these 3 in its place:
Do I get tenure or what?
Compile this like you would any other plugin. This works for the Oct. 13th patch.
MQ2Warp.cpp
Rich (BB code):
#include "../MQ2Plugin.h"
#define CDisplay__MoveLocalPlayerToSafeCoords 0x43437B
PreSetup("MQ2Warp");
VOID DoWarp(float y, float x, float z);
VOID Warp(PSPAWNINFO pChar, PCHAR szLine);
VOID zWarp(PSPAWNINFO pChar, PCHAR szLine);
VOID ExactLocation(PSPAWNINFO pChar);
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 zWarp(PSPAWNINFO pChar, PCHAR szLine)
{ CHAR Z[MAX_STRING] = {0};
GetArg(Z,szLine,1);
float MyY = pChar->Y;
float MyX = pChar->X;
if (Z[0]==0) {
WriteChatColor("Usage: /zwarp <dist>", CONCOLOR_RED);
return;
}
float NewZ = pChar->Z;
NewZ = NewZ + (FLOAT)atof(Z);
DoWarp(MyY, MyX, NewZ);
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
) {
WriteChatColor("Usage: /warp <succor|last|loc <y x z>|dir <dist>| target>", 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;
}
}
}
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;
}
PLUGIN_API VOID InitializePlugin(VOID)
{
AddCommand("/warp",Warp);
AddCommand("/zwarp",zWarp);
AddCommand("/exactloc",ExactLocation);
}
PLUGIN_API VOID ShutdownPlugin(VOID)
{
DebugSpewAlways("Shutting down MQ2Warp");
RemoveCommand("/warp");
RemoveCommand("/exactloc");
RemoveCommand("/zwarp");
}
Struct Changes
Open up MQ2Main\EQData.h
Go to line 1201 (This is the line as of our latest MQ2 Release), it will look like
Rich (BB code):
/*0x1ec*/ FLOAT Unknown0x1ec[3];
Delete that line and add these 3 in its place:
Rich (BB code):
/*0x1ec*/ FLOAT SafeYLoc;
/*0x1f0*/ FLOAT SafeXLoc;
/*0x1f4*/ FLOAT SafeZLoc;
Do I get tenure or what?



