• 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

MQ2IntelliInstaMem - Mem spellsets instantly without rememming spells unnecessarily

daslackas

Member
Joined
Jan 18, 2006
RedCents
This plugin mems spellsets instantly. It uses the command /memspell of the plugin MQ2InstaMem the randomguy_01 posted. You need MQ2InstaMem loaded for this to work.

You might have realized, that if you do a /memset [spellsetname] (thats the command of MQ2InstaMem), it will unload every spell you have memed, and reload the new spellset instantly.

This plugin compares the spell that should be loaded from the spellset (starting with Gem #1) with the spell that is memed at this time in Gem Slot #1. If the spells are the same, nothing will happen. If the spells do differ, then the new spell will be loaded instantly. Now it will go through all 9 Spell Gems and mem the whole spellset. (theres a bit more logic behind that, but thats the basic ;))

It is pretty handy if you have one spell saved in various spellsets (lets say cleric's DA - long recast time), always in the same Gem Slot. Now if you want to load the other spellset, DA won't be unloaded and loaded again... :)


Syntax:
/iim <spellset>
Mems spellset

/iim quiet
Hides the spam produced by the /memspell command of MQ2InstaMem if a spell has been replaced by another. Needs to be turned on everytime MQ2 is restarted. Default is Off. Its a toggle command.

The plugin uses the spellsets from EQ, so if you want to save a new spellset, do that by right-clicking on the spellbook button.

Rich (BB code):
/* **************************************************************************
Description:	Memorizes spellsets instantly. Uses the /memspell command of 
				the plugin MQ2InstaMem. This plugin is using the Everquest's 
				spellsets, the only	difference to MQ2InstaMem is that if a 
				spell is already memorized, it wont be unloaded and loaded 
				again. Useful for spells that have a long recast time.

				Some Code is taken from MQ2Commands (/loadspells)

 Usage:       /iim [Spellsetname]
*************************************************************************** */

#include "../MQ2Plugin.h"

//2 global variables needed for quiet mode
bool quietModeOn(false);
CHAR szQuietMode[MAX_STRING] = "";

DWORD IndexOfAlreadyMemorizedSpellId(DWORD SpellID) {
	for (DWORD i=0; i<9; i++) {
		if (GetCharInfo2()->MemorizedSpells == SpellID)
			return i;
	}
	return -1;
}

VOID MemSpellSetCommand(PSPAWNINFO pChar, PCHAR szLine) 
{ 
    if (!pSpellSets || !ppSpellBookWnd || szLine[0]==0) return; 

    DWORD Index, DoIndex(0xFFFFFFFF), MemorizedAt(0xFFFFFFFF);
    CHAR szArg1[MAX_STRING] = {0}; 
    CHAR szArg2[MAX_STRING] = {0}; 
    CHAR szBuffer[MAX_STRING] = {0}; 

    if (!pSpellBookWnd) return; 

    GetArg(szArg1,szLine,1); 
    GetArg(szArg2,szLine,2); 

	//Displays help
	if ((!stricmp(szArg1,"help")) && (szArg2[0]==0)) {
		WriteChatf("\nMQ2IntelliInstaMem Help:\nUse \ay/iim [spellsetname|spellsetnumber]\ax to load a spellset instantly\nUse \ay/iim list\ax to display all saved spellsets with their number\nUse \ay/iim list [spellsetname|spellsetnumber]\ax to display the saved spells in the spellset\nUse \ay/iim quiet\ax to toggle on/off the display of exchange messages generated by MQ2InstaMem");
		return;
	}

	//Toggles quiet mode
	if (!stricmp(szArg1,"quiet")) {
		if (quietModeOn) {
			sprintf(szQuietMode, "");
			quietModeOn = false;
			WriteChatf("MQ2IntelliInstaMem: Quiet Mode is now OFF");
		}
		else {
			sprintf(szQuietMode, "/squelch ");
			quietModeOn = true;
			WriteChatf("MQ2IntelliInstaMem: Quiet Mode is now ON");
		}
		return;
	}

	//Displays the names of all saved spellsets. Command: /iimss list
    if ((!stricmp(szArg1,"list")) && (szArg2[0]==0)) { 
		WriteChatf("\n-----------------------------------------\nMQ2IntelliInstaMem: Spell favorites list:"); 
        for (Index=0;Index<10;Index++) { 
            if (pSpellSets[Index].Name[0]!=0) { 
				WriteChatf("%d) %s", Index, pSpellSets[Index].Name);  
            } 
        } 
        return; 
    } 
	
	//Displays the spells that are saved in the given spellsetname / number, Command: /iim list [spellsetname / number]	
	if (!stricmp(szArg1,"list")) { 

        DoIndex = IsNumber(szArg2)?atoi(szArg2):FindSpellListByName(szArg2); 

		if (DoIndex < 0 || DoIndex > 9 || pSpellSets[DoIndex].Name[0] == 0) { 
			WriteChatf("MQ2IntelliInstaMem: Unable to find favorite list '%s'",szArg2);
            return; 
        } 
		WriteChatf("\n-----------------------------------------\nMQ2IntelliInstaMem: Favorite list '%s':",pSpellSets[DoIndex].Name); 
        for (Index=0;Index<9;Index++) { 
            if (pSpellSets[DoIndex].SpellId[Index]!=0xFFFFFFFF) { 
                sprintf(szBuffer,"%d) %s", Index+1, GetSpellByID(pSpellSets[DoIndex].SpellId[Index])->Name ); 
                WriteChatColor(szBuffer,USERCOLOR_DEFAULT); 
            } 
        }
        return; 
    } 
	
	//Memorize spells if given spellset differs from memorized spells
	DoIndex = IsNumber(szArg1)?atoi(szArg1):FindSpellListByName(szArg1);
	if (DoIndex >= 0 && DoIndex <=9) { 
		for (Index=0; Index<9; Index++) {

			if (pSpellSets[DoIndex].SpellId[Index] == 0xFFFFFFFF && GetCharInfo2()->MemorizedSpells[Index] != 0xFFFFFFFF) {
				sprintf(szBuffer, "%s/unmem %d", szQuietMode, Index+1);
				HideDoCommand(GetCharInfo()->pSpawn, szBuffer, FromPlugin);
			}
			else if (pSpellSets[DoIndex].SpellId[Index] != GetCharInfo2()->MemorizedSpells[Index]) {
				MemorizedAt = IndexOfAlreadyMemorizedSpellId(pSpellSets[DoIndex].SpellId[Index]);
				
				if ( MemorizedAt > Index && MemorizedAt < 10) {
					sprintf(szBuffer, "%s/unmem %d", szQuietMode, MemorizedAt + 1);
					HideDoCommand(GetCharInfo()->pSpawn, szBuffer, FromPlugin);
				}

				sprintf(szBuffer, "%s/memspell %d %d", szQuietMode, pSpellSets[DoIndex].SpellId[Index], Index+1);
				HideDoCommand(GetCharInfo()->pSpawn, szBuffer, FromPlugin);
			}
		}
	} 
	else { 
		WriteChatf("\arMQ2IntelliInstaMem: Unable to find spellset '%s'\ax",szArg1); 
    } 
} 


// Called once, when the plugin is to initialize
PLUGIN_API VOID InitializePlugin(VOID) {
	DebugSpewAlways("Initializing MQ2IntelliInstaMem");
	AddCommand("/iim",MemSpellSetCommand);

	WriteChatf("\nMQ2IntelliInstaMem: Use '/iim help' for further help");
}

// Called once, when the plugin is to shutdown
PLUGIN_API VOID ShutdownPlugin(VOID) {
	DebugSpewAlways("Shutting down MQ2IntelliInstaMem");
	RemoveCommand("/iim");
}


Since the source of MQ2InstaMem isnt public, i chose that way, its a bit inconvenient but it works (i didnt find any problems till now) :)

Report any problems here.

Redcents appreciated.
 
Last edited:
Edit - I wrote some more explaining words to the post and attached the source file to the post (its in the zip file with the dll) :)

daslackas
 
MQ2IntelliInstaMem - Mem spellsets instantly without rememming spells unnecessarily

Users who are viewing this thread

Back
Top
Cart