EQLib_MacroParser.cpp
Code: Select all
// $char(space)
// $char(space,free)
} else if (!strncmp("char(space",szVar,10)) {
if (!strstr(szVar,")")) {
return PMP_ERROR_BADPARM;
} else {
PCONTENTS pItem = NULL;
i += (strstr(szVar,")")-szVar);
PCHAR szArg = szVar+10;
if (!strncmp(",free)",szArg,6) || !strncmp(")",szArg,1)) {
DWORD count=0;
DWORD slot,pslot;
CHAR szTemp[MAX_STRING] = {0};
for (slot=22;slot<30;slot++) {
if (pItem = pCharInfo->Inventory[slot]) {
if (pItem->Item->Type == ITEMTYPE_PACK) {
for (pslot=0;pslot<pItem->Item->Container.Slots;pslot++) {
if (!pItem->Contents[pslot]) count++;
}
}
} else {
count++;
}
}
itoa(count,szTemp,10);
strcat(szOutput,szTemp);
// $char(space,size)
} else if (!strncmp(",size)",szArg,6)) {
DWORD size=0;
DWORD slot,pslot;
BOOL hasfree = FALSE;
CHAR szTemp[MAX_STRING] = {0};
for (slot=22;slot<30;slot++) {
if (pItem = pCharInfo->Inventory[slot]) {
if (pItem->Item->Type == ITEMTYPE_PACK) {
hasfree=FALSE;
for (pslot=0;pslot<pItem->Item->Container.Slots;pslot++) {
if (!pItem->Contents[pslot]) hasfree=TRUE;
}
if (hasfree && (pItem->Item->Container.SizeCapacity>size)) size=pItem->Item->Container.SizeCapacity;
}
} else {
size=4;
}
}
itoa(size,szTemp,10);
strcat(szOutput,szTemp);
}
}[color=red]
// $char(unknown)[/color]

