If you guys don't like the formula in FindSpeed(), feel free to change it.
In EQLib_Utilities.cpp: (end of file) add
Code: Select all
// ***************************************************************************
// FindMount(PSPAWNINFO) - Used to find the mount of a spawn, if one
// exists. returns the spawn if one does not.
// ***************************************************************************
PSPAWNINFO FindMount(PSPAWNINFO pSpawn)
{
PSPAWNINFO pChar = NULL;
PSPAWNINFO pSpawnInfo = *EQADDR_SPAWNLIST;
CHAR szName[MAX_STRING] = {0};
CHAR szTemp[MAX_STRING] = {0};
if (!EQADDR_SPAWNLIST) return NULL;
if (!*EQADDR_SPAWNLIST) return NULL;
sprintf(szName, "%s`s Mount",pSpawn->Name);
for (pChar = pSpawnInfo; pChar; pChar=pChar->pNext) {
strcpy(szTemp,pChar->Name);
if (strstr(strlwr(szTemp),"'s mount"))
WriteChatBuffer(szTemp,USERCOLOR_WHO);
if (!stricmp(CleanupName(szTemp, FALSE), szName)) {
return pChar;
}
}
return pSpawn;
}
// ***************************************************************************
// FindSpeed(PSPAWNINFO) - Used to find the speed of a Spawn taking a mount into
// consideration.
// ***************************************************************************
FLOAT FindSpeed(PSPAWNINFO pSpawn)
{
PSPAWNINFO pMount = NULL;
FLOAT fRunSpeed = 0;
pMount=FindMount(pSpawn);
if (pMount)
if(!fRunSpeed)
fRunSpeed = pMount->SpeedRun * 10000 / 70;
return fRunSpeed;
}
Code: Select all
extern PSPAWNINFO FindMount(PSPAWNINFO pSpawn);
extern FLOAT FindSpeed(PSPAWNINFO pSpawn);
In EQLib_MacroParser.cpp: (at line 1069) modify what's in red
Code: Select all
// $target(speed)
} else if (!strncmp("target(speed)",szVar,13)) {
CHAR szTemp[MAX_STRING] = {0};
i+=12;
if (!pTarget) {
strcat(szOutput,"0");
} else {
[color=red] sprintf(szTemp,"%1.2f",FindSpeed(pTarget));[/color]
strcat(szOutput,szTemp);
}
Code: Select all
// $spawn(#,speed)
} else if (!strncmp("speed)",szRest,6)) {
CHAR szTemp[MAX_STRING] = {0};
i+=strstr(szVar,")")-szVar;
if (!pSpawn) {
strcat(szOutput,"0");
} else {
[color=red] sprintf(szTemp,"%1.2f",FindSpeed(pSpawn));[/color]
strcat(szOutput,szTemp);
}
Code: Select all
// $char(speed)
} else if (!strncmp("char(speed)",szVar,11)) {
CHAR szTemp[MAX_STRING] = {0};
i+=10;
[color=red] sprintf(szTemp,"%1.2f",FindSpeed(pChar) );[/color]
strcat(szOutput,szTemp);
Code: Select all
// $char(ismoving)
} else if (!strncmp("char(ismoving)",szVar,14)) {
i+=13;
if (gbMoving && (pChar->SpeedRun==0.0f)) {
strcat(szOutput,"TRUE");
[color=red] } else if (FindSpeed(pChar) > 0.0f ) {
strcat(szOutput,"TRUE");[/color]
} else {
strcat(szOutput,"FALSE");
}

donations for this month's patches.