Moderator: MacroQuest Developers
While what you say is true, I don't think that you understand the question. What plaz posted in the other thread was for /loadspells. What he posted here was for /memspell. He found a way to use the function, that is used when loading a spell favorite list, to load single spells. So yes both of these functions do the same thing. Plazmic's does not have a problem with spell unmeming and uses less offsets.BlueSkies wrote:Actually, /loadspells mems spells previously saved in a favorites list, while /memspell loads a single spell to a single gem.
Similar, but not the same. I'd like to see both of these functions added to the CVS.
Code: Select all
SPELLFAVORITE MemSpellFavorite;
VOID MemSpell(PSPAWNINFO pChar, PCHAR szLine)
{
if (!EQADDR_SPELLBOOKWND || !cmdLoadSpells) return;
DWORD Favorite = (DWORD)&MemSpellFavorite;
CHAR szGem[MAX_STRING] = {0};
DWORD sp;
WORD Gem = -1;
CHAR SpellName[MAX_STRING] = {0};
PCHARINFO pCharInfo = NULL;
DWORD SpellBookWnd = *EQADDR_SPELLBOOKWND;
if (!SpellBookWnd) return;
if (NULL == (pCharInfo = GetCharInfo())) return;
GetArg(szGem,szLine,1);
GetArg(SpellName,szLine,2);
Gem = atoi(szGem);
if (Gem<1 || Gem>8) return;
Gem--;
PSPELLLIST pSpell = GetSpellByName(SpellName);
if (!pSpell) return;
if (pSpell->Level[pChar->Class-1]>pChar->Level) return;
ZeroMemory(&MemSpellFavorite,sizeof(MemSpellFavorite));
strcpy(MemSpellFavorite.Name,"Mem a Spell");
MemSpellFavorite.Byte_3A=1;
for (sp=0;sp<8;sp++) MemSpellFavorite.SpellId[sp]=0xFFFFFFFF;
MemSpellFavorite.SpellId[Gem] = pSpell->ID;
__asm {
push ecx;
mov ecx, dword ptr [SpellBookWnd];
push 8;
push dword ptr [Favorite];
call dword ptr [cmdLoadSpells];
pop ecx;
}
}Code: Select all
VOID MemSpell(PSPAWNINFO pChar, PCHAR szLine)
{
bRunNextCommand = FALSE;
DWORD SpellBookWnd = *EQADDR_SPELLBOOKWND;
CHAR szBuffer[MAX_STRING] = {0};
CHAR szGem[MAX_STRING] = {0};
WORD Gem = -1;
CHAR SpellName[MAX_STRING] = {0};
PCHARINFO pCharInfo = NULL;
DWORD ID,GEMSLOT;
if (!SpellBookWnd || !cmdMemSpell) return;
if (NULL == (pCharInfo = GetCharInfo())) return;
GetArg(szGem,szLine,1);
GetArg(SpellName,szLine,2);
Gem = atoi(szGem);
if (Gem<1 || Gem>8) return;
Gem--;
if (pCharInfo->MemorizedSpells[Gem]!=0xFFFFFFFF) return; //Im gonna put in dememcode here instead of returning, be patient...
PSPELLLIST pSpell = GetSpellByName(SpellName);
if (!pSpell) {
sprintf(szBuffer,"Unable to find Spell '%s'",SpellName);
WriteChatBuffer(szBuffer,CONCOLOR_RED);
return;
}
if (pSpell->Level[pChar->Class-1]>pChar->Level) {
sprintf(szBuffer,"You need to be level '%d' to memorize that spell ",pSpell->Level[pChar->Class-1]);
WriteChatBuffer(szBuffer,CONCOLOR_RED);
return;
}
ID = (DWORD)pSpell->ID;
GEMSLOT = (DWORD)Gem;
sprintf(szBuffer,"Memorizing spell '%d' in slot '%x' ",pSpell->ID, GEMSLOT+1);
WriteChatBuffer(szBuffer,USERCOLOR_DEFAULT);
__asm {
push ecx;
mov ecx, dword ptr [SpellBookWnd];
push GEMSLOT;
push ID;
call dword ptr [cmdMemSpell];
pop ecx;
}
return;
}I better start by correcting you then lolgrimjack wrote: And you would no longer require these offsets for /memspell:
[Function Locations]
MemSpell=004468C2
[Class Locations]
SpellBookWnd=005E545C
You would only require the offset that is needed for his /loadspells.
Please correct me if I'm wrong.
Thanks
GrimJack
Code: Select all
if (!EQADDR_SPELLBOOKWND || !cmdLoadSpells) return;
donations for this month's patches.I was not comparing your coding with anyones. I was just atempting to answer wassups question. He asked if what you posted and what plaz posted did the same thing. It was an atempt to explain that they acomplished the same thing and also explain the differences.EqMule00 wrote:now uhm, as I have stated before, my coding skills cant be compared to Plaz, and all I do is done based on his work, so if he posts a function it will have precidence over mine... he is also the one with cvs access...
Code: Select all
[Function Locations]
MemSpell=004F633F
LoadSpells=004F6216
[Memory Locations]
SpellFavorites=007117D4
[Class Locations]
SpellBookWnd=005FE258
donations for this month's patches.