Ejemplo n.º 1
0
void ClickDoor(PDOOR pDoor)
{
	EQSwitch *pSwitch = (EQSwitch *)pDoor;
	srand((unsigned int)time(0));
	int randclickY = rand() % 5;
	int randclickX = rand() % 5;
	int randclickZ = rand() % 5;
	
	SWITCHCLICK click;
	click.Y = pDoor->Y + randclickY;
	click.X = pDoor->X + randclickX;
	click.Z = pDoor->Z + randclickZ;
	randclickY = rand() % 5;
	randclickX = rand() % 5;
	randclickZ = rand() % 5;
	click.Y1 = click.Y + randclickY;
	click.X1 = click.X + randclickX;
	click.Z1 = click.Z + randclickZ;
	pSwitch->UseSwitch(GetCharInfo()->pSpawn->SpawnID, 0xFFFFFFFF, 0, (DWORD)&click);
}
Ejemplo n.º 2
0
VOID Click(PSPAWNINFO pChar, PCHAR szLine) 
{ 
	if(GetGameState()!=GAMESTATE_INGAME) {
		MacroError("Dont /click stuff(%s) when not in game... Gamestate is %d",szLine,GetGameState());
		return;
	}
    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 (!pTarget) { 
                WriteChatColor("You must have a target selected for /click x target.",CONCOLOR_RED); 
                return; 
            } 
            if (!strnicmp(szArg1, "left", 4)) { 
                pEverQuest->LeftClickedOnPlayer(pTarget); 
                gMouseEventTime = GetFastTime();
            } else if (!strnicmp(szArg1, "right", 5)) { 
                pEverQuest->RightClickedOnPlayer(pTarget, 0); 
                gMouseEventTime = GetFastTime();
            } 
            return;
        } else if(!strnicmp(szMouseLoc,"center",6)) {
            sprintf(szMouseLoc,"%d %d",ScreenXMax/2,ScreenYMax/2);
        } else if (!strnicmp(szMouseLoc, "item", 4)) {
			if(pGroundTarget) {
				if (!strnicmp(szArg1, "left", 4)) {
					if(EnviroTarget.Name[0]!=0) {
						if(DistanceToSpawn(pChar,&EnviroTarget)<=20.0f) {
							//do stuff
							if(PEQSWITCH pSwitch = (PEQSWITCH)pGroundTarget->pSwitch) {
								*((DWORD*)__LMouseHeldTime)=((PCDISPLAY)pDisplay)->TimeStamp-0x45;
								//we "click" at -1000,-1000 because we know the user doesnt have any windows there...
								//if its possible, i would like to figure out a pixel
								//on the users screen that isnt covered by a window...
								//the click need to be issued on the main UI...
								//but for now this will work -eqmule 8 mar 2014
								pEverQuest->LMouseUp(-1000,-1000);
							}
						} else {
							WriteChatf("You are to far away from the item, please move closer before issuing the /click left item command.");
						}
					} else {
						WriteChatf("No Item targeted, use /itemtarget <theid> before issuing a /click left item command.");
					}
				} else {
					WriteChatf("Invalid click args, use \"/click left item\", aborting: %s",szMouseLoc);
				}
			} else {
				WriteChatf("No Item targeted, use /itemtarget <theid> before issuing a /click left item command.");
			}
			return;
        } else if (!strnicmp(szMouseLoc, "door", 4)) {
			// a right clicked door spawn does nothing
			if(pDoorTarget) {
				if (!strnicmp(szArg1, "left", 4)) {
					if(DoorEnviroTarget.Name[0]!=0) {
						if(DistanceToSpawn(pChar,&DoorEnviroTarget)<20.0f) {
							EQSwitch *pSwitch = (EQSwitch *)pDoorTarget;
							srand((unsigned int)time(0));
							int randclickY = rand() % 5;
							int randclickX = rand() % 5;
							int randclickZ = rand() % 5;
							PSWITCHCLICK pclick = new SWITCHCLICK;
							if(pclick) {
								pclick->Y=pDoorTarget->Y+randclickY;
								pclick->X=pDoorTarget->X+randclickX;
								pclick->Z=pDoorTarget->Z+randclickZ;
								randclickY = rand() % 5;
								randclickX = rand() % 5;
								randclickZ = rand() % 5;
								pclick->Y1=pclick->Y+randclickY;
								pclick->X1=pclick->X+randclickX;
								pclick->Z1=pclick->Z+randclickZ;
								pSwitch->UseSwitch(GetCharInfo()->pSpawn->SpawnID,0xFFFFFFFF,0,(DWORD)pclick);
								delete pclick;
							}
							//DoorEnviroTarget.Name[0]='\0';
							if (pTarget==(EQPlayer*)&DoorEnviroTarget) {//this should NEVER happen
								pTarget=NULL;
							}
							return;
						} else {
							WriteChatf("You are to far away from the door, please move closer before issuing the /click left door command.");
						}
					} else {
						WriteChatf("No Door targeted, use /doortarget <theid> before issuing a /click left door command.");
					}
				} else {
					WriteChatf("Invalid click args, use \"/click left door\", aborting: %s",szMouseLoc);
				}
			} else {
				WriteChatf("No Door targeted, use /doortarget <theid> before issuing a /click left door command.");
			}
			return;;
		} 
        ClickMouseLoc(szMouseLoc, szArg1);
        return;
    }

    if (szArg1[0]!=0) { 
        if (!strnicmp(szArg1, "left", 4)) { 
            ClickMouse(0);
        } else if (!strnicmp(szArg1, "right", 5)) { 
            ClickMouse(1);
        } else { 
            WriteChatColor("Usage: /click <left|right>",USERCOLOR_DEFAULT); 
            DebugSpew("Bad command: %s",szLine); 
            return; 
        } 
    } 
}