• 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

MQ2InstaMem

Laeuvasu said:
just found the 7.2 download in main thread and now i do not CDT anymore. but instead of memming spells . all /memset setname does is clear all my spells from being memmed. Hoping that I don't get flamed for not wanting to spend 2 hours reading to search for an answer to my problem when i only get about 3 hours of play time a day. After a long day at work all I want to do is come home and play for a little while and then sleep.


Make sure you got the last download the one you got does not sound like the newest one.
 
I'm digging through old posts. . .again

Is this working, or does it need to be updated errrrr what?
 
Does anyone have a working version of MQ2Instamem? Seen it listed in a compile but it wasnt included in the dowload.
 
No it isn't. It hasn't been updated or posted in a couple of years

Lets see if we can fix this. My OLD code contains up to 10 I think spells slots. I updated the Op_code for the most recent EXE. I removed all the code for Op_ForgetSpell as this used to crash more often than not, and it still works without it. Also need to maybe look at the structure of the packet itself and see if it changed.

The packets look OLD to start with and need updating. Before compiling someone will have to sniff this out and double check.

Try to compile this and see if perhaps it works for the first few spell slots, then we can work from there and add more etc. You also must add CoBFuscator (packet fix) or perhaps this won't work right.:

Rich (BB code):
// MQ2InstantMem.cpp
// 
// Commands:
// - /memspell <Spell Name> <Spell Gem>   -- i.e. /memspell "Complete Heal" 1
// - /memset <Spell Set Name>             -- i.e. /memset RaidBuffs
//
// Currently, /memset will unmem everything before attempting to mem new spells
// regardless if they are the correct spell already.
//
// /memspell will not check to see if the spell is already memmed in another gem
// before unmemming the target spell gem.
//
//


#include "../MQ2Plugin.h"
PreSetup("MQ2InstantMem");

#define OPCODE_MemorizeSpell  0x71BF  // 12-08-2010
#define OPCODE_ChangeStandState 0x7B64 // 12-08-2010
//#define OPCODE_ForgetSpells  0x71BF // 12-08-2010

struct _MemorizeSpellPacket {
/*0000*/ unsigned int gem_slot;
/*0004*/ unsigned int spell_id;
/*0008*/ unsigned int memorize; // 0x01 unmem / 0x02 mem
/*0012*/ unsigned int unknown12;
} MemorizeSpellPacket; // 16 bytes

struct _StandStatePacket 
{
/*0000*/ unsigned short ID;
/*0002*/ unsigned short unknown;      // always 0x0e
/*0004*/ unsigned int state;
} StandState; // 8 Bytes

// struct _ForgetSpellsPacket {
// /*0000*/ unsigned int gem_slot0; // Gem 1
// /*0004*/ unsigned int gem_slot1; // Gem 2
// /*0008*/ unsigned int gem_slot2; // Gem 3
// /*0012*/ unsigned int gem_slot3; // Gem 4
// /*0016*/ unsigned int gem_slot4; // Gem 5
// /*0020*/ unsigned int gem_slot5; // Gem 6
// /*0024*/ unsigned int gem_slot6; // Gem 7
// /*0028*/ unsigned int gem_slot7; // Gem 8
// /*0032*/ unsigned int gem_slot8; // Gem 9
// /*0036*/ unsigned int gem_slot9; // Unused (Gem 10)
// } ForgetSpellsPacket; // 40 bytes


