Page 1 of 1

pSpell->Level something not right

Posted: Wed Apr 28, 2004 12:19 am
by weapon
I want to mem a spell in a plugin so I'm trying to use the MQ2Utilities.cpp to do so.

Code: Select all

PSPELL pSpell = GetSpellByName("Levitation");
Returns the spell pointer fine but if you

Code: Select all

					sprintf(szOutput,"GetSpellByNameLevel: %i",pSpell->Level[GetCharInfo()->pSpawn->Class-1]);
					WriteChatColor(szOutput,USERCOLOR_DEFAULT);

Code: Select all

pSpell->Level[GetCharInfo()->pSpawn->Class-1]
is returning 255 for levitation. For Remove Greater Curse it works fine. I can't figure out what the problem is something todo with

Code: Select all

pSpell = &(*((PSPELLMGR)pSpellMgr)->Spells[dwSpellID]);
or the offset for spell manager

Posted: Wed Apr 28, 2004 12:30 am
by Lax
I believe there is multiple spells called "Levitation"

Posted: Wed Apr 28, 2004 12:35 am
by weapon
/em wants what lax smokes

Posted: Wed Apr 28, 2004 12:38 am
by wassup
Lax is right... there are 2 different ones.

One uses a component, the other one doesn't.

Posted: Wed Apr 28, 2004 12:44 am
by weapon
So what list is this looping through?

Code: Select all

    for (DWORD dwSpellID = 0; dwSpellID < TOTAL_SPELL_COUNT; dwSpellID++) {
        pSpell = &(*((PSPELLMGR)pSpellMgr)->Spells[dwSpellID]);
the spells_en.txt file? I don't see another Levitation spell or is the Spells structure loaded from somewhere else?

Posted: Wed Apr 28, 2004 12:46 am
by Lax
http://lucy.allakhazam.com/spelllist.ht ... levitation

http://lucy.allakhazam.com/spell.html?i ... ource=Live
http://lucy.allakhazam.com/spell.html?i ... ource=Live

The one that is not a regular spell is #970 and the first one that ${Spell[Levitation]} finds.

You can use ${Spell[2894]} instead to get the one you want

What it's looping through is the list of spells, which is in fact loaded directly from spells_us.txt, and into the spell manager.

Posted: Wed Apr 28, 2004 12:53 am
by weapon
Got it ... I added

Code: Select all

					if (pSpell->Level[GetCharInfo()->pSpawn->Class-1] < 66 ) {
						return pSpell;
					}
And it forces the loop to land on the spell I care about. Thanks guys