• 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

Classic Source::MQ2RWarp : /warp, /waypoint, and other cmds

Tonka Trucks

Well-known member
Joined
Apr 27, 2006
RedCents
20¢
Updated 07/18/06:

-Offsets current as of 07/18/06.
-Modified source so that there is no need to edit EQData.h to use /warp. This does not include modifications to use /zone. If you are looking for /zone or /gate, go here.
-Included instructions in .cpp on what changes need to be made for this to compile correctly.
-Included MQ2RWarp.cpp in the .zip file below. Reasons as to the board being buggy with code function.

See Zip for Source .cpp file.

<- Red Cents if this helps!

-TurkReno
 
Last edited:
1 questions and a few comments. Question is me wondering why you left /fade? If someone is using your piggyzone as well, which I assume is what you want, then won't those just interfere?

You should take out the /ghost, since yours is the nerfed version and would just mess up RG_01's uber_ghost. You should also remove all of that extra code in there that doesn't do anything anymore (zoning / movepkt, for example).

Also, aside from /zwarp, what does this do that makes it any different from the Allwarp that is already posted about?
 
Just what I used in my compile /shrug. No problems with /fade.

I also just commented out the coding for /zone and /gate even though this works best with the update of MQ2PiggyZone. I know that its excessive, but I'd prefer until I learn a bit more to leave it for future reference.

Will edit after raid in a few hours.

-TurkReno
 
Go to line 178, there is a space in the middle of the word "Heading", turning it into "He" and "ading".
 
Included .cpp file with zip so that the board code errors are not present.

-TurkReno
 
Last edited:
My version:

Rich (BB code):
#include "../MQ2Plugin.h"

PreSetup("MQ2Rwarp");
#define CDisplay__MoveLocalPlayerToSuccorCoords 0x458150

VOID dothewrap(float y, float x, float z);
VOID wrap(PSPAWNINFO pChar, PCHAR szLine);
VOID zwrap(PSPAWNINFO pChar, PCHAR szLine);
VOID ExLoc(PSPAWNINFO pChar);
VOID waypoint(PSPAWNINFO pChar, PCHAR szLine);

VOID ExLoc(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 zwrap(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);
        dothewrap(MyY, MyX, NewZ);
        return;
}

VOID wrap(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, "t") != 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, "t") || !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;
         dothewrap(TargetY, TargetX, TargetZ);
      } else if (!stricmp(command,"succor"))  {
         static float north = 0;
         ((PSPAWNINFO)pCharSpawn)->Heading = north;
           DWORD MLPTSC = CDisplay__MoveLocalPlayerToSuccorCoords;
         __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);
      dothewrap((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;
      }
      dothewrap(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 disSuccorgoto = (FLOAT)atof(Y);
      dothewrap(pChar->Y + (FLOAT)(disSuccorgoto * cos(angle)), pChar->X + (FLOAT)(disSuccorgoto * sin(angle)), pChar->Z);
      return;
                }
   {
      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 szDestwrapX[MAX_STRING] = {0};
      char szDestwrapY[MAX_STRING] = {0};
      char szDestwrapZ[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(szDestwrapX, szLoc, 2);
		             GetArg(szDestwrapY, szLoc, 1);
		             GetArg(szDestwrapZ, szLoc, 3);

		             // get heading
		             GetArg(szBuf, szLoc, 4);
            GetArg(szHeading,szBuf,1,0,0,0,':');
         dothewrap((float)atof(szDestwrapY), (float)atof(szDestwrapX), (float)atof(szDestwrapZ));
            }
         }
         }
   }
}


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

        PZONEINFO Zone = (PZONEINFO)pZoneInfo;
   float SafeY = Zone->Unknown0x24c[0];
   float SafeX = Zone->Unknown0x24c[1];
   float SafeZ = Zone->Unknown0x24c[2];
   Zone->Unknown0x24c[0] = y;
   Zone->Unknown0x24c[1] = x;
   Zone->Unknown0x24c[2] = z;

   CHAR szMsg[MAX_STRING] = {0};
   sprintf(szMsg, "warping to: %3.2f, %3.2f, %3.2f.", Zone->Unknown0x24c[0], Zone->Unknown0x24c[1], Zone->Unknown0x24c[2]);
   WriteChatColor(szMsg, COLOR_PURPLE);

   DWORD MLPTSC = CDisplay__MoveLocalPlayerToSuccorCoords;
   __asm call dword ptr [MLPTSC];
}

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 InitializePlugin(VOID)
{
   AddCommand("/warp",wrap);
   AddCommand("/zwarp",zwrap);
   AddCommand("/exactloc",ExLoc);
   AddCommand("/waypoint", waypoint);
//   ppLEQ=(LocalCEverQuest**)pinstCEverQuest;
}


PLUGIN_API VOID ShutdownPlugin(VOID)
{
   DebugSpewAlways("Shutting down MQ2Rwrap");
   RemoveCommand("/warp");
   RemoveCommand("/exactloc");
   RemoveCommand("/zwarp");
   RemoveCommand("/waypoint");
}

A few notes. I changed the names on a bunch of things (exactlocation to exloc, warp to wrap, etc) to avoid speedbumps in the MQ2 zips. Ease of compiling, etc.

You'll need to do the speedbumps listed in Turk's cpp to work it right.
 
Classic Source::MQ2RWarp : /warp, /waypoint, and other cmds

Users who are viewing this thread

Back
Top
Cart