Exemplo n.º 1
0
void InitializeMQ2Commands()
{
    int i;
    DebugSpew("Initializing Commands");
    InitializeCriticalSection(&gCommandCS);

    EzDetour(CEverQuest__InterpretCmd,&CCommandHook::Detour,&CCommandHook::Trampoline);

    // Import EQ commands
    PCMDLIST pCmdListOrig = (PCMDLIST)EQADDR_CMDLIST;
    for (i=0;pCmdListOrig[i].fAddress != 0;i++) {
        if (!strcmp(pCmdListOrig[i].szName,"/who")) {
            cmdWho  = (fEQCommand)pCmdListOrig[i].fAddress;
            AddCommand("/",pCmdListOrig[i].fAddress,TRUE,1,1); // make sure / does EQ who by default
        } else if (!strcmp(pCmdListOrig[i].szName,"/whotarget")) {
            cmdWhoTarget  = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/location")) {
            cmdLocation  = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/help")) {
            cmdHelp = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/target")) {
            cmdTarget = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/charinfo")) {
            cmdCharInfo = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/filter")) {
            cmdFilter = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/doability")) {
            cmdDoAbility = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/cast")) {
            cmdCast = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/useitem")) {
            cmdUseItem = (fEQCommand)pCmdListOrig[i].fAddress;
        }
        AddCommand(pCmdListOrig[i].szName,pCmdListOrig[i].fAddress,TRUE,1,1);
    }    



    // Add MQ commands...
    struct _NEWCOMMANDLIST { PCHAR szCommand; fEQCommand pFunc; BOOL Parse; BOOL InGame;} NewCommands[] = {
        {"/who",        SuperWho,1,1},
        {"/whotarget",  SuperWhoTarget,1,1},
        {"/location",   Location,1,1},
        {"/help",       Help,1,0},
        {"/target",     Target,1,1},
        {"/alias",      Alias,0,0},
        {"/aa",         AltAbility,0,1},
        {"/substitute", Substitute,0,0},
        {"/filter",     Filter,1,0},
        {"/whofilter",  SWhoFilter,1,1},
        {"/spewfile",   DebugSpewFile,1,0},
        {"/char",       CharInfo,1,1},
        {"/face",       Face,1,1},
        {"/identify",   Identify,1,1},
        {"/where",      Where,1,1},
        {"/skills",     Skills,1,1},
        {"/unload",     Unload,1,0},
        {"/macro",      Macro,1,0},
        {"/buyitem",    BuyItem,1,1},
        {"/sellitem",   SellItem,1,1},
        {"/memspell",   MemSpell,1,1},
        {"/loadspells", LoadSpells,1,1},
        {"/loginname",  DisplayLoginName,1,0},
        {"/endmacro",   EndMacro,1,0},
        {"/listmacros", ListMacros,1,0},
        {"/echo",       Echo,1,0},
        {"/msgbox",     MQMsgBox,1,0},
        {"/lootall",    LootAll,1,0},
        {"/alert",      Alert,1,1},
        {"/click",      Click,1,0},
        {"/mqpause",    MacroPause,1,0},
        {"/items",      Items,1,1},
        {"/itemtarget", ItemTarget,1,1},
        {"/doability",  DoAbility,1,1},
        {"/doors",      Doors,1,1},
        {"/doortarget", DoorTarget,1,1},
        {"/beep",       MacroBeep,1,0},
        {"/cast",       Cast,1,1},
        {"/mqlog",      MacroLog,1,0},
        {"/seterror",   SetError,1,0},
        {"/declare",    NewDeclareVar,1,0},
        {"/deletevar",  NewDeleteVarCmd,1,0},
        {"/varcalc",    NewVarcalc,1,0},
        {"/varset",     NewVarset,1,0},
        {"/vardata",    NewVardata,1,0},
        {"/delay",      Delay,0,0}, // do not parse
        {"/cleanup",    Cleanup,1,0},
        {"/doevents",   DoEvents,1,0},
        {"/goto",       Goto,1,0},
        {"/for",        For,1,0},
        {"/next",       Next,1,0},
        {"/call",       Call,1,0},
        {"/return",     Return,1,0},
        {"/updateitems",UpdateItemInfo,1,1},
        {"/ini",        IniOutput,1,0},
        {"/dumpstack",  DumpStack,1,0},
        {"/setautorun", SetAutoRun,0,1},
        {"/banklist",   BankList,1,1},
        {"/look",       Look,1,1},
        {"/keepkeys",   KeepKeys,1,0},
        {"/windowstate",WindowState,1,0},
        {"/plugin",     PluginCommand,1,0},
        {"/destroy",    EQDestroyHeldItemOrMoney,1,1},
        {"/exec",       Exec,1,0}, 
        {"/keypress",   DoMappable,1,0},
        {"/popup",      PopupText,1,1},
        {"/multiline",  MultilineCommand,0,0},
        {"/bind",       MQ2KeyBindCommand,1,0},
        {"/ranged",     do_ranged,1,1},
        {"/loadcfg",    LoadCfgCommand,1,0},
        {"/dumpbinds",  DumpBindsCommand,1,0},
        {"/squelch",    SquelchCommand,1,0},
        {"/dosocial",   DoSocial,1,1},
        {"/docommand",  DoCommandCmd,1,0},
        {"/ctrlkey",    DoCtrlCmd,0,0},
        {"/altkey",     DoAltCmd,0,0},
        {"/shiftkey",   DoShiftCmd,0,0},
        {"/timed",      DoTimedCmd,0,0},
        {"/if",         NewIf,1,0},
        {"/while",      WhileCmd,1,0},
        {"/combine",    CombineCmd,1,1},
        {"/clearerrors",ClearErrorsCmd,1,0},
        {"/drop",       DropCmd,1,0},
        {"/hud",        HudCmd,1,0},
        {"/caption",    CaptionCmd,0,0},
        {"/captioncolor",CaptionColorCmd,1,0},
        {"/noparse",    NoParseCmd,0,0},
        {"/nomodkey",   NoModKeyCmd,0,0},
        {"/useitem",    UseItemCmd,1,1},
		{"/spellslotinfo",SpellSlotInfo,1,1},
		{"/getwintitle",GetWinTitle,1,0},
		{"/setwintitle",SetWinTitle,1,0},
		{"/removebuff",RemoveBuff,1,1},
		{"/makemevisible",MakeMeVisible,0,1},
        {NULL,          NULL,0,1},
    };

    // Remove replaced commands first
    for (i = 0 ; NewCommands[i].szCommand && NewCommands[i].pFunc ; i++)
    {
        RemoveCommand(NewCommands[i].szCommand);
        AddCommand(NewCommands[i].szCommand,NewCommands[i].pFunc,0,NewCommands[i].Parse,NewCommands[i].InGame);
    }

    /* ALIASES FOR OUT OF ORDER SHORTHAND COMMANDS */
    AddAlias("/d","/duel");
    AddAlias("/t","/tell");
    AddAlias("/w","/who");
    AddAlias("/a","/anonymous");
    AddAlias("/ta","/tap");
    AddAlias("/c","/consider");
    AddAlias("/cha","/channel");
    AddAlias("/f","/feedback");
    AddAlias("/fa","/fastdrop");
    AddAlias("/m","/msg");
    AddAlias("/load","/loadspells");
    AddAlias("/b","/bazaar");
    AddAlias("/ba","/bazaar");
    AddAlias("/g","/gsay");
    AddAlias("/gu","/guildsay");
    AddAlias("/key","/keys");
    AddAlias("/r","/reply");

    AddAlias("/newif","/if");
    /* NOW IMPORT THE USER'S ALIAS LIST, THEIR MODIFICATIONS OVERRIDE EXISTING. */

    CHAR AliasList[MAX_STRING*10] = {0};
    CHAR szBuffer[MAX_STRING] = {0};
    CHAR MainINI[MAX_STRING] = {0};
    sprintf(MainINI,"%s\\macroquest.ini",gszINIPath);
    GetPrivateProfileString("Aliases",NULL,"",AliasList,MAX_STRING*10,MainINI);
    PCHAR pAliasList = AliasList;
    while (pAliasList[0]!=0) {
        GetPrivateProfileString("Aliases",pAliasList,"",szBuffer,MAX_STRING,MainINI);
        if (szBuffer[0]!=0) {
            AddAlias(pAliasList,szBuffer);
        }
        pAliasList+=strlen(pAliasList)+1;
    }

    // Here is where you can add in permanent Substitutions
    AddSubstitute("omg","Oh My God");

    //Importing the User's Substitution List from .ini file
    CHAR SubsList[MAX_STRING*10] = {0};
    CHAR szBuffer2[MAX_STRING] = {0};
    sprintf(MainINI,"%s\\macroquest.ini",gszINIPath);
    GetPrivateProfileString("Substitutions",NULL,"",SubsList,MAX_STRING*10,MainINI);
    PCHAR pSubsList = SubsList;
    while (pSubsList[0]!=0) {
        GetPrivateProfileString("Substitutions",pSubsList,"",szBuffer2,MAX_STRING,MainINI);
        if (szBuffer[0]!=0) {
            AddSubstitute(pSubsList,szBuffer2);
        }
        pSubsList+=strlen(pSubsList)+1;
    }
}
Exemplo n.º 2
0
void InitializeMQ2Commands()
{
    int i = 0;
    DebugSpew("Initializing Commands");
    InitializeCriticalSection(&gCommandCS);
	if (!ghCCommandLock)
		ghCCommandLock = CreateMutex(NULL, FALSE, NULL);
    EzDetourwName(CEverQuest__InterpretCmd,&CCommandHook::Detour,&CCommandHook::Trampoline,"CEverQuest__InterpretCmd");

    // Import EQ commands
    PCMDLIST pCmdListOrig = (PCMDLIST)EQADDR_CMDLIST;
    for (i=0;pCmdListOrig[i].fAddress != 0;i++) {
        if (!strcmp(pCmdListOrig[i].szName,"/who")) {
            cmdWho  = (fEQCommand)pCmdListOrig[i].fAddress;
            AddCommand("/",pCmdListOrig[i].fAddress,TRUE,1,1); // make sure / does EQ who by default
        } else if (!strcmp(pCmdListOrig[i].szName,"/whotarget")) {
            cmdWhoTarget  = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/location")) {
            cmdLocation  = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/help")) {
            cmdHelp = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/target")) {
            cmdTarget = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/charinfo")) {
            cmdCharInfo = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/filter")) {
            cmdFilter = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/doability")) {
            cmdDoAbility = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/cast")) {
            cmdCast = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/useitem")) {
            cmdUseItem = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/pet")) {
            cmdPet = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/mercswitch")) {
            cmdMercSwitch = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/advloot")) {
            cmdAdvLoot = (fEQCommand)pCmdListOrig[i].fAddress;
        } else if (!strcmp(pCmdListOrig[i].szName,"/pickzone")) {
            cmdPickZone = (fEQCommand)pCmdListOrig[i].fAddress;
		} else if (!strcmp(pCmdListOrig[i].szName,"/assist")) {
			cmdAssist = (fEQCommand)pCmdListOrig[i].fAddress;
        }
        AddCommand(pCmdListOrig[i].szName,pCmdListOrig[i].fAddress,TRUE,1,1);
    }



    // Add MQ commands...
    struct _NEWCOMMANDLIST { PCHAR szCommand; fEQCommand pFunc; BOOL Parse; BOOL InGame;} NewCommands[] = {
        {"/whotarget",  SuperWhoTarget,1,1},
        {"/location",   Location,1,1},
        {"/help",       Help,1,0},
        {"/target",     Target,1,1},
        {"/alias",      Alias,0,0},
        {"/aa",         AltAbility,0,1},
        {"/substitute", Substitute,0,0},
        {"/filter",     Filter,1,0},
        {"/whofilter",  SWhoFilter,1,1},
        {"/spewfile",   DebugSpewFile,1,0},
        {"/char",       CharInfo,1,1},
        {"/face",       Face,1,1},
        {"/identify",   Identify,1,1},
        {"/where",      Where,1,1},
        {"/skills",     Skills,1,1},
        {"/unload",     Unload,1,0},
		{"/selectitem", SelectItem,1,1},
        {"/buyitem",    BuyItem,1,1},
        {"/sellitem",   SellItem,1,1},
        {"/memspell",   MemSpell,1,1},
        {"/loadspells", LoadSpells,1,1},
        {"/loginname",  DisplayLoginName,1,0},
        {"/echo",       Echo,1,0},
        {"/msgbox",     MQMsgBox,1,0},
        {"/lootall",    LootAll,1,0},
        {"/alert",      Alert,1,1},
        {"/click",      Click,1,0},
		{"/mouseto",    MouseTo,1,0},
        {"/items",      Items,1,1},
        {"/itemtarget", ItemTarget,1,1},
        {"/doability",  DoAbility,1,1},
        {"/doors",      Doors,1,1},
        {"/doortarget", DoorTarget,1,1},
        {"/beep",       MacroBeep,1,0},
        {"/cast",       Cast,1,1},
        {"/mqlog",      MacroLog,1,0},
		{"/updateitems",UpdateItemInfo,1,1},
        {"/ini",        IniOutput,1,0},
        {"/setautorun", SetAutoRun,0,1},
        {"/banklist",   BankList,1,1},
        {"/look",       Look,1,1},
        {"/windowstate",WindowState,1,0},
        {"/destroy",    EQDestroyHeldItemOrMoney,1,1},
        {"/popup",      PopupText,1,1},
		{"/popcustom",	PopupTextCustom,1,1},
		{"/popupecho",	PopupTextEcho,1,1},
		{"/exec",       Exec,1,0},
		{"/keypress",   DoMappable,1,0},
		{"/multiline",  MultilineCommand,0,0},
		{"/ranged",     do_ranged,1,1},
		{"/loadcfg",    LoadCfgCommand,1,0},
		{"/squelch",    SquelchCommand,1,0},
		{"/docommand",  DoCommandCmd,1,0},
		{"/ctrlkey",    DoCtrlCmd,0,0},
		{"/altkey",     DoAltCmd,0,0},
		{"/shiftkey",   DoShiftCmd,0,0},
		{"/timed",      DoTimedCmd,0,0},
#ifndef ISXEQ_LEGACY
        {"/bind",       MQ2KeyBindCommand,1,0},
#endif
		{"/noparse",    NoParseCmd,0,0},
		{"/nomodkey",   NoModKeyCmd,0,0},
        {"/dumpbinds",  DumpBindsCommand,1,0},
        {"/dosocial",   DoSocial,1,1},
		{"/combine",    CombineCmd,1,1},
        {"/drop",       DropCmd,1,0},
		{"/delay",      Delay,0,0}, // do not parse
        {"/hud",        HudCmd,1,0},
        {"/caption",    CaptionCmd,0,0},
        {"/captioncolor",CaptionColorCmd,1,0},
        {"/useitem",    UseItemCmd,1,1},
		{"/spellslotinfo",SpellSlotInfo,1,1},
		{"/getwintitle",GetWinTitle,1,0},
		{"/setwintitle",SetWinTitle,1,0},
		{"/removebuff", RemoveBuff,1,1},
		{"/removepetbuff", RemovePetBuff,1,1},
		{"/makemevisible",MakeMeVisible,0,1},
		{"/pet",        PetCmd,1,1},
		{"/mercswitch", MercSwitchCmd,1,1},
		{"/removeaura", RemoveAura,0,1},
		{"/advloot",    AdvLootCmd,1,1},
		{"/pickzone",   PickZoneCmd,1,1},
		{"/assist",     AssistCmd,1,1},
		{"/setprio",    SetProcessPriority,1,0},
		{"/screenmode", ScreenModeCmd,1,0},
		{"/usercamera", UserCameraCmd,1,0},
		{"/mapzoom",    MapZoomCmd,1,0},
		{"/foreground", ForeGroundCmd,1,0},
		
        {NULL,          NULL,0,1},
    };
    // Remove replaced commands first
    for (i = 0 ; NewCommands[i].szCommand && NewCommands[i].pFunc ; i++)
    {
        RemoveCommand(NewCommands[i].szCommand);
        AddCommand(NewCommands[i].szCommand,NewCommands[i].pFunc,0,NewCommands[i].Parse,NewCommands[i].InGame);
    }
	//truebox builds are not supported anymore.
	//This code is here to make sure we are NOT run on truebox.
	//(bypassing these calls will severly cripple your mq2) -eqmule
	typedef DWORD(__cdecl *fAuthenticateTrueBox)(DWORD);
	fAuthenticateTrueBox AuthenticateTrueBox = 0;
	typedef DWORD(__cdecl *fGetTrueBoxKey)(DWORD);
	fGetTrueBoxKey GetTrueBoxKey = 0;
	if (ghmq2ic) {
		AuthenticateTrueBox = (fAuthenticateTrueBox)GetProcAddress(ghmq2ic, "AuthenticateTrueBox");
		GetTrueBoxKey = (fGetTrueBoxKey)GetProcAddress(ghmq2ic, "GetTrueBoxKey");
		DWORD tbkey = GetTrueBoxKey(1);
		if (AuthenticateTrueBox) {
			AuthenticateTrueBox(tbkey);
		}
	}
	
    /* ALIASES FOR OUT OF ORDER SHORTHAND COMMANDS */
    AddAlias("/d","/duel");
    AddAlias("/t","/tell");
    AddAlias("/w","/who");
    AddAlias("/a","/anonymous");
    AddAlias("/ta","/tap");
    AddAlias("/c","/consider");
    AddAlias("/cha","/channel");
    AddAlias("/f","/feedback");
    AddAlias("/fa","/fastdrop");
    AddAlias("/m","/msg");
    AddAlias("/load","/loadspells");
    AddAlias("/b","/bazaar");
    AddAlias("/ba","/bazaar");
    AddAlias("/g","/gsay");
    AddAlias("/gu","/guildsay");
    AddAlias("/key","/keys");
    AddAlias("/r","/reply");

    AddAlias("/newif","/if");
    /* NOW IMPORT THE USER'S ALIAS LIST, THEIR MODIFICATIONS OVERRIDE EXISTING. */

    CHAR AliasList[MAX_STRING*10] = {0};
    CHAR szBuffer[MAX_STRING] = {0};
    CHAR MainINI[MAX_STRING] = {0};
    sprintf_s(MainINI,"%s\\macroquest.ini",gszINIPath);
    GetPrivateProfileString("Aliases",NULL,"",AliasList,MAX_STRING*10,MainINI);
    PCHAR pAliasList = AliasList;
    while (pAliasList[0]!=0) {
        GetPrivateProfileString("Aliases",pAliasList,"",szBuffer,MAX_STRING,MainINI);
        if (szBuffer[0]!=0) {
            AddAlias(pAliasList,szBuffer);
        }
        pAliasList+=strlen(pAliasList)+1;
    }

    // Here is where you can add in permanent Substitutions
    AddSubstitute("omg","Oh My God");

    //Importing the User's Substitution List from .ini file
    CHAR SubsList[MAX_STRING*10] = {0};
    CHAR szBuffer2[MAX_STRING] = {0};
	sprintf_s(MainINI,"%s\\macroquest.ini",gszINIPath);
    GetPrivateProfileString("Substitutions",NULL,"",SubsList,MAX_STRING*10,MainINI);
    PCHAR pSubsList = SubsList;
    while (pSubsList[0]!=0) {
        GetPrivateProfileString("Substitutions",pSubsList,"",szBuffer2,MAX_STRING,MainINI);
        if (szBuffer[0]!=0) {
            AddSubstitute(pSubsList,szBuffer2);
        }
        pSubsList+=strlen(pSubsList)+1;
    }
}