-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added QualityOfLife plugin - Allows right click to move items like in…
… d2maphack if d2maphack.dll is not loaded
- Loading branch information
1 parent
0cbdc0a
commit ce67ffc
Showing
5 changed files
with
282 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
#include "../../Includes/ClientCore.cpp" | ||
|
||
#define CONFIG_FILE ".\\plugin\\QualityOfLife.ini" | ||
|
||
int isRightClickItemTransfer = 0; | ||
|
||
void ReadConfig(); | ||
void OnRightClick(); | ||
|
||
CLIENTINFO | ||
( | ||
0,1, | ||
"", | ||
"", | ||
"QualityOfLife", | ||
"" | ||
) | ||
|
||
BOOL CALLBACK ClientWndProc(LRESULT *pResult, HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) | ||
{ | ||
switch (uMsg) | ||
{ | ||
case WM_RBUTTONDOWN: | ||
{ | ||
OnRightClick(); | ||
break; | ||
} | ||
} | ||
|
||
return FALSE; | ||
} | ||
|
||
void OnRightClick() | ||
{ | ||
if (!isRightClickItemTransfer) | ||
{ | ||
return; | ||
} | ||
|
||
const auto isStashOpen = me->IsUIOpened(UI_STASH); | ||
const auto isInventoryOpen = me->IsUIOpened(UI_INVENTORY); | ||
const auto isCubeOpen = me->IsUIOpened(UI_CUBE); | ||
|
||
if (!isStashOpen && !isInventoryOpen && !isCubeOpen) | ||
{ | ||
return; | ||
} | ||
|
||
const auto cursorItem = me->GetCursorItem(); | ||
if (cursorItem == 0) | ||
{ | ||
return; | ||
} | ||
|
||
const auto mousePositionGame = screen->GetMousePosition(); | ||
const auto screenDimensions = screen->GetScreenSize(); | ||
const auto isOnRightSideOfScreen = mousePositionGame.x > (screenDimensions.cx / 2); | ||
|
||
if (isOnRightSideOfScreen) | ||
{ | ||
if (isStashOpen) | ||
{ | ||
me->DropCursorItemToStorage(STORAGE_STASH); | ||
} | ||
else if (isCubeOpen) | ||
{ | ||
me->DropCursorItemToStorage(STORAGE_CUBE); | ||
} | ||
else | ||
{ | ||
me->DropCursorItemToGround(); | ||
} | ||
} | ||
else | ||
{ | ||
me->DropCursorItemToStorage(STORAGE_INVENTORY); | ||
} | ||
} | ||
|
||
|
||
BOOL EXPORT OnGameJoin() | ||
{ | ||
server->SendKey(189); | ||
|
||
return TRUE; | ||
} | ||
|
||
BOOL EXPORT OnClientStart() | ||
{ | ||
if (!GetModuleHandle("d2maphack.dll")) | ||
{ | ||
server->HookD2WndProc(g_hModule, ClientWndProc); | ||
} | ||
else | ||
{ | ||
return FALSE; | ||
} | ||
|
||
return TRUE; | ||
} | ||
|
||
void ReadConfig() | ||
{ | ||
isRightClickItemTransfer = GetPrivateProfileInt("Main", "RightClickItemTransfer", 1, CONFIG_FILE); | ||
} | ||
|
||
VOID EXPORT OnGameJoin(THISGAMESTRUCT* thisgame) | ||
{ | ||
ReadConfig(); | ||
} | ||
|
||
MODULECOMMANDSTRUCT ModuleCommands[]= | ||
{ | ||
{ | ||
"help", | ||
OnGameCommandHelp, | ||
"helpÿc0 List commands available in this module.\n" | ||
"<command> helpÿc0 Shows detailed help for <command> in this module." | ||
}, | ||
{NULL} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup Label="ProjectConfigurations"> | ||
<ProjectConfiguration Include="Debug|Win32"> | ||
<Configuration>Debug</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
<ProjectConfiguration Include="Release|Win32"> | ||
<Configuration>Release</Configuration> | ||
<Platform>Win32</Platform> | ||
</ProjectConfiguration> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<Diablo2Path Condition="'$(Diablo2Path)' == '' "> | ||
C:\Program Files (x86)\Diablo II | ||
</Diablo2Path> | ||
</PropertyGroup> | ||
<PropertyGroup Label="Globals"> | ||
<ProjectGuid>{EA69AB6D-FFC2-4CB7-83C8-5D43CDAFF036}</ProjectGuid> | ||
<RootNamespace>QualityOfLife</RootNamespace> | ||
<Keyword>Win32Proj</Keyword> | ||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
<WholeProgramOptimization>true</WholeProgramOptimization> | ||
<PlatformToolset>v142</PlatformToolset> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> | ||
<ConfigurationType>DynamicLibrary</ConfigurationType> | ||
<CharacterSet>MultiByte</CharacterSet> | ||
<PlatformToolset>v142</PlatformToolset> | ||
</PropertyGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> | ||
<ImportGroup Label="ExtensionSettings"> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> | ||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> | ||
</ImportGroup> | ||
<PropertyGroup Label="UserMacros" /> | ||
<PropertyGroup> | ||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> | ||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)$(Configuration)\</OutDir> | ||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\</IntDir> | ||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> | ||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)$(Configuration)\</OutDir> | ||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\</IntDir> | ||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> | ||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> | ||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | ||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" /> | ||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet> | ||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | ||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" /> | ||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.d2h</TargetExt> | ||
<TargetExt Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.d2h</TargetExt> | ||
</PropertyGroup> | ||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<TargetName>qol</TargetName> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> | ||
<ClCompile> | ||
<Optimization>Disabled</Optimization> | ||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;QualityOfLife_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<MinimalRebuild>true</MinimalRebuild> | ||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> | ||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> | ||
<PrecompiledHeader> | ||
</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat> | ||
<LanguageStandard>stdcpp17</LanguageStandard> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<SubSystem>Windows</SubSystem> | ||
<TargetMachine>MachineX86</TargetMachine> | ||
</Link> | ||
<PostBuildEvent> | ||
<Command>xcopy /Y Resources $(SolutionDir)\..\$(Configuration)\ | ||
xcopy /Y $(TargetPath) $(SolutionDir)\..\$(Configuration)\ | ||
xcopy /Y $(TargetPath) "$(Diablo2Path)\plugin\" | ||
xcopy /Y $(TargetDir)$(TargetName).pdb "$(Diablo2Path)\plugin\"</Command> | ||
</PostBuildEvent> | ||
</ItemDefinitionGroup> | ||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> | ||
<ClCompile> | ||
<Optimization>MaxSpeed</Optimization> | ||
<IntrinsicFunctions>true</IntrinsicFunctions> | ||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;QualityOfLife_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions> | ||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary> | ||
<FunctionLevelLinking>true</FunctionLevelLinking> | ||
<PrecompiledHeader> | ||
</PrecompiledHeader> | ||
<WarningLevel>Level3</WarningLevel> | ||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> | ||
<LanguageStandard>stdcpp17</LanguageStandard> | ||
</ClCompile> | ||
<Link> | ||
<GenerateDebugInformation>true</GenerateDebugInformation> | ||
<SubSystem>Windows</SubSystem> | ||
<OptimizeReferences>true</OptimizeReferences> | ||
<EnableCOMDATFolding>true</EnableCOMDATFolding> | ||
<TargetMachine>MachineX86</TargetMachine> | ||
</Link> | ||
<PostBuildEvent> | ||
<Command>xcopy /Y Resources $(SolutionDir)\..\$(Configuration)\ | ||
xcopy /Y $(TargetPath) $(SolutionDir)\..\$(Configuration)\</Command> | ||
</PostBuildEvent> | ||
</ItemDefinitionGroup> | ||
<ItemGroup> | ||
<ClCompile Include="QualityOfLife.cpp" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\QualityOfLife.ini" /> | ||
</ItemGroup> | ||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> | ||
<ImportGroup Label="ExtensionTargets"> | ||
</ImportGroup> | ||
</Project> |
27 changes: 27 additions & 0 deletions
27
D2Hackit/Modules/QualityOfLife/QualityOfLife.vcxproj.filters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<ItemGroup> | ||
<Filter Include="Source Files"> | ||
<UniqueIdentifier>{FFC737F1-C7A5-4376-A066-2A32DF52A2FF}</UniqueIdentifier> | ||
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> | ||
</Filter> | ||
<Filter Include="Header Files"> | ||
<UniqueIdentifier>{9399FF80-89BD-4b04-88EB-6F5FBE52EBFB}</UniqueIdentifier> | ||
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions> | ||
</Filter> | ||
<Filter Include="Resource Files"> | ||
<UniqueIdentifier>{67DA6AB6-F800-Fc08-8B7A-83BB1FFAAD01}</UniqueIdentifier> | ||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav</Extensions> | ||
</Filter> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClCompile Include="QualityOfLife.cpp"> | ||
<Filter>Source Files</Filter> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<None Include="Resources\QualityOfLife.ini"> | ||
<Filter>Resource Files</Filter> | ||
</None> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[Main] | ||
RightClickItemTransfer=1 |