void InitializeMQ2Pulse() { DebugSpew("Initializing Pulse"); if (!ghLockDelayCommand) ghLockDelayCommand = CreateMutex(NULL, FALSE, NULL); InitializeCriticalSection(&gPulseCS); EzDetourwName(ProcessGameEvents, Detour_ProcessGameEvents, Trampoline_ProcessGameEvents,"ProcessGameEvents"); EzDetourwName(CEverQuest__EnterZone, &CEverQuestHook::EnterZone_Detour, &CEverQuestHook::EnterZone_Trampoline,"CEverQuest__EnterZone"); EzDetourwName(CEverQuest__SetGameState, &CEverQuestHook::SetGameState_Detour, &CEverQuestHook::SetGameState_Trampoline,"CEverQuest__SetGameState"); EzDetourwName(CTargetWnd__RefreshTargetBuffs, &CEverQuestHook::CTargetWnd__RefreshTargetBuffs_Detour, &CEverQuestHook::CTargetWnd__RefreshTargetBuffs_Trampoline,"CTargetWnd__RefreshTargetBuffs"); }
VOID Draw_Detour(VOID) { CLabel* pThisLabel = (CLabel*)this; CHAR Buffer[MAX_STRING] = {0}; BOOL Found=FALSE; DWORD index; if (gAnonymize) { if (!bTrimnames) { EzDetourwName(CEverQuest__trimName, &CLabelHook::CEverQuest__trimName_Detour, &CLabelHook::CEverQuest__trimName_Trampoline,"CEverQuest__trimName"); EzDetourwName(__GetGaugeValueFromEQ, GetGaugeValueFromEQ_Detour, GetGaugeValueFromEQ_Trampoline,"__GetGaugeValueFromEQ"); EzDetourwName(__GetLabelFromEQ, GetLabelFromEQ_Detour, GetLabelFromEQ_Trampoline,"__GetLabelFromEQ"); bTrimnames = 1; } if (pThisLabel && pThisLabel->WindowText) { GetCXStr(pThisLabel->WindowText, Buffer); Anonymize(Buffer); } } else { if (bTrimnames) { bTrimnames = 0; RemoveDetour(CEverQuest__trimName); RemoveDetour(__GetGaugeValueFromEQ); RemoveDetour(__GetLabelFromEQ); } } Draw_Trampoline(); if ((DWORD)pThisLabel->EQType==9999) { if (!pThisLabel->XMLToolTip) { strcpy_s(Buffer,"BadCustom"); Found=TRUE; } else { //strcpy_s(Buffer,&pThisLabel->XMLToolTip->Text[0]); STMLToPlainText(&pThisLabel->XMLToolTip->Text[0],Buffer); ParseMacroParameter(((PCHARINFO)pCharData)->pSpawn,Buffer); if (!strcmp(Buffer,"NULL")) Buffer[0]=0; Found=TRUE; } } else if (pThisLabel->EQType==1000) { for (index=0;Id_PMP[index].ID>0 && !Found;index++) { if (Id_PMP[index].ID==(DWORD)pThisLabel->EQType) { strcpy_s(Buffer,Id_PMP[index].PMP); ParseMacroParameter(((PCHARINFO)pCharData)->pSpawn,Buffer); if (!strcmp(Buffer,"NULL")) Buffer[0]=0; Found=TRUE; } } } if (Found) SetCXStr(&(pThisLabel->WindowText),Buffer); }
// Called once, when the plugin is to initialize PLUGIN_API VOID InitializePlugin(VOID) { DebugSpewAlways("Initializing MQ2Labels"); // Add commands, macro parameters, hooks, etc. //EasyClassDetour(CLabel__Draw,CLabelHook,Draw_Detour,VOID,(VOID),Draw_Trampoline); EzDetourwName(CLabel__Draw,&CLabelHook::Draw_Detour,&CLabelHook::Draw_Trampoline,"CLabel__Draw"); EzDetourwName(CSidlManager__CreateLabel,&CSidlManagerHook::CreateLabel_Detour,&CSidlManagerHook::CreateLabel_Trampoline,"CSidlManager__CreateLabel"); if (gAnonymize) { EzDetourwName(CEverQuest__trimName, &CLabelHook::CEverQuest__trimName_Detour, &CLabelHook::CEverQuest__trimName_Trampoline,"CEverQuest__trimName"); EzDetourwName(__GetGaugeValueFromEQ, GetGaugeValueFromEQ_Detour, GetGaugeValueFromEQ_Trampoline,"__GetGaugeValueFromEQ"); EzDetourwName(__GetLabelFromEQ, GetLabelFromEQ_Detour, GetLabelFromEQ_Trampoline,"__GetLabelFromEQ"); bTrimnames = 1; } }
PLUGIN_API VOID InitializePlugin(VOID) { //dont mess with this its work in progress, im sick of the crash that happens if you invoke the UAC dialog while eq is loading //basically it makes the render device get lost and then we crash //the proper handling would be to detect UAC or device lost and then reset it, but its not done //and if it is, its in the wrong place or it misses it //also, if the device is lost then we cant simply do d3device->Reset because well... d3device is NULL so that would crash us... //something to think more on... //8B 44 24 04 8B 0D ?? ?? ?? 10 50 E8 ?? E8 FF FF /*MessageBox(NULL, "break in", "eqbugfix", MB_SYSTEMMODAL | MB_OK); if (HANDLE eqghandle = GetModuleHandle("EQGraphicsDX9.dll")) { if (DWORD DeviceReady = _FindPattern((DWORD)eqghandle, 0x150000, drPattern, drMask)) { g_bDeviceReady = _GetDWordAt(DeviceReady, 2); } if (switchbug = _FindPattern((DWORD)eqghandle, 0x150000, lcPattern, lcMask)) { p2DPrimitiveManager = _GetDWordAt(switchbug, 6); if (g_ppDrawHandler) { if (DWORD addr = *(DWORD*)g_ppDrawHandler) { if (DWORD addr2 = *(DWORD*)addr) { if (__UpdateDisplay = *(DWORD*)(addr2 + 0xb4)) { pRender = _GetDWordAt(__UpdateDisplay, 1); //EzDetourwName(__UpdateDisplay, &CDisplay_Hook::UpdateDisplay_Detour , &CDisplay_Hook::UpdateDisplay_Tramp, "UpdateDisplay_Detour"); } if (__Reset = *(DWORD*)(addr2 + 0x40)) { EzDetourwName(__Reset, &CDisplay_Hook::Reset_Detour , &CDisplay_Hook::Reset_Tramp, "Reset_Detour"); } } } } //EzDetourwName(switchbug, CachedTextBug_Detour, CachedTextBug_Tramp,"CachedTextBug_Detour"); } }*/ DebugSpewAlways("Initializing MQ2EQBugFix"); EzDetourwName(CDisplay__is3dON, &CDisplay_Hook::is_3dON_Detour, &CDisplay_Hook::is_3dON_Trampoline,"CDisplay__is3dON"); #ifdef EQMULETESTINGSTUFF //EzDetourwName(startworlddisplayexceptionhandler, startworddisplayexceptionhandler_Detour, startworddisplayexceptionhandler_Trampoline,"startworlddisplayexceptionhandler"); #endif }
// Called once, when the plugin is to initialize PLUGIN_API VOID InitializePlugin(VOID) { bzsrchhandle = CreateMutex(NULL, FALSE, NULL); DebugSpewAlways("Initializing MQ2Bzsrch"); LoadMQ2Plugin("MQ2ItemDisplay"); if(HMODULE h = GetModuleHandle("MQ2ItemDisplay.dll")) { pg_Item = (ITEMINFO *)GetProcAddress(h, "g_Item"); } else { pg_Item = NULL; } // Add commands, macro parameters, hooks, etc. AddCommand("/bzquery",BZQuery); AddCommand("/bzsrch",BzSrchMe); AddCommand("/breset",BzSrchMe); AddCommand("/mq2bzsrch",MQ2BzSrch); //AddCommand("/pricecheck",bzpc); AddMQ2Data("Bazaar",dataBazaar); // cc - added, but not using TLO yet EzDetourwName(CBazaarSearchWnd__HandleBazaarMsg,&BzSrchHook::BzDetour,&BzSrchHook::BzTrampoline,"CBazaarSearchWnd__HandleBazaarMsg"); pBazaarType = new MQ2BazaarType; pBazaarItemType = new MQ2BazaarItemType; }
VOID Draw_Detour(VOID) { CLabel* pThisLabel = (CLabel*)this; CHAR Buffer[MAX_STRING] = {0}; BOOL Found=FALSE; DWORD index; if (gAnonymize) { if (!bTrimnames) { #if !defined(ROF2EMU) && !defined(UFEMU) EzDetourwName(CAdvancedLootWnd__UpdateMasterLooter, &CLabelHook::CAdvancedLootWnd__UpdateMasterLooter_Detour, &CLabelHook::CAdvancedLootWnd__UpdateMasterLooter_Trampoline,"CAdvancedLootWnd__UpdateMasterLooter"); EzDetourwName(CComboWnd__GetChoiceText, &CLabelHook::CComboWnd__GetChoiceText_Detour, &CLabelHook::CComboWnd__GetChoiceText_Trampoline,"CComboWnd__GetChoiceText"); EzDetourwName(CComboWnd__InsertChoiceAtIndex, &CLabelHook::CComboWnd__InsertChoiceAtIndex_Detour, &CLabelHook::CComboWnd__InsertChoiceAtIndex_Trampoline,"CComboWnd__InsertChoiceAtIndex"); EzDetourwName(CAdvancedLootWnd__AddPlayerToList, &CLabelHook::CAdvancedLootWnd__AddPlayerToList_Detour, &CLabelHook::CAdvancedLootWnd__AddPlayerToList_Trampoline,"CAdvancedLootWnd__AddPlayerToList"); if (pAdvancedLootWnd && GetGameState() == GAMESTATE_INGAME) { CleanupLootCombo(true); } #endif EzDetourwName(CListWnd__AddString, &CLabelHook::CListWnd__AddString_Detour, &CLabelHook::CListWnd__AddString_Trampoline,"CListWnd__AddString"); EzDetourwName(CEverQuest__trimName, &CLabelHook::CEverQuest__trimName_Detour, &CLabelHook::CEverQuest__trimName_Trampoline,"CEverQuest__trimName"); EzDetourwName(__GetGaugeValueFromEQ, GetGaugeValueFromEQ_Detour, GetGaugeValueFromEQ_Trampoline,"__GetGaugeValueFromEQ"); EzDetourwName(__GetLabelFromEQ, GetLabelFromEQ_Detour, GetLabelFromEQ_Trampoline,"__GetLabelFromEQ"); bTrimnames = 1; } if (pThisLabel && pThisLabel->CGetWindowText()) { GetCXStr(pThisLabel->CGetWindowText(), Buffer); Anonymize(Buffer,MAX_STRING); } } else { if (bTrimnames) { bTrimnames = 0; #if !defined(ROF2EMU) && !defined(UFEMU) RemoveDetour(CComboWnd__GetChoiceText); RemoveDetour(CComboWnd__InsertChoiceAtIndex); RemoveDetour(CAdvancedLootWnd__AddPlayerToList); #endif RemoveDetour(CListWnd__AddString); RemoveDetour(CEverQuest__trimName); RemoveDetour(__GetGaugeValueFromEQ); RemoveDetour(__GetLabelFromEQ); #if !defined(ROF2EMU) && !defined(UFEMU) CleanupLootCombo(false); RemoveDetour(CAdvancedLootWnd__UpdateMasterLooter); #endif } } Draw_Trampoline(); if ((DWORD)pThisLabel->EQType==9999) { if (!pThisLabel->GetXMLToolTip()) { strcpy_s(Buffer,"BadCustom"); Found=TRUE; } else { //strcpy_s(Buffer,&pThisLabel->XMLToolTip->Text[0]); STMLToPlainText(&pThisLabel->GetXMLToolTip()->Text[0],Buffer); ParseMacroParameter(((PCHARINFO)pCharData)->pSpawn,Buffer); if (!strcmp(Buffer,"NULL")) Buffer[0]=0; Found=TRUE; } } else if (pThisLabel->EQType==1000) { for (index=0;Id_PMP[index].ID>0 && !Found;index++) { if (Id_PMP[index].ID==(DWORD)pThisLabel->EQType) { strcpy_s(Buffer,Id_PMP[index].PMP); ParseMacroParameter(((PCHARINFO)pCharData)->pSpawn,Buffer); if (!strcmp(Buffer,"NULL")) Buffer[0]=0; Found=TRUE; } } } if (Found) { pThisLabel->CSetWindowText(Buffer); //SetCXStr(&(pThisLabel->WindowText), Buffer); } }
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; } }