Page 1 of 1

Changes to Spell handling...

Posted: Thu Apr 24, 2003 6:00 pm
by NealThorpayt
Greetings Constructs,

There were some changes to the way the spell list is handled. To get spell functions working again make the following changes.

In MQ.h add the following before the _SPELLLIST struct:

Code: Select all

#define	SPELLLIST_STARTOFFSET		0x24
#define	TOTAL_SPELL_COUNT			0x0FA0		// # of spells in game
In EQLib.cpp replace the following functions:

Code: Select all

PCHAR GetSpellByID(DWORD dwSpellID) {
	PCHAR szUnknown = "Unknown Spell";
	PSPELLLIST pSpell = NULL;
	if (EQADDR_SPELLS != NULL) {
		PSPELLLIST *pList = (PSPELLLIST*)(((DWORD)*EQADDR_SPELLS) + SPELLLIST_STARTOFFSET);
		pSpell =  pList[dwSpellID];
		if (pSpell != NULL) {
			if (pSpell->Name != NULL) {
				return pSpell->Name;
			}
		}
	}
	return szUnknown;
}

Code: Select all

PSPELLLIST GetSpellByName(PCHAR szName) {
	PSPELLLIST pSpell = NULL;
	if (EQADDR_SPELLS != NULL) {
		PSPELLLIST *pList = (PSPELLLIST*)(((DWORD)*EQADDR_SPELLS) + SPELLLIST_STARTOFFSET);
		for (DWORD dwSpellID = 0; dwSpellID < TOTAL_SPELL_COUNT; dwSpellID++) {
			 pSpell = pList[dwSpellID];
			 if ((pSpell->ID > 0) && (pSpell->ID < TOTAL_SPELL_COUNT)) {
				 if (pSpell->Name != NULL) {
					 if (!strnicmp(szName, pSpell->Name, strlen(szName))) {
						 return pSpell;
					 }
				 }
			 }
		}
	}
	return NULL;
}
Change the line in MemSpell from:

Code: Select all

				PSPELLLIST *pList = *EQADDR_SPELLS;
to

Code: Select all

				PSPELLLIST *pList = (PSPELLLIST*)(((DWORD)*EQADDR_SPELLS) + SPELLLIST_STARTOFFSET);
End of line...

Posted: Thu Apr 24, 2003 7:08 pm
by dont_know_at_all
Are there really 4000 spells?

Wow, don't ever use spell names.

Number of spells...

Posted: Thu Apr 24, 2003 7:28 pm
by NealThorpayt
Greetings constructs,

Actually, there appear to be only 0x0F46 (3910) spells (including bard songs). However, the code in eqgame.exe checks the spell id against 0x0FA0. If you make the changes that I have posted, it will be able to pass over the extra, blank, spells.

End of line...

Posted: Thu Apr 24, 2003 7:48 pm
by dont_know_at_all
Here that peeps?

If you have an underpowered machine don't use spellnames to invoke spells. Use their numeric equivalent instead.

not:

Code: Select all

/cast "Yaulp"
but

Code: Select all

#define Yaulp v20
/vaset v20 $char(gem, "Yaulp")   | once on startup
and later

Code: Select all

/cast $Yaulp