TeachersPet
Well-known member
- Joined
- Jul 27, 2005
- RedCents
- 71¢
This is my christmas present to RedGuides, I've talked about this plugin for a while but I didn't start coding it until this morning. It works surprisingly well too btw.
It does as the topic states, it lets you cast while running. It reads the casting packet so there is no extra slash command etc... you just need to enable the plugin (you will have to enable it each time you load EQ, it has no stored values). It should also work for casting aura's as melee classes (though I haven't tested it).
I am currently working on this to also work with clicky items, I have the packet structure already, just need to do some testing.
Usage: /focusmind on|off (Default is off)
Update 12/28 at 2:56pm: Fixed a little "whoopsy" making the plugin work when it shouldn't.
It does as the topic states, it lets you cast while running. It reads the casting packet so there is no extra slash command etc... you just need to enable the plugin (you will have to enable it each time you load EQ, it has no stored values). It should also work for casting aura's as melee classes (though I haven't tested it).
I am currently working on this to also work with clicky items, I have the packet structure already, just need to do some testing.
Usage: /focusmind on|off (Default is off)
Update 12/28 at 2:56pm: Fixed a little "whoopsy" making the plugin work when it shouldn't.
Rich (BB code):
/*
MQ2FocusedMind
By: TeachersPet
When enabled, allows you to cast while running.
Usage: /focusmind on|off (Default is off)
*/
#include "../MQ2Plugin.h"
PreSetup("MQ2FocusedMind");
#define OP_MovePkt 0x178A
typedef struct _MOVEPKT {
unsigned short SpawnID;
unsigned short TimeStamp;
int ZHeading:12;
unsigned int HeadingRemainder:2;
unsigned int Heading:10;
unsigned int paddingHeading:8;
float DeltaY;
unsigned int Animation:10;
unsigned int paddingAnimation:22;
float DeltaX;
float Y;
int DeltaHeading:10;
int paddingDeltaHeading:22;
float DeltaZ;
float Z;
float X;
} MovePacket, *PMovePacket;
#define OP_ClickItem 0x105b
typedef struct _CLICKPKT {
DWORD ItemSlot;
DWORD TargetID;
} ClickPacket, *PClickPacket;
#define OP_CastSpell 0x141E
typedef struct _CastPacket {
DWORD SlotID;
DWORD SpellID;
BYTE Unknown0x04[12];
} CastPacket, *PCastPacket;
bool bFocusedMind = false;
bool bSpellGoing = false;
int SpellTime = 0;
float CastingY = 0;
float CastingX = 0;
float CastingZ = 0;
VOID MoveToLoc(float _Y, float _X, float _Z) {
MovePacket M;
ZeroMemory(&M, sizeof(M));
M.SpawnID = (unsigned short)GetCharInfo()->pSpawn->SpawnID;
M.Heading = (unsigned int)GetCharInfo()->pSpawn->Heading;
M.DeltaHeading = 0;
M.Animation = 0;
M.Y = _Y;
M.X = _X;
M.Z = _Z;
SendEQMessage(OP_MovePkt, &M, sizeof(M));
}
BOOL PluginsSendPacket(DWORD Type, PVOID Packet, DWORD Size)
{
typedef BOOL (__cdecl *fMQSendPacket)(DWORD, PVOID, DWORD);
bool bSend = true;
PMQPLUGIN pPlugin = pPlugins;
while(pPlugin)
{
fMQSendPacket SendPacket = (fMQSendPacket)GetProcAddress(pPlugin->hModule, "OnSendPacket");
if (SendPacket)
{
if (!SendPacket(Type, Packet, Size)) bSend = false;
}
pPlugin = pPlugin->pNext;
}
return bSend;
}
DETOUR_TRAMPOLINE_EMPTY(VOID memchecks_trampoline(PVOID, DWORD, PCHAR, DWORD, BOOL));
VOID memchecks_detour(PVOID A, DWORD B, PCHAR C, DWORD D, BOOL E)
{
if (PluginsSendPacket(B, C, D)) memchecks_trampoline(A, B, C, D, E);
}
PLUGIN_API BOOL OnSendPacket(DWORD Type, PVOID Packet, DWORD Size)
{
if(bFocusedMind) {
if(Type == OP_MovePkt && bSpellGoing && GetTickCount() > SpellTime) {
PMovePacket MovePkt = (PMovePacket)Packet;
MovePkt->Y = CastingY;
MovePkt->X = CastingX;
MovePkt->Z = CastingZ;
MovePkt->Heading = GetCharInfo()->pSpawn->Heading;
MovePkt->DeltaHeading = 0;
MovePkt->Animation = 0;
MovePkt->DeltaX = 0;
MovePkt->DeltaY = 0;
MovePkt->DeltaZ = 0;
}
if(Type == OP_CastSpell) {
MoveToLoc(GetCharInfo()->pSpawn->Y,GetCharInfo()->pSpawn->X,GetCharInfo()->pSpawn->Z);
PCastPacket SpellPacket = (PCastPacket)Packet;
PSPELL spell;
spell = GetSpellByID(SpellPacket->SpellID);
SpellTime = int((pCharData1->GetAACastingTimeModifier((EQ_Spell*)spell)
+pCharData1->GetFocusCastingTimeModifier((EQ_Spell*)spell,0)
+spell->CastTime-200)); // Blatant Ripoff from zippzipp <3
SpellTime+= GetTickCount();
CastingY = GetCharInfo()->pSpawn->Y;
CastingX = GetCharInfo()->pSpawn->X;
CastingZ = GetCharInfo()->pSpawn->Z;
bSpellGoing = true;
}
}
return true;
}
PLUGIN_API VOID OnPulse(VOID)
{
if(bFocusedMind) {
if(bSpellGoing && GetCharInfo()->pSpawn->CastingSpellID == -1) {
bSpellGoing = false;
MoveToLoc(GetCharInfo()->pSpawn->Y,GetCharInfo()->pSpawn->X,GetCharInfo()->pSpawn->Z);
}
if(bSpellGoing && GetTickCount() > SpellTime) {
MoveToLoc(CastingY,CastingX,CastingZ);
}
}
}
VOID FocusMindToggle(PSPAWNINFO pChar, PCHAR szLine)
{
CHAR szArg[MAX_STRING] = {0};
GetArg(szArg, szLine, 1);
if (szArg[0] == 0) {
bFocusedMind = !bFocusedMind;
} else if (!strcmp(szArg, "on")) {
bFocusedMind = true;
} else if (!strcmp(szArg, "off")) {
bFocusedMind = false;
} else {
bFocusedMind = !bFocusedMind;
}
if(bFocusedMind) {
WriteChatColor("Your thoughts are so focused, you can do them on the run.");
} else {
WriteChatColor("Your thoughts are no longer focused");
}
}
PLUGIN_API VOID InitializePlugin(VOID)
{
AddCommand("/focusmind",FocusMindToggle);
}
PLUGIN_API VOID ShutdownPlugin(VOID)
{
RemoveCommand("/focusmind");
}
Last edited:


one more question, do you think this would work using PBAOE spells? This makes me think of how bards used to pbaoe kite only now with this plugin using wizard or mage pbaoe spells. I tried with scast but had no luck 

.