X,Y,Z in /items (please CVS)

A forum for feature requests/discussions and user submitted patches that improve MQ2

Moderator: MacroQuest Developers

HanzO
orc pawn
orc pawn
Posts: 16
Joined: Tue Jul 01, 2003 7:58 pm

X,Y,Z in /items (please CVS)

Post by HanzO » Wed Nov 05, 2003 10:49 am

Hi guys, just my little contribution... Really helps out when ground spawns are inside trees, so that /items * kicks back x,y,z so you don't go hunt down that item again.

On that note, I'll post a req for development regarding /itemtarget as well in another post...

PCHAR GetFriendlyNameForGroundItem(PGROUNDITEM pItem)
{
CHAR szName[MAX_STRING] = {0};
PITEMDB ItemDB=gItemDB;
DWORD Item = atoi(pItem->Name + 2);
while ((ItemDB) && (pItem->ID != ItemDB->ID)) {
ItemDB = ItemDB->pNext;
}
if (ItemDB) {
strcpy(szName,ItemDB->szName);
} else if ((Item>=400) && (Item<=MAX_ITEM4xx) && (szItemName4xx[Item-400])) {
sprintf(szName,"%s%d (%3.2f, %3.2f, %3.2f)",szItemName4xx[Item-400],pItem->ID,pItem->Y,pItem->X,pItem->Z);
// Regular
} else if ((Item<=255) && (szItemName[Item])) {
strcpy(szName,szItemName[Item]);
// Unknown
} else {
sprintf(szName,"Drop%04d/%d",Item,pItem->ID);
}
return strdup(szName);
}

MacroFiend
a grimling bloodguard
a grimling bloodguard
Posts: 662
Joined: Mon Jul 28, 2003 2:47 am

Post by MacroFiend » Wed Nov 05, 2003 12:20 pm

Possibly a better way to do this so all ground spawn items get the loc attached.

Code: Select all

    CHAR szName[MAX_STRING] = {0};[color=red]
    CHAR szLoc[MAX_STRING] = {0};[/color]
    PITEMDB ItemDB=gItemDB;

Code: Select all

    }[color=red]
   sprintf(szLoc," (%3.2f, %3.2f, %3.2f)",pItem->Y,pItem->X,pItem->Z);
   strcat(szName,szLoc);[/color]
   return strdup(szName);
}