Page 1 of 1

An interesting addition to exts2.cpp

Posted: Sat Jul 26, 2003 4:38 pm
by Amadeus
This little tidbit of code for exts2.cpp will allow you to export a tilde delimited output of the entire spells database that is stored in memory. Of course, the beauty of this is that you can import this file to MS Excel and have a nice database.

You could use this same logic to create functions for the other databases that are stored in memory (ie, zones, etc..)

In mqext.def..add (under the EXPORTS heading)

Code: Select all

    exportallspells
In exts2.cpp...add

Code: Select all

// This routine exports all spell information in the game (stored
// in memory) into a tilde delimited format which works well with 
// Microsoft Excel.
// Note:  Add "Levels"
DECLARE_API ( exportallspells )
{
    SPELLLIST *p, *pnull=NULL, ci, *r;
	DWORD *q, cb;
	CHAR Name[MAX_STRING] = {0};
	CHAR Target[MAX_STRING] = {0};
	CHAR CastOnYou[MAX_STRING] = {0};
	CHAR CastOnAnother[MAX_STRING] = {0};
	CHAR WearOff[MAX_STRING] = {0};
	int i=1;
	int j=0;
	int k=0;



	dprintf("ID~Name~Range~CastTime~FizzleTime~RecastTime~DurationType~DurationValue1~Mana~");
	dprintf("Target~CastOnYou~CastOnAnother~WearOff~");
	dprintf("BookIcon~GemIcon~SpellIcon~");
	dprintf("CastingAnim~SpellAnim~");
	for (k=0;k<4;k++) dprintf("ReagentID%d~ReagentCount%d~",k+1,k+1);
	for (k=0;k<12;k++) dprintf("Base%d~",k+1);
	for (k=0;k<12;k++) dprintf("Max%d~",k+1);
	for (k=0;k<12;k++) dprintf("Calc%d~",k+1);
	for (k=0;k<12;k++) dprintf("Attrib%d~",k+1);
	dprintf("DescNum~FizzLeadj\n");

	while( i <= (TOTAL_SPELL_COUNT+2) )
	{
		q = (DWORD*) GetExpression(args)+j;
		ReadMemory((PARAM1)q, &r, sizeof(r), &cb);

		p = (SPELLLIST * )r;
		ReadMemory((PARAM1)p,&ci,sizeof(ci),&cb); 

		//Read some memory locations into buffers
		ReadMemory((PARAM1)ci.Name,Name,256,&cb);
		ReadMemory((PARAM1)ci.Target,Target,256,&cb);
		ReadMemory((PARAM1)ci.CastOnYou,CastOnYou,256,&cb);
		ReadMemory((PARAM1)ci.CastOnAnother,CastOnAnother,256,&cb);
		ReadMemory((PARAM1)ci.WearOff,WearOff,256,&cb);
		//

		dprintf("%d~%s~%2f~%d~%d~%d~%d~%d~%d~", ci.ID, Name, ci.Range, ci.CastTime, ci.FizzleTime, ci.RecastTime, ci.DurationType, ci.DurationValue1, ci.Mana );
		dprintf("%s~%s~Someone%s~%s~", Target, CastOnYou, CastOnAnother, WearOff );
		dprintf("%d~%d~%d~", ci.BookIcon, ci.GemIcon, ci.SpellIcon );
		dprintf("%d~%d~", ci.CastingAnim, ci.SpellAnim );
		for (k=0;k<4;k++)  dprintf("%d~%d~", ci.ReagentId[k], ci.ReagentCount[k] );
		for (k=0;k<12;k++) dprintf("%d~", ci.Base[k]);
		for (k=0;k<12;k++) dprintf("%d~", ci.Max[k]);
		for (k=0;k<12;k++) dprintf("%d~", ci.Calc[k]);
		for (k=0;k<12;k++) dprintf("%d~", ci.Attrib[k]);
		dprintf("%d~%d\n", ci.descnum, ci.FizzLeadj );

	
		//Clean up (always better to be safe than sorry)
		Name[0] = Target[0] = CastOnYou[0] = CastOnAnother[0] = WearOff[0] = '\0';
		i++;
		j++;
	} 
}

Syntax (in windbg):

> dd SPELLLIST_OFFSET
> !mqext.exportallspells <value given from command above>+0x24

(I think that's right..I havn't used it in a while ..hehe)

Posted: Sat Jul 26, 2003 10:30 pm
by compuboy
i take it by replacing key tidles with something else you could deliminate it by anything, or does C++ not like that too much?

Posted: Sat Jul 26, 2003 10:42 pm
by Amadeus
nope...no reason why MOST other things wouldn't work. Things such as slashes and quotation marks would be the ones to avoid though...

awesome!

Posted: Thu Jul 31, 2003 1:55 pm
by EqMule
good job Amadeus! :D

Posted: Sun Aug 03, 2003 6:59 am
by kagonis
Ooh, my very own personal spell db. Nice.