well sense cronic wont update maybe someone here will This code was taken from somewhere I forget lolz.
// MQ2Ghost.cpp : Defines the entry point for the DLL application.
// Enables one to "ghost" through zones by remaining stationary on the server
// while moving client-side.
// MQ2Ghost by cronic, with credit to Lestor for the /ghost return idea.
//Updated by drellisdee 6/08/05
#include "../MQ2Plugin.h"
#include "MQ2Packets.h"
PreSetup("MQ2Ghost");
// if CDisplay__MoveLocalPlayerToSafeCoords is defined in eqgame-private
// then this is not neccessary
// valid for 9/14 patch
#define tehSafe 0x00444C21
#define MLPTSC 0x00444C21
//004370CA
#ifndef CDisplay__MoveLocalPlayerToSafeCoords
#pragma warning(disable:4273) // inconsistent dll linkage warning
FUNCTION_AT_ADDRESS(void CDisplay::MoveLocalPlayerToSafeCoords(void), MLPTSC);
#endif
DWORD MLPTSC2 = tehSafe;
BOOL bGhosting = FALSE;
BOOL bFilterPackets = FALSE;
FLOAT fOldX;
FLOAT fOldY;
FLOAT fOldZ;
DWORD fOldTurning;
FLOAT fOldHeading;
void SendMovementPacket(float x, float y, float z)
{
PSPAWNINFO Me = GetCharInfo()->pSpawn;
MovePacket Packet;
Packet.SpawnID = (WORD)Me->SpawnID;
Packet.X = x;
Packet.Y = y;
Packet.Z = z;
Packet.SpeedX = 0;
Packet.SpeedY = 0;
Packet.SpeedZ = 0;
Packet.Turning = Me->pActorInfo->LastPacketHeadingTurning;
SendEQMessage(29775, &Packet, sizeof(Packet));
}
// disables packet blocking, sends a movement packet to ghosted position,
// sends given packet, then sends another movement packet back
void QuickJumpPacket(DWORD Type, PVOID Packet, DWORD Size)
{
bFilterPackets = false;
PSPAWNINFO Me = GetCharInfo()->pSpawn;
SendMovementPacket(Me->X, Me->Y, Me->Z);
SendEQMessage(Type, Packet, Size);
SendMovementPacket(fOldX, fOldY, fOldZ);
bFilterPackets = true;
}
// moves you to fOldX, fOldY, fOldZ
void Return()
{
FLOAT* fSafeX = &((PZONEINFO)pZoneInfo)->SafeXLoc;
FLOAT* fSafeY = &((PZONEINFO)pZoneInfo)->SafeYLoc;
FLOAT* fSafeZ = &((PZONEINFO)pZoneInfo)->SafeZLoc;
FLOAT fOldSafeX = *fSafeX;
FLOAT fOldSafeY = *fSafeY;
FLOAT fOldSafeZ = *fSafeZ;
*fSafeX = fOldX;
*fSafeY = fOldY;
*fSafeZ = fOldZ;
//pDisplay->MoveLocalPlayerToSafeCoords(); //Old code no longer works
//Zone->Unknown0x1ec[0] = (float)atof(szDestWarpY);; // New code works fine
// Zone->Unknown0x1ec[1] = (float)atof(szDestWarpX);;
// Zone->Unknown0x1ec[2] = (float)atof(szDestWarpZ);;
__asm call dword ptr [MLPTSC2];
// Zone->Unknown0x1ec[0] = PrevY;
// Zone->Unknown0x1ec[1] = PrevX;
// Zone->Unknown0x1ec[2] = PrevZ;
*fSafeX = fOldSafeX;
*fSafeY = fOldSafeY;
*fSafeZ = fOldSafeZ;
GetCharInfo()->pSpawn->Heading = fOldHeading;
}
void ShowHelp()
{
WriteChatColor("/ghost on (enables ghosting)", COLOR_LIGHTGREY);
WriteChatColor("/ghost off (disables ghosting)", COLOR_LIGHTGREY);
WriteChatColor("/ghost return (disables ghosting and returns to original location)", COLOR_LIGHTGREY);
}
VOID GhostCmd(PSPAWNINFO pChar, PCHAR szLine)
{
CHAR szArg[MAX_STRING] = {0};
GetArg(szArg, szLine, 1);
if (szArg[0] == 0) ShowHelp();
else if (!strcmp(szArg, "on")) {
if (!bGhosting) {
bGhosting = true;
bFilterPackets = true;
fOldX = pChar->X;
fOldY = pChar->Y;
fOldZ = pChar->Z;
fOldTurning = pChar->pActorInfo->LastPacketHeadingTurning;
fOldHeading = pChar->Heading;
WriteChatColor("You are now ghosting.");
}
else WriteChatColor("Ghost mode is already on.", COLOR_PURPLE);
}
else if (!strcmp(szArg, "off")) {
if (bGhosting) {
bGhosting = false;
bFilterPackets = false;
WriteChatColor("You are no longer ghosting.", COLOR_PURPLE);
SendMovementPacket(pChar->X, pChar->Y, pChar->Z);
}
else WriteChatColor("Ghost mode is already off.", COLOR_PURPLE);
}
else if (!strcmp(szArg, "return")) {
if (bGhosting) {
Return();
bGhosting = false;
bFilterPackets = false;
WriteChatColor("You are no longer ghosting.", COLOR_PURPLE);
}
else WriteChatColor("Ghost mode is already off.", COLOR_PURPLE);
}
}
PLUGIN_API BOOL OnSendPacket(DWORD Type, PVOID Packet, DWORD Size)
{
if (bGhosting && bFilterPackets)
{
// movement (0x1E)
if (Type == 29775)
{
PMovePacket movepkt = (PMovePacket)Packet;
movepkt->X = fOldX;
movepkt->Y = fOldY;
movepkt->Z = fOldZ;
movepkt->SpeedX = 0;
movepkt->SpeedY = 0;
movepkt->SpeedZ = 0;
movepkt->Turning = fOldTurning;
//return true;
return false;
}
// falling? (0x1F) / falling? (0x17)
if (Type == 15306 || Type == 1848)
{
return false;
}
// standstate adjustment (0x8)
if (Type == 9890) return false;
// jump (0x0)
if (Type == 30416) return false;
// inspect anonymously (ie, they don't get a message that you're looking) (0x8)
if (Type == 1782)
{
((PInspectPacket)Packet)->MyID = 0;
return true;
}
// doors and switches (0x10)
if (Type == 26971)
{
QuickJumpPacket(Type, Packet, Size);
return false;
}
// PickPocket (0x12)
if (Type == 15144)
{
QuickJumpPacket(Type, Packet, Size);
return true;
}
// Sense Traps (0x0)
if (Type == 13714)
{
QuickJumpPacket(Type, Packet, Size);
return true;
}
// Disarm Traps (0x0)
if (Type == 3060)
{
QuickJumpPacket(Type, Packet, Size);
return true;
}
// Begging (0x12)
if (Type == 992)
{
QuickJumpPacket(Type, Packet, Size);
return true;
}
// pick up item (0x8)
if (Type == 5962)
{
QuickJumpPacket(Type, Packet, Size);
return false;
}
// drop item (0x0)
if (Type == 29874)
{
QuickJumpPacket(Type, Packet, Size);
return false;
}
// some abilities and all spells (0x14)
if (Type == 29867)
{
//if (GetCharInfo()->pSpawn->pActorInfo->CastingSpellID == -1)
//{
QuickJumpPacket(Type, Packet, Size);
return false;
//}
//return true;
}
// taunt (0x4)
if (Type == 13489)
{
QuickJumpPacket(Type, Packet, Size);
return false;
}
// bash, kick, and other combat abilities (0xc)
if (Type == 425)
{
QuickJumpPacket(Type, Packet, Size);
return false;
}
// open trade with pc (0x8), pc opens trade with you (0x8)
if (Type == 22227 || Type == 2550)
{
QuickJumpPacket(Type, Packet, Size);
return false;
}
// ShiftItems (0x0c) / ShiftMoney 0x14
if (Type == 16435 || Type == 30388)
{
QuickJumpPacket(Type, Packet, Size);
return false;
}
// corpsedrag (0x98), corpsedrop (0x1f)
// using corpsedrag will port the corpse to your location on
// the server, NOT where you are ghosting
if (Type == 11382 || Type == 22160)
{
QuickJumpPacket(Type, Packet, Size);
return false;
}
// loot corpse (0x4), loot item (0x4) / EndLoot (0x10) is 6492
if (Type == 27334 || Type == 2530)
{
QuickJumpPacket(Type, Packet, Size);
return false;
}
// enter merchant window (0x10), purchase (0x18), sell (0x10)
if (Type == 16108 || Type == 27987 || Type == 6298)
{
QuickJumpPacket(Type, Packet, Size);
return false;
}
}
return true;
}
PLUGIN_API VOID InitializePlugin(VOID)
{
AddCommand("/ghost", GhostCmd);
////
}
PLUGIN_API VOID ShutdownPlugin(VOID)
{
RemoveCommand("/ghost");
}
/////////////////////////////////////////////////////////////////////////////////////
//Way outdated needs update
// MQ2Packets.h
// all known packet types used by send_message
// type == 39
typedef struct _MovePacket {
WORD SpawnID;
FLOAT Z;
FLOAT Y;
FLOAT SpeedY;
FLOAT X;
FLOAT SpeedZ;
FLOAT SpeedX;
DWORD Turning;
} MovePacket, *PMovePacket; // 0x1E
// type == 249
typedef struct _PickupPacket {
DWORD DropID;
DWORD SpawnID;
} PickupPacket, *PPickupPacket; // 0x08
// type == 295
typedef struct _ClickSwitchPacket {
DWORD SwitchID;
DWORD unk0x4; // always 0
DWORD unk0x8; // always -1
DWORD SpawnID;
} ClickSwitchPacket, *PClickSwitchPacket; // 0x10
// type == 584
typedef struct _InspectPacket {
DWORD YourID;
DWORD MyID;
} InspectPacket, *PInspectPacket; // 0x08
// type == 250
typedef struct _DropPacket {
// empty packet. drops what's on your cursor
} DropPacket, *PDropPacket; // 0x00
// type == 303
typedef struct _EngageLootPacket {
WORD MyID;
WORD CorpseID;
DWORD Unknown0x04; // 0
} EngageLootPacket, *PEngageLootPacket; // 0x08
// type == 190
typedef struct _CastPacket {
DWORD SlotID;
DWORD SpellID;
BYTE Unknown0x04[12];
} CastPacket, *PCastPacket; // 0x14
// type == 337
typedef struct _ShiftItemPacket {
DWORD SourceSlot; // cursor == 30
DWORD DestSlot;
DWORD Unk0x08;
} ShiftItemPacket, *PShiftItemPacket; // 0x0C