• You've discovered RedGuides, an EverQuest multi-boxing and scripting community 🧙‍♀️⚙️. We want you to play several EQ characters at once, come join us and say hello! 👋

  • A TLP without truebox has thawed (Very Vanilla ready)
    Frostreaver

MQ2FocusedMind (Cast While Running)

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.

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:
Yeah, except has a significantly higher success rate and you don't type /scast, you just type /focusmind once and then until you disable the plugin you can cast spells normally and not have them interrupt by you moving.
 
Very nice TP :) 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 :(
 
I'm not quite sure, basically the way it operates is the location you start casting at is set as an anchor. Two tenths of a second before casting goes off, all movement packets are changed to that anchor location, thus allowing you to complete a cast. I mean, it would be possible to have a PBAE kite work using this, but it would involve a lot of good timing. I personally think that you would have better luck PBAE "kiting" if you used warp and had your character warp in a circle at selected intervals, guaranteeing that you end casting at the same location every time.

HOWEVER, this would be very good for quadding if you quadded in a somewhat tight circle. You'd never have to stop running or any of that.
 
This is an awesome plugin for me, working great !!! Thank you muchly TP, and Merry Christmas to you!!
 
So this warps you back to the location you started casting 2/10ths of a second before the cast then warps you back? So if you run with a horse, cast at full speed with something chasing you, then it wouldn't hit? Because your original location was much further behind you so the mob would be out of range.
 
I'v been playing with this for a little bit. It's a very nice plugin but only thing I have against it is that It will look very noticable watching a toon warping right in front of someone just like how its a no no to warp in front of anyone.

The other thing I saw was that yes its moving while casting but really when u are casting your casting at the spot u started from and it would only be a range of that loc. A example

Playing a Sk, U cast spells to keep aggro and what not. So when your casting and also tanking your moving all over the place. Jumping 1 place to another and then cast another spell to another place.

I'm not trying to put it down just saying it kinda puts this as a flag that people can see ya do it and petition for something like that. Plus it will be another flag for soe to snag about a warp flag.
 
If you're running in a circle, you'll be fine hitting them. Also, Zero, as with most everything I develop, this is an active hack. One thing I thought this would help most with is SK's and Paladins casting to keep aggro, because the slight movements can interrupt casting, this would help eliminate this problem. If you're fighting against stuff that pushes and what not, this is going to be a great help for you casters.
 
I will be using this with my SK for sure RC to you TP and merry xmas : P
 
Nice stuff TP. Even though I've only been a member for a few days, I've already been impressed with the plugins that you've put together. RC for you.
 
Not sure what is goin on, when I loaded this up, I started ghosting around. I do have the ghost plugin loaded, but it wasnt turned on. I havent tried unloading ghost yet as I use this alot to look around. /shrug
 
It shouldn't conflict with ghost at all, but try unloading Ghost then reloading it.
 
Very nice to have as a cleric. Don't have any intention of using this except on raids. The little movement here or there from a mob doesn't interrupt the casting of a heal spell $$. That little movement should not be detectable either to the eye.

Nice job, RC inc to you!
 
Fixed an issue making it work when /focusmind was disabled (forgot to put in the other boolean, WHOOPSIE)
 
nice plugin to be used if implemented right... underwater bard kiting... cast in water, warps over water across other side... not to catch hits. or even aoe underwater....
 
Going to try this might be god for cleric soling so I dont get interrupted. No running but I do get bashed around allot.. WOuld not be very noticable.
 
I tried this on my shaman and spell was still interrupted....pluged it in and did /focusmind on....ran and tried to cast sumthing but didnt do anything?....
 
Is it a fresh compile? If not I'll throw this on my Massive Pile of Plugins (tm) I have to update and see what the dealio is.

(I have no idea why I said dealio)
 
i have tried this,,it loads fine and turns on and off but spells still interupt if i move
 
/bump

Any chance of getting this updated? It is $$ for clerics on raids - don't use it while running, but being able to move slightly while casting (if a target is out of range).

Thanks for your time and efforts!
 
TeachersPet said:
Ok this is nearing the top of my pile. I have two more macros to finish.


So are you really playing EQ any more TP or have you gone to the other side?????
 
This uses warp of course and So if you dont have warp this will not work for you. I do have an updated copy but its not mine and will not rip from someone else. I do know where to get it so PM me if you need that info
 
MQ2FocusedMind (Cast While Running)

Users who are viewing this thread

Back
Top
Cart