- Joined
- Jan 31, 2005
- Messages
- 11,860
- Reaction score
- 587
- Points
- 113
- Location
- Australia
- Website
- www.mmobugs.com
Credit to Psycotic for this Plugin.
Code:
// MQ2NoSummon.cpp : Defines the entry point for the DLL application
// Same offset as MQ2Warp
// Comment this out to update the offsets/opcodes/structs manually
#define UseMMOBugs True
#ifdef UseMMOBugs
#include "../MQ2MMOBugs.h"
#else
#define CDisplay__MoveLocalPlayerToSafeCoords 0x458210 // 06-13-06
#endif
#include "../MQ2Plugin.h"
PreSetup("MQ2NoSummon");
float UnSummonY, UnSummonX, UnSummonZ;
bool bNoSummon = true;
bool bSummoned = false;
bool bNoSumAll = false;
VOID NoSummon(PSPAWNINFO pChar, PCHAR szLine)
{
if (strstr(szLine, "-all"))
{
bNoSumAll = true;
bNoSummon = false;
}
if (bNoSummon)
{
WriteChatColor("MQ2NoSummon: NoSummon Disabled", CONCOLOR_YELLOW);
bNoSummon = false;
if (bNoSumAll)
{
WriteChatColor("MQ2NoSummon: Target bypass disabled", CONCOLOR_YELLOW);
bNoSumAll = false;
}
}
else
{
WriteChatColor("MQ2NoSummon: NoSummon Enabled", CONCOLOR_GREEN);
bNoSummon = true;
if (bNoSumAll)
{
WriteChatColor("MQ2NoSummon: Will now bypass target check", CONCOLOR_GREEN);
}
}
}
VOID UnSummonMe(PSPAWNINFO pChar)
{
CHAR ABuffer[MAX_STRING] = {0};
PZONEINFO Zone = (PZONEINFO)pZoneInfo;
float SafeY = Zone->SafeYLoc;
float SafeX = Zone->SafeXLoc;
float SafeZ = Zone->SafeZLoc;
Zone->SafeYLoc = UnSummonY;
Zone->SafeXLoc = UnSummonX;
Zone->SafeZLoc = UnSummonZ;
DWORD MLPTSC = CDisplay__MoveLocalPlayerToSafeCoords;
__asm call dword ptr [MLPTSC];
Zone->SafeYLoc = SafeY;
Zone->SafeXLoc = SafeX;
Zone->SafeZLoc = SafeZ;
DoCommand(pChar, "/keypress left");
bSummoned = false;
}
PLUGIN_API DWORD OnIncomingChat(PCHAR Line, DWORD Color)
{
if (strstr(Line,"You have been summoned!"))
{
WriteChatColor("MQ2NoSummon: Summon has been detected!", CONCOLOR_RED);
bSummoned = true;
}
return 0;
}
PLUGIN_API VOID OnPulse(VOID)
{
CHAR ABuffer[MAX_STRING] = {0};
PSPAWNINFO pChar = (PSPAWNINFO)pCharSpawn;
PSPAWNINFO Target = (PSPAWNINFO)pTarget;
if (bNoSummon)
{
if ((bSummoned) && (bNoSumAll))
{
UnSummonMe(pChar);
}
else
{
if ((pTarget) && (ppTarget))
{
if (((abs(Target->Y - pChar->Y)<2) && (abs(UnSummonY - pChar->Y)>4)) || ((abs(Target->X - pChar->X)<2) && (abs(UnSummonX - pChar->X)>4)))
{
if ((Target->Type == SPAWN_NPC)&& (bSummoned) && (pChar->SpawnID != Target->SpawnID))
{
UnSummonMe(pChar);
}
}
else
{
UnSummonY = pChar->Y;
UnSummonX = pChar->X;
UnSummonZ = pChar->Z;
}
}
else
{
UnSummonY = pChar->Y;
UnSummonX = pChar->X;
UnSummonZ = pChar->Z;
}
}
}
else
{
UnSummonY = pChar->Y;
UnSummonX = pChar->X;
UnSummonZ = pChar->Z;
}
}
PLUGIN_API VOID InitializePlugin(VOID)
{
AddCommand("/nosummon",NoSummon);
}
PLUGIN_API VOID ShutdownPlugin(VOID)
{
RemoveCommand("/nosummon");
}