A quick hack and slash job, uncompiled and untested, gives us this for /click, integrating /lclicktarget and /rclicktarget into the standard form /click left|right target:
Code: Select all
VOID Click(PSPAWNINFO pChar, PCHAR szLine) {
CHAR szArg1[MAX_STRING] = {0};
PCHAR szMouseLoc;
MOUSE_DATA_TYPES mdType = MD_Unknown;
DWORD RightOrLeft = 0;
GetArg(szArg1, szLine, 1); //left or right
szMouseLoc = GetNextArg(szLine, 1); //location to click
//parse location for click location (szMouseLoc) here
if (szMouseLoc && szMouseLoc[0]!=0) {
if (!strnicmp(szMouseLoc, "target", 6)) {
if (!strnicmp(szArg1, "left", 4)) {
if(!EQADDR_LCLICKTARGET) return;
RightOrLeft = EQADDR_LCLICKTARGET;
} else if (!strnicmp(szArg1, "right", 5)) {
if (!EQADDR_RCLICKTARGET) return;
RightOrLeft = EQADDR_RCLICKTARGET;
}
DWORD CEverQuest = 0;
CEverQuest = (DWORD)*EQADDR_CLSMAINNEWUI;
DWORD pTarget = NULL;
if (EQADDR_TARGET && *(DWORD *)EQADDR_TARGET) {
pTarget = *(DWORD *)EQADDR_TARGET;
__asm {
push ecx;
push pTarget;
mov ecx, dword ptr [CEverQuest];
call dword ptr [RightOrLeft];
pop ecx;
}
}
return;
} else if (!ParseMouseLoc(GetCharInfo(), szMouseLoc)) {
DebugSpew("Invalid mouse loc to click, aborting: %s",szMouseLoc);
return;
}
}
if (szArg1[0]!=0) {
if (!strnicmp(szArg1, "left", 4)) {
mdType = MD_Button0;
MouseClickL(pChar,szLine);
} else if (!strnicmp(szArg1, "right", 5)) {
mdType = MD_Button1;
MouseClickR(pChar,szLine);
} else {
WriteChatBuffer("Usage: /click <left|right>",USERCOLOR_DEFAULT);
DebugSpew("Bad command: %s",szLine);
return;
}
PMOUSESPOOF pData = (PMOUSESPOOF)malloc(sizeof(MOUSESPOOF));
pData->mdType = mdType;
pData->dwData = 0x00;
pData->pNext = NULL;
if (!gMouseData) {
gMouseData = pData;
} else {
PMOUSESPOOF pTemp = gMouseData;
while (pTemp->pNext) {
pTemp = pTemp->pNext;
}
pTemp->pNext = pData;
}
}
}
Wouldn't be surprised if I have a few braces missing or misaligned
Edit: missed a "return" that is needed to avoid parsing "target" twice and clicking it.