here is neat plugin nokos zone warp metalmario(sink to bottom of water and walk) and fly
(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', 'CODE'))):
#include "../MQ2Plugin.h"
#define CDisplay_MoveLocalPlayerToSafeCoords 0x00440F59
#ifdef CDisplay_MoveLocalPlayerToSafeCoords
FUNCTION_AT_ADDRESS(void CDisplay::MoveLocalPlayerToSafeCoords(void),CDisplay_MoveLocalPlayerToSafeCoords);
#endif
PreSetup("MQ2Megawarp");
DWORD addr_MM0=(DWORD)0x00468D82;
BYTE ori_MM0[6];
BYTE new_MM0[6];
VOID Fly (PSPAWNINFO, PCHAR);
VOID MM (PSPAWNINFO, PCHAR);
VOID NoKos (PSPAWNINFO, PCHAR);
/*VOID SetCursorSpell (PSPAWNINFO, PCHAR);*/
VOID PickupItem (PSPAWNINFO, PCHAR);
VOID Gate (PSPAWNINFO, PCHAR);
VOID warp (PSPAWNINFO, PCHAR);
VOID Zone (PSPAWNINFO, PCHAR);
VOID Offset(DWORD Address, BYTE *NewData, DWORD Length=1)
{
DWORD oldperm=0, tmp;
FlushInstructionCache(GetCurrentProcess(),(LPCVOID)Address, Length);
VirtualProtectEx(GetCurrentProcess(), (LPVOID)Address, Length,PAGE_EXECUTE_READWRITE, &oldperm);
WriteProcessMemory(
GetCurrentProcess(),
(LPVOID)Address,
(LPVOID)NewData,
Length,
NULL);
VirtualProtectEx(GetCurrentProcess(), (LPVOID)Address, Length, oldperm, &tmp);
}
// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID)
{
DebugSpewAlways("Initializing MQ2Megawarp");
// Add commands, macro parameters, hooks, etc.
AddCommand("/nokos",NoKos);
AddCommand("/fly",Fly);
AddCommand("/metalmario",MM);
//AddCommand("/setspell",SetCursorSpell);
AddCommand("/pickup",PickupItem);
AddCommand("/gate",Gate);
AddCommand("/warp",warp);
AddCommand("/zone",Zone);
AddDetour(addr_MM0,NULL,NULL,sizeof(ori_MM0));
WriteChatColor("Usage: /warp [safe|last|target|loc y x z], /gate, /nokos(nerfed), /fly [on|off], /metalmario [on|off], /zone [shortzonename], /pickupitem ", 13, 0);
}
// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID)
{
DebugSpewAlways("Shutting down MQ2Megawarp");
RemoveCommand("/fly");
RemoveCommand("/metalmario");
//RemoveCommand("/setspell");
RemoveCommand("/nokos");
RemoveCommand("/pickup");
RemoveCommand("/gate");
RemoveCommand("/warp");
RemoveCommand("/zone");
RemoveDetour(addr_MM0);
}
VOID NoKos(PSPAWNINFO pChar, PCHAR szLine)
{
static int gSpawnID;
if (pChar->SpawnID!=0){
gSpawnID = pChar->SpawnID;
WriteChatColor("Making you non-kos",USERCOLOR_TELL);
pChar->SpawnID = 0;
} else {
pChar->SpawnID = gSpawnID;
WriteChatColor("Making you mortal",USERCOLOR_TELL);
}
}
//
// Metal Mario offset is located at EQPlayer__BodyEnvironmentChange
VOID MM(PSPAWNINFO pChar, PCHAR szLine)
{
BYTE ori_MM0[6]={0x88, 0x90, 0xA9, 0x00, 0x00, 0x00};
BYTE new_MM0[6]={0x90, 0x90, 0x90, 0x90, 0x90, 0x90};
static bool MM;
bRunNextCommand = TRUE;
if(!MM && pChar->pActorInfo->Swimming==5){
Offset(addr_MM0,new_MM0,6);
WriteChatColor("Metal Mario on.",USERCOLOR_TELL);
pChar->pActorInfo->Swimming = 0;
pChar->pActorInfo->FeetWet = 0;
pChar->pActorInfo->UnderWater = 0;
MM=true;
} else if(MM && pChar->pActorInfo->Swimming==0){
Offset(addr_MM0,ori_MM0,6);
WriteChatColor("Metal Mario off.",USERCOLOR_TELL);
pChar->pActorInfo->Swimming = 5;
pChar->pActorInfo->FeetWet = 5;
pChar->pActorInfo->UnderWater = 5;
MM=false;
}
}
// How many bytes were added to actorinfo for new fly offset?? 4 bytes!
VOID Fly(PSPAWNINFO pChar, PCHAR szLine)
{
bRunNextCommand = TRUE;
if(pChar->pActorInfo->Unknown0x07c[0x1c]!=0){
WriteChatColor("Fly Mode on.",USERCOLOR_TELL);
pChar->pActorInfo->Unknown0x07c[0x1c] = 0;
} else {
pChar->pActorInfo->Unknown0x07c[0x1c] = 1;
WriteChatColor("Fly Mode off.",USERCOLOR_TELL);
}
}
/*
VOID SetCursorSpell(PSPAWNINFO pChar, PCHAR szLine)
{
CHAR Arg1[MAX_STRING] = {0};
CHAR Arg2[MAX_STRING] = {0};
if (!pChar->pCharInfo->Cursor) {
WriteChatColor("Please have an item on the cursor to use this command.",USERCOLOR_DEFAULT);
return;
}
GetArg(Arg1,szLine,1);
GetArg(Arg2,szLine,2);
if (Arg1[0]==0) {
WriteChatColor("Usage: /setcursorspell <spellname>");
return;
}
PSPELLLIST pSpell = GetSpellByName(Arg1);
if (!pSpell) {
WriteChatColor("Unknown spell.",USERCOLOR_DEFAULT);
return;
}
SetItemWornEffect(pChar->pCharInfo->Cursor->Item,pSpell->ID);
if (Arg2[0]!=0) pChar->pCharInfo->Cursor->Item->Level = atoi(Arg2);
}
BOOL DoesCharHaveSpellItem(PSPAWNINFO pChar, DWORD SpellID)
{
DWORD i;
if (!pChar) return FALSE;
if (!pChar->pCharInfo) return FALSE;
for (i=0;i<22;i++) {
if (!pChar->pCharInfo->InventoryArray[i]) continue;
if (!pChar->pCharInfo->InventoryArray[i]->Item) continue;
if (pChar->pCharInfo->InventoryArray[i]->Item->SpellId == SpellID) return TRUE;
}
return FALSE;
}
*/
VOID PickupItem(PSPAWNINFO pChar, PCHAR szLine)
{
ItemTarget(pChar,szLine);
if (EnviroTarget.Name[0]!=0) {
INTERACTGROUNDITEM Data;
Data.SpawnID = GetCharInfo()->pSpawn->SpawnID;
Data.DropID = EnviroTarget.Race;
SendEQMessage(EQ_INTERACTGROUNDITEM,&Data,sizeof(INTERACTGROUNDITEM));
EnviroTarget.Name[0]=0;
if ((DWORD)pTarget == (DWORD)&EnviroTarget) pTarget=NULL;
return;
}
}
VOID Gate(PSPAWNINFO pChar, PCHAR szLine)
{
pChar->Type=SPAWN_CORPSE;
}
VOID warp(PSPAWNINFO pChar, PCHAR szLine)
{
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);
FLOAT TempSafeX,TempSafeY,TempSafeZ;
TempSafeY=((PZONEINFO)pZoneInfo)->SafeYLoc;
TempSafeX=((PZONEINFO)pZoneInfo)->SafeXLoc;
TempSafeZ=((PZONEINFO)pZoneInfo)->SafeZLoc;
PSPAWNINFO psTarget = NULL;
if (!stricmp(command,"safe")) {
pDisplay->MoveLocalPlayerToSafeCoords();
} else if (!stricmp(command,"target")) {
if (ppTarget && pTarget) {
psTarget = (PSPAWNINFO)pTarget;
}
((PZONEINFO)pZoneInfo)->SafeXLoc = psTarget->X;
((PZONEINFO)pZoneInfo)->SafeYLoc = psTarget->Y;
((PZONEINFO)pZoneInfo)->SafeZLoc = psTarget->Z;
pDisplay->MoveLocalPlayerToSafeCoords();
} else if (!stricmp(command,"loc")) {
((PZONEINFO)pZoneInfo)->SafeXLoc = (float)atof(X);
((PZONEINFO)pZoneInfo)->SafeYLoc = (float)atof(Y);
((PZONEINFO)pZoneInfo)->SafeZLoc = (float)atof(Z);
pDisplay->MoveLocalPlayerToSafeCoords();
}
((PZONEINFO)pZoneInfo)->SafeYLoc=TempSafeY;
((PZONEINFO)pZoneInfo)->SafeXLoc=TempSafeX;
((PZONEINFO)pZoneInfo)->SafeZLoc=TempSafeZ;
}
VOID Zone(PSPAWNINFO pChar, PCHAR szLine)
{
CHAR cTargetZone[MAX_STRING]; GetArg(cTargetZone,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);
int TargetZone=GetZoneID(cTargetZone);
if (TargetZone!=-1) {
pChar->pCharInfo->ZoneBoundId=TargetZone;
pChar->pCharInfo->ZoneBoundY = (float)atof(Y);
pChar->pCharInfo->ZoneBoundX = (float)atof(X);
pChar->pCharInfo->ZoneBoundZ = (float)atof(Z);
pChar->Type=SPAWN_CORPSE;
}
}