Converted MQ2 Command - /memspell

Moderator: MacroQuest Developers

onetimehero
a ghoul
a ghoul
Posts: 105
Joined: Fri Sep 05, 2003 2:42 pm

Converted MQ2 Command - /memspell

Post by onetimehero » Sun Mar 27, 2005 6:03 pm

ISXEQCommandList.h

Code: Select all

COMMAND("MemSpell",CMD_MemSpell,true,false);
ISXEQCommands.cpp

Code: Select all

// ***************************************************************************
// Function:    MemSpell
// Description: Our '/MemSpell' command
// Usage:       /MemSpell gem# "spell name"
// ***************************************************************************
SPELLFAVORITE MemSpellFavorite;
int CMD_MemSpell(int argc, char *argv[])
{
	if (argc < 3)
	{
		WriteChatf("Syntax: %s gem# spellname",argv[0]);
		return 0;
	}
    if (!ppSpellBookWnd) return -1;
    DWORD Favorite = (DWORD)&MemSpellFavorite;
   CHAR szGem[MAX_STRING] = {0};
    DWORD sp;
   WORD Gem = -1;
   CHAR SpellName[MAX_STRING] = {0};
   PCHARINFO pCharInfo = NULL;
    if (!pSpellBookWnd) return -1;
   if (NULL == (pCharInfo = GetCharInfo())) return -1;

//   GetArg(szGem,szLine,1);
//   GetArg(SpellName,szLine,2);
   pISInterface->GetArgs(2,argc,argv,SpellName);
   Gem = atoi(argv[1]);
   if (Gem<1 || Gem>9) return -1;
   Gem--;

   pCharInfo->SpellBook;
   PSPELL pSpell=0;
	for (DWORD N = 0 ; N < NUM_BOOK_SLOTS ; N++)
	if (PSPELL pTempSpell=GetSpellByID(pCharInfo->SpellBook[N]))
	{
		if (!stricmp(SpellName,pTempSpell->Name))
		{
			pSpell=pTempSpell;
			break;
		}
	}

    if (!pSpell) return -1;
    if (pSpell->Level[pCharInfo->Class-1]>pCharInfo->Level) return -1;

    ZeroMemory(&MemSpellFavorite,sizeof(MemSpellFavorite));
    strcpy(MemSpellFavorite.Name,"Mem a Spell");
    MemSpellFavorite.Byte_3e=1;
    for (sp=0;sp<9;sp++) MemSpellFavorite.SpellId[sp]=0xFFFFFFFF;
    MemSpellFavorite.SpellId[Gem] = pSpell->ID;
	pSpellBookWnd->MemorizeSet((int*)Favorite,9);
	return 0;
}
Hmm. That's odd.

Lax
We're not worthy!
We're not worthy!
Posts: 3524
Joined: Thu Oct 17, 2002 1:01 pm
Location: ISBoxer
Contact:

Post by Lax » Sun Mar 27, 2005 6:08 pm

Added for next zip
Lax Lacks
Master of MQ2 Disaster
Purveyor of premium, EULA-safe MMORPG Multiboxing Software
* Multiboxing with ISBoxer: Quick Start Video
* EQPlayNice, WinEQ 2.0