VOID MemorizeSpell( PSPAWNINFO pChar, PCHAR szLine )
{
char szSpellName[MAX_STRING] = {0};
char szGemSlot[MAX_STRING] = {0};
char szTemp[MAX_STRING] = {0};
unsigned int Gem;

	PCHARINFO pCharInfo = 0;
	pCharInfo = GetCharInfo();

	// Verify that our parameters are correct.
	if (szLine[0] == 0) 
	{
		MacroError( "Usage: /memspell <spell name> <gem slot>\r\n" );
		return;
	}

	// Parse out the arguments
	GetArg(szSpellName,szLine,1);
	GetArg(szGemSlot,szLine,2);

	// Sanity checking on the gem slot.
	Gem = (unsigned int)atoi(szGemSlot);
	if (Gem<1 || Gem>9) 
	{
		return;
	}
	Gem--;

	// Determine the spell id of the spell that's currently in the gem slot.
	if (PSPELL pSpell=GetSpellByID(GetCharInfo2()->MemorizedSpells[Gem]))
	{
		WriteChatf("spell = %s .", pSpell->Name );

		// Construct and send the packet to memorize the spell.
		ZeroMemory(&MemorizeSpellPacket, sizeof(MemorizeSpellPacket));

		MemorizeSpellPacket.gem_slot = Gem;
		MemorizeSpellPacket.spell_id = pSpell->ID;
		MemorizeSpellPacket.memorize = 0x2;

		SendEQMessage(OPCODE_MemorizeSpell, &MemorizeSpellPacket, sizeof(MemorizeSpellPacket));
	}

	BYTE orig_stand_state = pChar->StandState;

	// Gotta be sitting in order to mem spells.
	ZeroMemory(&StandState, sizeof(StandState));

	StandState.ID = pChar->SpawnID;
	StandState.unknown = 0x0e;
	StandState.state = STANDSTATE_SIT;
	
	SendEQMessage(OPCODE_ChangeStandState, &StandState, sizeof(StandState));
	
	// Set this so that the client is up to date.
	pChar->StandState = STANDSTATE_SIT;
	GetCharInfo()->standstate = STANDSTATE_SIT;
	

	// Look up the spell and send the mem packet.
	PSPELL pNewSpell = GetSpellByName(szSpellName);
	
	if(pNewSpell) 
	{
		// Construct and send the packet to memorize the spell.
		ZeroMemory(&MemorizeSpellPacket, sizeof(MemorizeSpellPacket));
		
		MemorizeSpellPacket.gem_slot = Gem;
		MemorizeSpellPacket.spell_id = pNewSpell->ID;
		MemorizeSpellPacket.memorize = 0x1;
		
		SendEQMessage(OPCODE_MemorizeSpell, &MemorizeSpellPacket, sizeof(MemorizeSpellPacket));
	} 
	else
	{
		WriteChatf("Couldn't find spell %s .", szSpellName );
		WriteChatColor(szTemp, CONCOLOR_GREEN);
	}
	
	// If we weren't sitting originally then return the char to their original standstate.
	if( orig_stand_state != STANDSTATE_SIT ) 
	{
		// Construct and send the packet to sit your ass down.
		ZeroMemory(&StandState, sizeof(StandState));
	
		StandState.ID = pChar->SpawnID;
		StandState.unknown = 0x0e;
		StandState.state = orig_stand_state;
		
		SendEQMessage(OPCODE_ChangeStandState, &StandState, sizeof(StandState));
		
		// Set this so that the client is up to date.
		pChar->StandState = orig_stand_state;
		GetCharInfo()->standstate = orig_stand_state;
	}
	return;
}


