[SIZE=2]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();
if (szLine[0] == 0)
{
WriteChatf( "\atUsage: \ag/memspell \ar<\aygem slot\ar> <\ayspell name\ar>" );
return;
}
GetArg(szSpellName,szLine,2);
GetArg(szGemSlot,szLine,1);
Gem = (unsigned int)atoi(szGemSlot);
if (Gem<1 || Gem>9)
{
return;
}
Gem--;
if (PSPELL pSpell=GetSpellByID(GetCharInfo2()->MemorizedSpells[Gem]))
{
WriteChatf("spell = %s .", pSpell->Name );
DoMemorizeSpell(Gem,pSpell->ID,0x2);
}
BYTE orig_stand_state = pChar->StandState;
ForceState(STANDSTATE_SIT);
pChar->StandState = STANDSTATE_SIT;
GetCharInfo()->standstate = STANDSTATE_SIT;
GetCharInfo2()->SpellBook;
PSPELL pNewSpell=0;
for (DWORD N = 0 ; N < NUM_BOOK_SLOTS ; N++)
if (PSPELL pTempSpell=GetSpellByID(GetCharInfo2()->SpellBook[N]))
{
if (!stricmp(szSpellName,pTempSpell->Name) || (strstr(pTempSpell->Name,"Rk. II") && !strnicmp(szSpellName,pTempSpell->Name,strlen(pTempSpell->Name)-8)))
{
pNewSpell=pTempSpell;
break;
}
}
if(pNewSpell)
{
if (pNewSpell->Level[pChar->Class-1]>pChar->Level) {
WriteChatf("\aySpell found in book, but above current level.");
return;
}
DoMemorizeSpell(Gem,pNewSpell->ID,0x1);
}
else
{
WriteChatf("\ayCouldn't find spell \ar%s", szSpellName);
}
if( orig_stand_state != STANDSTATE_SIT )
{
ForceState(orig_stand_state);
pChar->StandState = orig_stand_state;
GetCharInfo()->standstate = orig_stand_state;
}
return;
}