// MQ2Gatewarp.cpp : Defines the entry point for the DLL application.
//
// PLUGIN_API is only to be used for callbacks. All existing callbacks at this time
// are shown below. Remove the ones your plugin does not use. Always use Initialize
// and Shutdown for setup and cleanup, do NOT do it in DllMain.
#include "../MQ2Plugin.h"
PreSetup("MQ2Gatewarp");
VOID SetMove(PSPAWNINFO pChar,PCHAR szLine)
{
CHAR szBuffer[MAX_STRING] = {0};
PZONEINFO TZone = (PZONEINFO) pZoneInfo;
CHAR Arg1[MAX_STRING] = {0};
CHAR Arg2[MAX_STRING] = {0};
CHAR Arg3[MAX_STRING] = {0};
DWORD Dzone;
if (szLine[0] == 0)
{
WriteChatColor("Useage: /mgate mode mode = target, y x z or safe", CONCOLOR_LIGHTBLUE);
WriteChatColor(" Then use Gate to Move", CONCOLOR_LIGHTBLUE);
return;
}
if (!strcmpi(Arg1, "s") || !strcmpi(Arg1, "safe") || !strcmpi(Arg1, "succor"))
{
GetCharInfo()->ZoneBoundId = GetZoneID(TZone->ShortName);
GetCharInfo()->ZoneBoundY = TZone->SafeY;
GetCharInfo()->ZoneBoundX = TZone->SafeX;
GetCharInfo()->ZoneBoundZ = TZone->SafeZ;
sprintf(szBuffer, "Gate set for Succor Point (%.0f, %.0f, %.0f).", GetCharInfo()->ZoneBoundY, GetCharInfo()->ZoneBoundX, GetCharInfo()->ZoneBoundZ);
}
else if ((!strcmpi(Arg1, "t") || !strcmpi(Arg1, "target")) && pTarget)
{
GetCharInfo()->ZoneBoundY = ((PSPAWNINFO)pTarget)->Y+1;
GetCharInfo()->ZoneBoundX = ((PSPAWNINFO)pTarget)->X+1;
GetCharInfo()->ZoneBoundZ = ((PSPAWNINFO)pTarget)->Z+1;
GetCharInfo()->ZoneBoundId = GetZoneID(TZone->ShortName);
sprintf(szBuffer, "Gate set to %s (%.0f, %.0f, %.0f - Zone %.0f).", ((PSPAWNINFO)pTarget)->Name, GetCharInfo()->ZoneBoundY, GetCharInfo()->ZoneBoundX, GetCharInfo()->ZoneBoundZ);
}
else if (*Arg1 && *Arg2 && *Arg3)
{
GetCharInfo()->ZoneBoundY = (float)atof(Arg1);
GetCharInfo()->ZoneBoundX = (float)atof(Arg2);
GetCharInfo()->ZoneBoundZ = (float)atof(Arg3);
GetCharInfo()->ZoneBoundId = GetZoneID(TZone->ShortName);
sprintf(szBuffer, "Gate set to the location you specified (%.0f, %.0f, %.0f - Zone %.0f).", GetCharInfo()->ZoneBoundY, GetCharInfo()->ZoneBoundX, GetCharInfo()->ZoneBoundZ);
}
WriteChatColor(szBuffer, CONCOLOR_YELLOW);
Dzone = GetCharInfo()->ZoneBoundId;
sprintf(szBuffer, "Gate set to zone (should be local zone) %s (%s).", GetFullZone(Dzone), GetShortZone(Dzone));
WriteChatColor(szBuffer, CONCOLOR_YELLOW);
}
//VOID ClearMove(PSPAWNINFO pChar,PCHAR szLine)
//{
//
//}
// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
DebugSpewAlways("Initializing MQ2Gatewarp");
DebugSpewAlways(" Use /mgate to set target");
//DebugSpewAlways(" Use /cgate to clear move");
AddCommand("/mgate", SetMove);
//AddCommand("/cgate", ClearMove);
}
// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
DebugSpewAlways("Shutting down MQ2Gatewarp");
RemoveCommand("/mgate");
//RemoveCommand("/cgate");
}