VOID MemSet( PSPAWNINFO pChar, PCHAR szLine )
{
char szSpellSetName[MAX_STRING] = {0};
DWORD SpellSetIndex = -1;

	// Verify that our parameters are correct.
	if (szLine[0] == 0) 
	{
		MacroError( "Usage: /memset <spell set name>\r\n" );
		return;
	}

	// Parse out the arguments
	GetArg( szSpellSetName, szLine, 1 );
	
	// Look up the spell set.
	for (DWORD i=0;i<10;i++) 
	{
		if (!stricmp( pSpellSets.Name, szSpellSetName )) 
			SpellSetIndex = i;
	}
	// If we didn't find it then return error.
	if (SpellSetIndex==-1) 
	{
		MacroError("Unable to find spell set '%s'", szSpellSetName);
		return;
	}

	// Gotta be sitting in order to mem spells.
	BYTE orig_stand_state = pChar->StandState;
	
	if( pChar->StandState != STANDSTATE_SIT ) 
	{
		// Construct and send the packet to sit your ass down.
		ZeroMemory(&StandState, sizeof(StandState));
		
		StandState.ID = pChar->SpawnID;
		StandState.unknown = 0x0e;
		StandState.state = STANDSTATE_SIT;
		
		SendEQMessage(OPCODE_ChangeStandState, &StandState, sizeof(StandState));
		
		// Set this so that the client is up to date.
		pChar->StandState = STANDSTATE_SIT;
		GetCharInfo()->standstate = STANDSTATE_SIT;
	}

/*	// Clear out all of our currently memorized spells.
	ZeroMemory(&ForgetSpellsPacket, sizeof(ForgetSpellsPacket));
	
	ForgetSpellsPacket.gem_slot0 = 0x0;
	ForgetSpellsPacket.gem_slot1 = 0x1;
	ForgetSpellsPacket.gem_slot2 = 0x2;
	ForgetSpellsPacket.gem_slot3 = 0x3;
	ForgetSpellsPacket.gem_slot4 = 0x4;
	ForgetSpellsPacket.gem_slot5 = 0x5;
	ForgetSpellsPacket.gem_slot6 = 0x6;
	ForgetSpellsPacket.gem_slot7 = 0x7;
	ForgetSpellsPacket.gem_slot8 = 0x8;
	ForgetSpellsPacket.gem_slot9 = 0x9; 
	
	SendEQMessage(OPCODE_ForgetSpells, &ForgetSpellsPacket, sizeof(ForgetSpellsPacket));
*/	
	for ( int SpellIndex=8; SpellIndex>=0; SpellIndex--) 
	{
		if( pSpellSets[SpellSetIndex].SpellId[SpellIndex] != 0xFFFFFFFF ) 
		{

			// Check to see if the spell gem already has something in it.
			PSPELL pSpell = GetSpellByID( GetCharInfo2()->MemorizedSpells[SpellIndex] );
			if( pSpell ) 
			{
				// If the spell gem already has something in it and it's not the
				// spell we want then unmem it.
				if ( pSpell->ID != pSpellSets[SpellSetIndex].SpellId[SpellIndex] )
				{
					// Determine the spell id of the spell that's currently in the gem slot.
					CHAR szTemp[MAX_STRING] = {0};
					WriteChatf("unmemming %s .", pSpell->Name );

					// Construct and send the packet to unmemorize the spell.
					ZeroMemory(&MemorizeSpellPacket, sizeof(MemorizeSpellPacket));

					MemorizeSpellPacket.gem_slot = (unsigned int)SpellIndex;
					MemorizeSpellPacket.spell_id = pSpell->ID;
					MemorizeSpellPacket.memorize = 0x2;

					SendEQMessage(OPCODE_MemorizeSpell, &MemorizeSpellPacket, sizeof(MemorizeSpellPacket));
				} else

				// If the spell gem has something in it and it IS the spell we
				// want then skip to the next spell in the spell set.
				if( pSpell->ID == pSpellSets[SpellSetIndex].SpellId[SpellIndex] ) 
				{
					continue;
				}
			}


			// Construct and send the packet to memorize the spell.
			ZeroMemory(&MemorizeSpellPacket, sizeof(MemorizeSpellPacket));

			MemorizeSpellPacket.gem_slot = (unsigned int)SpellIndex;
			MemorizeSpellPacket.spell_id = pSpellSets[SpellSetIndex].SpellId[SpellIndex];
			MemorizeSpellPacket.memorize = 0x1;
			
			SendEQMessage(OPCODE_MemorizeSpell, &MemorizeSpellPacket, sizeof(MemorizeSpellPacket));
		}
	}

	// If we weren't sitting originally then return the char to their original standstate.
	if( orig_stand_state != STANDSTATE_SIT ) 
	{
		// Construct and send the packet to sit your ass down.
		ZeroMemory(&StandState, sizeof(StandState));
		
		StandState.ID = pChar->SpawnID;
		StandState.unknown = 0x0e;
		StandState.state = orig_stand_state;
		
		SendEQMessage(OPCODE_ChangeStandState, &StandState, sizeof(StandState));

		// Set this so that the client is up to date.
		pChar->StandState = orig_stand_state;
		GetCharInfo()->standstate = orig_stand_state;
	}
}

PLUGIN_API VOID InitializePlugin(VOID)
{
	AddCommand("/memset",MemSet);
	AddCommand("/memspell",MemorizeSpell);
}

PLUGIN_API VOID ShutdownPlugin(VOID)
{
	RemoveCommand("/memset");
	RemoveCommand("/memspell");
}
 
Czarman for the win. I will cram mq2addicts into this and see if blows up my computer.
 
It compiles and loads ok but it doesn't mem or unload any spells. I am getting the correct spam from from it though. Its not crashing at all that's a good sign.

I am posting this for Alatyami and Siddin to look at hopefully they will be able to get it going.
 
It compiles and loads ok but it doesn't mem or unload any spells. I am getting the correct spam from from it though. Its not crashing at all that's a good sign.

I am posting this for Alatyami and Siddin to look at hopefully they will be able to get it going.

Yeah I think the problem may lie in that you need to infuse it like most other packet programs with the capability to read and send packets -- sendeqmessage is OLD in this version, so it needs updating.

Perhaps move this to level 3 or 4 and we can discuss further and maybe try ourselves.
 
MQ2InstaMem

Users who are viewing this thread

Back
Top
Cart