mirror of
https://gitlab.com/hashborgir/d2tweaks-rnd2k.git
synced 2025-10-13 08:24:23 -05:00
Initial commit
This commit is contained in:
205
include/common/Ini.h
Normal file
205
include/common/Ini.h
Normal file
@@ -0,0 +1,205 @@
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// Ini.h
|
||||
//
|
||||
// "CIni" is a simple API wrap class used for ini file access.
|
||||
// The purpose of this class is to make ini file access more
|
||||
// convenient than direct API calls.
|
||||
//
|
||||
// This file is distributed "as is" and without any expressed or implied
|
||||
// warranties. The author holds no responsibilities for any possible damages
|
||||
// or loss of data that are caused by use of this file. The user must assume
|
||||
// the entire risk of using this file.
|
||||
//
|
||||
// 7/08/2002 Bin Liu
|
||||
//
|
||||
// Update history:
|
||||
//
|
||||
// 7/08/2002 -- Initial release.
|
||||
// 7/14/2002 -- Added "IncreaseInt" and "AppendString"
|
||||
// 9/02/2002 -- Added "removeProfileSection" and "RemoveProfileEntry"
|
||||
// 2/09/2003 -- The class has been made unicode-compliant
|
||||
// 11/04/2003 -- Integrated MFC support, added in new member functions
|
||||
// for accessing arrays.
|
||||
// 11/08/2003 -- Fixed "GetString" and "GetPathName" method, changed parameter
|
||||
// from "LPSTR" to "LPTSTR"
|
||||
// 11/10/2003 -- Renamed method "GetKeys" to "GetKeyLines",
|
||||
// Added method "GetKeyNames"
|
||||
// Added parameter "bTrimString" to method "GetArray"
|
||||
// 11/14/2003 -- Use "__AFXWIN_H__" instead of "_AFXDLL" to determine MFC presence
|
||||
// Removed length limit on "m_pszPathName"
|
||||
// Removed "GetStruct" and "WriteStruct"
|
||||
// Added "GetDataBlock" and "WriteDataBlock"
|
||||
// Added "GetChar" and "WriteChar"
|
||||
// 02/20/2004 -- Fixed a bug in "_TrimString". Thanks to yao_xuejun.
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __INI_H__
|
||||
#define __INI_H__
|
||||
|
||||
#include <windows.h>
|
||||
#include <tchar.h>
|
||||
|
||||
// If MFC is linked, we will use CStringArray for great convenience
|
||||
#ifdef __AFXWIN_H__
|
||||
#include <afxtempl.h>
|
||||
#endif
|
||||
|
||||
// Number bases
|
||||
#define BASE_BINARY 2
|
||||
#define BASE_OCTAL 8
|
||||
#define BASE_DECIMAL 10
|
||||
#define BASE_HEXADECIMAL 16
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Callback Function Type Definition
|
||||
//---------------------------------------------------------------
|
||||
// The callback function used for parsing a "double-null terminated string".
|
||||
// When called, the 1st parameter passed in will store the newly extracted sub
|
||||
// string, the 2nd parameter is a 32-bit user defined data, this parameter can
|
||||
// be NULL. The parsing will terminate if this function returns zero. To use
|
||||
// the callback, function pointer needs to be passed to "CIni::ParseDNTString".
|
||||
typedef BOOL (CALLBACK *SUBSTRPROC)(LPCTSTR, LPVOID);
|
||||
|
||||
class CIni
|
||||
{
|
||||
public:
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Constructors & Destructor
|
||||
//-----------------------------------------------------------
|
||||
CIni(); // Default constructor
|
||||
CIni(LPCTSTR lpPathName); // Construct with a given file name
|
||||
virtual ~CIni();
|
||||
|
||||
//-----------------------------------------------------------
|
||||
// Ini File Path Name Access
|
||||
//-----------------------------------------------------------
|
||||
void SetPathName(LPCTSTR lpPathName); // Specify a new file name
|
||||
DWORD GetPathName(LPTSTR lpBuffer, DWORD dwBufSize) const; // Retrieve current file name
|
||||
#ifdef __AFXWIN_H__
|
||||
CString GetPathName() const;
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------
|
||||
// String Access
|
||||
//------------------------------------------------------------
|
||||
DWORD GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dwBufSize, LPCTSTR lpDefault = NULL) const;
|
||||
#ifdef __AFXWIN_H__
|
||||
CString GetString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefault = NULL) const;
|
||||
#endif
|
||||
BOOL WriteString(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpValue) const;
|
||||
|
||||
// Read a string from the ini file, append it with another string then write it
|
||||
// back to the ini file.
|
||||
BOOL AppendString(LPCTSTR Section, LPCTSTR lpKey, LPCTSTR lpString) const;
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Ini File String Array Access
|
||||
//------------------------------------------------------------
|
||||
// Parse the string retrieved from the ini file and split it into a set of sub strings.
|
||||
DWORD GetArray(LPCTSTR lpSection, LPCTSTR lpKey, LPTSTR lpBuffer, DWORD dwBufSize, LPCTSTR lpDelimiter = NULL, BOOL bTrimString = TRUE) const;
|
||||
#ifdef __AFXWIN_H__
|
||||
void GetArray(LPCTSTR lpSection, LPCTSTR lpKey, CStringArray* pArray, LPCTSTR lpDelimiter = NULL, BOOL bTrimString = TRUE) const;
|
||||
BOOL WriteArray(LPCTSTR lpSection, LPCTSTR lpKey, const CStringArray* pArray, int nWriteCount = -1, LPCTSTR lpDelimiter = NULL) const;
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Primitive Data Type Access
|
||||
//------------------------------------------------------------
|
||||
int GetInt(LPCTSTR lpSection, LPCTSTR lpKey, int nDefault, int nBase = BASE_DECIMAL) const;
|
||||
BOOL WriteInt(LPCTSTR lpSection, LPCTSTR lpKey, int nValue, int nBase = BASE_DECIMAL) const;
|
||||
BOOL IncreaseInt(LPCTSTR lpSection, LPCTSTR lpKey, int nIncrease = 1, int nBase = BASE_DECIMAL) const;
|
||||
|
||||
UINT GetUInt(LPCTSTR lpSection, LPCTSTR lpKey, UINT nDefault, int nBase = BASE_DECIMAL) const;
|
||||
BOOL WriteUInt(LPCTSTR lpSection, LPCTSTR lpKey, UINT nValue, int nBase = BASE_DECIMAL) const;
|
||||
BOOL IncreaseUInt(LPCTSTR lpSection, LPCTSTR lpKey, UINT nIncrease = 1, int nBase = BASE_DECIMAL) const;
|
||||
|
||||
BOOL GetBool(LPCTSTR lpSection, LPCTSTR lpKey, BOOL bDefault) const;
|
||||
BOOL WriteBool(LPCTSTR lpSection, LPCTSTR lpKey, BOOL bValue) const;
|
||||
BOOL InvertBool(LPCTSTR lpSection, LPCTSTR lpKey) const;
|
||||
|
||||
double GetDouble(LPCTSTR lpSection, LPCTSTR lpKey, double fDefault) const;
|
||||
BOOL WriteDouble(LPCTSTR lpSection, LPCTSTR lpKey, double fValue, int nPrecision = -1) const;
|
||||
BOOL IncreaseDouble(LPCTSTR lpSection, LPCTSTR lpKey, double fIncrease, int nPrecision = -1) const;
|
||||
|
||||
TCHAR GetChar(LPCTSTR lpSection, LPCTSTR lpKey, TCHAR cDefault) const;
|
||||
BOOL WriteChar(LPCTSTR lpSection, LPCTSTR lpKey, TCHAR c) const;
|
||||
|
||||
//------------------------------------------------------------
|
||||
// User-Defined Data Type & Data Block Access
|
||||
//------------------------------------------------------------
|
||||
POINT GetPoint(LPCTSTR lpSection, LPCTSTR lpKey, POINT ptDefault) const;
|
||||
BOOL WritePoint(LPCTSTR lpSection, LPCTSTR lpKey, POINT pt) const;
|
||||
|
||||
RECT GetRect(LPCTSTR lpSection, LPCTSTR lpKey, RECT rcDefault) const;
|
||||
BOOL WriteRect(LPCTSTR lpSection, LPCTSTR lpKey, RECT rc) const;
|
||||
|
||||
DWORD GetDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPVOID lpBuffer, DWORD dwBufSize, DWORD dwOffset = 0) const;
|
||||
BOOL WriteDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWORD dwDataSize) const;
|
||||
BOOL AppendDataBlock(LPCTSTR lpSection, LPCTSTR lpKey, LPCVOID lpData, DWORD dwDataSize) const;
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Section Operations
|
||||
//------------------------------------------------------------
|
||||
BOOL IsSectionExist(LPCTSTR lpSection) const;
|
||||
DWORD GetSectionNames(LPTSTR lpBuffer, DWORD dwBufSize) const;
|
||||
#ifdef __AFXWIN_H__
|
||||
void GetSectionNames(CStringArray* pArray) const;
|
||||
#endif
|
||||
BOOL CopySection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIfExist) const;
|
||||
BOOL MoveSection(LPCTSTR lpSrcSection, LPCTSTR lpDestSection, BOOL bFailIfExist = TRUE) const;
|
||||
BOOL DeleteSection(LPCTSTR lpSection) const;
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Key Operations
|
||||
//------------------------------------------------------------
|
||||
BOOL IsKeyExist(LPCTSTR lpSection, LPCTSTR lpKey) const;
|
||||
DWORD GetKeyLines(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) const;
|
||||
#ifdef __AFXWIN_H__
|
||||
void GetKeyLines(LPCTSTR lpSection, CStringArray* pArray) const;
|
||||
#endif
|
||||
DWORD GetKeyNames(LPCTSTR lpSection, LPTSTR lpBuffer, DWORD dwBufSize) const;
|
||||
#ifdef __AFXWIN_H__
|
||||
void GetKeyNames(LPCTSTR lpSection, CStringArray* pArray) const;
|
||||
#endif
|
||||
BOOL CopyKey(LPCTSTR lpSrcSection, LPCTSTR lpSrcKey, LPCTSTR lpDestSection, LPCTSTR lpDestKey, BOOL bFailIfExist) const;
|
||||
BOOL MoveKey(LPCTSTR lpSrcSection, LPCTSTR lpSrcKey, LPCTSTR lpDestSection, LPCTSTR lpDestKey, BOOL bFailIfExist = TRUE) const;
|
||||
BOOL DeleteKey(LPCTSTR lpSection, LPCTSTR lpKey) const;
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Parse a "Double-Null Terminated String"
|
||||
//------------------------------------------------------------
|
||||
static BOOL ParseDNTString(LPCTSTR lpString, SUBSTRPROC lpFnStrProc, LPVOID lpParam = NULL);
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Check for Whether a String Representing TRUE or FALSE
|
||||
//------------------------------------------------------------
|
||||
static BOOL StringToBool(LPCTSTR lpString, BOOL bDefault = FALSE);
|
||||
|
||||
protected:
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Helper Functions
|
||||
//------------------------------------------------------------
|
||||
static LPTSTR __StrDupEx(LPCTSTR lpStart, LPCTSTR lpEnd);
|
||||
static BOOL __TrimString(LPTSTR lpBuffer);
|
||||
LPTSTR __GetStringDynamic(LPCTSTR lpSection, LPCTSTR lpKey, LPCTSTR lpDefault = NULL) const;
|
||||
static DWORD __StringSplit(LPCTSTR lpString, LPTSTR lpBuffer, DWORD dwBufSize, LPCTSTR lpDelimiter = NULL, BOOL bTrimString = TRUE);
|
||||
static void __ToBinaryString(UINT nNumber, LPTSTR lpBuffer, DWORD dwBufSize);
|
||||
static int __ValidateBase(int nBase);
|
||||
static void __IntToString(int nNumber, LPTSTR lpBuffer, int nBase);
|
||||
static void __UIntToString(UINT nNumber, LPTSTR lpBuffer, int nBase);
|
||||
static BOOL CALLBACK __SubStrCompare(LPCTSTR lpString1, LPVOID lpParam);
|
||||
static BOOL CALLBACK __KeyPairProc(LPCTSTR lpString, LPVOID lpParam);
|
||||
#ifdef __AFXWIN_H__
|
||||
static BOOL CALLBACK __SubStrAdd(LPCTSTR lpString, LPVOID lpParam);
|
||||
#endif
|
||||
|
||||
//------------------------------------------------------------
|
||||
// Member Data
|
||||
//------------------------------------------------------------
|
||||
LPTSTR m_pszPathName; // Stores path of the associated ini file
|
||||
};
|
||||
|
||||
#endif // #ifndef __INI_H__
|
178
include/common/asm_code.h
Normal file
178
include/common/asm_code.h
Normal file
@@ -0,0 +1,178 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
#include <optional>
|
||||
|
||||
namespace details {
|
||||
class asm_address {
|
||||
intptr_t m_full_offset = 0;
|
||||
public:
|
||||
virtual ~asm_address() = default;
|
||||
|
||||
intptr_t get_full_offset() const {
|
||||
return m_full_offset;
|
||||
}
|
||||
|
||||
void set_full_offset(const intptr_t full_offset) {
|
||||
m_full_offset = full_offset;
|
||||
}
|
||||
|
||||
virtual void build(unsigned char* code) = 0;
|
||||
|
||||
virtual intptr_t get_offset() const = 0;
|
||||
virtual intptr_t get() const = 0;
|
||||
};
|
||||
}
|
||||
|
||||
class asm_address_static final : public details::asm_address {
|
||||
intptr_t m_offset;
|
||||
intptr_t m_address;
|
||||
public:
|
||||
/**
|
||||
* \brief
|
||||
* \param offset relative to current instruction
|
||||
* \param address
|
||||
*/
|
||||
asm_address_static(intptr_t offset, void* address) {
|
||||
m_offset = offset;
|
||||
m_address = reinterpret_cast<intptr_t>(address);
|
||||
}
|
||||
|
||||
void build(unsigned char* code) override {
|
||||
*reinterpret_cast<intptr_t*>(code + get_full_offset() + m_offset) = m_address;
|
||||
}
|
||||
|
||||
intptr_t get_offset() const override {
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
intptr_t get() const override {
|
||||
return m_address;
|
||||
}
|
||||
};
|
||||
|
||||
class asm_address_relative : public details::asm_address {
|
||||
intptr_t m_offset;
|
||||
intptr_t m_instruction_size;
|
||||
intptr_t m_to_address;
|
||||
|
||||
intptr_t m_address;
|
||||
public:
|
||||
/**
|
||||
* \brief
|
||||
* \param offset relative to current instruction
|
||||
* \param instructionSize full size of instruction
|
||||
* \param toAddress
|
||||
*/
|
||||
asm_address_relative(intptr_t offset, size_t instructionSize, void* toAddress) {
|
||||
m_offset = offset;
|
||||
m_instruction_size = instructionSize;
|
||||
m_to_address = reinterpret_cast<decltype(m_to_address)>(toAddress);
|
||||
|
||||
m_address = 0;
|
||||
}
|
||||
|
||||
void build(unsigned char* code) override {
|
||||
const auto fromAddress = reinterpret_cast<intptr_t>(code + get_full_offset());
|
||||
*reinterpret_cast<intptr_t*>(code + get_full_offset() + m_offset) =
|
||||
m_to_address - fromAddress - m_instruction_size;
|
||||
}
|
||||
|
||||
intptr_t get_offset() const override {
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
intptr_t get() const override {
|
||||
return m_address;
|
||||
}
|
||||
};
|
||||
|
||||
class asm_code {
|
||||
const size_t m_growth_factor = 2;
|
||||
|
||||
unsigned char* m_code;
|
||||
unsigned char* m_buffer;
|
||||
size_t m_buffer_size;
|
||||
intptr_t m_offset;
|
||||
|
||||
std::vector<details::asm_address*> m_addresses;
|
||||
public:
|
||||
explicit asm_code(const size_t initSize = 0) {
|
||||
m_code = nullptr;
|
||||
m_buffer = nullptr;
|
||||
m_buffer_size = initSize;
|
||||
m_offset = 0;
|
||||
|
||||
if (initSize != 0)
|
||||
m_buffer = new unsigned char[initSize]();
|
||||
}
|
||||
|
||||
~asm_code() {
|
||||
delete[] m_buffer;
|
||||
|
||||
for (auto addr : m_addresses)
|
||||
delete addr;
|
||||
}
|
||||
|
||||
template<size_t Len>
|
||||
void add(int const(&code)[Len], details::asm_address* address = nullptr) {
|
||||
if (m_code)
|
||||
return;
|
||||
|
||||
if (Len == 0)
|
||||
return;
|
||||
|
||||
ensure_buffer_size(Len);
|
||||
|
||||
const auto startOffset = m_offset;
|
||||
|
||||
for (size_t i = 0; i < Len; i++)
|
||||
m_buffer[m_offset++] = static_cast<unsigned char>(code[i]);
|
||||
|
||||
if (!address)
|
||||
return;
|
||||
|
||||
//scratch some space in buffer for address
|
||||
ensure_buffer_size(Len + sizeof(intptr_t));
|
||||
m_offset += sizeof(intptr_t);
|
||||
|
||||
address->set_full_offset(startOffset);
|
||||
m_addresses.push_back(address);
|
||||
}
|
||||
|
||||
size_t get_code_size() const {
|
||||
return m_offset;
|
||||
}
|
||||
|
||||
unsigned char* get_code() {
|
||||
if (!m_code)
|
||||
build();
|
||||
|
||||
return m_code;
|
||||
}
|
||||
|
||||
void build();
|
||||
private:
|
||||
void ensure_buffer_size(size_t size) {
|
||||
if (m_buffer_size - m_offset > size)
|
||||
return;
|
||||
|
||||
auto newSize = m_buffer_size;
|
||||
|
||||
if (newSize == 0)
|
||||
newSize = 1;
|
||||
|
||||
do {
|
||||
newSize *= m_growth_factor;
|
||||
} while (size > newSize);
|
||||
|
||||
const auto newBuffer = new unsigned char[newSize]();
|
||||
memcpy(newBuffer, m_buffer, m_buffer_size);
|
||||
|
||||
delete[] m_buffer;
|
||||
|
||||
m_buffer_size = newSize;
|
||||
m_buffer = newBuffer;
|
||||
}
|
||||
};
|
50
include/common/autopickup_lootfilter.h
Normal file
50
include/common/autopickup_lootfilter.h
Normal file
@@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
#define MAX_STRING_LENGHT 65536
|
||||
|
||||
enum D2ItemQuality
|
||||
{
|
||||
ITEMQUALITY_CRACKED = 1,
|
||||
ITEMQUALITY_NORMAL = 2,
|
||||
ITEMQUALITY_SUPERIOR = 3,
|
||||
ITEMQUALITY_MAGIC = 4,
|
||||
ITEMQUALITY_SET = 5,
|
||||
ITEMQUALITY_RARE = 6,
|
||||
ITEMQUALITY_UNIQUE = 7,
|
||||
ITEMQUALITY_CRAFTED = 8,
|
||||
ITEMQUALITY_TEMPERED = 9
|
||||
};
|
||||
|
||||
struct item_code {
|
||||
char code0;
|
||||
char code1;
|
||||
char code2;
|
||||
char code3;
|
||||
uint32_t qualityinclude[10] = { 0 };
|
||||
};
|
||||
|
||||
struct item_type {
|
||||
uint32_t dwtype;
|
||||
uint32_t qualityinclude[10] = { 0 };
|
||||
};
|
||||
|
||||
struct recipe {
|
||||
item_code input1_code;
|
||||
item_code input2_code;
|
||||
item_code input3_code;
|
||||
item_code input4_code;
|
||||
item_code input5_code;
|
||||
item_code input6_code;
|
||||
item_code input7_code;
|
||||
item_type input1_type;
|
||||
item_type input2_type;
|
||||
item_type input3_type;
|
||||
item_type input4_type;
|
||||
item_type input5_type;
|
||||
item_type input6_type;
|
||||
item_type input7_type;
|
||||
uint32_t repeat_count;
|
||||
bool back_to_inventory;
|
||||
bool auto_transmute;
|
||||
};
|
15
include/common/config.h
Normal file
15
include/common/config.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <fw/singleton.h>
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
class config : public singleton<config> {
|
||||
nlohmann::json* m_json;
|
||||
|
||||
bool m_unlock_fps;
|
||||
bool m_prevent_minimize;
|
||||
uint32_t m_gold_pickup_range;
|
||||
|
||||
public:
|
||||
explicit config(token);
|
||||
};
|
9
include/common/enum_helper.h
Normal file
9
include/common/enum_helper.h
Normal file
@@ -0,0 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
template<typename TEnum>
|
||||
class enum_helper {
|
||||
public:
|
||||
static constexpr const char* to_string(TEnum value) {
|
||||
return __FUNCSIG__;
|
||||
}
|
||||
};
|
74
include/common/hooking.h
Normal file
74
include/common/hooking.h
Normal file
@@ -0,0 +1,74 @@
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace hooking {
|
||||
enum mh_status_t {
|
||||
// Unknown error. Should not be returned.
|
||||
MH_UNKNOWN = -1,
|
||||
|
||||
// Successful.
|
||||
MH_OK = 0,
|
||||
|
||||
// MinHook is already initialized.
|
||||
MH_ERROR_ALREADY_INITIALIZED,
|
||||
|
||||
// MinHook is not initialized yet, or already uninitialized.
|
||||
MH_ERROR_NOT_INITIALIZED,
|
||||
|
||||
// The hook for the specified target function is already created.
|
||||
MH_ERROR_ALREADY_CREATED,
|
||||
|
||||
// The hook for the specified target function is not created yet.
|
||||
MH_ERROR_NOT_CREATED,
|
||||
|
||||
// The hook for the specified target function is already enabled.
|
||||
MH_ERROR_ENABLED,
|
||||
|
||||
// The hook for the specified target function is not enabled yet, or already
|
||||
// disabled.
|
||||
MH_ERROR_DISABLED,
|
||||
|
||||
// The specified pointer is invalid. It points the address of non-allocated
|
||||
// and/or non-executable region.
|
||||
MH_ERROR_NOT_EXECUTABLE,
|
||||
|
||||
// The specified target function cannot be hooked.
|
||||
MH_ERROR_UNSUPPORTED_FUNCTION,
|
||||
|
||||
// Failed to allocate memory.
|
||||
MH_ERROR_MEMORY_ALLOC,
|
||||
|
||||
// Failed to change the memory protection.
|
||||
MH_ERROR_MEMORY_PROTECT,
|
||||
|
||||
// The specified module is not loaded.
|
||||
MH_ERROR_MODULE_NOT_FOUND,
|
||||
|
||||
// The specified function is not found.
|
||||
MH_ERROR_FUNCTION_NOT_FOUND
|
||||
};
|
||||
|
||||
namespace details {
|
||||
mh_status_t hook(void* target, void* detour, void** original);
|
||||
}
|
||||
|
||||
template<typename TOrig>
|
||||
mh_status_t hook(void* target, void* detour, TOrig** original) {
|
||||
return details::hook(target, detour, reinterpret_cast<void**>(original));
|
||||
}
|
||||
|
||||
template<size_t TOrdinal, typename TOrig>
|
||||
mh_status_t hook(void* base, void* detour, TOrig** original) {
|
||||
auto fn = GetProcAddress(reinterpret_cast<HMODULE>(base),
|
||||
reinterpret_cast<LPCSTR>(TOrdinal));
|
||||
|
||||
return hook(fn, detour, original);
|
||||
}
|
||||
|
||||
intptr_t get_executable_memory(void* origin, size_t size);
|
||||
void* set_call(void* address, void* function, size_t stubSize = 7);
|
||||
void* set_jmp(void* address, void* function, size_t stubSize = 7);
|
||||
void* get_call(void* address);
|
||||
}
|
184
include/common/ptr_wrapper.h
Normal file
184
include/common/ptr_wrapper.h
Normal file
@@ -0,0 +1,184 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <Windows.h>
|
||||
|
||||
namespace details {
|
||||
template<typename TRet, typename... Args>
|
||||
class wrap_func_cdecl_ {
|
||||
void* m_function_ptr;
|
||||
public:
|
||||
explicit wrap_func_cdecl_(uintptr_t ptr, void* base) {
|
||||
m_function_ptr = static_cast<char*>(base) + ptr;
|
||||
}
|
||||
|
||||
TRet operator()(Args... args) {
|
||||
return reinterpret_cast<TRet(__cdecl*)(Args...)>(m_function_ptr)(args...);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename TRet, typename... Args>
|
||||
class wrap_func_std_ {
|
||||
void* m_function_ptr;
|
||||
public:
|
||||
explicit wrap_func_std_(uintptr_t ptr, void* base) {
|
||||
m_function_ptr = static_cast<char*>(base) + ptr;
|
||||
}
|
||||
|
||||
TRet operator()(Args... args) {
|
||||
return reinterpret_cast<TRet(__stdcall*)(Args...)>(m_function_ptr)(args...);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename TRet, typename... Args>
|
||||
class wrap_func_cdecl_import_ {
|
||||
void* m_base;
|
||||
void* m_function_ptr;
|
||||
uint32_t m_ordinal;
|
||||
public:
|
||||
explicit wrap_func_cdecl_import_(uint32_t ordinal, void* base) {
|
||||
m_base = base;
|
||||
m_function_ptr = nullptr;
|
||||
m_ordinal = ordinal;
|
||||
}
|
||||
|
||||
TRet operator()(Args... args) {
|
||||
if (!m_function_ptr) {
|
||||
m_function_ptr = reinterpret_cast<decltype(m_function_ptr)>(GetProcAddress(reinterpret_cast<HMODULE>(m_base),
|
||||
reinterpret_cast<LPCSTR>(m_ordinal)));
|
||||
}
|
||||
|
||||
return reinterpret_cast<TRet(__cdecl*)(Args...)>(m_function_ptr)(args...);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename TRet, typename... Args>
|
||||
class wrap_func_std_import_ {
|
||||
void* m_base;
|
||||
void* m_function_ptr;
|
||||
uint32_t m_ordinal;
|
||||
public:
|
||||
explicit wrap_func_std_import_(uint32_t ordinal, void* base) {
|
||||
m_base = base;
|
||||
m_function_ptr = nullptr;
|
||||
m_ordinal = ordinal;
|
||||
}
|
||||
|
||||
TRet operator()(Args... args) {
|
||||
if (!m_function_ptr) {
|
||||
m_function_ptr = reinterpret_cast<decltype(m_function_ptr)>(GetProcAddress(reinterpret_cast<HMODULE>(m_base),
|
||||
reinterpret_cast<LPCSTR>(m_ordinal)));
|
||||
}
|
||||
|
||||
return reinterpret_cast<TRet(__stdcall*)(Args...)>(m_function_ptr)(args...);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename TRet, typename... Args>
|
||||
class wrap_func_fast_import_ {
|
||||
void* m_base;
|
||||
void* m_function_ptr;
|
||||
uint32_t m_ordinal;
|
||||
public:
|
||||
explicit wrap_func_fast_import_(uint32_t ordinal, void* base) {
|
||||
m_base = base;
|
||||
m_function_ptr = nullptr;
|
||||
m_ordinal = ordinal;
|
||||
}
|
||||
|
||||
TRet operator()(Args... args) {
|
||||
if (!m_function_ptr) {
|
||||
m_function_ptr = reinterpret_cast<decltype(m_function_ptr)>(GetProcAddress(reinterpret_cast<HMODULE>(m_base),
|
||||
reinterpret_cast<LPCSTR>(m_ordinal)));
|
||||
}
|
||||
|
||||
return reinterpret_cast<TRet(__fastcall*)(Args...)>(m_function_ptr)(args...);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename TRet, typename... Args>
|
||||
class wrap_func_fast_ {
|
||||
void* m_function_ptr;
|
||||
public:
|
||||
explicit wrap_func_fast_(uintptr_t ptr, void* base) {
|
||||
m_function_ptr = static_cast<char*>(base) + ptr;
|
||||
}
|
||||
|
||||
TRet operator()(Args... args) {
|
||||
return reinterpret_cast<TRet(__fastcall*)(Args...)>(m_function_ptr)(args...);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
template<typename TRet>
|
||||
class wrap_func_cdecl {};
|
||||
|
||||
template<typename TRet, typename... Args>
|
||||
class wrap_func_cdecl<TRet(Args...)> : public details::wrap_func_cdecl_<TRet, Args...> {
|
||||
public:
|
||||
wrap_func_cdecl(uintptr_t ptr, void* base) : wrap_func_cdecl_(ptr, base) {};
|
||||
};
|
||||
|
||||
template<typename TRet>
|
||||
class wrap_func_cdecl_import {};
|
||||
|
||||
template<typename TRet, typename... Args>
|
||||
class wrap_func_cdecl_import<TRet(Args...)> : public details::wrap_func_cdecl_import_<TRet, Args...> {
|
||||
public:
|
||||
wrap_func_cdecl_import(uint32_t ordinal, void* base) : wrap_func_cdecl_import_(ordinal, base) {};
|
||||
};
|
||||
|
||||
template<typename TRet>
|
||||
class wrap_func_std {};
|
||||
|
||||
template<typename TRet, typename... Args>
|
||||
class wrap_func_std<TRet(Args...)> : public details::wrap_func_std_<TRet, Args...> {
|
||||
public:
|
||||
wrap_func_std(uintptr_t ptr, void* base) : wrap_func_std_(ptr, base) {};
|
||||
};
|
||||
|
||||
template<typename TRet>
|
||||
class wrap_func_std_import {};
|
||||
|
||||
template<typename TRet, typename... Args>
|
||||
class wrap_func_std_import<TRet(Args...)> : public details::wrap_func_std_import_<TRet, Args...> {
|
||||
public:
|
||||
wrap_func_std_import(uint32_t ordinal, void* base) : wrap_func_std_import_(ordinal, base) {};
|
||||
};
|
||||
|
||||
template<typename TRet>
|
||||
class wrap_func_fast_import {};
|
||||
|
||||
template<typename TRet, typename... Args>
|
||||
class wrap_func_fast_import<TRet(Args...)> : public details::wrap_func_fast_import_<TRet, Args...> {
|
||||
public:
|
||||
wrap_func_fast_import(uint32_t ordinal, void* base) : wrap_func_fast_import_(ordinal, base) {};
|
||||
};
|
||||
|
||||
template<typename TRet>
|
||||
class wrap_func_fast {};
|
||||
|
||||
template<typename TRet, typename... Args>
|
||||
class wrap_func_fast<TRet(Args...)> : public details::wrap_func_fast_<TRet, Args...> {
|
||||
public:
|
||||
wrap_func_fast(uintptr_t ptr, void* base) : wrap_func_fast_(ptr, base) {};
|
||||
};
|
||||
|
||||
template<typename TType>
|
||||
class wrap_value {
|
||||
TType* m_value;
|
||||
public:
|
||||
wrap_value(uintptr_t ptr, void* base) {
|
||||
// Fuck off, I'm gonna cast it in C-style because of templates
|
||||
// ReSharper disable once CppCStyleCast
|
||||
m_value = (TType*)(static_cast<char*>(base) + ptr);
|
||||
}
|
||||
|
||||
operator void* () const {
|
||||
return m_value;
|
||||
}
|
||||
|
||||
operator TType* () const {
|
||||
return m_value;
|
||||
}
|
||||
};
|
7
include/common/string_utils.h
Normal file
7
include/common/string_utils.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace string_utils {
|
||||
std::wstring string_to_wstring(const std::string& str);
|
||||
}
|
73
include/d2tweaks/client/client.h
Normal file
73
include/d2tweaks/client/client.h
Normal file
@@ -0,0 +1,73 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <fw/singleton.h>
|
||||
|
||||
#include <diablo2/d2win.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <diablo2/structures/gfxdata.h>
|
||||
|
||||
// Define the structure to hold stat information
|
||||
struct StatEntry {
|
||||
std::wstring stat_display_string;
|
||||
diablo2::ui_color_t colorStat, colorStatValue;
|
||||
int x1, y1, x2, y2, is_item_stat, item_type_id, stat = 0; // x1,y1 stat_display_string | x2,y2 statValue
|
||||
};
|
||||
|
||||
extern std::vector<StatEntry> globalStatsVector; // Declaration of the global variable
|
||||
|
||||
extern diablo2::structures::gfxdata g_gfxdata; // global gfxdata
|
||||
|
||||
extern int randStat;
|
||||
extern int randStatRangeLow;
|
||||
extern int randStatRangeHigh;
|
||||
extern int randStatBool;
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct unit;
|
||||
}
|
||||
}
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace common {
|
||||
struct packet_header;
|
||||
enum packet_types_cs_t;
|
||||
enum message_types_t;
|
||||
}
|
||||
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class client_module;
|
||||
}
|
||||
|
||||
class client : public singleton<client> {
|
||||
uint8_t m_module_id_counter;
|
||||
uint8_t m_tick_handler_id_counter;
|
||||
modules::client_module* m_modules[0xFF]{ nullptr }; //max 255 modules atm.
|
||||
modules::client_module* m_tick_handlers[0xFF]{ nullptr }; //max 255 handlers
|
||||
modules::client_module* m_packet_handlers[0xFF]{ nullptr }; //max 255 handlers because of one-byte packet header
|
||||
modules::client_module* m_packet_cs_handlers[0xFF]{ nullptr }; //max 255 handlers because of one-byte packet header
|
||||
public:
|
||||
explicit client(token);
|
||||
|
||||
void init();
|
||||
void register_module(modules::client_module* module);
|
||||
|
||||
void register_tick_handler(modules::client_module* module);
|
||||
void register_packet_handler(common::message_types_t type, modules::client_module* module);
|
||||
void register_packet_cs_handler(common::packet_types_cs_t packet, common::message_types_t type, modules::client_module* module);
|
||||
static diablo2::structures::unit* get_client_unit(uint32_t type, uint32_t guid);
|
||||
|
||||
private:
|
||||
//static void __fastcall game_loop_start();
|
||||
static void __fastcall handle_standart_packet(common::packet_header* packet, size_t size);
|
||||
static void __fastcall handle_cs_packet(common::packet_header* packet, size_t size);
|
||||
static void __fastcall handle_packet(common::packet_header* packet, size_t size);
|
||||
static void __fastcall game_tick();
|
||||
static int32_t __stdcall draw_game_ui();
|
||||
};
|
||||
}
|
||||
}
|
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace ui {
|
||||
namespace controls {
|
||||
class label;
|
||||
}
|
||||
}
|
||||
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class auto_gold_pickup final : public client_module {
|
||||
public:
|
||||
void init() override;
|
||||
void init_early() override;
|
||||
void handle_packet(common::packet_header* packet) override;
|
||||
void tick() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class auto_item_pickup final : public client_module {
|
||||
public:
|
||||
void init() override;
|
||||
void init_early() override;
|
||||
void handle_packet(common::packet_header* packet) override;
|
||||
void tick() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
18
include/d2tweaks/client/modules/autosort/autosort_client.h
Normal file
18
include/d2tweaks/client/modules/autosort/autosort_client.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
|
||||
//Inventory auto sort module client side
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class autosort final : public client_module {
|
||||
public:
|
||||
void init() override;
|
||||
void init_early() override;
|
||||
void handle_packet(common::packet_header* packet) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
28
include/d2tweaks/client/modules/client_module.h
Normal file
28
include/d2tweaks/client/modules/client_module.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#define MODULE_INIT(module_name) static d2_tweaks::client::modules::module_name g_instance;
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace common {
|
||||
struct packet_header;
|
||||
}
|
||||
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class client_module {
|
||||
public:
|
||||
virtual ~client_module() = default;
|
||||
client_module();
|
||||
|
||||
virtual void init() = 0;
|
||||
virtual void init_early() = 0;
|
||||
virtual void draw_ui();
|
||||
virtual void tick();
|
||||
virtual void handle_packet(common::packet_header* packet);
|
||||
virtual void handle_cs_packet(common::packet_header* packet);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
|
||||
//Display damage client side
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class damage_display final : public client_module {
|
||||
public:
|
||||
void init() override;
|
||||
void init_early() override;
|
||||
void handle_packet(common::packet_header* packet) override;
|
||||
void tick() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class item_drop_message final : public client_module {
|
||||
public:
|
||||
void init() override;
|
||||
void init_early() override;
|
||||
void handle_packet(common::packet_header* packet) override;
|
||||
static void GamePacketReceivedInterceptASM();
|
||||
static void __fastcall GamePacketReceivedIntercept(uint8_t* packet, size_t size);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
18
include/d2tweaks/client/modules/item_move/item_move_client.h
Normal file
18
include/d2tweaks/client/modules/item_move/item_move_client.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
|
||||
//Item moving between inventory pages (cube, inventory and stash) by ctrl+click client side
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class item_move final : public client_module {
|
||||
public:
|
||||
void init() override;
|
||||
void init_early() override;
|
||||
void handle_packet(common::packet_header* packet) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
15
include/d2tweaks/client/modules/loot_filter/loot_filter.h
Normal file
15
include/d2tweaks/client/modules/loot_filter/loot_filter.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class loot_filter final : public client_module {
|
||||
public:
|
||||
void init() override;
|
||||
void init_early() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <diablo2/structures/item_data.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace client {
|
||||
namespace modules {
|
||||
struct loot_filter_settings {
|
||||
size_t size; //struct size
|
||||
|
||||
bool alt_only;
|
||||
bool show_gold;
|
||||
bool show_runes;
|
||||
bool show_gems;
|
||||
|
||||
bool quality_settings[static_cast<size_t>(diablo2::structures::item_quality_t::ITEM_QUALITY_COUNT)];
|
||||
|
||||
char reserved[1004];
|
||||
|
||||
static loot_filter_settings& get();
|
||||
|
||||
static void save(const char* name);
|
||||
static void load(const char* name);
|
||||
static void remove(const char* name);
|
||||
|
||||
private:
|
||||
loot_filter_settings() : size(sizeof(loot_filter_settings)),
|
||||
alt_only(false), show_gold(true), show_runes(true), show_gems(true), reserved{}
|
||||
{
|
||||
memset(quality_settings, 0x1, sizeof quality_settings);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include <fw/singleton.h>
|
||||
|
||||
#include <d2tweaks/ui/menu.h>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct unit;
|
||||
enum class item_quality_t : unsigned;
|
||||
}
|
||||
}
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace ui {
|
||||
namespace controls {
|
||||
class checkbox;
|
||||
}
|
||||
}
|
||||
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class loot_filter_settings_menu final : public ui::menu, singleton<loot_filter_settings_menu> {
|
||||
ui::controls::checkbox* m_altonly;
|
||||
ui::controls::checkbox* m_show_gold;
|
||||
ui::controls::checkbox* m_show_runes;
|
||||
ui::controls::checkbox* m_show_gems;
|
||||
|
||||
void(__fastcall* m_draw_dropped_items_names_original)(void*, void*);
|
||||
void(__fastcall* m_handle_dropped_items_original)(void*, void*);
|
||||
public:
|
||||
explicit loot_filter_settings_menu(token);
|
||||
|
||||
void reload_settings();
|
||||
|
||||
void draw() override;
|
||||
private:
|
||||
void register_misc_checkboxes();
|
||||
void register_quality_checkboxes();
|
||||
|
||||
void update_alt_only(bool value);
|
||||
void update_show_gold(bool value);
|
||||
void update_show_runes(bool value);
|
||||
void update_show_gems(bool value);
|
||||
|
||||
void update_quality_allowance(bool value, diablo2::structures::item_quality_t quality);
|
||||
void register_quality_checkbox(const std::string& name, diablo2::structures::item_quality_t quality);
|
||||
|
||||
void setup_hooks();
|
||||
void setup_alt_hook() const;
|
||||
|
||||
static bool is_gold(diablo2::structures::unit* item);
|
||||
static bool is_rune(diablo2::structures::unit* item);
|
||||
static bool is_gem(diablo2::structures::unit* item);
|
||||
|
||||
static bool __fastcall check_alt_item(diablo2::structures::unit* unit);
|
||||
|
||||
//draw labels over dropped items
|
||||
static void __fastcall draw_dropped_items_names(diablo2::structures::unit* unit, void* edx);
|
||||
|
||||
//handle hovering over item and actual click
|
||||
static void __fastcall handle_dropped_items(diablo2::structures::unit* unit, void* edx);
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <fw/singleton.h>
|
||||
#include <d2tweaks/ui/menu.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace ui {
|
||||
namespace controls {
|
||||
class button;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class loot_filter_settings_toggle_menu final : public ui::menu, singleton<loot_filter_settings_toggle_menu> {
|
||||
ui::controls::button* m_toggle_filter_settings_btn;
|
||||
menu* m_filter_settings_menu;
|
||||
bool m_show;
|
||||
public:
|
||||
explicit loot_filter_settings_toggle_menu(token);
|
||||
|
||||
void toggle_filter_settings_click();
|
||||
|
||||
void draw() override;
|
||||
|
||||
bool key_event(uint32_t key, bool up) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
|
||||
//Client side patches that are too small to implement as separate modules
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class small_patches final : public client_module {
|
||||
public:
|
||||
void init() override;
|
||||
void init_early() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
18
include/d2tweaks/client/modules/test/test.h
Normal file
18
include/d2tweaks/client/modules/test/test.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
|
||||
//Test client side module
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class test final : public client_module {
|
||||
public:
|
||||
void init() override;
|
||||
void init_early() override;
|
||||
void handle_packet(common::packet_header* packet) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class trader_update final : public client_module {
|
||||
public:
|
||||
void init() override;
|
||||
void init_early() override;
|
||||
void handle_packet(common::packet_header* packet) override;
|
||||
void handle_cs_packet(common::packet_header* packet) override;
|
||||
void tick() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
18
include/d2tweaks/client/modules/transmute/transmute_client.h
Normal file
18
include/d2tweaks/client/modules/transmute/transmute_client.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <d2tweaks/client/modules/client_module.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace client {
|
||||
namespace modules {
|
||||
class transmute final : public client_module {
|
||||
public:
|
||||
void init() override;
|
||||
void init_early() override;
|
||||
void handle_packet(common::packet_header* packet) override;
|
||||
void tick() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
33
include/d2tweaks/common/asset.h
Normal file
33
include/d2tweaks/common/asset.h
Normal file
@@ -0,0 +1,33 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace common {
|
||||
enum mpq_file_type_t;
|
||||
|
||||
class asset final {
|
||||
std::string m_path;
|
||||
void* m_asset;
|
||||
mpq_file_type_t m_type;
|
||||
public:
|
||||
explicit asset(const std::string& path, void* asset, mpq_file_type_t type) : m_path(path), m_asset(asset), m_type(type) {}
|
||||
|
||||
const std::string& get_path() const {
|
||||
return m_path;
|
||||
}
|
||||
|
||||
void* get() const {
|
||||
return m_asset;
|
||||
}
|
||||
|
||||
mpq_file_type_t get_type() const {
|
||||
return m_type;
|
||||
}
|
||||
|
||||
void update(void* asset) {
|
||||
m_asset = asset;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
35
include/d2tweaks/common/asset_manager.h
Normal file
35
include/d2tweaks/common/asset_manager.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <fw/singleton.h>
|
||||
|
||||
#include <functional>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace common {
|
||||
class asset;
|
||||
|
||||
enum mpq_file_type_t {
|
||||
MPQ_FILE_TYPE_UNKNOWN = -1,
|
||||
|
||||
MPQ_FILE_TYPE_DC6 = 0,
|
||||
MPQ_FILE_TYPE_DCC = 1,
|
||||
|
||||
MPQ_FILE_TYPE_COUNT
|
||||
};
|
||||
|
||||
class asset_manager : public singleton<asset_manager> {
|
||||
std::unordered_map<std::string, asset*> m_assets;
|
||||
public:
|
||||
explicit asset_manager(token);
|
||||
|
||||
void init();
|
||||
|
||||
asset* get_mpq_file(const std::string& path, mpq_file_type_t type);
|
||||
private:
|
||||
void* load_asset_data(const std::string& path, mpq_file_type_t type);
|
||||
static int32_t __stdcall reload();
|
||||
};
|
||||
}
|
||||
}
|
19
include/d2tweaks/common/common.h
Normal file
19
include/d2tweaks/common/common.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <fw/singleton.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace common {
|
||||
struct packet_header;
|
||||
|
||||
class common : public singleton<common> {
|
||||
public:
|
||||
explicit common(token);
|
||||
|
||||
void init();
|
||||
|
||||
bool get_packet_size_cs(packet_header* packet, size_t& size);
|
||||
bool get_packet_size_sc(packet_header* packet, size_t& size);
|
||||
};
|
||||
}
|
||||
}
|
391
include/d2tweaks/common/protocol.h
Normal file
391
include/d2tweaks/common/protocol.h
Normal file
@@ -0,0 +1,391 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace common {
|
||||
#pragma pack(push,1)
|
||||
#define MAX_MSG_SIZE = 0x204
|
||||
|
||||
enum packet_types_cs_t {
|
||||
PACKET_0x00,
|
||||
PACKET_0x01,
|
||||
PACKET_0x02,
|
||||
PACKET_0x03,
|
||||
PACKET_0x04,
|
||||
PACKET_0x05,
|
||||
PACKET_0x06,
|
||||
PACKET_0x07,
|
||||
PACKET_0x08,
|
||||
PACKET_0x09,
|
||||
PACKET_0x0A,
|
||||
PACKET_0x0B,
|
||||
PACKET_0x0C,
|
||||
PACKET_0x0D,
|
||||
PACKET_0x0E,
|
||||
PACKET_0x0F,
|
||||
PACKET_0x10,
|
||||
PACKET_0x11,
|
||||
PACKET_0x12,
|
||||
PACKET_0x13,
|
||||
PACKET_0x14,
|
||||
PACKET_0x15,
|
||||
PACKET_0x16,
|
||||
PACKET_0x17,
|
||||
PACKET_0x18,
|
||||
PACKET_0x19,
|
||||
PACKET_0x1A,
|
||||
PACKET_0x1B,
|
||||
PACKET_0x1C,
|
||||
PACKET_0x1D,
|
||||
PACKET_0x1E,
|
||||
PACKET_0x1F,
|
||||
PACKET_0x20,
|
||||
PACKET_0x21,
|
||||
PACKET_0x22,
|
||||
PACKET_0x23,
|
||||
PACKET_0x24,
|
||||
PACKET_0x25,
|
||||
PACKET_0x26,
|
||||
PACKET_0x27,
|
||||
PACKET_0x28,
|
||||
PACKET_0x29,
|
||||
PACKET_0x2A,
|
||||
PACKET_0x2B,
|
||||
PACKET_0x2C,
|
||||
PACKET_0x2D,
|
||||
PACKET_0x2E,
|
||||
PACKET_0x2F,
|
||||
PACKET_0x30,
|
||||
PACKET_0x31,
|
||||
PACKET_0x32,
|
||||
PACKET_0x33,
|
||||
PACKET_0x34,
|
||||
PACKET_0x35,
|
||||
PACKET_0x36,
|
||||
PACKET_0x37,
|
||||
PACKET_0x38,
|
||||
PACKET_0x39,
|
||||
PACKET_0x3A,
|
||||
PACKET_0x3B,
|
||||
PACKET_0x3C,
|
||||
PACKET_0x3D,
|
||||
PACKET_0x3E,
|
||||
PACKET_0x3F,
|
||||
PACKET_0x40,
|
||||
PACKET_0x41,
|
||||
PACKET_0x42,
|
||||
PACKET_0x43,
|
||||
PACKET_0x44,
|
||||
PACKET_0x45,
|
||||
PACKET_0x46,
|
||||
PACKET_0x47,
|
||||
PACKET_0x48,
|
||||
PACKET_0x49,
|
||||
PACKET_0x4A,
|
||||
PACKET_0x4B,
|
||||
PACKET_0x4C,
|
||||
PACKET_0x4D,
|
||||
PACKET_0x4E,
|
||||
PACKET_0x4F,
|
||||
PACKET_0x50,
|
||||
PACKET_0x51,
|
||||
PACKET_0x52,
|
||||
PACKET_0x53,
|
||||
PACKET_0x54,
|
||||
PACKET_0x55,
|
||||
PACKET_0x56,
|
||||
PACKET_0x57,
|
||||
PACKET_0x58,
|
||||
PACKET_0x59,
|
||||
PACKET_0x5A,
|
||||
PACKET_0x5B,
|
||||
PACKET_0x5C,
|
||||
PACKET_0x5D,
|
||||
PACKET_0x5E,
|
||||
PACKET_0x5F,
|
||||
PACKET_0x60,
|
||||
PACKET_0x61,
|
||||
PACKET_0x62,
|
||||
PACKET_0x63,
|
||||
PACKET_0x64,
|
||||
PACKET_0x65,
|
||||
PACKET_0x66,
|
||||
PACKET_0x67,
|
||||
PACKET_0x68,
|
||||
PACKET_0x69,
|
||||
PACKET_0x6A,
|
||||
PACKET_0x6B,
|
||||
PACKET_0x6C,
|
||||
PACKET_0x6D,
|
||||
PACKET_0x6E,
|
||||
PACKET_0x6F,
|
||||
PACKET_0x70,
|
||||
PACKET_0x71,
|
||||
PACKET_0x72,
|
||||
PACKET_0x73,
|
||||
PACKET_0x74,
|
||||
PACKET_0x75,
|
||||
PACKET_0x76,
|
||||
PACKET_0x77,
|
||||
PACKET_0x78,
|
||||
PACKET_0x79,
|
||||
PACKET_0x7A,
|
||||
PACKET_0x7B,
|
||||
PACKET_0x7C,
|
||||
PACKET_0x7D,
|
||||
PACKET_0x7E,
|
||||
PACKET_0x7F,
|
||||
PACKET_0x80,
|
||||
PACKET_0x81,
|
||||
PACKET_0x82,
|
||||
PACKET_0x83,
|
||||
PACKET_0x84,
|
||||
PACKET_0x85,
|
||||
PACKET_0x86,
|
||||
PACKET_0x87,
|
||||
PACKET_0x88,
|
||||
PACKET_0x89,
|
||||
PACKET_0x8A,
|
||||
PACKET_0x8B,
|
||||
PACKET_0x8C,
|
||||
PACKET_0x8D,
|
||||
PACKET_0x8E,
|
||||
PACKET_0x8F,
|
||||
PACKET_0x90,
|
||||
PACKET_0x91,
|
||||
PACKET_0x92,
|
||||
PACKET_0x93,
|
||||
PACKET_0x94,
|
||||
PACKET_0x95,
|
||||
PACKET_0x96,
|
||||
PACKET_0x97,
|
||||
PACKET_0x98,
|
||||
PACKET_0x99,
|
||||
PACKET_0x9A,
|
||||
PACKET_0x9B,
|
||||
PACKET_0x9C,
|
||||
PACKET_0x9D,
|
||||
PACKET_0x9E,
|
||||
PACKET_0x9F,
|
||||
PACKET_0xA0,
|
||||
PACKET_0xA1,
|
||||
PACKET_0xA2,
|
||||
PACKET_0xA3,
|
||||
PACKET_0xA4,
|
||||
PACKET_0xA5,
|
||||
PACKET_0xA6,
|
||||
PACKET_0xA7,
|
||||
PACKET_0xA8,
|
||||
PACKET_0xA9,
|
||||
PACKET_0xAA,
|
||||
PACKET_0xAB,
|
||||
PACKET_0xAC,
|
||||
PACKET_0xAD,
|
||||
PACKET_0xAE,
|
||||
PACKET_0xAF,
|
||||
PACKET_0xB0,
|
||||
PACKET_0xB1,
|
||||
PACKET_0xB2,
|
||||
PACKET_0xB3,
|
||||
PACKET_0xB4
|
||||
};
|
||||
|
||||
enum message_types_t {
|
||||
MESSAGE_TYPE_ITEM_MOVE = 1,
|
||||
MESSAGE_TYPE_INVENTORY_SORT,
|
||||
MESSAGE_TYPE_DAMAGE_INFO,
|
||||
MESSAGE_TYPE_GOLD_PICKUP_INFO,
|
||||
MESSAGE_TYPE_ITEM_PICKUP_INFO,
|
||||
MESSAGE_TYPE_ITEM_DROPPED_INFO,
|
||||
MESSAGE_TYPE_TRANSMUTE,
|
||||
MESSAGE_TYPE_TRADER_UPDATE,
|
||||
|
||||
MESSAGE_TYPE_COUNT
|
||||
};
|
||||
|
||||
enum damage_type_t : uint8_t {
|
||||
DAMAGE_TYPE_PHYSICAL = 0,
|
||||
|
||||
DAMAGE_TYPE_COLD = 1,
|
||||
DAMAGE_TYPE_FIRE = 2,
|
||||
DAMAGE_TYPE_LIGHTNING = 3,
|
||||
DAMAGE_TYPE_POISON = 4,
|
||||
DAMAGE_TYPE_MAGIC = 5,
|
||||
|
||||
DAMAGE_TYPE_COUNT,
|
||||
DAMAGE_TYPE_UNKNOWN = 0xFF
|
||||
};
|
||||
|
||||
struct packet_header {
|
||||
uint8_t d2_packet_type;
|
||||
uint8_t message_type;
|
||||
|
||||
packet_header() : d2_packet_type(0xBB), message_type(0) {}
|
||||
};
|
||||
|
||||
struct d2_entity_action_cs : packet_header {
|
||||
uint32_t action;
|
||||
uint32_t entity_id;
|
||||
uint32_t complement;
|
||||
|
||||
d2_entity_action_cs() : action(0), entity_id(0), complement(0) {}
|
||||
};
|
||||
|
||||
struct item_move_cs : packet_header {
|
||||
uint32_t item_guid;
|
||||
uint8_t target_page;
|
||||
|
||||
item_move_cs() : item_guid(0), target_page(0) {
|
||||
message_type = MESSAGE_TYPE_ITEM_MOVE;
|
||||
}
|
||||
};
|
||||
|
||||
struct item_move_sc : packet_header {
|
||||
uint32_t item_guid;
|
||||
uint32_t tx;
|
||||
uint32_t ty;
|
||||
uint8_t target_page;
|
||||
|
||||
item_move_sc() : item_guid(0), tx(0), ty(0), target_page(0) {
|
||||
message_type = MESSAGE_TYPE_ITEM_MOVE;
|
||||
}
|
||||
};
|
||||
|
||||
struct inventory_sort_cs : packet_header {
|
||||
uint8_t page;
|
||||
|
||||
inventory_sort_cs() : page(0) {
|
||||
message_type = MESSAGE_TYPE_INVENTORY_SORT;
|
||||
}
|
||||
};
|
||||
|
||||
struct inventory_sort_sc : packet_header {
|
||||
uint8_t page;
|
||||
uint8_t tx;
|
||||
uint8_t ty;
|
||||
uint32_t guid;
|
||||
|
||||
inventory_sort_sc() : page(0), tx(0), ty(0), guid(0) {
|
||||
message_type = MESSAGE_TYPE_INVENTORY_SORT;
|
||||
}
|
||||
};
|
||||
|
||||
struct damage_info_cs : packet_header {
|
||||
uint8_t state; //on or off
|
||||
|
||||
damage_info_cs() : state(0) {
|
||||
message_type = MESSAGE_TYPE_DAMAGE_INFO;
|
||||
}
|
||||
};
|
||||
|
||||
struct damage_info_sc : packet_header {
|
||||
uint8_t unit_type;
|
||||
uint32_t guid;
|
||||
damage_type_t damage_type;
|
||||
uint32_t damage;
|
||||
|
||||
|
||||
uint32_t currentHp; // New field for current hit points
|
||||
uint32_t maxHp; // New field for maximum hit points
|
||||
|
||||
damage_info_sc() : unit_type(0), guid(0), damage_type(DAMAGE_TYPE_UNKNOWN), damage(0), currentHp(0), maxHp(0) {
|
||||
message_type = MESSAGE_TYPE_DAMAGE_INFO;
|
||||
}
|
||||
};
|
||||
|
||||
struct gold_pickup_info_sc : packet_header {
|
||||
uint32_t gold;
|
||||
gold_pickup_info_sc() : gold(0) {
|
||||
message_type = MESSAGE_TYPE_GOLD_PICKUP_INFO;
|
||||
}
|
||||
};
|
||||
|
||||
struct gold_pickup_info_cs : packet_header {
|
||||
uint32_t item_guid;
|
||||
gold_pickup_info_cs() : item_guid(0) {
|
||||
message_type = MESSAGE_TYPE_GOLD_PICKUP_INFO;
|
||||
}
|
||||
};
|
||||
|
||||
struct item_pickup_info_cs : packet_header {
|
||||
uint32_t item_guid;
|
||||
item_pickup_info_cs() : item_guid(0) {
|
||||
message_type = MESSAGE_TYPE_ITEM_PICKUP_INFO;
|
||||
}
|
||||
};
|
||||
|
||||
struct item_pickup_info_sc : packet_header {
|
||||
bool inventory_full;
|
||||
item_pickup_info_sc() : inventory_full(false) {
|
||||
message_type = MESSAGE_TYPE_ITEM_PICKUP_INFO;
|
||||
}
|
||||
};
|
||||
|
||||
struct item_dropped_info_cs : packet_header {
|
||||
uint16_t item_id;
|
||||
uint8_t code[4];
|
||||
item_dropped_info_cs() : item_id(0), code{ 0 } {
|
||||
message_type = MESSAGE_TYPE_ITEM_DROPPED_INFO;
|
||||
}
|
||||
};
|
||||
|
||||
struct item_dropped_info_sc : packet_header {
|
||||
uint32_t item;
|
||||
uint8_t code[4];
|
||||
uint8_t quality;
|
||||
uint8_t showthis;
|
||||
uint8_t namestr[130]; //130
|
||||
uint8_t index_arr_itemtype;
|
||||
uint8_t arr_itemtype_codestr_equivstr[20][5];
|
||||
item_dropped_info_sc() : item(0), quality(0), showthis(0), index_arr_itemtype(0), code{ 0 }, arr_itemtype_codestr_equivstr{ 0 }, namestr{ 0 } {
|
||||
message_type = MESSAGE_TYPE_ITEM_DROPPED_INFO;
|
||||
}
|
||||
};
|
||||
|
||||
struct transmute_info_sc : packet_header {
|
||||
uint32_t item_guid;
|
||||
uint32_t tx;
|
||||
uint32_t ty;
|
||||
uint8_t target_page;
|
||||
uint8_t command;
|
||||
|
||||
transmute_info_sc() : item_guid(0), tx(0), ty(0), target_page(0), command(0) {
|
||||
message_type = MESSAGE_TYPE_TRANSMUTE;
|
||||
}
|
||||
};
|
||||
|
||||
struct transmute_info_cs : packet_header {
|
||||
uint32_t item_guid;
|
||||
uint8_t target_page;
|
||||
uint8_t command;
|
||||
bool transmute_start_flag;
|
||||
|
||||
transmute_info_cs() : item_guid(0), target_page(0), command(0), transmute_start_flag(0) {
|
||||
message_type = MESSAGE_TYPE_TRANSMUTE;
|
||||
}
|
||||
};
|
||||
|
||||
struct trader_update_cs : packet_header {
|
||||
uint32_t npc_id;
|
||||
uint32_t client_id;
|
||||
uint8_t command;
|
||||
bool is_gamble_menu_open;
|
||||
trader_update_cs() : npc_id(0), client_id(0), command(0), is_gamble_menu_open(0) {
|
||||
message_type = MESSAGE_TYPE_TRADER_UPDATE;
|
||||
}
|
||||
};
|
||||
|
||||
struct trader_update_sc : packet_header {
|
||||
uint32_t npc_id;
|
||||
uint32_t client_id;
|
||||
uint8_t command;
|
||||
bool is_gamble_menu_open;
|
||||
trader_update_sc() : npc_id(0), client_id(0), command(0), is_gamble_menu_open(0) {
|
||||
message_type = MESSAGE_TYPE_TRADER_UPDATE;
|
||||
}
|
||||
};
|
||||
|
||||
#pragma pack(pop)
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/server/modules/server_module.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace server {
|
||||
class server;
|
||||
|
||||
namespace modules {
|
||||
class auto_gold_pickup final : public server_module {
|
||||
public:
|
||||
void init() override;
|
||||
void tick(diablo2::structures::game* game, diablo2::structures::unit* unit) override;
|
||||
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) override;
|
||||
bool au_pickup_gold(diablo2::structures::game* game, diablo2::structures::unit* unit, diablo2::structures::unit* item);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,19 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/server/modules/server_module.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace server {
|
||||
class server;
|
||||
|
||||
namespace modules {
|
||||
class auto_item_pickup final : public server_module {
|
||||
public:
|
||||
void init() override;
|
||||
void tick(diablo2::structures::game* game, diablo2::structures::unit* unit) override;
|
||||
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) override;
|
||||
bool au_pickup_item(diablo2::structures::game* game, diablo2::structures::unit* unit, uint32_t guid);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
35
include/d2tweaks/server/modules/autosort/autosort_server.h
Normal file
35
include/d2tweaks/server/modules/autosort/autosort_server.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <d2tweaks/server/modules/server_module.h>
|
||||
|
||||
//Inventory auto sort module server side
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct game;
|
||||
struct inventory;
|
||||
struct unit;
|
||||
}
|
||||
}
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace server {
|
||||
class server;
|
||||
|
||||
namespace modules {
|
||||
class autosort final : public server_module {
|
||||
public:
|
||||
void init() override;
|
||||
|
||||
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player,
|
||||
common::packet_header* packet) override;
|
||||
private:
|
||||
bool sort(diablo2::structures::game* game, diablo2::structures::unit* player, uint8_t page);
|
||||
bool find_free_space(diablo2::structures::inventory* inv,
|
||||
diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y, bool isCharmZone);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <d2tweaks/server/modules/server_module.h>
|
||||
|
||||
//Display damage server side
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct inventory;
|
||||
struct game;
|
||||
struct unit;
|
||||
}
|
||||
}
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace server {
|
||||
class server;
|
||||
|
||||
namespace modules {
|
||||
class damage_display final : public server_module {
|
||||
public:
|
||||
void init() override;
|
||||
|
||||
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player,
|
||||
common::packet_header* packet) override;
|
||||
void tick(diablo2::structures::game* game, diablo2::structures::unit* unit) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/server/modules/server_module.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace server {
|
||||
class server;
|
||||
|
||||
namespace modules {
|
||||
class identify_on_pickup final : public server_module {
|
||||
public:
|
||||
void init() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/server/modules/server_module.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace server {
|
||||
class server;
|
||||
|
||||
namespace modules {
|
||||
class item_drop_message final : public server_module {
|
||||
public:
|
||||
void init() override;
|
||||
void tick(diablo2::structures::game* game, diablo2::structures::unit* unit) override;
|
||||
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
34
include/d2tweaks/server/modules/item_move/item_move_server.h
Normal file
34
include/d2tweaks/server/modules/item_move/item_move_server.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <d2tweaks/server/modules/server_module.h>
|
||||
|
||||
//Item moving between inventory pages (cube, inventory and stash) by ctrl+click server side
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct inventory;
|
||||
struct game;
|
||||
struct unit;
|
||||
}
|
||||
}
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace server {
|
||||
class server;
|
||||
|
||||
namespace modules {
|
||||
class item_move final : public server_module {
|
||||
public:
|
||||
void init() override;
|
||||
|
||||
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player,
|
||||
common::packet_header* packet) override;
|
||||
private:
|
||||
bool find_free_space(diablo2::structures::inventory* inv,
|
||||
diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
38
include/d2tweaks/server/modules/server_module.h
Normal file
38
include/d2tweaks/server/modules/server_module.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
#include <stdint.h>
|
||||
#define MODULE_INIT(module_name) static d2_tweaks::server::modules::module_name g_instance;
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct game;
|
||||
struct unit;
|
||||
}
|
||||
}
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace common {
|
||||
struct packet_header;
|
||||
}
|
||||
|
||||
namespace server {
|
||||
namespace modules {
|
||||
class server_module {
|
||||
public:
|
||||
virtual ~server_module() = default;
|
||||
server_module();
|
||||
|
||||
virtual void init() = 0;
|
||||
|
||||
/**
|
||||
* \brief
|
||||
* \param game
|
||||
* \param player
|
||||
* \param packet
|
||||
* \return true - block further packet processing, false - pass packet to game
|
||||
*/
|
||||
virtual bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet);
|
||||
virtual void tick(diablo2::structures::game* game, diablo2::structures::unit* unit);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
16
include/d2tweaks/server/modules/test/test.h
Normal file
16
include/d2tweaks/server/modules/test/test.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/server/modules/server_module.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace server {
|
||||
class server;
|
||||
|
||||
namespace modules {
|
||||
class test final : public server_module {
|
||||
public:
|
||||
void init() override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <d2tweaks/server/modules/server_module.h>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct inventory;
|
||||
struct game;
|
||||
struct unit;
|
||||
}
|
||||
}
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace server {
|
||||
class server;
|
||||
|
||||
namespace modules {
|
||||
class trader_update final : public server_module {
|
||||
public:
|
||||
void init() override;
|
||||
void tick(diablo2::structures::game* game, diablo2::structures::unit* unit) override;
|
||||
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) override;
|
||||
|
||||
//private:
|
||||
// bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y);
|
||||
// bool send_to_cube(diablo2::structures::game* game, diablo2::structures::unit* player, diablo2::structures::unit* item);
|
||||
// bool move_item_to(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
32
include/d2tweaks/server/modules/transmute/transmute_server.h
Normal file
32
include/d2tweaks/server/modules/transmute/transmute_server.h
Normal file
@@ -0,0 +1,32 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <d2tweaks/server/modules/server_module.h>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct inventory;
|
||||
struct game;
|
||||
struct unit;
|
||||
}
|
||||
}
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace server {
|
||||
class server;
|
||||
|
||||
namespace modules {
|
||||
class transmute final : public server_module {
|
||||
public:
|
||||
void init() override;
|
||||
void tick(diablo2::structures::game* game, diablo2::structures::unit* unit) override;
|
||||
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet) override;
|
||||
|
||||
private:
|
||||
bool find_free_space(diablo2::structures::inventory* inv, diablo2::structures::unit* item, int32_t inventoryIndex, char page, uint32_t& x, uint32_t& y);
|
||||
bool send_to_cube(diablo2::structures::game* game, diablo2::structures::unit* player, diablo2::structures::unit* item);
|
||||
bool move_item_to(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
55
include/d2tweaks/server/server.h
Normal file
55
include/d2tweaks/server/server.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#include <fw/singleton.h>
|
||||
#include <d2tweaks/common/protocol.h>
|
||||
#include <functional>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
enum class unit_type_t;
|
||||
struct game;
|
||||
struct inventory;
|
||||
struct unit;
|
||||
struct net_client;
|
||||
}
|
||||
}
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace common {
|
||||
struct packet_header;
|
||||
}
|
||||
|
||||
namespace server {
|
||||
namespace modules {
|
||||
class server_module;
|
||||
}
|
||||
|
||||
class server : public singleton<server> {
|
||||
uint8_t m_module_id_counter;
|
||||
uint8_t m_tick_handler_id_counter;
|
||||
modules::server_module* m_modules[0xFF]{ nullptr }; //max 255 modules atm.
|
||||
modules::server_module* m_tick_handlers[0xFF]{ nullptr }; //max 255 modules atm.
|
||||
modules::server_module* m_packet_handlers[0xFF]{ nullptr }; //max 255 handlers because of one-byte packet header
|
||||
public:
|
||||
explicit server(token);
|
||||
|
||||
void init();
|
||||
|
||||
void send_packet(diablo2::structures::net_client* client, common::packet_header* packet, size_t size);
|
||||
bool handle_packet(diablo2::structures::game* game, diablo2::structures::unit* player, common::packet_header* packet);
|
||||
|
||||
void register_module(modules::server_module* module);
|
||||
|
||||
void register_tick_handler(modules::server_module* module);
|
||||
void register_packet_handler(common::message_types_t type, modules::server_module* module);
|
||||
|
||||
diablo2::structures::unit* get_server_unit(diablo2::structures::game* game, uint32_t guid, diablo2::structures::unit_type_t type);
|
||||
void iterate_server_units(diablo2::structures::game* game, diablo2::structures::unit_type_t type,
|
||||
const std::function<bool(diablo2::structures::unit*)>& cb);
|
||||
private:
|
||||
static int32_t __fastcall net_tick(diablo2::structures::game* game, diablo2::structures::unit* unit, int32_t a3, int32_t a4);
|
||||
};
|
||||
}
|
||||
}
|
91
include/d2tweaks/ui/controls/button.h
Normal file
91
include/d2tweaks/ui/controls/button.h
Normal file
@@ -0,0 +1,91 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/ui/controls/control.h>
|
||||
#include <d2tweaks/ui/rect.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
|
||||
#include <pugixml.hpp>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct cell_file;
|
||||
}
|
||||
}
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace common {
|
||||
class asset;
|
||||
}
|
||||
|
||||
namespace ui {
|
||||
namespace controls {
|
||||
class image;
|
||||
|
||||
class button final : public control {
|
||||
rect m_rect;
|
||||
image* m_image;
|
||||
int32_t m_frame_down;
|
||||
int32_t m_frame_up;
|
||||
int32_t m_click_sound;
|
||||
|
||||
bool m_is_down;
|
||||
int32_t m_current_frame;
|
||||
uint32_t m_res_count;
|
||||
|
||||
std::wstring m_popup;
|
||||
std::function<void()> m_on_click;
|
||||
|
||||
std::vector<respos> m_respos;
|
||||
public:
|
||||
button(menu* menu, const rect& rect, const std::function<void()>& onClick,
|
||||
common::asset* image, int32_t frameDown, int32_t frameUp, int32_t clickSound = -1);
|
||||
explicit button(menu* menu, const pugi::xml_node& node);
|
||||
virtual ~button();
|
||||
|
||||
void set_x(int32_t value) override;
|
||||
int32_t get_x() const override {
|
||||
return m_rect.get_x();
|
||||
}
|
||||
|
||||
void set_y(int32_t value) override;
|
||||
int32_t get_y() const override {
|
||||
return m_rect.get_y();
|
||||
}
|
||||
|
||||
std::wstring popup() const {
|
||||
return m_popup;
|
||||
}
|
||||
|
||||
void set_popup(const std::wstring& popup) {
|
||||
m_popup = popup;
|
||||
}
|
||||
|
||||
void set_current_frame(int32_t value) {
|
||||
m_current_frame = value;
|
||||
}
|
||||
|
||||
int32_t get_current_frame() {
|
||||
return m_current_frame;
|
||||
}
|
||||
|
||||
std::function<void()> get_on_click() const {
|
||||
return m_on_click;
|
||||
}
|
||||
|
||||
void set_on_click(const std::function<void()>& on_click) {
|
||||
m_on_click = on_click;
|
||||
}
|
||||
|
||||
void draw() override;
|
||||
void draw(int32_t offsetX, int32_t offsetY) override;
|
||||
|
||||
void left_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) override;
|
||||
void right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) override;
|
||||
|
||||
void key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
85
include/d2tweaks/ui/controls/checkbox.h
Normal file
85
include/d2tweaks/ui/controls/checkbox.h
Normal file
@@ -0,0 +1,85 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/ui/controls/control.h>
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <functional>
|
||||
#include <d2tweaks/ui/rect.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace common {
|
||||
class asset;
|
||||
}
|
||||
}
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace ui {
|
||||
namespace controls {
|
||||
class image;
|
||||
class label;
|
||||
|
||||
class checkbox : public control {
|
||||
rect m_rect;
|
||||
image* m_image;
|
||||
label* m_label;
|
||||
|
||||
std::wstring m_popup;
|
||||
|
||||
int32_t m_frame_checked;
|
||||
int32_t m_frame_unchecked;
|
||||
int32_t m_click_sound;
|
||||
|
||||
bool m_is_down;
|
||||
bool m_state;
|
||||
|
||||
std::function<void(bool)> m_on_click;
|
||||
public:
|
||||
explicit checkbox(menu* menu, const std::wstring& text, const rect& rect, const std::function<void()>& onClick,
|
||||
common::asset* image, int32_t frameChecked, int32_t frameUnchecked, int32_t clickSound = -1);
|
||||
explicit checkbox(menu* menu, const pugi::xml_node& node);
|
||||
|
||||
void set_x(int32_t value) override;
|
||||
int32_t get_x() const override {
|
||||
return m_rect.get_x();
|
||||
}
|
||||
|
||||
void set_y(int32_t value) override;
|
||||
int32_t get_y() const override {
|
||||
return m_rect.get_y();
|
||||
}
|
||||
|
||||
std::wstring popup() const {
|
||||
return m_popup;
|
||||
}
|
||||
|
||||
void set_popup(const std::wstring& popup) {
|
||||
m_popup = popup;
|
||||
}
|
||||
|
||||
std::function<void(bool)> get_on_click() const {
|
||||
return m_on_click;
|
||||
}
|
||||
|
||||
void set_on_click(const std::function<void(bool)>& on_click) {
|
||||
m_on_click = on_click;
|
||||
}
|
||||
|
||||
bool get_state() const {
|
||||
return m_state;
|
||||
}
|
||||
|
||||
void set_state(bool value) {
|
||||
m_state = value;
|
||||
}
|
||||
|
||||
void draw() override;
|
||||
void draw(int32_t offsetX, int32_t offsetY) override;
|
||||
|
||||
void left_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) override;
|
||||
void right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) override;
|
||||
|
||||
void key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
120
include/d2tweaks/ui/controls/control.h
Normal file
120
include/d2tweaks/ui/controls/control.h
Normal file
@@ -0,0 +1,120 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <cstdint>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace ui {
|
||||
class menu;
|
||||
|
||||
namespace controls {
|
||||
struct respos {
|
||||
uint32_t res_x;
|
||||
uint32_t res_y;
|
||||
uint32_t pos_x;
|
||||
uint32_t pos_y;
|
||||
};
|
||||
|
||||
class control {
|
||||
control* m_parent;
|
||||
menu* m_menu;
|
||||
|
||||
std::string m_name;
|
||||
bool m_enabled = false;
|
||||
bool m_visible = false;
|
||||
int32_t m_x;
|
||||
int32_t m_y;
|
||||
int32_t m_width;
|
||||
int32_t m_height;
|
||||
|
||||
public:
|
||||
control(menu* menu, int32_t x, int32_t y, int32_t w, int32_t h) : m_parent(nullptr),
|
||||
m_menu(menu),
|
||||
m_x(x), m_y(y),
|
||||
m_width(w), m_height(h) {}
|
||||
|
||||
virtual ~control() = default;
|
||||
|
||||
control* get_parent() const {
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
void set_parent(control* const parent) {
|
||||
m_parent = parent;
|
||||
}
|
||||
|
||||
menu* get_menu() const {
|
||||
return m_menu;
|
||||
}
|
||||
|
||||
void set_menu(menu* const menu) {
|
||||
m_menu = menu;
|
||||
}
|
||||
|
||||
std::string get_name() const {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
void set_name(const std::string& name) {
|
||||
m_name = name;
|
||||
}
|
||||
|
||||
virtual bool get_enabled() const {
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
virtual void set_enabled(bool value) {
|
||||
m_enabled = value;
|
||||
}
|
||||
|
||||
virtual bool get_visible() const {
|
||||
return m_visible;
|
||||
}
|
||||
|
||||
virtual void set_visible(bool value) {
|
||||
m_visible = value;
|
||||
}
|
||||
|
||||
virtual int32_t get_x() const {
|
||||
return m_x;
|
||||
}
|
||||
|
||||
virtual void set_x(int32_t value) {
|
||||
m_x = value;
|
||||
}
|
||||
|
||||
virtual int32_t get_y() const {
|
||||
return m_y;
|
||||
}
|
||||
|
||||
virtual void set_y(int32_t value) {
|
||||
m_y = value;
|
||||
}
|
||||
|
||||
virtual int32_t get_width() const {
|
||||
return m_width;
|
||||
}
|
||||
|
||||
virtual void set_width(const int32_t width) {
|
||||
m_width = width;
|
||||
}
|
||||
|
||||
virtual int32_t get_height() const {
|
||||
return m_height;
|
||||
}
|
||||
|
||||
virtual void set_height(const int32_t height) {
|
||||
m_height = height;
|
||||
}
|
||||
|
||||
virtual void draw() = 0;
|
||||
virtual void draw(int32_t offsetX, int32_t offsetY) = 0;
|
||||
|
||||
virtual void left_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) = 0;
|
||||
virtual void right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) = 0;
|
||||
|
||||
virtual void key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) = 0;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
31
include/d2tweaks/ui/controls/group.h
Normal file
31
include/d2tweaks/ui/controls/group.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/ui/controls/control.h>
|
||||
#include <pugixml.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace ui {
|
||||
class menu;
|
||||
|
||||
namespace controls {
|
||||
class group : public control {
|
||||
std::vector<control*> m_controls;
|
||||
public:
|
||||
explicit group(menu* menu, int32_t x, int32_t y);
|
||||
explicit group(menu* menu, const pugi::xml_node& node);
|
||||
|
||||
void draw() override;
|
||||
void draw(int32_t offsetX, int32_t offsetY) override;
|
||||
|
||||
void left_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) override;
|
||||
void right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) override;
|
||||
|
||||
void key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) override;
|
||||
|
||||
private:
|
||||
void add_control(control* control);
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
45
include/d2tweaks/ui/controls/image.h
Normal file
45
include/d2tweaks/ui/controls/image.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/ui/controls/control.h>
|
||||
#include <diablo2/structures/gfxdata.h>
|
||||
|
||||
#include <pugixml.hpp>
|
||||
#include <d2tweaks/ui/rect.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace common {
|
||||
class asset;
|
||||
}
|
||||
|
||||
namespace ui {
|
||||
namespace controls {
|
||||
class image : public control {
|
||||
common::asset* m_image;
|
||||
int32_t m_frame;
|
||||
|
||||
rect m_rect;
|
||||
bool m_block_click;
|
||||
diablo2::structures::gfxdata m_draw_info;
|
||||
public:
|
||||
explicit image(menu* menu, common::asset* image, int32_t x = 0, int32_t y = 0, int32_t frame = 0);
|
||||
explicit image(menu* menu, const pugi::xml_node& node);
|
||||
|
||||
void set_frame(int32_t frame) {
|
||||
m_frame = static_cast<uint32_t>(frame);
|
||||
}
|
||||
|
||||
int32_t get_frame() const {
|
||||
return static_cast<int32_t>(m_frame);
|
||||
}
|
||||
|
||||
void draw() override;
|
||||
void draw(int32_t offsetX, int32_t offsetY) override;
|
||||
|
||||
void left_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) override;
|
||||
void right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) override;
|
||||
|
||||
void key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
61
include/d2tweaks/ui/controls/label.h
Normal file
61
include/d2tweaks/ui/controls/label.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include <d2tweaks/ui/controls/control.h>
|
||||
#include <vector>
|
||||
#include <pugixml.hpp>
|
||||
|
||||
#include <diablo2/d2win.h>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace ui {
|
||||
namespace controls {
|
||||
|
||||
class label : public control {
|
||||
std::wstring m_text;
|
||||
bool m_text_owned;
|
||||
diablo2::ui_color_t m_color;
|
||||
diablo2::ui_font_t m_font;
|
||||
uint32_t m_res_count;
|
||||
std::vector<respos> m_respos;
|
||||
public:
|
||||
explicit label(menu* menu, const std::wstring& text, int32_t x = 0, int32_t y = 0,
|
||||
diablo2::ui_color_t color = diablo2::UI_COLOR_WHITE,
|
||||
diablo2::ui_font_t font = diablo2::UI_FONT_16);
|
||||
explicit label(menu* menu, const pugi::xml_node& node);
|
||||
|
||||
void set_text(const std::wstring& text) {
|
||||
m_text = text;
|
||||
}
|
||||
|
||||
const std::wstring& get_text() const {
|
||||
return m_text;
|
||||
}
|
||||
|
||||
|
||||
diablo2::ui_color_t get_color() const {
|
||||
return m_color;
|
||||
}
|
||||
|
||||
void set_color(const diablo2::ui_color_t color) {
|
||||
m_color = color;
|
||||
}
|
||||
|
||||
diablo2::ui_font_t get_font() const {
|
||||
return m_font;
|
||||
}
|
||||
|
||||
void set_font(const diablo2::ui_font_t font) {
|
||||
m_font = font;
|
||||
}
|
||||
|
||||
void draw() override;
|
||||
void draw(int32_t offsetX, int32_t offsetY) override;
|
||||
|
||||
void left_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) override;
|
||||
void right_mouse(int32_t offsetX, int32_t offsetY, bool up, bool& block) override;
|
||||
|
||||
void key_event(int32_t offsetX, int32_t offsetY, uint32_t key, bool up, bool& block) override;
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
88
include/d2tweaks/ui/menu.h
Normal file
88
include/d2tweaks/ui/menu.h
Normal file
@@ -0,0 +1,88 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace ui {
|
||||
namespace controls {
|
||||
class control;
|
||||
}
|
||||
|
||||
struct respos {
|
||||
uint32_t res_x;
|
||||
uint32_t res_y;
|
||||
uint32_t pos_x;
|
||||
uint32_t pos_y;
|
||||
};
|
||||
|
||||
class menu {
|
||||
bool m_enabled = false;
|
||||
bool m_visible = false;
|
||||
|
||||
std::string m_name;
|
||||
|
||||
int32_t m_x;
|
||||
int32_t m_y;
|
||||
int32_t m_width;
|
||||
int32_t m_height;
|
||||
uint32_t m_res_count;
|
||||
|
||||
std::vector<controls::control*> m_controls;
|
||||
std::unordered_map<std::string, controls::control*> m_named_controls;
|
||||
std::vector<respos> m_respos;
|
||||
public:
|
||||
virtual ~menu() = default;
|
||||
|
||||
menu();
|
||||
|
||||
const std::vector<controls::control*>& get_controls() const {
|
||||
return m_controls;
|
||||
}
|
||||
|
||||
const std::string& get_name() const {
|
||||
return m_name;
|
||||
}
|
||||
|
||||
virtual bool get_enabled() const {
|
||||
return m_enabled;
|
||||
}
|
||||
|
||||
virtual void set_enabled(bool value) {
|
||||
m_enabled = value;
|
||||
}
|
||||
|
||||
virtual bool get_visible() const {
|
||||
return m_visible;
|
||||
}
|
||||
|
||||
virtual void set_visible(bool value) {
|
||||
m_visible = value;
|
||||
}
|
||||
|
||||
bool load_xml(const char* path);
|
||||
|
||||
template<typename TControl = controls::control>
|
||||
TControl* get_control(const std::string& name) {
|
||||
const auto it = m_named_controls.find(name);
|
||||
|
||||
if (it == m_named_controls.end())
|
||||
return nullptr;
|
||||
|
||||
return static_cast<TControl*>(it->second);
|
||||
}
|
||||
|
||||
virtual void add_control(controls::control* control);
|
||||
//virtual controls::control* get_control(const std::string& name);
|
||||
virtual void remove_control(controls::control* control);
|
||||
|
||||
virtual void draw();
|
||||
|
||||
virtual bool left_mouse(bool up);
|
||||
virtual bool right_mouse(bool up);
|
||||
|
||||
virtual bool key_event(uint32_t key, bool up);
|
||||
};
|
||||
}
|
||||
}
|
57
include/d2tweaks/ui/rect.h
Normal file
57
include/d2tweaks/ui/rect.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace ui {
|
||||
//Special ui rectangle with starting point in the left bottom corner
|
||||
class rect {
|
||||
int32_t m_x, m_y, m_w, m_h;
|
||||
public:
|
||||
rect() : m_x(0), m_y(0), m_w(0), m_h(0) {}
|
||||
rect(int32_t x, int32_t y, int32_t width, int32_t height) : m_x(x), m_y(y), m_w(width), m_h(height) {}
|
||||
|
||||
int32_t get_x() const {
|
||||
return m_x;
|
||||
}
|
||||
|
||||
void set_x(int32_t value) {
|
||||
m_x = value;
|
||||
}
|
||||
|
||||
int32_t get_y() const {
|
||||
return m_y;
|
||||
}
|
||||
|
||||
void set_y(int32_t value) {
|
||||
m_y = value;
|
||||
}
|
||||
|
||||
void set_width(int32_t value) {
|
||||
m_w = value;
|
||||
}
|
||||
|
||||
int32_t get_width() const {
|
||||
return m_w;
|
||||
}
|
||||
|
||||
void set_height(int32_t value) {
|
||||
m_h = value;
|
||||
}
|
||||
|
||||
int32_t get_height() const {
|
||||
return m_h;
|
||||
}
|
||||
|
||||
bool contains(int32_t x, int32_t y) const {
|
||||
return x >= m_x && x < m_x + m_w &&
|
||||
y > m_y - m_h && y <= m_y;
|
||||
}
|
||||
|
||||
bool contains(int32_t x, int32_t y, int32_t offsetX, int32_t offsetY) const {
|
||||
return x >= m_x + offsetX && x < m_x + offsetX + m_w &&
|
||||
y > m_y + offsetY - m_h && y <= m_y + offsetY;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
39
include/d2tweaks/ui/ui_manager.h
Normal file
39
include/d2tweaks/ui/ui_manager.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
|
||||
#include <fw/singleton.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
|
||||
namespace d2_tweaks {
|
||||
namespace ui {
|
||||
class menu;
|
||||
|
||||
class ui_manager final : public singleton<ui_manager> {
|
||||
std::vector<menu*> m_menus;
|
||||
|
||||
bool m_was_down_before_left = false;
|
||||
bool m_was_down_before_right = false;
|
||||
bool m_mouse_state_left = false;
|
||||
bool m_mouse_state_right = false;
|
||||
public:
|
||||
explicit ui_manager(token);
|
||||
|
||||
void add_menu(menu* m);
|
||||
menu* get_menu(const std::string& name);
|
||||
void remove_menu(menu* m);
|
||||
|
||||
void draw();
|
||||
private:
|
||||
static LRESULT __stdcall wnd_proc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
|
||||
void process_inputs();
|
||||
|
||||
bool process_left_mouse(bool up);
|
||||
bool process_right_mouse(bool up);
|
||||
|
||||
bool process_key_event(uint32_t key, bool up);
|
||||
};
|
||||
}
|
||||
}
|
89
include/diablo2/d2client.h
Normal file
89
include/diablo2/d2client.h
Normal file
@@ -0,0 +1,89 @@
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct gfxdata;
|
||||
struct unit;
|
||||
struct client_unit_list;
|
||||
struct cellfile;
|
||||
}
|
||||
|
||||
enum ui_window_t {
|
||||
UI_WINDOW_INTERFACE = 0x0,
|
||||
UI_WINDOW_INVENTORY = 0x01,
|
||||
UI_WINDOW_CHARACTER = 0x02,
|
||||
UI_WINDOW_MINISKILL = 0x03,
|
||||
UI_WINDOW_SKILL = 0x04,
|
||||
UI_WINDOW_CHAT = 0x05,
|
||||
UI_WINDOW_NPCMENU = 0x08,
|
||||
UI_WINDOW_MAINMENU = 0x09,
|
||||
UI_WINDOW_AUTOMAP = 0x0a,
|
||||
UI_WINDOW_CONFIG = 0x0b,
|
||||
UI_WINDOW_NPCSHOP = 0x0c,
|
||||
UI_WINDOW_ALTDOWN = 0x0d,
|
||||
UI_WINDOW_ANVIL = 0x0e,
|
||||
UI_WINDOW_QUEST = 0x0f,
|
||||
UI_WINDOW_QUESTLOG = 0x11,
|
||||
UI_WINDOW_STATUSAREA = 0x12,
|
||||
UI_WINDOW_WPMENU = 0x14,
|
||||
UI_WINDOW_MINIPANEL = 0x15,
|
||||
UI_WINDOW_PARTY = 0x16,
|
||||
UI_WINDOW_TRADE = 0x17,
|
||||
UI_WINDOW_MSGS = 0x18,
|
||||
UI_WINDOW_STASH = 0x19,
|
||||
UI_WINDOW_CUBE = 0x1a,
|
||||
UI_WINDOW_BELT = 0x1f,
|
||||
UI_WINDOW_HELP = 0x21,
|
||||
UI_WINDOW_MERC = 0x24,
|
||||
UI_WINDOW_SCROLL = 0x25
|
||||
};
|
||||
|
||||
class d2_client {
|
||||
public:
|
||||
static char* get_base();
|
||||
|
||||
static bool is_lod();
|
||||
|
||||
static structures::unit* get_local_player();
|
||||
static const char* get_local_player_name();
|
||||
static structures::client_unit_list* get_client_unit_list();
|
||||
|
||||
static int32_t get_view_offset_x();
|
||||
static int32_t get_view_offset_y();
|
||||
|
||||
static uint32_t get_mouse_x();
|
||||
static uint32_t get_mouse_y();
|
||||
static bool get_ui_window_state(ui_window_t window);
|
||||
static void* get_buysellbtn();
|
||||
|
||||
static void play_sound(uint32_t soundId, structures::unit* u, uint32_t ticks, BOOL prePick, uint32_t cache);
|
||||
|
||||
static structures::unit* get_unit_by_guid(int32_t type, int32_t guid);
|
||||
|
||||
static void send_to_server(void* data, size_t size);
|
||||
static void print_chat(wchar_t* string, uint32_t color);
|
||||
|
||||
static bool cache_gfx_data(structures::gfxdata* gfxData,
|
||||
structures::unit* unit,
|
||||
structures::cellfile* cellfFile,
|
||||
int32_t direction,
|
||||
int32_t frame,
|
||||
int32_t* outIndex,
|
||||
int8_t flags,
|
||||
int32_t colorTint);
|
||||
|
||||
static structures::cellfile* load_gfx_resource(char* path);
|
||||
static int32_t unload_gfx_resource(structures::cellfile* handle);
|
||||
static int32_t send_to_server_7(BYTE type, DWORD num, DWORD unk1, DWORD unk2);
|
||||
static uint32_t screen_height();
|
||||
static uint32_t screen_width();
|
||||
static uint32_t current_vendor_id();
|
||||
static uint32_t current_vendor_guid();
|
||||
static bool is_gamble_open();
|
||||
static uint8_t current_interact_menu();
|
||||
static void resync_vendor_inventory(structures::unit* ptNPC);
|
||||
};
|
||||
}
|
14
include/diablo2/d2cmp.h
Normal file
14
include/diablo2/d2cmp.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct gfxdata;
|
||||
|
||||
class d2_cmp {
|
||||
public:
|
||||
static char* get_base();
|
||||
|
||||
static bool init_gfx_data(gfxdata* gfxdata);
|
||||
};
|
||||
}
|
||||
}
|
456
include/diablo2/d2common.h
Normal file
456
include/diablo2/d2common.h
Normal file
@@ -0,0 +1,456 @@
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
#include <cstdint>
|
||||
|
||||
//struct UniqueItemsBIN //size=0x14C (332)
|
||||
//{
|
||||
// WORD uniqueId; //+00
|
||||
// BYTE uk1[0x20]; //+02
|
||||
// WORD uniqueNameId; //+22
|
||||
// BYTE uk2[0x08]; //+24
|
||||
// union {
|
||||
// BYTE flag; //+2C
|
||||
// struct {
|
||||
// BYTE ukf : 2;
|
||||
// BYTE carry1 : 1;
|
||||
// BYTE ladder : 1;
|
||||
// };
|
||||
// };
|
||||
// BYTE uk3[0x11F]; //+2D
|
||||
//};
|
||||
|
||||
//struct DataTables//01EE6A20 * 01FDA2D0 //second comments=1.11
|
||||
//{
|
||||
// BYTE uk1[0xA78]; //+000
|
||||
// DWORD* monStats; //+A78 //1.11 and 1.10
|
||||
// BYTE uk2[0x4]; //+A7C
|
||||
// DWORD nbMonStats; //+A80 //1.11 and 1.10
|
||||
// BYTE uk3[0x108]; //+A84
|
||||
// DWORD* skilldesc; //+B8C
|
||||
// BYTE uk4[0x4]; //+B90
|
||||
// DWORD nbSkilldesc; //+B94
|
||||
// DWORD* skills; //+B98
|
||||
// BYTE uk5[0x4]; //+B9C
|
||||
// DWORD nbSkills; //+BA0
|
||||
// int* nbSkillsPerPlayer; //+BA4
|
||||
// int maxSkillsPerPlayer; //+BA8
|
||||
// WORD* playerSkills; //+BAC
|
||||
// BYTE uk6[0x14]; //+BB0
|
||||
// DWORD* charStats; //+BC4
|
||||
// DWORD nbCharStats; //+BC8
|
||||
// DWORD* itemStatCost; //+BCC
|
||||
// BYTE uk7[4]; //+BD0
|
||||
// DWORD nbItemStatCosts; //+BD4
|
||||
// WORD* statsDescPriority; //+BD8
|
||||
// DWORD nbStatsDescPriority;//+BDC
|
||||
// BYTE uk8[0x18]; //+BE0
|
||||
// DWORD* itemTypes; //+BF8
|
||||
// DWORD nbItemTypes; //+BFC
|
||||
// BYTE uk9[0x0C]; //+C00
|
||||
// DWORD* sets; //+C0C //1.11 and 1.10
|
||||
// DWORD nbSets; //+C10 //1.11 and 1.10
|
||||
// BYTE uk9b[0x4]; //+C14
|
||||
// DWORD* setItems; //+C18 //1.11 and 1.10
|
||||
// DWORD nbSetItems; //+C1C //1.11 and 1.10
|
||||
// BYTE uk10[0x4]; //+C20
|
||||
// UniqueItemsBIN* uniqueItems; //+C24 //1.11 and 1.10
|
||||
// DWORD nbUniqueItems; //+C28 //1.11 and 1.10
|
||||
// BYTE uk11[0x2C]; //+C2C
|
||||
// DWORD* levels; //+C58
|
||||
// DWORD nbLevels; //+C5C
|
||||
// BYTE uk12[0x64]; //+C60
|
||||
// DWORD* cubemain; //+CC4 //14C0 by 148 for 1.11
|
||||
// DWORD nbCubemain; //+CC8 //14C4 for 1.11
|
||||
// DWORD nbInventory; //+CCC
|
||||
// DWORD* inventory; //+CD0
|
||||
// BYTE uk13[0x04]; //+CD4
|
||||
// DWORD nbItems; //+CD8
|
||||
// DWORD* items; //+CDC
|
||||
// DWORD* itemsBis; //+CE0
|
||||
// BYTE uk14[0x1F8]; //+CDC
|
||||
// DWORD nbRunes; //+EDC
|
||||
// DWORD* runes; //+EE0
|
||||
//};
|
||||
//
|
||||
//extern DataTables* sgptDataTables;
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct unit;
|
||||
struct path;
|
||||
struct inventory;
|
||||
struct room;
|
||||
|
||||
struct items_line;
|
||||
struct item_types_line;
|
||||
}
|
||||
|
||||
enum unit_stats_t {
|
||||
UNIT_STAT_STRENGTH = 0x0,
|
||||
UNIT_STAT_ENERGY = 0x1,
|
||||
UNIT_STAT_DEXTERITY = 0x2,
|
||||
UNIT_STAT_VITALITY = 0x3,
|
||||
UNIT_STAT_STATPTS = 0x4,
|
||||
UNIT_STAT_NEWSKILLS = 0x5,
|
||||
UNIT_STAT_HITPOINTS = 0x6,
|
||||
UNIT_STAT_MAXHP = 0x7,
|
||||
UNIT_STAT_MANA = 0x8,
|
||||
UNIT_STAT_MAXMANA = 0x9,
|
||||
UNIT_STAT_STAMINA = 0xA,
|
||||
UNIT_STAT_MAXSTAMINA = 0xB,
|
||||
UNIT_STAT_LEVEL = 0xC,
|
||||
UNIT_STAT_EXPERIENCE = 0xD,
|
||||
UNIT_STAT_GOLD = 0xE,
|
||||
UNIT_STAT_GOLDBANK = 0xF,
|
||||
UNIT_STAT_ITEM_ARMOR_PERCENT = 0x10,
|
||||
UNIT_STAT_ITEM_MAXDAMAGE_PERCENT = 0x11,
|
||||
UNIT_STAT_ITEM_MINDAMAGE_PERCENT = 0x12,
|
||||
UNIT_STAT_TOHIT = 0x13,
|
||||
UNIT_STAT_TOBLOCK = 0x14,
|
||||
UNIT_STAT_MINDAMAGE = 0x15,
|
||||
UNIT_STAT_MAXDAMAGE = 0x16,
|
||||
UNIT_STAT_SECONDARY_MINDAMAGE = 0x17,
|
||||
UNIT_STAT_SECONDARY_MAXDAMAGE = 0x18,
|
||||
UNIT_STAT_DAMAGEPERCENT = 0x19,
|
||||
UNIT_STAT_MANARECOVERY = 0x1A,
|
||||
UNIT_STAT_MANARECOVERYBONUS = 0x1B,
|
||||
UNIT_STAT_STAMINARECOVERYBONUS = 0x1C,
|
||||
UNIT_STAT_LASTEXP = 0x1D,
|
||||
UNIT_STAT_NEXTEXP = 0x1E,
|
||||
UNIT_STAT_ARMORCLASS = 0x1F,
|
||||
UNIT_STAT_ARMORCLASS_VS_MISSILE = 0x20,
|
||||
UNIT_STAT_ARMORCLASS_VS_HTH = 0x21,
|
||||
UNIT_STAT_NORMAL_DAMAGE_REDUCTION = 0x22,
|
||||
UNIT_STAT_MAGIC_DAMAGE_REDUCTION = 0x23,
|
||||
UNIT_STAT_DAMAGERESIST = 0x24,
|
||||
UNIT_STAT_MAGICRESIST = 0x25,
|
||||
UNIT_STAT_MAXMAGICRESIST = 0x26,
|
||||
UNIT_STAT_FIRERESIST = 0x27,
|
||||
UNIT_STAT_MAXFIRERESIST = 0x28,
|
||||
UNIT_STAT_LIGHTRESIST = 0x29,
|
||||
UNIT_STAT_MAXLIGHTRESIST = 0x2A,
|
||||
UNIT_STAT_COLDRESIST = 0x2B,
|
||||
UNIT_STAT_MAXCOLDRESIST = 0x2C,
|
||||
UNIT_STAT_POISONRESIST = 0x2D,
|
||||
UNIT_STAT_MAXPOISONRESIST = 0x2E,
|
||||
UNIT_STAT_DAMAGEAURA = 0x2F,
|
||||
UNIT_STAT_FIREMINDAM = 0x30,
|
||||
UNIT_STAT_FIREMAXDAM = 0x31,
|
||||
UNIT_STAT_LIGHTMINDAM = 0x32,
|
||||
UNIT_STAT_LIGHTMAXDAM = 0x33,
|
||||
UNIT_STAT_MAGICMINDAM = 0x34,
|
||||
UNIT_STAT_MAGICMAXDAM = 0x35,
|
||||
UNIT_STAT_COLDMINDAM = 0x36,
|
||||
UNIT_STAT_COLDMAXDAM = 0x37,
|
||||
UNIT_STAT_COLDLENGTH = 0x38,
|
||||
UNIT_STAT_POISONMINDAM = 0x39,
|
||||
UNIT_STAT_POISONMAXDAM = 0x3A,
|
||||
UNIT_STAT_POISONLENGTH = 0x3B,
|
||||
UNIT_STAT_LIFEDRAINMINDAM = 0x3C,
|
||||
UNIT_STAT_LIFEDRAINMAXDAM = 0x3D,
|
||||
UNIT_STAT_MANADRAINMINDAM = 0x3E,
|
||||
UNIT_STAT_MANADRAINMAXDAM = 0x3F,
|
||||
UNIT_STAT_STAMDRAINMINDAM = 0x40,
|
||||
UNIT_STAT_STAMDRAINMAXDAM = 0x41,
|
||||
UNIT_STAT_STUNLENGTH = 0x42,
|
||||
UNIT_STAT_VELOCITYPERCENT = 0x43,
|
||||
UNIT_STAT_ATTACKRATE = 0x44,
|
||||
UNIT_STAT_OTHER_ANIMRATE = 0x45,
|
||||
UNIT_STAT_QUANTITY = 0x46,
|
||||
UNIT_STAT_VALUE = 0x47,
|
||||
UNIT_STAT_DURABILITY = 0x48,
|
||||
UNIT_STAT_MAXDURABILITY = 0x49,
|
||||
UNIT_STAT_HPREGEN = 0x4A,
|
||||
UNIT_STAT_ITEM_MAXDURABILITY_PERCENT = 0x4B,
|
||||
UNIT_STAT_ITEM_MAXHP_PERCENT = 0x4C,
|
||||
UNIT_STAT_ITEM_MAXMANA_PERCENT = 0x4D,
|
||||
UNIT_STAT_ITEM_ATTACKERTAKESDAMAGE = 0x4E,
|
||||
UNIT_STAT_ITEM_GOLDBONUS = 0x4F,
|
||||
UNIT_STAT_ITEM_MAGICBONUS = 0x50,
|
||||
UNIT_STAT_ITEM_KNOCKBACK = 0x51,
|
||||
UNIT_STAT_ITEM_TIMEDURATION = 0x52,
|
||||
UNIT_STAT_ITEM_ADDCLASSSKILLS = 0x53,
|
||||
UNIT_STAT_UNSENTPARAM1 = 0x54,
|
||||
UNIT_STAT_ITEM_ADDEXPERIENCE = 0x55,
|
||||
UNIT_STAT_ITEM_HEALAFTERKILL = 0x56,
|
||||
UNIT_STAT_ITEM_REDUCEDPRICES = 0x57,
|
||||
UNIT_STAT_ITEM_DOUBLEHERBDURATION = 0x58,
|
||||
UNIT_STAT_ITEM_LIGHTRADIUS = 0x59,
|
||||
UNIT_STAT_ITEM_LIGHTCOLOR = 0x5A,
|
||||
UNIT_STAT_ITEM_REQ_PERCENT = 0x5B,
|
||||
UNIT_STAT_ITEM_LEVELREQ = 0x5C,
|
||||
UNIT_STAT_ITEM_FASTERATTACKRATE = 0x5D,
|
||||
UNIT_STAT_ITEM_LEVELREQPCT = 0x5E,
|
||||
UNIT_STAT_LASTBLOCKFRAME = 0x5F,
|
||||
UNIT_STAT_ITEM_FASTERMOVEVELOCITY = 0x60,
|
||||
UNIT_STAT_ITEM_NONCLASSSKILL = 0x61,
|
||||
UNIT_STAT_STATE = 0x62,
|
||||
UNIT_STAT_ITEM_FASTERGETHITRATE = 0x63,
|
||||
UNIT_STAT_MONSTER_PLAYERCOUNT = 0x64,
|
||||
UNIT_STAT_SKILL_POISON_OVERRIDE_LENGTH = 0x65,
|
||||
UNIT_STAT_ITEM_FASTERBLOCKRATE = 0x66,
|
||||
UNIT_STAT_SKILL_BYPASS_UNDEAD = 0x67,
|
||||
UNIT_STAT_SKILL_BYPASS_DEMONS = 0x68,
|
||||
UNIT_STAT_ITEM_FASTERCASTRATE = 0x69,
|
||||
UNIT_STAT_SKILL_BYPASS_BEASTS = 0x6A,
|
||||
UNIT_STAT_ITEM_SINGLESKILL = 0x6B,
|
||||
UNIT_STAT_ITEM_RESTINPEACE = 0x6C,
|
||||
UNIT_STAT_CURSE_RESISTANCE = 0x6D,
|
||||
UNIT_STAT_ITEM_POISONLENGTHRESIST = 0x6E,
|
||||
UNIT_STAT_ITEM_NORMALDAMAGE = 0x6F,
|
||||
UNIT_STAT_ITEM_HOWL = 0x70,
|
||||
UNIT_STAT_ITEM_STUPIDITY = 0x71,
|
||||
UNIT_STAT_ITEM_DAMAGETOMANA = 0x72,
|
||||
UNIT_STAT_ITEM_IGNORETARGETAC = 0x73,
|
||||
UNIT_STAT_ITEM_FRACTIONALTARGETAC = 0x74,
|
||||
UNIT_STAT_ITEM_PREVENTHEAL = 0x75,
|
||||
UNIT_STAT_ITEM_HALFFREEZEDURATION = 0x76,
|
||||
UNIT_STAT_ITEM_TOHIT_PERCENT = 0x77,
|
||||
UNIT_STAT_ITEM_DAMAGETARGETAC = 0x78,
|
||||
UNIT_STAT_ITEM_DEMONDAMAGE_PERCENT = 0x79,
|
||||
UNIT_STAT_ITEM_UNDEADDAMAGE_PERCENT = 0x7A,
|
||||
UNIT_STAT_ITEM_DEMON_TOHIT = 0x7B,
|
||||
UNIT_STAT_ITEM_UNDEAD_TOHIT = 0x7C,
|
||||
UNIT_STAT_ITEM_THROWABLE = 0x7D,
|
||||
UNIT_STAT_ITEM_ELEMSKILL = 0x7E,
|
||||
UNIT_STAT_ITEM_ALLSKILLS = 0x7F,
|
||||
UNIT_STAT_ITEM_ATTACKERTAKESLIGHTDAMAGE = 0x80,
|
||||
UNIT_STAT_IRONMAIDEN_LEVEL = 0x81,
|
||||
UNIT_STAT_LIFETAP_LEVEL = 0x82,
|
||||
UNIT_STAT_THORNS_PERCENT = 0x83,
|
||||
UNIT_STAT_BONEARMOR = 0x84,
|
||||
UNIT_STAT_BONEARMORMAX = 0x85,
|
||||
UNIT_STAT_ITEM_FREEZE = 0x86,
|
||||
UNIT_STAT_ITEM_OPENWOUNDS = 0x87,
|
||||
UNIT_STAT_ITEM_CRUSHINGBLOW = 0x88,
|
||||
UNIT_STAT_ITEM_KICKDAMAGE = 0x89,
|
||||
UNIT_STAT_ITEM_MANAAFTERKILL = 0x8A,
|
||||
UNIT_STAT_ITEM_HEALAFTERDEMONKILL = 0x8B,
|
||||
UNIT_STAT_ITEM_EXTRABLOOD = 0x8C,
|
||||
UNIT_STAT_ITEM_DEADLYSTRIKE = 0x8D,
|
||||
UNIT_STAT_ITEM_ABSORBFIRE_PERCENT = 0x8E,
|
||||
UNIT_STAT_ITEM_ABSORBFIRE = 0x8F,
|
||||
UNIT_STAT_ITEM_ABSORBLIGHT_PERCENT = 0x90,
|
||||
UNIT_STAT_ITEM_ABSORBLIGHT = 0x91,
|
||||
UNIT_STAT_ITEM_ABSORBMAGIC_PERCENT = 0x92,
|
||||
UNIT_STAT_ITEM_ABSORBMAGIC = 0x93,
|
||||
UNIT_STAT_ITEM_ABSORBCOLD_PERCENT = 0x94,
|
||||
UNIT_STAT_ITEM_ABSORBCOLD = 0x95,
|
||||
UNIT_STAT_ITEM_SLOW = 0x96,
|
||||
UNIT_STAT_ITEM_AURA = 0x97,
|
||||
UNIT_STAT_ITEM_INDESCTRUCTIBLE = 0x98,
|
||||
UNIT_STAT_ITEM_CANNOTBEFROZEN = 0x99,
|
||||
UNIT_STAT_ITEM_STAMINADRAINPCT = 0x9A,
|
||||
UNIT_STAT_ITEM_REANIMATE = 0x9B,
|
||||
UNIT_STAT_ITEM_PIERCE = 0x9C,
|
||||
UNIT_STAT_ITEM_MAGICARROW = 0x9D,
|
||||
UNIT_STAT_ITEM_EXPLOSIVEARROW = 0x9E,
|
||||
UNIT_STAT_ITEM_THROW_MINDAMAGE = 0x9F,
|
||||
UNIT_STAT_ITEM_THROW_MAXDAMAGE = 0xA0,
|
||||
UNIT_STAT_SKILL_HANDOFATHENA = 0xA1,
|
||||
UNIT_STAT_SKILL_STAMINAPERCENT = 0xA2,
|
||||
UNIT_STAT_SKILL_PASSIVE_STAMINAPERCENT = 0xA3,
|
||||
UNIT_STAT_SKILL_CONCENTRATION = 0xA4,
|
||||
UNIT_STAT_SKILL_ENCHANT = 0xA5,
|
||||
UNIT_STAT_SKILL_PIERCE = 0xA6,
|
||||
UNIT_STAT_SKILL_CONVICTION = 0xA7,
|
||||
UNIT_STAT_SKILL_CHILLINGARMOR = 0xA8,
|
||||
UNIT_STAT_SKILL_FRENZY = 0xA9,
|
||||
UNIT_STAT_SKILL_DECREPIFY = 0xAA,
|
||||
UNIT_STAT_SKILL_ARMOR_PERCENT = 0xAB,
|
||||
UNIT_STAT_ALIGNMENT = 0xAC,
|
||||
UNIT_STAT_TARGET0 = 0xAD,
|
||||
UNIT_STAT_TARGET1 = 0xAE,
|
||||
UNIT_STAT_GOLDLOST = 0xAF,
|
||||
UNIT_STAT_CONVERSION_LEVEL = 0xB0,
|
||||
UNIT_STAT_CONVERSION_MAXHP = 0xB1,
|
||||
UNIT_STAT_UNIT_DOOVERLAY = 0xB2,
|
||||
UNIT_STAT_ATTACK_VS_MONTYPE = 0xB3,
|
||||
UNIT_STAT_DAMAGE_VS_MONTYPE = 0xB4,
|
||||
UNIT_STAT_FADE = 0xB5,
|
||||
UNIT_STAT_ARMOR_OVERRIDE_PERCENT = 0xB6,
|
||||
UNIT_STAT_UNUSED183 = 0xB7,
|
||||
UNIT_STAT_UNUSED184 = 0xB8,
|
||||
UNIT_STAT_UNUSED185 = 0xB9,
|
||||
UNIT_STAT_UNUSED186 = 0xBA,
|
||||
UNIT_STAT_UNUSED187 = 0xBB,
|
||||
UNIT_STAT_ITEM_ADDSKILL_TAB = 0xBC,
|
||||
UNIT_STAT_UNUSED189 = 0xBD,
|
||||
UNIT_STAT_UNUSED190 = 0xBE,
|
||||
UNIT_STAT_UNUSED191 = 0xBF,
|
||||
UNIT_STAT_UNUSED192 = 0xC0,
|
||||
UNIT_STAT_UNUSED193 = 0xC1,
|
||||
UNIT_STAT_ITEM_NUMSOCKETS = 0xC2,
|
||||
UNIT_STAT_ITEM_SKILLONATTACK = 0xC3,
|
||||
UNIT_STAT_ITEM_SKILLONKILL = 0xC4,
|
||||
UNIT_STAT_ITEM_SKILLONDEATH = 0xC5,
|
||||
UNIT_STAT_ITEM_SKILLONHIT = 0xC6,
|
||||
UNIT_STAT_ITEM_SKILLONLEVELUP = 0xC7,
|
||||
UNIT_STAT_UNUSED200 = 0xC8,
|
||||
UNIT_STAT_ITEM_SKILLONGETHIT = 0xC9,
|
||||
UNIT_STAT_UNUSED202 = 0xCA,
|
||||
UNIT_STAT_UNUSED203 = 0xCB,
|
||||
UNIT_STAT_ITEM_CHARGED_SKILL = 0xCC,
|
||||
UNIT_STAT_UNUSED204 = 0xCD,
|
||||
UNIT_STAT_UNUSED205 = 0xCE,
|
||||
UNIT_STAT_UNUSED206 = 0xCF,
|
||||
UNIT_STAT_UNUSED207 = 0xD0,
|
||||
UNIT_STAT_UNUSED208 = 0xD1,
|
||||
UNIT_STAT_UNUSED209 = 0xD2,
|
||||
UNIT_STAT_UNUSED210 = 0xD3,
|
||||
UNIT_STAT_UNUSED211 = 0xD4,
|
||||
UNIT_STAT_UNUSED212 = 0xD5,
|
||||
UNIT_STAT_ITEM_ARMOR_PERLEVEL = 0xD6,
|
||||
UNIT_STAT_ITEM_ARMORPERCENT_PERLEVEL = 0xD7,
|
||||
UNIT_STAT_ITEM_HP_PERLEVEL = 0xD8,
|
||||
UNIT_STAT_ITEM_MANA_PERLEVEL = 0xD9,
|
||||
UNIT_STAT_ITEM_MAXDAMAGE_PERLEVEL = 0xDA,
|
||||
UNIT_STAT_ITEM_MAXDAMAGE_PERCENT_PERLEVEL = 0xDB,
|
||||
UNIT_STAT_ITEM_STRENGTH_PERLEVEL = 0xDC,
|
||||
UNIT_STAT_ITEM_DEXTERITY_PERLEVEL = 0xDD,
|
||||
UNIT_STAT_ITEM_ENERGY_PERLEVEL = 0xDE,
|
||||
UNIT_STAT_ITEM_VITALITY_PERLEVEL = 0xDF,
|
||||
UNIT_STAT_ITEM_TOHIT_PERLEVEL = 0xE0,
|
||||
UNIT_STAT_ITEM_TOHITPERCENT_PERLEVEL = 0xE1,
|
||||
UNIT_STAT_ITEM_COLD_DAMAGEMAX_PERLEVEL = 0xE2,
|
||||
UNIT_STAT_ITEM_FIRE_DAMAGEMAX_PERLEVEL = 0xE3,
|
||||
UNIT_STAT_ITEM_LTNG_DAMAGEMAX_PERLEVEL = 0xE4,
|
||||
UNIT_STAT_ITEM_POIS_DAMAGEMAX_PERLEVEL = 0xE5,
|
||||
UNIT_STAT_ITEM_RESIST_COLD_PERLEVEL = 0xE6,
|
||||
UNIT_STAT_ITEM_RESIST_FIRE_PERLEVEL = 0xE7,
|
||||
UNIT_STAT_ITEM_RESIST_LTNG_PERLEVEL = 0xE8,
|
||||
UNIT_STAT_ITEM_RESIST_POIS_PERLEVEL = 0xE9,
|
||||
UNIT_STAT_ITEM_ABSORB_COLD_PERLEVEL = 0xEA,
|
||||
UNIT_STAT_ITEM_ABSORB_FIRE_PERLEVEL = 0xEB,
|
||||
UNIT_STAT_ITEM_ABSORB_LTNG_PERLEVEL = 0xEC,
|
||||
UNIT_STAT_ITEM_ABSORB_POIS_PERLEVEL = 0xED,
|
||||
UNIT_STAT_ITEM_THORNS_PERLEVEL = 0xEE,
|
||||
UNIT_STAT_ITEM_FIND_GOLD_PERLEVEL = 0xEF,
|
||||
UNIT_STAT_ITEM_FIND_MAGIC_PERLEVEL = 0xF0,
|
||||
UNIT_STAT_ITEM_REGENSTAMINA_PERLEVEL = 0xF1,
|
||||
UNIT_STAT_ITEM_STAMINA_PERLEVEL = 0xF2,
|
||||
UNIT_STAT_ITEM_DAMAGE_DEMON_PERLEVEL = 0xF3,
|
||||
UNIT_STAT_ITEM_DAMAGE_UNDEAD_PERLEVEL = 0xF4,
|
||||
UNIT_STAT_ITEM_TOHIT_DEMON_PERLEVEL = 0xF5,
|
||||
UNIT_STAT_ITEM_TOHIT_UNDEAD_PERLEVEL = 0xF6,
|
||||
UNIT_STAT_ITEM_CRUSHINGBLOW_PERLEVEL = 0xF7,
|
||||
UNIT_STAT_ITEM_OPENWOUNDS_PERLEVEL = 0xF8,
|
||||
UNIT_STAT_ITEM_KICK_DAMAGE_PERLEVEL = 0xF9,
|
||||
UNIT_STAT_ITEM_DEADLYSTRIKE_PERLEVEL = 0xFA,
|
||||
UNIT_STAT_ITEM_FIND_GEMS_PERLEVEL = 0xFB,
|
||||
UNIT_STAT_ITEM_REPLENISH_DURABILITY = 0xFC,
|
||||
UNIT_STAT_ITEM_REPLENISH_QUANTITY = 0xFD,
|
||||
UNIT_STAT_ITEM_EXTRA_STACK = 0xFE,
|
||||
UNIT_STAT_ITEM_FIND_ITEM = 0xFF,
|
||||
UNIT_STAT_ITEM_SLASH_DAMAGE = 0x100,
|
||||
UNIT_STAT_ITEM_SLASH_DAMAGE_PERCENT = 0x101,
|
||||
UNIT_STAT_ITEM_CRUSH_DAMAGE = 0x102,
|
||||
UNIT_STAT_ITEM_CRUSH_DAMAGE_PERCENT = 0x103,
|
||||
UNIT_STAT_ITEM_THRUST_DAMAGE = 0x104,
|
||||
UNIT_STAT_ITEM_THRUST_DAMAGE_PERCENT = 0x105,
|
||||
UNIT_STAT_ITEM_ABSORB_SLASH = 0x106,
|
||||
UNIT_STAT_ITEM_ABSORB_CRUSH = 0x107,
|
||||
UNIT_STAT_ITEM_ABSORB_THRUST = 0x108,
|
||||
UNIT_STAT_ITEM_ABSORB_SLASH_PERCENT = 0x109,
|
||||
UNIT_STAT_ITEM_ABSORB_CRUSH_PERCENT = 0x10A,
|
||||
UNIT_STAT_ITEM_ABSORB_THRUST_PERCENT = 0x10B,
|
||||
UNIT_STAT_ITEM_ARMOR_BYTIME = 0x10C,
|
||||
UNIT_STAT_ITEM_ARMORPERCENT_BYTIME = 0x10D,
|
||||
UNIT_STAT_ITEM_HP_BYTIME = 0x10E,
|
||||
UNIT_STAT_ITEM_MANA_BYTIME = 0x10F,
|
||||
UNIT_STAT_ITEM_MAXDAMAGE_BYTIME = 0x110,
|
||||
UNIT_STAT_ITEM_MAXDAMAGE_PERCENT_BYTIME = 0x111,
|
||||
UNIT_STAT_ITEM_STRENGTH_BYTIME = 0x112,
|
||||
UNIT_STAT_ITEM_DEXTERITY_BYTIME = 0x113,
|
||||
UNIT_STAT_ITEM_ENERGY_BYTIME = 0x114,
|
||||
UNIT_STAT_ITEM_VITALITY_BYTIME = 0x115,
|
||||
UNIT_STAT_ITEM_TOHIT_BYTIME = 0x116,
|
||||
UNIT_STAT_ITEM_TOHITPERCENT_BYTIME = 0x117,
|
||||
UNIT_STAT_ITEM_COLD_DAMAGEMAX_BYTIME = 0x118,
|
||||
UNIT_STAT_ITEM_FIRE_DAMAGEMAX_BYTIME = 0x119,
|
||||
UNIT_STAT_ITEM_LTNG_DAMAGEMAX_BYTIME = 0x11A,
|
||||
UNIT_STAT_ITEM_POIS_DAMAGEMAX_BYTIME = 0x11B,
|
||||
UNIT_STAT_ITEM_RESIST_COLD_BYTIME = 0x11C,
|
||||
UNIT_STAT_ITEM_RESIST_FIRE_BYTIME = 0x11D,
|
||||
UNIT_STAT_ITEM_RESIST_LTNG_BYTIME = 0x11E,
|
||||
UNIT_STAT_ITEM_RESIST_POIS_BYTIME = 0x11F,
|
||||
UNIT_STAT_ITEM_ABSORB_COLD_BYTIME = 0x120,
|
||||
UNIT_STAT_ITEM_ABSORB_FIRE_BYTIME = 0x121,
|
||||
UNIT_STAT_ITEM_ABSORB_LTNG_BYTIME = 0x122,
|
||||
UNIT_STAT_ITEM_ABSORB_POIS_BYTIME = 0x123,
|
||||
UNIT_STAT_ITEM_FIND_GOLD_BYTIME = 0x124,
|
||||
UNIT_STAT_ITEM_FIND_MAGIC_BYTIME = 0x125,
|
||||
UNIT_STAT_ITEM_REGENSTAMINA_BYTIME = 0x126,
|
||||
UNIT_STAT_ITEM_STAMINA_BYTIME = 0x127,
|
||||
UNIT_STAT_ITEM_DAMAGE_DEMON_BYTIME = 0x128,
|
||||
UNIT_STAT_ITEM_DAMAGE_UNDEAD_BYTIME = 0x129,
|
||||
UNIT_STAT_ITEM_TOHIT_DEMON_BYTIME = 0x12A,
|
||||
UNIT_STAT_ITEM_TOHIT_UNDEAD_BYTIME = 0x12B,
|
||||
UNIT_STAT_ITEM_CRUSHINGBLOW_BYTIME = 0x12C
|
||||
};
|
||||
|
||||
class d2_common {
|
||||
public:
|
||||
static char* get_base();
|
||||
static int8_t diablo2::d2_common::get_item_page(structures::unit* item);
|
||||
static void diablo2::d2_common::empty_inventory_1(structures::inventory* inv);
|
||||
static void diablo2::d2_common::empty_inventory_2(structures::inventory* inv);
|
||||
static void diablo2::d2_common::free_trade_inventory(structures::inventory* inv);
|
||||
static int32_t get_item_type_from_unit(structures::unit* item);
|
||||
static int32_t diablo2::d2_common::get_previous_interact_guid(structures::unit* player);
|
||||
static int32_t get_inventory_index(structures::unit* item, char page, BOOL lod);
|
||||
static void* get_inventory_data(int32_t index, int32_t zero, char* data);
|
||||
static structures::unit* get_item_at_cell(structures::inventory* inv, uint32_t cellx, uint32_t celly,
|
||||
uint32_t* pcellx, uint32_t* pcelly, int32_t invIndex, uint8_t page);
|
||||
static uint32_t can_put_into_slot(structures::inventory* inv, structures::unit* item, uint32_t x, uint32_t y,
|
||||
uint32_t invIndex, structures::unit** lastBlockingUnit, uint32_t* lastBlockingUnitIndex, uint8_t page);
|
||||
|
||||
static uint32_t get_item_type(structures::unit* item);
|
||||
static uint32_t get_item_type_class(structures::unit* item);
|
||||
static uint32_t diablo2::d2_common::get_item_primary_weapon_class(structures::unit* item);
|
||||
static uint32_t diablo2::d2_common::check_item_type_equiv(uint32_t itemtype, uint32_t itemtype_equiv);
|
||||
|
||||
static structures::unit* inv_remove_item(structures::inventory* inventory, structures::unit* item);
|
||||
static BOOL inv_add_item(structures::inventory* inv, structures::unit* item, uint32_t x, uint32_t y,
|
||||
uint32_t invIndex, BOOL isClient, uint8_t page);
|
||||
static BOOL inv_update_item(structures::inventory* inv, structures::unit* item, BOOL isClient);
|
||||
|
||||
static structures::items_line* get_item_record(uint32_t guid);
|
||||
static structures::item_types_line* get_item_type_record(uint32_t typeId);
|
||||
|
||||
static uint32_t get_maximum_character_gold(structures::unit* player);
|
||||
static uint32_t get_item_unique_index(structures::unit* item);
|
||||
static int32_t set_stat(structures::unit* unit, unit_stats_t stat, uint32_t value, int16_t param);
|
||||
static int32_t get_stat(structures::unit* unit, unit_stats_t stat, int16_t param);
|
||||
static int32_t get_stat_signed(structures::unit* unit, unit_stats_t stat, int16_t param);
|
||||
|
||||
static int32_t _10111(int32_t* x, int32_t* y);
|
||||
static int32_t _10116(int32_t x1, int32_t y1, int32_t* x, int32_t* y);
|
||||
|
||||
static structures::room* get_room_from_unit(structures::unit* unit);
|
||||
|
||||
static int32_t get_unit_size_x(structures::unit* unit);
|
||||
static int32_t get_unit_size_y(structures::unit* unit);
|
||||
|
||||
static int32_t get_distance_between_units(structures::unit* unit1, structures::unit* unit2);
|
||||
|
||||
static int32_t get_unit_x(structures::path* path);
|
||||
static int32_t get_unit_y(structures::path* path);
|
||||
static int32_t get_unit_precise_x(structures::unit* unit);
|
||||
static int32_t get_unit_precise_y(structures::unit* unit);
|
||||
|
||||
static int32_t get_item_quality(structures::unit* item);
|
||||
static uint32_t diablo2::d2_common::set_unit_mode(structures::unit* item, uint32_t mode);
|
||||
|
||||
static structures::unit* get_target_from_path(structures::path* path);
|
||||
static structures::unit* diablo2::d2_common::get_first_inventory_item(structures::inventory* inv);
|
||||
static structures::unit* diablo2::d2_common::get_last_inventory_item(structures::inventory* inv);
|
||||
static structures::unit* diablo2::d2_common::get_next_inventory_item(structures::unit* prev_item);
|
||||
static uint32_t diablo2::d2_common::get_max_cube_recipes();
|
||||
static void diablo2::d2_common::free_inventory(structures::inventory* inventory);
|
||||
static void diablo2::d2_common::refresh_unit_inventory(structures::unit* unit, bool set_update_flags);
|
||||
static void diablo2::d2_common::update_trade(structures::inventory* inventory, structures::unit* item);
|
||||
//static void diablo2::d2_common::set_item_flags(structures::unit* item, structures::itemflags_t dwFlag, bool bSet);
|
||||
};
|
||||
}
|
51
include/diablo2/d2game.h
Normal file
51
include/diablo2/d2game.h
Normal file
@@ -0,0 +1,51 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <diablo2/structures/unit.h>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct game_server;
|
||||
struct net_client;
|
||||
struct game;
|
||||
struct unit;
|
||||
}
|
||||
|
||||
class d2_game {
|
||||
public:
|
||||
static char* get_base();
|
||||
|
||||
static void enqueue_packet(structures::net_client* client, void* packet, size_t size);
|
||||
|
||||
static uint32_t* get_game_id_array_begin();
|
||||
static uint32_t* get_game_id_array_end();
|
||||
|
||||
static structures::game_server* get_game_server();
|
||||
static structures::game* get_game(structures::game_server* gs, uint32_t gameId);
|
||||
|
||||
static structures::game* get_game_from_client_id(int32_t id);
|
||||
static structures::net_client* get_net_client_from_id(structures::game* game, int32_t id);
|
||||
static structures::net_client* diablo2::d2_game::get_net_client_from_id_2(structures::game* game, int32_t id);
|
||||
|
||||
static structures::unit* get_player_pet(structures::game* game, structures::unit* unit, uint32_t type, uint32_t index);
|
||||
|
||||
static structures::unit* get_server_unit(structures::game* game, diablo2::structures::unit_type_t type, uint32_t uniqueid);
|
||||
static structures::npc_record* diablo2::d2_game::get_npc_record(structures::game* game, structures::unit* npc, structures::unit** ptnpc);
|
||||
static void diablo2::d2_game::free_gamble(structures::game* game, structures::unit* player, structures::unit* npc, structures::npc_record* npcrecord);
|
||||
static void diablo2::d2_game::fill_gamble(structures::game* game, structures::unit* player, structures::unit* npc, structures::npc_record* npcrecord);
|
||||
static void diablo2::d2_game::create_vendor_cache1(structures::game* game, structures::unit* player, structures::unit* npc, uint32_t param, bool bGamble);
|
||||
static void diablo2::d2_game::create_vendor_cache2(structures::game* game, structures::unit* player, structures::unit* npc, uint32_t param, bool bGamble);
|
||||
|
||||
static int32_t identify_item(structures::game* game, structures::unit* player, structures::unit* item);
|
||||
static int32_t pickup_gold_pile(structures::game* game, structures::unit* unit, structures::unit* item);
|
||||
//static int32_t pickup_item(structures::game* game, structures::unit* unit, structures::unit* item);
|
||||
static bool __fastcall pickup_item(structures::game* game, structures::unit* player, uint32_t guid, uint32_t* ptrItemCarried);
|
||||
static structures::unit* get_unit_owner(structures::game* game, structures::unit* unit);
|
||||
static void* iterate_unit_pets(structures::game* game, structures::unit* unit,
|
||||
const std::function<void(structures::game*, structures::unit*, structures::unit*)>& cb);
|
||||
|
||||
static void update_inventory_items(structures::game* game, structures::unit* player);
|
||||
static uint32_t __fastcall diablo2::d2_game::transmogrify(diablo2::structures::game* game, diablo2::structures::unit* player);
|
||||
};
|
||||
}
|
21
include/diablo2/d2gfx.h
Normal file
21
include/diablo2/d2gfx.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct gfxdata;
|
||||
}
|
||||
|
||||
class d2_gfx {
|
||||
public:
|
||||
static char* get_base();
|
||||
|
||||
static bool check_perspective_mode();
|
||||
static bool check_perspective_coords(int32_t x, int32_t y);
|
||||
static int32_t adjust_perspective_coords(int32_t x, int32_t y, int32_t* adjustX, int32_t* adjustY);
|
||||
static int32_t get_resolution_mode();
|
||||
static void draw_image(structures::gfxdata* data, uint32_t x, uint32_t y, int32_t gamma, int32_t drawType, void* palette);
|
||||
};
|
||||
}
|
17
include/diablo2/d2lang.h
Normal file
17
include/diablo2/d2lang.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <diablo2/structures/unit.h>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct unit;
|
||||
}
|
||||
|
||||
class d2_lang {
|
||||
public:
|
||||
static char* get_base();
|
||||
static wchar_t* get_string_from_index(short);
|
||||
};
|
||||
}
|
8
include/diablo2/d2launch.h
Normal file
8
include/diablo2/d2launch.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
namespace diablo2 {
|
||||
class d2_launch {
|
||||
public:
|
||||
static char* get_base();
|
||||
};
|
||||
}
|
18
include/diablo2/d2net.h
Normal file
18
include/diablo2/d2net.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct game_server;
|
||||
}
|
||||
|
||||
class d2_net {
|
||||
public:
|
||||
static char* get_base();
|
||||
|
||||
static int32_t send_to_server(int32_t queue, void* data, size_t size);
|
||||
static int32_t send_to_client(int32_t queue, int32_t clientId, void* packet, size_t size);
|
||||
};
|
||||
}
|
61
include/diablo2/d2win.h
Normal file
61
include/diablo2/d2win.h
Normal file
@@ -0,0 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
enum ui_color_t {
|
||||
UI_COLOR_WHITE = 0x0,
|
||||
UI_COLOR_RED = 0x1,
|
||||
UI_COLOR_LIGHT_GREEN = 0x2,
|
||||
UI_COLOR_BLUE = 0x3,
|
||||
UI_COLOR_DARK_GOLD = 0x4,
|
||||
UI_COLOR_GREY = 0x5,
|
||||
UI_COLOR_BLACK = 0x6,
|
||||
UI_COLOR_GOLD = 0x7,
|
||||
UI_COLOR_ORANGE = 0x8,
|
||||
UI_COLOR_YELLOW = 0x9,
|
||||
UI_COLOR_DARK_GREEN = 0xA,
|
||||
UI_COLOR_PURPLE = 0xB,
|
||||
UI_COLOR_GREEN = 0xC,
|
||||
UI_COLOR_WHITE2 = 0xD,
|
||||
UI_COLOR_BLACK2 = 0xE,
|
||||
UI_COLOR_DARK_WHITE = 0xF,
|
||||
UI_COLOR_LIGHT_GREY = 0x10,
|
||||
};
|
||||
|
||||
enum ui_font_t {
|
||||
UI_FONT_8 = 0,
|
||||
UI_FONT_16 = 1,
|
||||
UI_FONT_30 = 2,
|
||||
UI_FONT_42 = 3,
|
||||
UI_FONT_FORMAL10 = 4,
|
||||
UI_FONT_FORMAL12 = 5,
|
||||
UI_FONT_6 = 6,
|
||||
UI_FONT_24 = 7,
|
||||
UI_FONT_FORMAL11 = 8,
|
||||
UI_FONT_EXOCET10 = 9,
|
||||
UI_FONT_RIDICULOUS = 10,
|
||||
UI_FONT_EXOCET8 = 11,
|
||||
UI_FONT_REALLYTHELASTSUCKER = 12,
|
||||
UI_FONT_INGAMECHAT = 13
|
||||
};
|
||||
|
||||
class d2_win {
|
||||
public:
|
||||
static char* get_base();
|
||||
|
||||
static int32_t get_text_pixel_width(wchar_t* str);
|
||||
static void draw_text(wchar_t* str, uint32_t x, uint32_t y, ui_color_t color, int32_t transTbl);
|
||||
static void draw_boxed_text(wchar_t* str, uint32_t x, uint32_t y, int32_t paletteIndex, int32_t transTbl, ui_color_t color);
|
||||
static void set_popup_properties(wchar_t* str, uint32_t x, uint32_t y, ui_color_t color, int32_t align);
|
||||
static void draw_popup();
|
||||
|
||||
static ui_font_t get_current_font();
|
||||
static int32_t get_current_font_height();
|
||||
static int32_t set_current_font(ui_font_t font);
|
||||
|
||||
static void* load_mpq(char* dllName, char* mpqName, char* mpqTitle, int32_t overrideFlags);
|
||||
static bool unload_mpq(void* mpq);
|
||||
};
|
||||
}
|
22
include/diablo2/fog.h
Normal file
22
include/diablo2/fog.h
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct file_handle;
|
||||
}
|
||||
|
||||
class fog {
|
||||
public:
|
||||
static char* get_base();
|
||||
|
||||
static void get_save_path(char* buffer, size_t bufferSize);
|
||||
|
||||
static bool mpq_open_file(char* path, structures::file_handle** outHandle);
|
||||
static bool mpq_close_file(structures::file_handle* handle);
|
||||
static bool mpq_read_file(structures::file_handle* handle, void* buffer, size_t size, size_t* bytesToRead);
|
||||
static size_t mpq_get_file_size(structures::file_handle* handle, size_t* compressedSize);
|
||||
};
|
||||
}
|
8
include/diablo2/storm.h
Normal file
8
include/diablo2/storm.h
Normal file
@@ -0,0 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
namespace diablo2 {
|
||||
class storm {
|
||||
public:
|
||||
static char* get_base();
|
||||
};
|
||||
}
|
80
include/diablo2/structures/UniqueItems.h
Normal file
80
include/diablo2/structures/UniqueItems.h
Normal file
@@ -0,0 +1,80 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct D2UniqueItemsTxt
|
||||
{
|
||||
uint16_t unk0x00; //0x00
|
||||
char szName[34]; //0x02
|
||||
uint32_t dwVersion; //0x24
|
||||
union
|
||||
{
|
||||
uint32_t dwBaseItemCode; //0x28
|
||||
char szBaseItemCode[4]; //0x28
|
||||
};
|
||||
uint32_t dwUniqueItemFlags; //0x2C
|
||||
uint32_t dwRarity; //0x30
|
||||
uint16_t wLvl; //0x34
|
||||
uint16_t wLvlReq; //0x36
|
||||
uint8_t nChrTransform; //0x38
|
||||
uint8_t nInvTransform; //0x39
|
||||
char szFlippyFile[32]; //0x3A
|
||||
char szInvFile[34]; //0x5A
|
||||
uint32_t dwCostMult; //0x7C
|
||||
uint32_t dwCostAdd; //0x80
|
||||
uint16_t wDropSound; //0x84
|
||||
uint16_t wUseSound; //0x86
|
||||
uint32_t dwDropSfxFrame; //0x88
|
||||
uint32_t dwProp1; //0x8C
|
||||
uint32_t dwPar1; //0x90
|
||||
uint32_t dwMin1; //0x94
|
||||
uint32_t dwMax1; //0x98
|
||||
uint32_t dwProp2; //0x9C
|
||||
uint32_t dwPar2; //0xA0
|
||||
uint32_t dwMin2; //0xA4
|
||||
uint32_t dwMax2; //0xA8
|
||||
uint32_t dwProp3; //0xAC
|
||||
uint32_t dwPar3; //0xB0
|
||||
uint32_t dwMin3; //0xB4
|
||||
uint32_t dwMax3; //0xB8
|
||||
uint32_t dwProp4; //0xBC
|
||||
uint32_t dwPar4; //0xC0
|
||||
uint32_t dwMin4; //0xC4
|
||||
uint32_t dwMax4; //0xC8
|
||||
uint32_t dwProp5; //0xCC
|
||||
uint32_t dwPar5; //0xD0
|
||||
uint32_t dwMin5; //0xD4
|
||||
uint32_t dwMax5; //0xD8
|
||||
uint32_t dwProp6; //0xDC
|
||||
uint32_t dwPar6; //0xE0
|
||||
uint32_t dwMin6; //0xE4
|
||||
uint32_t dwMax6; //0xE8
|
||||
uint32_t dwProp7; //0xEC
|
||||
uint32_t dwPar7; //0xF0
|
||||
uint32_t dwMin7; //0xF4
|
||||
uint32_t dwMax7; //0xF8
|
||||
uint32_t dwProp8; //0xFC
|
||||
uint32_t dwPar8; //0x100
|
||||
uint32_t dwMin8; //0x104
|
||||
uint32_t dwMax8; //0x10
|
||||
uint32_t dwProp9; //0x10C
|
||||
uint32_t dwPar9; //0x110
|
||||
uint32_t dwMin9; //0x114
|
||||
uint32_t dwMax9; //0x118
|
||||
uint32_t dwProp10; //0x11C
|
||||
uint32_t dwPar10; //0x120
|
||||
uint32_t dwMin10; //0x124
|
||||
uint32_t dwMax10; //0x128
|
||||
uint32_t dwProp11; //0x12C
|
||||
uint32_t dwPar11; //0x130
|
||||
uint32_t dwMin11; //0x134
|
||||
uint32_t dwMax11; //0x138
|
||||
uint32_t dwProp12; //0x13C
|
||||
uint32_t dwPar12; //0x140
|
||||
uint32_t dwMin12; //0x144
|
||||
uint32_t dwMax12; //0x148
|
||||
};
|
||||
}
|
||||
}
|
17
include/diablo2/structures/act_map.h
Normal file
17
include/diablo2/structures/act_map.h
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct room;
|
||||
|
||||
struct act_map //ptGame+BC size=0x60
|
||||
{
|
||||
uint32_t is_not_managed;
|
||||
uint32_t uk4;
|
||||
uint32_t uk8; //size = 0x488
|
||||
room* pt_first_room;
|
||||
};
|
||||
}
|
||||
}
|
23
include/diablo2/structures/cellfile.h
Normal file
23
include/diablo2/structures/cellfile.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct gfxcell;
|
||||
|
||||
struct cellfile {
|
||||
int32_t version; //0x00
|
||||
struct {
|
||||
int16_t flags;
|
||||
int8_t mylastcol;
|
||||
int8_t mytabno : 1;
|
||||
}; //0x04
|
||||
int32_t format; //0x08
|
||||
int32_t termination; //0x0C
|
||||
int32_t numdirs; //0x10
|
||||
int32_t numcells; //0x14
|
||||
gfxcell* cells[255]; //0x18
|
||||
};
|
||||
}
|
||||
}
|
11
include/diablo2/structures/client_unit_list.h
Normal file
11
include/diablo2/structures/client_unit_list.h
Normal file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct unit;
|
||||
|
||||
struct client_unit_list {
|
||||
unit* unit_list[5][128]; //0x1120
|
||||
};
|
||||
}
|
||||
}
|
41
include/diablo2/structures/damage.h
Normal file
41
include/diablo2/structures/damage.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct damage {
|
||||
int32_t hit_flags; //0x00
|
||||
int16_t result_flags; //0x04
|
||||
int16_t extra; //0x06
|
||||
int32_t phys_damage; //0x08
|
||||
int32_t en_dmg_pct; //0x0C
|
||||
int32_t fire_damage; //0x10
|
||||
int32_t burn_damage; //0x14
|
||||
int32_t burn_len; //0x18
|
||||
int32_t ltng_damage; //0x1C
|
||||
int32_t mag_damage; //0x20
|
||||
int32_t cold_damage; //0x24
|
||||
int32_t pois_damage; //0x28
|
||||
int32_t pois_len; //0x2C
|
||||
int32_t cold_len; //0x30
|
||||
int32_t frz_len; //0x34
|
||||
int32_t life_leech; //0x38
|
||||
int32_t mana_leech; //0x3C
|
||||
int32_t stam_leech; //0x40
|
||||
int32_t stun_len; //0x44
|
||||
int32_t abs_life; //0x48
|
||||
int32_t dmg_total; //0x4C
|
||||
int32_t unk0_x50; //0x50
|
||||
int32_t pierce_pct; //0x54
|
||||
int32_t damage_rate; //0x58
|
||||
int32_t unk0_x5_c; //0x5C
|
||||
int32_t hit_class; //0x60
|
||||
int8_t hit_class_active_set; //0x64
|
||||
char conv_type; //0x65
|
||||
int8_t unk0_x66[2]; //0x66
|
||||
int32_t conv_pct; //0x68
|
||||
int8_t unk0_x6_c[4]; //0x6C
|
||||
};
|
||||
}
|
||||
}
|
14
include/diablo2/structures/data/bodylocs_line.h
Normal file
14
include/diablo2/structures/data/bodylocs_line.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct bodylocs_line {
|
||||
union {
|
||||
uint32_t code;
|
||||
char str[4];
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
14
include/diablo2/structures/data/elemtypes_line.h
Normal file
14
include/diablo2/structures/data/elemtypes_line.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct elemtypes_line {
|
||||
union {
|
||||
uint32_t code;
|
||||
char str[4];
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
14
include/diablo2/structures/data/hitclass_line.h
Normal file
14
include/diablo2/structures/data/hitclass_line.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct hitclass_line {
|
||||
union {
|
||||
uint32_t code;
|
||||
char str[4];
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
45
include/diablo2/structures/data/item_types_line.h
Normal file
45
include/diablo2/structures/data/item_types_line.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct item_types_line {
|
||||
char code[4]; //0x00
|
||||
int16_t equiv1; //0x04
|
||||
int16_t equiv2; //0x06
|
||||
int8_t repair; //0x08
|
||||
int8_t body; //0x09
|
||||
int8_t body_loc1; //0x0A
|
||||
int8_t body_loc2; //0x0B
|
||||
int16_t shoots; //0x0C
|
||||
int16_t quiver; //0x0E
|
||||
int8_t throwable; //0x10
|
||||
int8_t reload; //0x11
|
||||
int8_t re_equip; //0x12
|
||||
int8_t auto_stack; //0x13
|
||||
int8_t magic; //0x14
|
||||
int8_t rare; //0x15
|
||||
int8_t normal; //0x16
|
||||
int8_t charm; //0x17
|
||||
int8_t gem; //0x18
|
||||
int8_t beltable; //0x19
|
||||
int8_t max_sock1; //0x1A
|
||||
int8_t max_sock25; //0x1B
|
||||
int8_t max_sock40; //0x1C
|
||||
int8_t treasure_class; //0x1D
|
||||
int8_t rarity; //0x1E
|
||||
int8_t staff_mods; //0x1F
|
||||
int8_t cost_formula; //0x20
|
||||
int8_t item_class; //0x21
|
||||
int8_t store_page; //0x22
|
||||
int8_t var_inv_gfx; //0x23
|
||||
char inv_gfx1[32]; //0x24
|
||||
char inv_gfx2[32]; //0x44
|
||||
char inv_gfx3[32]; //0x64
|
||||
char inv_gfx4[32]; //0x84
|
||||
char inv_gfx5[32]; //0xA4
|
||||
char inv_gfx6[32]; //0xC4
|
||||
};
|
||||
}
|
||||
}
|
211
include/diablo2/structures/data/items_line.h
Normal file
211
include/diablo2/structures/data/items_line.h
Normal file
@@ -0,0 +1,211 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
//https://phrozen-library.fandom.com/wiki/Items_line
|
||||
struct items_line {
|
||||
char flippy_file[32]; //0x00
|
||||
char inv_file[32]; //0x20
|
||||
char unique_inv_file[32]; //0x40
|
||||
char setinv_file[32]; //0x60
|
||||
union {
|
||||
uint32_t number_code; //0x80
|
||||
char string_code[4]; //0x80
|
||||
};
|
||||
|
||||
uint32_t norm_code; //0x84
|
||||
uint32_t uber_code; //0x88
|
||||
uint32_t ultra_code; //0x8C
|
||||
uint32_t alternate_gfx; //0x90
|
||||
void* spell; //0x94
|
||||
uint16_t state; //0x98
|
||||
uint16_t cstate1; //0x9A
|
||||
uint16_t cstate2; //0x9C
|
||||
uint16_t stat1; //0x9E
|
||||
uint16_t stat2; //0xA0
|
||||
uint16_t stat3; //0xA2
|
||||
uint32_t calc1; //0xA4
|
||||
uint32_t calc2; //0xA8
|
||||
uint32_t calc3; //0xAC
|
||||
uint32_t len; //0xB0
|
||||
uint16_t spell_desc; //0xB4
|
||||
uint16_t spell_desc_str; //0xB6
|
||||
uint32_t spell_desc_calc; //0xB8
|
||||
uint32_t better_gem; //0xBC
|
||||
uint32_t weapon_class; //0xC0
|
||||
uint32_t two_handed_weapon_class; //0xC4
|
||||
uint32_t transmog_type; //0xC8
|
||||
uint32_t min_ac; //0xCC
|
||||
uint32_t max_ac; //0xD0
|
||||
uint32_t gamble_cost; //0xD4
|
||||
uint32_t speed; //0xD8
|
||||
uint32_t bit_field1; //0xDC
|
||||
uint32_t cost; //0xE0
|
||||
uint32_t min_stack; //0xE4
|
||||
uint32_t max_stack; //0xE8
|
||||
uint32_t spawn_stack; //0xEC
|
||||
uint32_t gem_offset; //0xF0
|
||||
uint16_t name_str; //0xF4
|
||||
uint16_t version; //0xF6
|
||||
uint16_t auto_prefix; //0xF8
|
||||
uint16_t missile_type; //0xFA
|
||||
uint8_t rarity; //0xFC
|
||||
uint8_t level; //0xFD
|
||||
uint8_t min_damage; //0xFE
|
||||
uint8_t max_damage; //0xFF
|
||||
uint8_t min_misdamage; //0x100
|
||||
uint8_t max_misdamage; //0x101
|
||||
uint8_t two_hand_min_damage; //0x102
|
||||
uint8_t two_hand_max_damage; //0x103
|
||||
uint16_t range_adder; //0x104
|
||||
uint16_t str_bonus; //0x106
|
||||
uint16_t dex_bonus; //0x108
|
||||
uint16_t req_str; //0x10A
|
||||
uint16_t req_dex; //0x10C
|
||||
uint8_t absorbs; //0x10E
|
||||
uint8_t inv_width; //0x10F
|
||||
uint8_t inv_height; //0x110
|
||||
uint8_t block; //0x111
|
||||
uint8_t durability; //0x112
|
||||
uint8_t no_durability; //0x11
|
||||
uint8_t missile; //0x114
|
||||
uint8_t component; //0x115
|
||||
uint8_t right_arm; //0x116
|
||||
uint8_t left_arm; //0x117
|
||||
uint8_t torso; //0x118
|
||||
uint8_t legs; //0x119
|
||||
uint8_t right_spad; //0x11A
|
||||
uint8_t left_spad; //0x11B
|
||||
uint8_t two_handed; //0x11C
|
||||
uint8_t useable; //0x11D
|
||||
uint16_t type; //0x11E
|
||||
uint16_t type2; //0x120
|
||||
uint16_t subtype; //0x122
|
||||
uint16_t drop_sound; //0x124
|
||||
uint16_t use_sound; //0x126
|
||||
uint8_t drop_sfx_frame; //0x128
|
||||
uint8_t unique; //0x129
|
||||
uint8_t quest; //0x12A
|
||||
uint8_t quest_diff_check; //0x12B
|
||||
uint8_t transparent; //0x12C
|
||||
uint8_t trans_tbl; //0x12D
|
||||
uint8_t pad0_x12_e; //0x12E
|
||||
uint8_t light_radius; //0x12F
|
||||
uint8_t belt; //0x130
|
||||
uint8_t auto_belt; //0x131
|
||||
uint8_t stackable; //0x132
|
||||
uint8_t spawnable; //0x133
|
||||
uint8_t spell_icon; //0x134
|
||||
uint8_t dur_warning; //0x135
|
||||
uint8_t quantity_warning; //0x136
|
||||
uint8_t has_inv; //0x137
|
||||
uint8_t gem_sockets; //0x138
|
||||
uint8_t transmogrify; //0x139
|
||||
uint8_t transmog_min; //0x13A
|
||||
uint8_t transmog_max; //0x13B
|
||||
uint8_t hit_class; //0x13C
|
||||
uint8_t one_or_two_handed; //0x13D
|
||||
uint8_t gem_apply_type; //0x13E
|
||||
uint8_t level_req; //0x13F
|
||||
uint8_t magic_lvl; //0x140
|
||||
uint8_t transform; //0x141
|
||||
uint8_t inv_trans; //0x142
|
||||
uint8_t compact_save; //0x143
|
||||
uint8_t skip_name; //0x144
|
||||
uint8_t nameable; //0x145
|
||||
uint8_t akara_min; //0x146
|
||||
uint8_t gheed_min; //0x147
|
||||
uint8_t charsi_min; //0x148
|
||||
uint8_t fara_min; //0x149
|
||||
uint8_t lysander_min; //0x14A
|
||||
uint8_t drognan_min; //0x14B
|
||||
uint8_t hralti_min; //0x14C
|
||||
uint8_t alkor_min; //0x14D
|
||||
uint8_t ormus_min; //0x14E
|
||||
uint8_t elzix_min; //0x14F
|
||||
uint8_t asheara_min; //0x150
|
||||
uint8_t cain_min; //0x151
|
||||
uint8_t halbu_min; //0x152
|
||||
uint8_t jamella_min; //0x153
|
||||
uint8_t malah_min; //0x154
|
||||
uint8_t larzuk_min; //0x155
|
||||
uint8_t drehya_min; //0x156
|
||||
uint8_t akara_max; //0x157
|
||||
uint8_t gheed_max; //0x158
|
||||
uint8_t charsi_max; //0x159
|
||||
uint8_t fara_max; //0x15A
|
||||
uint8_t lysander_max; //0x15B
|
||||
uint8_t drognan_max; //0x15C
|
||||
uint8_t hralti_max; //0x15D
|
||||
uint8_t alkor_max; //0x15E
|
||||
uint8_t ormus_max; //0x15F
|
||||
uint8_t elzix_max; //0x160
|
||||
uint8_t asheara_max; //0x161
|
||||
uint8_t cain_max; //0x162
|
||||
uint8_t halbu_max; //0x163
|
||||
uint8_t jamella_max; //0x164
|
||||
uint8_t malah_max; //0x165
|
||||
uint8_t larzuk_max; //0x166
|
||||
uint8_t drehya_max; //0x167
|
||||
uint8_t akara_magic_min; //0x168
|
||||
uint8_t gheed_magic_min; //0x169
|
||||
uint8_t charsi_magic_min; //0x16A
|
||||
uint8_t fara_magic_min; //0x16B
|
||||
uint8_t lysander_magic_min; //0x16C
|
||||
uint8_t drognan_magic_min; //0x16D
|
||||
uint8_t hralti_magic_min; //0x16E
|
||||
uint8_t alkor_magic_min; //0x16F
|
||||
uint8_t ormus_magic_min; //0x170
|
||||
uint8_t elzix_magic_min; //0x171
|
||||
uint8_t asheara_magic_min; //0x172
|
||||
uint8_t cain_magic_min; //0x173
|
||||
uint8_t halbu_magic_min; //0x174
|
||||
uint8_t jamella_magic_min; //0x175
|
||||
uint8_t malah_magic_min; //0x176
|
||||
uint8_t larzuk_magic_min; //0x177
|
||||
uint8_t drehya_magic_min; //0x178
|
||||
uint8_t akara_magic_max; //0x179
|
||||
uint8_t gheed_magic_max; //0x17A
|
||||
uint8_t charsi_magic_max; //0x17B
|
||||
uint8_t fara_magic_max; //0x17C
|
||||
uint8_t lysander_magic_max; //0x17D
|
||||
uint8_t drognan_magic_max; //0x17E
|
||||
uint8_t hralti_magic_max; //0x17F
|
||||
uint8_t alkor_magic_max; //0x180
|
||||
uint8_t ormus_magic_max; //0x181
|
||||
uint8_t elzix_magic_max; //0x182
|
||||
uint8_t asheara_magic_max; //0x183
|
||||
uint8_t cain_magic_max; //0x184
|
||||
uint8_t halbu_magic_max; //0x185
|
||||
uint8_t jamella_magic_max; //0x186
|
||||
uint8_t malah_magic_max; //0x187
|
||||
uint8_t larzuk_magic_max; //0x188
|
||||
uint8_t drehya_magic_max; //0x189
|
||||
uint8_t akara_magic_lvl; //0x18A
|
||||
uint8_t gheed_magic_lvl; //0x18B
|
||||
uint8_t charsi_magic_lvl; //0x18C
|
||||
uint8_t fara_magic_lvl; //0x18D
|
||||
uint8_t lysander_magic_lvl; //0x18E
|
||||
uint8_t drognan_magic_lvl; //0x18F
|
||||
uint8_t hralti_magic_lvl; //0x190
|
||||
uint8_t alkor_magic_lvl; //0x191
|
||||
uint8_t ormus_magic_lvl; //0x192
|
||||
uint8_t elzix_magic_lvl; //0x193
|
||||
uint8_t asheara_magic_lvl; //0x194
|
||||
uint8_t cain_magic_lvl; //0x195
|
||||
uint8_t halbu_magic_lvl; //0x196
|
||||
uint8_t jamella_magic_lvl; //0x197
|
||||
uint8_t malah_magic_lvl; //0x198
|
||||
uint8_t larzuk_magic_lvl; //0x199
|
||||
uint8_t drehya_magic_lvl; //0x19A
|
||||
uint8_t pad0_x19_b; //0x19B
|
||||
uint32_t nightmare_upgrade; //0x19C
|
||||
uint32_t hell_upgrade; //0x1A0
|
||||
uint8_t perm_store_item; //0x1A4
|
||||
uint8_t multi_buy; //0x1A5
|
||||
uint16_t pad0_x1_a6; //0x1A6
|
||||
};
|
||||
}
|
||||
}
|
14
include/diablo2/structures/data/monmode_line.h
Normal file
14
include/diablo2/structures/data/monmode_line.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct monmode_line {
|
||||
union {
|
||||
uint32_t code;
|
||||
char str[4];
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
234
include/diablo2/structures/data/monstats_line.h
Normal file
234
include/diablo2/structures/data/monstats_line.h
Normal file
@@ -0,0 +1,234 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct monstats_line {
|
||||
uint16_t id; //0x00
|
||||
uint16_t base_id; //0x02
|
||||
uint16_t next_in_class; //0x04
|
||||
uint16_t name_str; //0x06
|
||||
uint16_t desc_str; //0x08
|
||||
uint16_t unk0_x0_a; //0x0A
|
||||
uint32_t mon_stats_flags; //0x0C
|
||||
uint32_t code; //0x10
|
||||
uint16_t mon_sound; //0x14
|
||||
uint16_t u_mon_sound; //0x16
|
||||
uint16_t mon_stats_ex; //0x18
|
||||
uint16_t mon_prop; //0x1A
|
||||
uint16_t mon_type; //0x1C
|
||||
uint16_t ai; //0x1E
|
||||
uint16_t spawn; //0x20
|
||||
uint8_t spawn_x; //0x22
|
||||
uint8_t spawn_y; //0x23
|
||||
uint16_t spawn_mode; //0x24
|
||||
uint16_t minion1; //0x26
|
||||
uint16_t minion2; //0x28
|
||||
uint16_t unk0_x2_a; //0x2A
|
||||
uint8_t party_min; //0x2C
|
||||
uint8_t party_max; //0x2D
|
||||
uint8_t rarity; //0x2E
|
||||
uint8_t min_grp; //0x2F
|
||||
uint8_t max_grp; //0x30
|
||||
uint8_t sparse_populate; //0x31
|
||||
uint16_t velocity; //0x32
|
||||
uint16_t run; //0x34
|
||||
uint16_t unk0_x36; //0x36
|
||||
uint16_t unk0_x38; //0x38
|
||||
uint16_t miss_a1; //0x3A
|
||||
uint16_t miss_a2; //0x3C
|
||||
uint16_t miss_s1; //0x3E
|
||||
uint16_t miss_s2; //0x40
|
||||
uint16_t miss_s3; //0x42
|
||||
uint16_t miss_s4; //0x44
|
||||
uint16_t miss_c; //0x46
|
||||
uint16_t miss_sq; //0x48
|
||||
uint16_t unk0_x4_a; //0x4A
|
||||
uint8_t align; //0x4C
|
||||
uint8_t trans_lvl; //0x4D
|
||||
uint8_t threat; //0x4E
|
||||
uint8_t ai_del; //0x4F
|
||||
uint8_t ai_del_n; //0x50
|
||||
uint8_t ai_del_h; //0x51
|
||||
uint8_t ai_dist; //0x52
|
||||
uint8_t ai_dist_n; //0x53
|
||||
uint16_t ai_dist_h; //0x54
|
||||
uint16_t ai_p1; //0x56
|
||||
uint16_t ai_p1_n; //0x58
|
||||
uint16_t ai_p1_h; //0x5A
|
||||
uint16_t ai_p2; //0x5C
|
||||
uint16_t ai_p2_n; //0x5E
|
||||
uint16_t ai_p2_h; //0x60
|
||||
uint16_t ai_p3; //0x62
|
||||
uint16_t ai_p3_n; //0x64
|
||||
uint16_t ai_p3_h; //0x66
|
||||
uint16_t ai_p4; //0x68
|
||||
uint16_t ai_p4_n; //0x6A
|
||||
uint16_t ai_p4_h; //0x6C
|
||||
uint16_t ai_p5; //0x6E
|
||||
uint16_t ai_p5_n; //0x70
|
||||
uint16_t ai_p5_h; //0x72
|
||||
uint16_t ai_p6; //0x74
|
||||
uint16_t ai_p6_n; //0x76
|
||||
uint16_t ai_p6_h; //0x78
|
||||
uint16_t ai_p7; //0x7A
|
||||
uint16_t ai_p7_n; //0x7C
|
||||
uint16_t ai_p7_h; //0x7E
|
||||
uint16_t ai_p8; //0x80
|
||||
uint16_t ai_p8_n; //0x82
|
||||
uint16_t ai_p8_h; //0x84
|
||||
uint16_t treasure_class1; //0x86
|
||||
uint16_t treasure_class2; //0x88
|
||||
uint16_t treasure_class3; //0x8A
|
||||
uint16_t treasure_class4; //0x8C
|
||||
uint16_t treasure_class1_n; //0x8E
|
||||
uint16_t treasure_class2_n; //0x90
|
||||
uint16_t treasure_class3_n; //0x92
|
||||
uint16_t treasure_class4_n; //0x94
|
||||
uint16_t treasure_class1_h; //0x96
|
||||
uint16_t treasure_class2_h; //0x98
|
||||
uint16_t treasure_class3_h; //0x9A
|
||||
uint16_t treasure_class4_h; //0x9C
|
||||
uint8_t tc_quest_id; //0x9E
|
||||
uint8_t tc_quest_cp; //0x9F
|
||||
uint8_t drain; //0xA0
|
||||
uint8_t drain_n; //0xA1
|
||||
uint8_t drain_h; //0xA2
|
||||
uint8_t to_block; //0xA3
|
||||
uint8_t b_to_block_n; //0xA4
|
||||
uint8_t to_block_h; //0xA5
|
||||
uint16_t crit; //0xA6
|
||||
uint16_t skill_damage; //0xA8
|
||||
uint16_t level; //0xAA
|
||||
uint16_t level_n; //0xAC
|
||||
uint16_t level_h; //0xAE
|
||||
uint16_t min_hp; //0xB0
|
||||
uint16_t min_hp_n; //0xB2
|
||||
uint16_t min_hp_h; //0xB4
|
||||
uint16_t max_hp; //0xB6
|
||||
uint16_t max_hp_n; //0xB8
|
||||
uint16_t max_hp_h; //0xBA
|
||||
uint16_t ac; //0xBC
|
||||
uint16_t ac_n; //0xBE
|
||||
uint16_t ac_h; //0xC0
|
||||
uint16_t a1_th; //0xC2
|
||||
uint16_t a1_th_n; //0xC4
|
||||
uint16_t a1_th_h; //0xC6
|
||||
uint16_t a2_th; //0xC8
|
||||
uint16_t a2_th_n; //0xCA
|
||||
uint16_t a2_th_h; //0xCC
|
||||
uint16_t s1_th; //0xCE
|
||||
uint16_t s1_th_n; //0xD0
|
||||
uint16_t s1_th_h; //0xD2
|
||||
uint16_t exp; //0xD4
|
||||
uint16_t exp_n; //0xD6
|
||||
uint16_t exp_h; //0xD8
|
||||
uint16_t a1_min_d; //0xDA
|
||||
uint16_t a1_min_d_n; //0xDC
|
||||
uint16_t a1_min_d_h; //0xDE
|
||||
uint16_t a1_max_d; //0xE0
|
||||
uint16_t a1_max_d_n; //0xE2
|
||||
uint16_t a1_max_d_h; //0xE4
|
||||
uint16_t a2_min_d; //0xE6
|
||||
uint16_t a2_min_d_n; //0xE8
|
||||
uint16_t a2_min_d_h; //0xEA
|
||||
uint16_t a2_max_d; //0xEC
|
||||
uint16_t a2_max_d_n; //0xEE
|
||||
uint16_t a2_max_d_h; //0xF0
|
||||
uint16_t s1_min_d; //0xF2
|
||||
uint16_t s1_min_d_n; //0xF4
|
||||
uint16_t s1_min_d_h; //0xF6
|
||||
uint16_t s1_max_d; //0xF8
|
||||
uint16_t s1_max_d_n; //0xFA
|
||||
uint16_t s1_max_d_h; //0xFC
|
||||
uint8_t el1_mode; //0xFE
|
||||
uint8_t el2_mode; //0xFF
|
||||
uint8_t el3_mode; //0x100
|
||||
uint8_t el1_type; //0x101
|
||||
uint8_t el2_type; //0x102
|
||||
uint8_t el3_type; //0x103
|
||||
uint8_t el1_pct; //0x104
|
||||
uint8_t el1_pct_n; //0x105
|
||||
uint8_t el1_pct_h; //0x106
|
||||
uint8_t el2_pct; //0x107
|
||||
uint8_t el2_pct_n; //0x108
|
||||
uint8_t el2_pct_h; //0x109
|
||||
uint8_t el3_pct; //0x10A
|
||||
uint8_t el3_pct_n; //0x10B
|
||||
uint8_t el3_pct_h; //0x10C
|
||||
uint8_t unk0_x_10d; //0x10D
|
||||
uint16_t el1_min_d; //0x10E
|
||||
uint16_t el1_min_d_n; //0x110
|
||||
uint16_t el1_min_d_h; //0x112
|
||||
uint16_t el2_min_d; //0x114
|
||||
uint16_t el2_min_d_n; //0x116
|
||||
uint16_t el2_min_d_h; //0x118
|
||||
uint16_t el3_min_d; //0x11A
|
||||
uint16_t el3_min_d_n; //0x11C
|
||||
uint16_t el3_min_d_h; //0x11E
|
||||
uint16_t el1_max_d; //0x120
|
||||
uint16_t el1_max_d_n; //0x122
|
||||
uint16_t el1_max_d_h; //0x124
|
||||
uint16_t el2_max_d; //0x126
|
||||
uint16_t el2_max_d_n; //0x128
|
||||
uint16_t el2_max_d_h; //0x12A
|
||||
uint16_t el3_max_d; //0x12C
|
||||
uint16_t el3_max_d_n; //0x12E
|
||||
uint16_t el3_max_d_h; //0x130
|
||||
uint16_t el_1dur; //0x132
|
||||
uint16_t el_1dur_n; //0x134
|
||||
uint16_t el_1dur_h; //0x136
|
||||
uint16_t el_2dur; //0x138
|
||||
uint16_t el_2dur_n; //0x13A
|
||||
uint16_t el_2dur_h; //0x13C
|
||||
uint16_t el_3dur; //0x13E
|
||||
uint16_t el_3dur_n; //0x140
|
||||
uint16_t el_3dur_h; //0x142
|
||||
uint16_t res_dmg; //0x144
|
||||
uint16_t res_dmg_n; //0x146
|
||||
uint16_t res_dmg_h; //0x148
|
||||
uint16_t res_magic; //0x14A
|
||||
uint16_t res_magic_n; //0x14C
|
||||
uint16_t res_magic_h; //0x14E
|
||||
uint16_t res_fire; //0x150
|
||||
uint16_t res_fire_n; //0x152
|
||||
uint16_t res_fire_h; //0x154
|
||||
uint16_t res_light; //0x156
|
||||
uint16_t res_light_n; //0x158
|
||||
uint16_t res_light_h; //0x15A
|
||||
uint16_t res_cold; //0x15C
|
||||
uint16_t res_cold_n; //0x15E
|
||||
uint16_t res_cold_h; //0x160
|
||||
uint16_t res_poison; //0x162
|
||||
uint16_t res_poison_n; //0x164
|
||||
uint16_t res_poiosn_h; //0x166
|
||||
uint8_t cold_effect; //0x168
|
||||
uint8_t cold_effect_n; //0x169
|
||||
uint16_t cold_effect_h; //0x16A
|
||||
uint32_t send_skills; //0x16C
|
||||
uint16_t skill1; //0x170
|
||||
uint16_t skill2; //0x172
|
||||
uint16_t skill3; //0x174
|
||||
uint16_t skill4; //0x176
|
||||
uint16_t skill5; //0x178
|
||||
uint16_t skill6; //0x17A
|
||||
uint16_t skill7; //0x17C
|
||||
uint16_t skill8; //0x17E
|
||||
uint32_t unk0_x180[6]; //0x180
|
||||
uint8_t sk1_lvl; //0x198
|
||||
uint8_t sk2_lvl; //0x199
|
||||
uint8_t sk3_lvl; //0x19A
|
||||
uint8_t sk4_lvl; //0x19B
|
||||
uint8_t sk5_lvl; //0x19C
|
||||
uint8_t sk6_lvl; //0x19D
|
||||
uint8_t sk7_lvl; //0x19E
|
||||
uint8_t sk8_lvl; //0x19F
|
||||
uint32_t damage_regen; //0x1A0
|
||||
uint8_t spl_end_death; //0x1A4
|
||||
uint8_t spl_get_mode_chart; //0x1A5
|
||||
uint8_t spl_end_generic; //0x1A6
|
||||
uint8_t spl_client_end; //0x1A7
|
||||
};
|
||||
}
|
||||
}
|
14
include/diablo2/structures/data/playerclass_line.h
Normal file
14
include/diablo2/structures/data/playerclass_line.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct playerclass_line {
|
||||
union {
|
||||
uint32_t code;
|
||||
char str[4];
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
15
include/diablo2/structures/data/properties_line.h
Normal file
15
include/diablo2/structures/data/properties_line.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct properties_line {
|
||||
uint16_t prop;
|
||||
uint8_t set[8];
|
||||
uint16_t val[7];
|
||||
uint8_t func[8];
|
||||
uint16_t stat[7];
|
||||
};
|
||||
}
|
||||
}
|
14
include/diablo2/structures/data/storepage_line.h
Normal file
14
include/diablo2/structures/data/storepage_line.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct storepage_line {
|
||||
union {
|
||||
uint32_t code;
|
||||
char str[4];
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
305
include/diablo2/structures/data_tables.h
Normal file
305
include/diablo2/structures/data_tables.h
Normal file
@@ -0,0 +1,305 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct linkage;
|
||||
|
||||
struct playerclass_line;
|
||||
struct bodylocs_line;
|
||||
struct storepage_line;
|
||||
struct elemtypes_line;
|
||||
struct hitclass_line;
|
||||
struct monmode_line;
|
||||
struct properties_line;
|
||||
|
||||
struct unique_items //size=0x14C (332)
|
||||
{
|
||||
WORD uniqueId; //+00
|
||||
BYTE uk1[0x20]; //+02
|
||||
WORD uniqueNameId; //+22
|
||||
BYTE uk2[0x08]; //+24
|
||||
union {
|
||||
BYTE flag; //+2C
|
||||
struct {
|
||||
BYTE ukf : 2;
|
||||
BYTE carry1 : 1;
|
||||
BYTE ladder : 1;
|
||||
};
|
||||
};
|
||||
BYTE uk3[0x11F]; //+2D
|
||||
};
|
||||
|
||||
struct data_tables {
|
||||
playerclass_line* player_class; //+00000000 01415B48 playerclass.txt
|
||||
linkage* player_class_info; //+00000004 01410524 playerclass info
|
||||
|
||||
bodylocs_line* body_locs; //+00000008 01415578 bodylocs.txt
|
||||
linkage* body_locs_info; //+0000000C 01410504 bodylocs info
|
||||
|
||||
storepage_line* store_page; //+00000010 01414CC8 storepage.txt
|
||||
linkage* store_page_info; //+00000014 01415B24 storepage info
|
||||
|
||||
elemtypes_line* elemtypes; //+00000018 01414958 elemtypes.txt
|
||||
linkage* elemtypes_info; //+0000001C 01415B04 elemtypes info
|
||||
|
||||
hitclass_line* hit_class; //+00000020 01414148 hitclass.txt
|
||||
linkage* hit_class_info; //+00000024 01415AE4 hitclass info
|
||||
|
||||
monmode_line* mon_mode; //+00000028 01416878 monmode.txt
|
||||
linkage* mon_mode_info; //+0000002C 01415514 monmode info
|
||||
|
||||
void* pPlayerModeStub; //+00000030 014162E8 plrmode.txt
|
||||
linkage* iPlayerMode; //+00000034 01414934 plrmode info
|
||||
void* pSkillCalc; //+00000038 05279860 skillcalc.txt
|
||||
linkage* iSkillCalc; //+0000003C 01410014 skillcalc info
|
||||
uint8_t* pSkillsCode; //+00000040 0537A514 skillscode formulae
|
||||
uint32_t dwSkillsCodeSize; //+00000044 00001768 size of skillscode block
|
||||
uint32_t dwSkillsCodeSizeEx; //+00000048 00001768 size of skillscode block
|
||||
uint8_t* pSkillDescCode; //+0000004C 0535C994 skilldesccode formulae
|
||||
uint32_t dwSkillDescCodeSize; //+00000050 0000107F size of skilldesccode block
|
||||
uint32_t dwSkillDescCodeSizeEx; //+00000054 0000107F size of skilldesccode block
|
||||
const char* pMissileCalc; //+00000058 01419C28 misscalc.txt
|
||||
linkage* iMissileCalc; //+0000005C 01417024 misscalc info
|
||||
uint8_t* pMissCode; //+00000060 014A4944 misscode formulae
|
||||
uint32_t dwMissCodeSize; //+00000064 000000D4 size of misscode block
|
||||
uint32_t dwMissCodeSizeEx; //+00000068 000000D4 size of misscode block
|
||||
const char* pSkillCode; //+0000006C 052C445C skillcode.txt (Id from skills.txt)
|
||||
linkage* iSkillCode; //+00000070 0141F084 skillcode info
|
||||
void* pEvents; //+00000074 0141ACA8 events.txt
|
||||
linkage* iEvents; //+00000078 0141F064 events info
|
||||
uint32_t* pCompCodes; //+0000007C 06C4FAFC compcode.txt
|
||||
linkage* iCompCodes; //+00000080 01410544 compcode info
|
||||
int nCompCodes; //+00000084 00000073 # of compcode records
|
||||
void* pMonAI; //+00000088 0564351C monai.txt
|
||||
linkage* iMonAI; //+0000008C 01414914 monai info
|
||||
int nMonAI; //+00000090 00000098 # of monai records
|
||||
linkage* iItems; //+00000094 014BA014 items info
|
||||
uint8_t* pItemsCode; //+00000098 013FDED8 itemscode formulae
|
||||
uint32_t dwItemsCodeSize; //+0000009C 000010E0 size of itemscode block
|
||||
uint32_t dwItemsCodeSizeEx; //+000000A0 000010E0 size of itemscode block
|
||||
uint32_t* pProperties; //+000000A4 0579E218 properties.txt
|
||||
linkage* iProperties; //+000000A8 01489464 properties info
|
||||
int nProperties; //+000000AC 00000110 # of properties records
|
||||
linkage* iRunes; //+000000B0 014C4774 runes info
|
||||
uint32_t* pMercDesc; //+000000B4 01417208 hiredesc.txt
|
||||
linkage* iMercDesc; //+000000B8 01415534 hiredesc info
|
||||
uint32_t* pStates; //+000000BC 05767EA0 states.txt (limit = 255)
|
||||
linkage* iStates; //+000000C0 014A16C4 states info
|
||||
int nStates; //+000000C4 000000BD # of states records
|
||||
void* pStateMasks; //+000000C8 014A2574 statemasks.txt
|
||||
uint32_t* fStateMasks[40]; //+000000CC 014A2574 statemasks[40] (statemasks.txt segment array)
|
||||
short* pProgressiveStates; //+0000016C 014A23E4 progressive-state list
|
||||
int nProgressiveStates; //+00000170 00000006 # of progressive states
|
||||
short* pCurseStates; //+00000174 014A2254 curse-state list
|
||||
int nCurseStates; //+00000178 0000001A # of curse states
|
||||
short* pTransformStates; //+0000017C 014A20C4 transform-state list
|
||||
int nTransformStates; //+00000180 00000007 # of transform states
|
||||
short* pActionStates; //+00000184 014A3E74 action-state list
|
||||
int nActionStates; //+00000188 00000007 # of action states
|
||||
short* pColourStates; //+0000018C 014A3CE4 color-state list
|
||||
int nColourStates; //+00000190 00000002 # of color states
|
||||
void* pSoundCodes; //+00000194 057656BC soundcode.txt (sound column from sounds.txt)
|
||||
linkage* iSoundCodes; //+00000198 0141F0E4 soundcode info
|
||||
int nSoundCodes; //+0000019C 00000000 # of soundcode records (blanked out later)
|
||||
uint32_t* pHirelings; //+000001A0 055D8CD8 hirelings.txt (limit = 256)
|
||||
int nHirelings; //+000001A4 00000078 # of hirelings records
|
||||
int pMercFirst[256]; //+000001A8 00000000 array of 256 integers (namefirst column from hirelings.txt)
|
||||
int pMercLast[256]; //+000005A8 0000000C array of 256 integers (namelast column from hirelings.txt)
|
||||
void* pNPCs; //+000009A8 05724F74 npcs.txt
|
||||
int nNPCs; //+000009AC 00000011 # of npcs records
|
||||
void* pColours; //+000009B0 01417568 colors.txt
|
||||
linkage* iColours; //+000009B4 01415554 colors info
|
||||
linkage* iTreasureClassEx; //+000009B8 014C4714 treasureclassex info
|
||||
uint32_t* pTreasureClassEx; //+000009BC 05718D98 treasureclassex.txt (limit = 65534 - autotcs#)
|
||||
int nTreasureClassEx; //+000009C0 0000043C # of treasureclassex records
|
||||
uint32_t* aTreasureClass[45]; //+000009C4 0571D074 chest treasureclassex list (an array of 45 pointers)
|
||||
uint32_t* pMonstats; //+00000A78 04FE0014 monstats.txt (limit = 32766)
|
||||
linkage* iMonstats; //+00000A7C 0143C024 monstats info
|
||||
int nMonstats; //+00000A80 000002E1 # of monstats records
|
||||
void* pMonSounds; //+00000A84 013EBC9C monsounds.txt
|
||||
linkage* iMonSounds; //+00000A88 01438024 monsounds info
|
||||
int nMonSounds; //+00000A8C 0000008D # of monsounds records
|
||||
uint32_t* pMonstats2; //+00000A90 05287408 monstats2.txt (no sign of that 1023 record limit)
|
||||
linkage* iMonstats2; //+00000A94 01502014 monstats2 info
|
||||
int nMonstats2; //+00000A98 00000245 # of monstats2 records
|
||||
void* pMonPlace; //+00000A9C 01412648 monplace.txt
|
||||
linkage* iMonPlace; //+00000AA0 01417BA4 monplace info
|
||||
int nMonPlace; //+00000AA4 00000025 # of monplace records
|
||||
void* pMonPreset; //+00000AA8 057248B0 monpreset.txt
|
||||
void* aMonPresetI[5]; //+00000AAC 057248B0 array of 5 pointers to the monpreset sections for each of the 5 acts
|
||||
void* aMonPresetII[5]; //+00000AC0 0000002F array of 5 integers (# of records for monpreset in each of the 5 acts)
|
||||
uint32_t* pSuperUniques; //+00000AD4 05364928 superuniques.txt (limit = 512)
|
||||
linkage* iSuperUniques; //+00000AD8 0145A1F4 superuniques info
|
||||
int nSuperUniques; //+00000ADC 00000042 # of superunique records
|
||||
uint16_t aSuperUniques[66]; //+00000AE0 00010000 array of 66 uint16_ts (the IdNos of the default superuniques, new ones are not added here [thankfully])
|
||||
uint32_t* pMissiles; //+00000B64 05590014 missiles.txt (does some fixing for collidetype > 8)
|
||||
linkage* iMissiles; //+00000B68 01492014 missiles info
|
||||
int nMissiles; //+00000B6C 000002C4 # of missiles records
|
||||
uint32_t* pMonLvl; //+00000B70 013B0064 monlvl.txt
|
||||
int nMonLvl; //+00000B74 0000006F # of monlvl records
|
||||
void* pMonSeq; //+00000B78 05375900 monseq.txt
|
||||
linkage* iMonSeq; //+00000B7C 0143A024 monseq info
|
||||
int nMonSeq; //+00000B80 000003F2 # of monseq records
|
||||
uint32_t* pMonSeqTable; //+00000B84 0143E7E4 sequences table (created from monseq.txt)
|
||||
int nMonSeqTable; //+00000B88 0000003C # of sequences
|
||||
uint32_t* pSkillDesc; //+00000B8C 05741104 skilldesc.txt (limit = 32766) [JL and not JLE]
|
||||
linkage* iSkillDesc; //+00000B90 014B8024 skilldesc info
|
||||
int nSkillDesc; //+00000B94 000000DD # of skilldesc records
|
||||
uint32_t* pSkills; //+00000B98 056E4D78 skills.txt (limit = 32766) [JL and not JLE]
|
||||
linkage* iSkills; //+00000B9C 014B50E4 skills info
|
||||
int nSkills; //+00000BA0 00000173 # of skills records
|
||||
int* nClassSkillCount; //+00000BA4 014B9014 class skill count list
|
||||
int nHighestClassSkillCount; //+00000BA8 0000001E # highest class skill count
|
||||
short* nClassSkillList; //+00000BAC 014BCB54 class skill list
|
||||
int nPassiveSkills; //+00000BB0 0000001C # of passive skills
|
||||
uint16_t* pPassiveSkills; //+00000BB4 014BCB04 passiveskill list
|
||||
linkage* iOverlay; //+00000BB8 01484024 overlay info
|
||||
uint32_t* pOverlay; //+00000BBC 05352F54 overlay.txt
|
||||
int nOverlay; //+00000BC0 00000125 # of overlay records
|
||||
uint32_t* pCharStats; //+00000BC4 057AD178 charstats.txt
|
||||
int nCharStats; //+00000BC8 00000007 # of charstats records
|
||||
uint32_t* pItemStatCost; //+00000BCC 05219760 itemstatcost.txt (limit = 510) [511 used as END_OF_STATS in 'GF/JM' files]
|
||||
linkage* iItemStatCost; //+00000BD0 0148C024 itemstatcost info
|
||||
int nItemStatCost; //+00000BD4 0000016E # of itemstatcost records
|
||||
void* pOPStats; //+00000BD8 014882A4 opstats nesting table
|
||||
int nOPStats; //+00000BDC 000000D3 # of nested opstats
|
||||
uint32_t* pMonEquip; //+00000BE0 013B3798 monequip.txt (limit = 32766)
|
||||
int nMonEquip; //+00000BE4 0000002D # of monequip records
|
||||
uint32_t* pPetType; //+00000BE8 05774138 pettype.txt (limit = 511)
|
||||
linkage* iPetType; //+00000BEC 01486024 pettype info
|
||||
int nPetType; //+00000BF0 00000014 # of pettype records
|
||||
linkage* iItemTypes; //+00000BF4 0141E024 itemtypes info
|
||||
uint32_t* pItemTypes; //+00000BF8 050D14AC itemtypes.txt
|
||||
int nItemTypes; //+00000BFC 00000069 # of itemtypes records
|
||||
int nItemTypesIndex; //+00000C00 00000004 (itemtypes#+31)/32
|
||||
uint32_t* pItemTypesNest; //+00000C04 0537C41C itemtypes nesting table
|
||||
linkage* iSets; //+00000C08 014B3CE4 sets info
|
||||
void* pSets; //+00000C0C 057A162C sets.txt (limit = 32766)
|
||||
int nSets; //+00000C10 00000020 # of sets records
|
||||
linkage* iSetItems; //+00000C14 014B1024 setitems info
|
||||
uint32_t* pSetItems; //+00000C18 056BBAC0 setitems.txt (limit = 32766)
|
||||
int nSetItems; //+00000C1C 0000007F # of setitems records
|
||||
linkage* iUniqueItems; //+00000C20 014AA044 uniqueitems info
|
||||
unique_items* pUniqueItems; //+00000C24 0510E8B4 uniqueitems.txt (limit = 32766)
|
||||
int nUniqueItems; //+00000C28 00000191 # of uniqueitems records
|
||||
//linkage* iMonProp; //+00000C2C 01439024 monprop info
|
||||
//FileMonpropTable* pMonProp; //+00000C30 05132A2C monprop.txt
|
||||
//int nMonProp; //+00000C34 0000000E # of monprop records
|
||||
//linkage* iMonType; //+00000C38 0141C024 montype info
|
||||
//void* pMonType; //+00000C3C 06C4F014 montype.txt
|
||||
//int nMonType; //+00000C40 0000003B # of montype records
|
||||
//uint32_t* pMonTypeNest; //+00000C44 0141AAB4 montype nesting table
|
||||
//int nMonTypeIndex; //+00000C48 00000002 (montype#+31)/32
|
||||
//linkage* iMonUMod; //+00000C4C 0145A274 monumod info
|
||||
//FileMonumodTable* pMonUMod; //+00000C50 0654F014 monumod.txt (limit = 512)
|
||||
//int nMonUMod; //+00000C54 0000002B # of monumod records
|
||||
//FileLevelsTable* pLevels; //+00000C58 0562D0EC levels.txt (limit = 1023)
|
||||
//int nLevels; //+00000C5C 00000096 # of levels records
|
||||
//FileLevelDefsTable* pLevelDefs; //+00000C60 055E134C leveldefs.txt
|
||||
//FileLevelPresetTable* pLevelPreset; //+00000C64 0502C7E8 lvlprest.txt
|
||||
//int nLevelPreset; //+00000C68 00000447 # of lvlprest records
|
||||
//int nStuff; //+00000C6C 00000006 stuff value (ItemStatCost.txt + 0x140, record #1)
|
||||
//int cStuff; //+00000C70 0000003F 2 ^ stuff - 1 (used as a controller field for opstats and other special stats)
|
||||
//FileAnimDataTable* pAnimData; //+00000C74 052369C0 sgptAnimTables (see below)
|
||||
//FileExperienceTable* pExperience; //+00000C78 05ECF014 experience.txt
|
||||
//FileDifficultyLevelsTable* pDifficultyLevels; //+00000C7C 05750CD8 difficultylevels.txt (recordNo must equal 3)
|
||||
//int nDifficultyLevels; //+00000C80 00000003 # of difficultylevels records
|
||||
//BOOL bCompileTXT; //+00000C84 -txt switch
|
||||
//void* ExpFieldI[6]; //+00000C88
|
||||
//uint32_t unk0[4]; //+00000CA0
|
||||
//void* pExpField; //+00000CB0
|
||||
//void* ExpFieldII[4]; //+00000CB4
|
||||
//void* pCubeMain; //+00000CC4
|
||||
//int nCubeMain; //+00000CC8
|
||||
//int nInventory; //+00000CCC
|
||||
//D2InventoryRecordStrc* pInventory; //+00000CD0
|
||||
//uint32_t unk1; //+00000CD4
|
||||
//int nMasterItemList; //+00000CD8
|
||||
//FileItemTable* pMasterItemList; //+00000CDC
|
||||
//void* pWeapons; //+00000CE0
|
||||
//int nWeapons; //+00000CE4
|
||||
//void* pArmor; //+00000CE8
|
||||
//int nArmor; //+00000CEC
|
||||
//void* pMisc; //+00000CF0
|
||||
//int nMisc; //+00000CF4
|
||||
//uint32_t unk2; //+00000CF8
|
||||
//int nGems; //+00000CFC
|
||||
//FileGemsTable* pGems; //+00000D00
|
||||
//int nLowQualityItems; //+00000D04
|
||||
//FileLowQualityItemsTable* pLowQualityItems; //+00000D08
|
||||
//int nBooks; //+00000D0C
|
||||
//FileBooksTable* pBooks; //+00000D10
|
||||
//int nRareAffix; //+00000D14
|
||||
//FileRareAffixTable* pRareAffix; //+00000D18
|
||||
//FileRareAffixTable* pRareSuffix; //+00000D1C
|
||||
//FileRareAffixTable* pRarePrefix; //+00000D20
|
||||
//int nItemRatio; //+00000D24
|
||||
//FileItemratioTable* pItemRatio; //+00000D28
|
||||
//uint32_t unk3; //+00000D2C
|
||||
//int nGamble; //+00000D30
|
||||
//uint32_t* pGambleSelection; //+00000D34
|
||||
//int* pGambleChooseLimit[100]; //+00000D3C
|
||||
//int nAffix; //+00000EC8
|
||||
//FileAffixTable* pAffix; //+00000ECC [suffixes][prefixes][automagic]
|
||||
//FileAffixTable* pMagicSuffix; //+00000ED0
|
||||
//FileAffixTable* pMagicPrefix; //+00000ED4
|
||||
//FileAffixTable* pAutoMagic; //+00000ED8
|
||||
//int nRunes; //+00000EDC
|
||||
//void* pRunes; //+00000EE0
|
||||
//int nQualityItems; //+00000EE4
|
||||
//FileQualityitemsTable* pQualityItems; //+00000EE8
|
||||
//uint32_t unk4; //+00000EEC
|
||||
//uint32_t dwHiSeed; //+00000EF0
|
||||
//uint32_t dwLoSeed; //+00000EF4
|
||||
//uint32_t dwAutoMapRand[72]; //+00000EFC
|
||||
//void* pLvlTypes; //+00001018
|
||||
//int* pPortalLevels; //+0000101C
|
||||
//int nPortalLevels; //+00001020
|
||||
//int nLvlTypes; //+00001024
|
||||
//FileLevelWarpTable* pLevelWarp; //+00001028
|
||||
//int nLevelWarp; //+0000102C
|
||||
//FileLevelMazeTable* pLevelMaze; //+00001030
|
||||
//int nLevelMaze; //+00001034
|
||||
//void* pLvlSub; //+00001038
|
||||
//int nLvlSub; //+0000103C
|
||||
//void* sLvlSub; //+00001040
|
||||
//uint32_t unk5; //+00001044
|
||||
//void* ppLvlTypes; //+00001048
|
||||
//uint32_t unk6; //+0000104C
|
||||
//D2AutoMapShortStrc* pAutoMap; //+00001050
|
||||
//int nAutoMap; //+00001054
|
||||
//void* pMonLink; //+00001058
|
||||
//int nMonItemPercent; //+0000105C
|
||||
//void* pMonItemPercent; //+00001060
|
||||
//void* pUniqueTitle; //+00001064
|
||||
//void* pUniquePrefix; //+00001068
|
||||
//void* pUniqueSuffix; //+0000106C
|
||||
//void* pUniqueAppelation; //+00001070
|
||||
//int nUniqueTitle; //+00001074
|
||||
//int nUniquePrefix; //+00001078
|
||||
//int nUniqueSuffix; //+0000107C
|
||||
//int nUniqueAppelation; //+00001080
|
||||
//uint32_t unk7[4]; //+00001084
|
||||
//FileShrinesTable* pShrines; //+00001094
|
||||
//int nShrines; //+00001098
|
||||
//FileObjectsTable* pObjects; //+0000109C
|
||||
//int nObjects; //+000010A0
|
||||
//void* pObjGroup; //+000010A4
|
||||
//int nObjectGroup; //+000010A8
|
||||
//void* pArmType; //+000010AC
|
||||
//int nMonMode; //+000010B0
|
||||
//FileMonmodeTable* pMonMode[3]; //+000010B4
|
||||
//void* pMonLoc; //+000010B8
|
||||
//int nObjTypeAndMode; //+000010BC
|
||||
//void* pObjTypeAndMode; //+000010C0
|
||||
//void* pObjType; //+000010C4
|
||||
//void* pObjMode; //+000010C8
|
||||
//int nPlayerTypeAndMode; //+000010CC
|
||||
//void* pPlayerTypeAndMode; //+000010D0
|
||||
//void* pPlayerType; //+000010D4
|
||||
//void* pPlayerMode; //+000010D8
|
||||
};
|
||||
}
|
||||
}
|
16
include/diablo2/structures/file_handle.h
Normal file
16
include/diablo2/structures/file_handle.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct file_handle {
|
||||
char pad_0000[0x134];
|
||||
void* file;
|
||||
int32_t position;
|
||||
int32_t size;
|
||||
char pad_0001[0x18];
|
||||
};
|
||||
static_assert(sizeof(file_handle) == 0x158);
|
||||
}
|
||||
}
|
57
include/diablo2/structures/game.h
Normal file
57
include/diablo2/structures/game.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct unit;
|
||||
|
||||
struct game {
|
||||
char pad_0000[24]; //0x0000
|
||||
void* critical_section; //0x0018
|
||||
void* memory_pool; //0x001C
|
||||
char pad_0020[74]; //0x0020
|
||||
int8_t game_type; //0x006A
|
||||
char pad_006_b[2]; //0x006B
|
||||
int8_t difficulty_level; //0x006D
|
||||
char pad_006_e[2]; //0x006E
|
||||
int32_t expansion; //0x0070
|
||||
int32_t game_type2; //0x0074
|
||||
int32_t item_format; //0x0078
|
||||
int32_t init_seed; //0x007C
|
||||
int32_t object_seed; //0x0080
|
||||
int32_t init_seed2; //0x0084
|
||||
void* last_client; //0x0088 structure of last player that entered the game
|
||||
int32_t clients_count; //0x008C
|
||||
int32_t unit_counts[6]; //0x0090
|
||||
int32_t game_frame; //0x00A8
|
||||
char pad_00_ac[12]; //0x00AC
|
||||
void* timer_queue; //0x00B8
|
||||
void* drlg_act[5]; //0x00BC
|
||||
int32_t lo_seed; //0x00D0
|
||||
int32_t hi_seed; //0x00D4
|
||||
char pad_00d8[20]; //0x00D8
|
||||
int32_t monster_seed; //0x00EC
|
||||
void* monster_region[1024]; //0x00F0
|
||||
void* object_controller; //0x10F0
|
||||
void* quest_controller; //0x10F4
|
||||
void* unit_nodes[10]; //0x10F8
|
||||
unit* unit_list[5][128]; //0x1120
|
||||
void* tile_list; //0x1B20
|
||||
int32_t unique_flags[128]; //0x1B24
|
||||
void* npc_control; //0x1D24
|
||||
void* arena_control; //0x1D28
|
||||
void* party_control; //0x1D2C
|
||||
int8_t boss_flags[64]; //0x1D30
|
||||
int32_t monster_mode_data[17]; //0x1D70
|
||||
int32_t monster_mode_data_count; //0x1DB4
|
||||
char pad_1db8[12]; //0x1DB8
|
||||
int32_t sync_timer; //0x1DC4
|
||||
char pad_1dc8[32]; //0x1DC8
|
||||
int32_t uber_baal; //0x1DE8
|
||||
int32_t uber_diablo; //0x1DEC
|
||||
int32_t uber_mephisto; //0x1DF0
|
||||
}; //Size: 0x1DF4
|
||||
static_assert(sizeof(game) == 0x1DF4);
|
||||
}
|
||||
}
|
7
include/diablo2/structures/game_server.h
Normal file
7
include/diablo2/structures/game_server.h
Normal file
@@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct game_server {};
|
||||
}
|
||||
}
|
16
include/diablo2/structures/gfxcell.h
Normal file
16
include/diablo2/structures/gfxcell.h
Normal file
@@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct gfxcell {
|
||||
int32_t version;
|
||||
int32_t width;
|
||||
int32_t height;
|
||||
int32_t offset_x;
|
||||
int32_t offset_y;
|
||||
void* fram_pixel_data;
|
||||
};
|
||||
}
|
||||
}
|
45
include/diablo2/structures/gfxdata.h
Normal file
45
include/diablo2/structures/gfxdata.h
Normal file
@@ -0,0 +1,45 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct cellfile;
|
||||
struct gfxcell;
|
||||
|
||||
struct gfxdata {
|
||||
gfxcell* cell_init; //+00
|
||||
cellfile* cell_file; //+04
|
||||
int32_t frame; //+08
|
||||
int32_t direction; //+0C
|
||||
int max_directions; //+10
|
||||
int max_frames; //+14
|
||||
int32_t flags; //+18
|
||||
int8_t state; //+1C
|
||||
union {
|
||||
int8_t component; //+1D
|
||||
int8_t item_flags; //+1D
|
||||
};
|
||||
int8_t unk1_e; //+1E - padding no doubt
|
||||
int8_t unk1_f; //+1F
|
||||
int unit_type; //+20
|
||||
int unit_index; //+24
|
||||
int mode; //+28
|
||||
int overlay; //+2C
|
||||
union {
|
||||
// [token][component][type][mode][hitclass]
|
||||
struct {
|
||||
int32_t token; //+30
|
||||
int32_t component; //+34
|
||||
int32_t armor_type; //+38 - lit, med , hvy
|
||||
int32_t mode; //+3C
|
||||
int32_t hit_class; //+40
|
||||
} details;
|
||||
char unk_name[5][4]; //+30
|
||||
};
|
||||
const char* name; //+44
|
||||
};
|
||||
|
||||
static_assert(sizeof(gfxdata) == 0x48);
|
||||
}
|
||||
}
|
28
include/diablo2/structures/inventory.h
Normal file
28
include/diablo2/structures/inventory.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct unit;
|
||||
|
||||
struct inventory {
|
||||
//Offset from Code. Size: 30 or 40
|
||||
int32_t tag; //0x0000
|
||||
void* memory_pool; //0x0004
|
||||
unit* owner; //0x0008
|
||||
unit* first_item; //0x000C
|
||||
unit* last_item; //0x0010
|
||||
void* inventory_info; //0x0014
|
||||
int32_t inventory_info_count; //0x0018
|
||||
int32_t weapon_guid; //0x001C
|
||||
unit* inventory_owner_item; //0x0020
|
||||
int32_t inventory_owner_guid; //0x0024
|
||||
int32_t filled_sockets_count; //0x0028
|
||||
char pad_002_c[8]; //0x002C
|
||||
void* first_corpse; //0x0034
|
||||
char pad_0038[4]; //0x0038
|
||||
int32_t next_corpse_guid; //0x003C
|
||||
};
|
||||
}
|
||||
}
|
120
include/diablo2/structures/item_data.h
Normal file
120
include/diablo2/structures/item_data.h
Normal file
@@ -0,0 +1,120 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct inventory;
|
||||
struct unit;
|
||||
|
||||
enum class item_quality_t : uint32_t {
|
||||
ITEM_QUALITY_INFERIOR = 0x01,
|
||||
ITEM_QUALITY_NORMAL = 0x02,
|
||||
ITEM_QUALITY_SUPERIOR = 0x03,
|
||||
ITEM_QUALITY_MAGIC = 0x04,
|
||||
ITEM_QUALITY_SET = 0x05,
|
||||
ITEM_QUALITY_RARE = 0x06,
|
||||
ITEM_QUALITY_UNIQUE = 0x07,
|
||||
ITEM_QUALITY_CRAFTED = 0x08,
|
||||
ITEM_QUALITY_TEMPERED = 0x09,
|
||||
|
||||
ITEM_QUALITY_COUNT
|
||||
};
|
||||
|
||||
struct item_data {
|
||||
//Offset from Code.
|
||||
item_quality_t quality; //+00
|
||||
uint32_t seed_low; //+04
|
||||
uint32_t seed_hi; //+08
|
||||
uint32_t player_id; //+0C #10734 / #10735 (PCInventory->ptPlayer->0C)
|
||||
uint32_t seed_starting; //+10
|
||||
uint32_t flags1; //+14
|
||||
union {
|
||||
uint32_t flags2; //+18
|
||||
struct {
|
||||
uint32_t fuk1 : 1; //0x00000001
|
||||
uint32_t is_indentified : 1; //0x00000002
|
||||
uint32_t fuk2 : 2; //0x0000000C
|
||||
uint32_t is_unindentified : 1; //0x00000010
|
||||
uint32_t fuk3 : 3; //0x000000E0
|
||||
uint32_t is_broken : 1; //0x00000100
|
||||
uint32_t fuk4 : 2; //0x00000600
|
||||
uint32_t is_socketed : 1; //0x00000800
|
||||
uint32_t fuk5 : 10; //0x003FF000
|
||||
uint32_t is_etheral : 1; //0x00400000
|
||||
uint32_t fuk6 : 3; //0x03800000
|
||||
uint32_t is_runeword : 1; //0x04000000
|
||||
uint32_t fuk7 : 1; //0x08000000
|
||||
uint32_t is_personalized : 1; //0x10000000
|
||||
uint32_t fuk8 : 3; //0xE0000000
|
||||
};
|
||||
};
|
||||
|
||||
/*
|
||||
ITEMFLAG_NEWITEM = 0x00000001,
|
||||
ITEMFLAG_TAGETING = 0x00000004,
|
||||
ITEMFLAG_UNIDENTIFIED = 0x00000010,
|
||||
ITEMFLAG_QUANTITY = 0x00000020,
|
||||
ITEMFLAG_Durability = 0x00000100,
|
||||
ITEMFLAG_UNKNOWN2 = 0x00000400,
|
||||
ITEMFLAG_SOCKETED = 0x00000800,
|
||||
ITEMFLAG_NON_SELLABLE = 0x00001000,
|
||||
ITEMFLAG_NEWITEM2 = 0x00002000,
|
||||
ITEMFLAG_UNKNOWN3 = 0x00004000,
|
||||
ITEMFLAG_CHECKSECPRICE = 0x00010000,
|
||||
ITEMFLAG_CHECKGAMBLEPRICE = 0x00020000,
|
||||
ITEMFLAG_UNKNOWN4 = 0x00080000,
|
||||
ITEMFLAG_INDESTRUCTIBLE(ETHERAL) = 0x00400000,
|
||||
ITEMFLAG_UNKNOWN5 = 0x00800000,
|
||||
ITEMFLAG_FROMPLAYER = 0x01000000,
|
||||
ITEMFLAG_RUNEuint16_t = 0x04000000
|
||||
*/
|
||||
uint32_t guid1; //+1C Global Unique ID 1
|
||||
uint32_t guid2; //+20 Global Unique ID 2
|
||||
uint32_t guid3; //+24 Global Unique ID 3
|
||||
uint32_t unique_id; //+28
|
||||
uint8_t ilvl; //+2C
|
||||
uint8_t uk1[0x03]; //+2D
|
||||
uint16_t version; //+30
|
||||
uint16_t rare_prefix; //+32
|
||||
uint16_t rare_suffix; //+34
|
||||
uint16_t auto_pref; //+36
|
||||
uint16_t prefix[3]; //+38
|
||||
uint16_t suffix[3]; //+3E
|
||||
uint8_t equip_loc; //+44
|
||||
/* emplacement si équipé
|
||||
* 00 = noequip/inBelt
|
||||
* 01 = head
|
||||
* 02 = neck
|
||||
* 03 = tors
|
||||
* 04 = rarm
|
||||
* 05 = larm
|
||||
* 06 = lrin
|
||||
* 07 = rrin
|
||||
* 08 = belt
|
||||
* 09 = feet
|
||||
* 0A = glov
|
||||
* 0B = ralt
|
||||
* 0C = lalt
|
||||
*/
|
||||
uint8_t page; //+45
|
||||
/* page dans laquel se trouve l'item
|
||||
* FF = mouse/equip/onEarth
|
||||
* 00 = inventory
|
||||
* 01 = cube
|
||||
* 04 = stash
|
||||
*/
|
||||
uint8_t uk4[0x01]; //+46
|
||||
uint8_t item_data3; //+47 //D2Common10854 D2Common10853
|
||||
uint8_t p_ear_level; //+48
|
||||
uint8_t var_gfx; //+49
|
||||
char i_name[0x12]; //+4A //inscribed/ear get_name
|
||||
inventory* inventory; //+5C
|
||||
unit* pt_prev_item; //+60
|
||||
unit* pt_next_item; //+64
|
||||
uint8_t uk8[0x01]; //+68
|
||||
uint8_t item_data2; //+69
|
||||
uint8_t uk9[0x0A]; //+6A
|
||||
};
|
||||
}
|
||||
}
|
12
include/diablo2/structures/linkage.h
Normal file
12
include/diablo2/structures/linkage.h
Normal file
@@ -0,0 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct linkage {
|
||||
void* link;
|
||||
uint32_t unk[3];
|
||||
};
|
||||
}
|
||||
}
|
28
include/diablo2/structures/monster_data.h
Normal file
28
include/diablo2/structures/monster_data.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct monstats_line;
|
||||
|
||||
struct monster_data { // sizeof(MonsterData)=0x60
|
||||
monstats_line* monstats;
|
||||
uint8_t components[16]; //+04
|
||||
union {
|
||||
uint16_t flags; //+16
|
||||
struct {
|
||||
uint16_t fuk1 : 1;
|
||||
uint16_t is_super_unique : 1;
|
||||
uint16_t is_champion : 1;
|
||||
uint16_t is_unique : 1;
|
||||
uint16_t fuk2 : 13;
|
||||
};
|
||||
};
|
||||
uint8_t uk1[0x0E]; //+18
|
||||
uint16_t super_unique_id; //+26
|
||||
void* unknow1; //+28
|
||||
uint8_t uk2[0x38]; //+28
|
||||
};
|
||||
}
|
||||
}
|
31
include/diablo2/structures/net_client.h
Normal file
31
include/diablo2/structures/net_client.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct game;
|
||||
|
||||
struct net_client {
|
||||
uint32_t client_id; //+00
|
||||
uint8_t uk1[0x06]; //+04
|
||||
union { //+0A
|
||||
uint16_t flag;
|
||||
struct {
|
||||
uint16_t f1 : 1;
|
||||
uint16_t f2 : 1;
|
||||
uint16_t is_hard_core_game : 1;
|
||||
};
|
||||
};
|
||||
uint8_t uk2; //+0C
|
||||
char name[0x10]; //+0D
|
||||
uint8_t uk3[0x15F]; //+1D
|
||||
uint8_t* savefile; //+17C
|
||||
uint32_t final_size; //+180
|
||||
uint32_t counter; //+184
|
||||
uint32_t current_size; //+188
|
||||
uint8_t uk4[0x1C]; //+18C
|
||||
game* game; //+1A8
|
||||
};
|
||||
}
|
||||
}
|
55
include/diablo2/structures/npc_record.h
Normal file
55
include/diablo2/structures/npc_record.h
Normal file
@@ -0,0 +1,55 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct inventory;
|
||||
|
||||
struct npc_gamble //sizeof 0xC
|
||||
{
|
||||
inventory* pInventory; //+00
|
||||
uint32_t dwGUID; //+04 npc_gamble* pNext; //+08
|
||||
};
|
||||
|
||||
struct npc_record //sizeof 0x44
|
||||
{
|
||||
int nNPC; //+00
|
||||
inventory* pInventory; //+04
|
||||
npc_gamble* pGamble; //+08
|
||||
bool bGambleInit; //+0C
|
||||
uint32_t* pMercData; //+10 //D2MercDataStrc*
|
||||
uint32_t* pEvent; //+14 //D2NPCEventStrc*
|
||||
uint32_t* pVendorChain; //+18 //D2VendorChainStrc*
|
||||
bool bTrading; //+1C
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
union
|
||||
{
|
||||
bool bFlags[8]; //+20
|
||||
struct
|
||||
{
|
||||
bool bVendorInit; //+20
|
||||
bool bHireInit; //+21
|
||||
uint8_t nAct; //+22
|
||||
bool bTrader; //+23
|
||||
bool bLevelRefresh; //+24
|
||||
bool bInited; //+25
|
||||
bool bForceVendor; //+26
|
||||
bool bRefreshInventory; //+27
|
||||
};
|
||||
};
|
||||
|
||||
uint32_t dwTicks; //+28
|
||||
uint32_t pProxy[4]; //+2C //D2UnitProxyStrc
|
||||
uint32_t dwUnk; //+3C
|
||||
uint32_t dwNPCGUID; //+40
|
||||
};
|
||||
|
||||
uint32_t pTrade; //+20 //D2NPCTradeStrc
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
14
include/diablo2/structures/object_data.h
Normal file
14
include/diablo2/structures/object_data.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct objects_bin;
|
||||
|
||||
struct object_data {
|
||||
objects_bin* pt_objects_bin;
|
||||
uint8_t level_id;
|
||||
};
|
||||
}
|
||||
}
|
23
include/diablo2/structures/path.h
Normal file
23
include/diablo2/structures/path.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct room;
|
||||
|
||||
struct path //(8 dword)
|
||||
{ //Offset from Code. Size: 20
|
||||
uint16_t uk1; //+00
|
||||
uint16_t mapx; //+02
|
||||
uint16_t uk2; //+04
|
||||
uint16_t mapy; //+06
|
||||
uint32_t uk3; //+08
|
||||
uint32_t x; //+0C
|
||||
uint32_t y; //+10
|
||||
uint32_t uk6; //+14
|
||||
uint32_t uk7; //+18
|
||||
room* pt_room; //+1C
|
||||
};
|
||||
}
|
||||
}
|
24
include/diablo2/structures/player_data.h
Normal file
24
include/diablo2/structures/player_data.h
Normal file
@@ -0,0 +1,24 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct net_client;
|
||||
|
||||
struct player_data {
|
||||
char name[0x10]; //+00 Player Name
|
||||
void* pt_quest[3]; //+10 Quest Pointers for each difficulty
|
||||
uint8_t uk1[0x18]; //+1C //before : 0x14
|
||||
void* pt_arena_unit; //+34 ptArena for the Unit
|
||||
uint8_t uk2[0x4]; //+38 //before : 0x7
|
||||
uint16_t mp_source_portal_unique_id; //+3C Source Portal Unique_ID
|
||||
uint8_t uk3[0x2]; //+3E
|
||||
uint16_t mp_dest_portal_unique_id; //+40 Destination Portal Unique_ID
|
||||
uint8_t uk4[0x06]; //+42
|
||||
uint8_t pt_object_un_id; //+48 Object UniqueID for TownPortals
|
||||
uint8_t uk5[0x53]; //+49
|
||||
net_client* net_client; //+9C ptClient
|
||||
};
|
||||
}
|
||||
}
|
29
include/diablo2/structures/room.h
Normal file
29
include/diablo2/structures/room.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct unit;
|
||||
|
||||
struct room//size=0x80
|
||||
{
|
||||
//ptRoom +48 0 = spawn new units (monster, objects e.tc), 1 = don't spawn any new units
|
||||
uint32_t seed1; //+00
|
||||
uint32_t seed2; //+04
|
||||
uint8_t uk8[0x1C]; //+08
|
||||
room* pt_near_rooms; //+24
|
||||
uint32_t nb_near_rooms; //+28
|
||||
unit* unit; //+2C
|
||||
uint8_t uk5[0x44]; //+30
|
||||
room* pt_next_room; //+74
|
||||
union {
|
||||
uint8_t flags; //+78
|
||||
struct {
|
||||
uint8_t is_generated : 1;
|
||||
uint8_t is_generated2 : 1;//???
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
223
include/diablo2/structures/unit.h
Normal file
223
include/diablo2/structures/unit.h
Normal file
@@ -0,0 +1,223 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
#pragma pack(push, 1)
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct skills;
|
||||
struct game;
|
||||
struct inventory;
|
||||
struct stats;
|
||||
struct path;
|
||||
struct player_data;
|
||||
struct item_data;
|
||||
struct object_data;
|
||||
struct monster_data;
|
||||
struct drlg_act;
|
||||
struct skill_sequence;
|
||||
struct anim_data;
|
||||
struct unit_gfxdata;
|
||||
struct statslistex;
|
||||
struct quest_record;
|
||||
struct npc_record;
|
||||
|
||||
enum class unit_type_t : int32_t {
|
||||
UNIT_TYPE_PLAYER = 0,
|
||||
UNIT_TYPE_MONSTER = 1,
|
||||
UNIT_TYPE_OBJECT = 2,
|
||||
UNIT_TYPE_MISSILE = 3,
|
||||
UNIT_TYPE_ITEM = 4,
|
||||
UNIT_TYPE_VIS_TILE = 5 //unused?
|
||||
};
|
||||
|
||||
enum player_class_t : int32_t {
|
||||
PLAYER_CLASS_AMAZON = 0,
|
||||
PLAYER_CLASS_SORCERESS = 1,
|
||||
PLAYER_CLASS_NECROMANCER = 2,
|
||||
PLAYER_CLASS_PALADIN = 3,
|
||||
PLAYER_CLASS_BARBARIAN = 4,
|
||||
PLAYER_CLASS_DRUID = 5,
|
||||
PLAYER_CLASS_ASSASSIN = 6
|
||||
};
|
||||
|
||||
enum itemflags_t : int32_t {
|
||||
ITEMFLAG_NEWITEM = 0x00000001,
|
||||
ITEMFLAG_TARGET = 0x00000002,
|
||||
ITEMFLAG_TARGETING = 0x00000004,
|
||||
ITEMFLAG_DELETED = 0x00000008,
|
||||
ITEMFLAG_IDENTIFIED = 0x00000010,
|
||||
ITEMFLAG_QUANTITY = 0x00000020,
|
||||
ITEMFLAG_WEAPONSET_IN = 0x00000040,
|
||||
ITEMFLAG_WEAPONSET_OUT = 0x00000080,
|
||||
ITEMFLAG_BROKEN = 0x00000100,
|
||||
ITEMFLAG_REPAIRED = 0x00000200,
|
||||
ITEMFLAG_UNKNOWN2 = 0x00000400,
|
||||
ITEMFLAG_SOCKETED = 0x00000800,
|
||||
ITEMFLAG_NON_SELLABLE = 0x00001000,
|
||||
ITEMFLAG_INSTORE = 0x00002000,
|
||||
ITEMFLAG_NOEQUIP = 0x00004000,
|
||||
ITEMFLAG_NAMED = 0x00008000,
|
||||
ITEMFLAG_ORGAN = 0x00010000,
|
||||
ITEMFLAG_SELLCHEAP = 0x00020000,
|
||||
ITEMFLAG_UNK5 = 0x00040000,
|
||||
ITEMFLAG_INIT = 0x00080000,
|
||||
ITEMFLAG_UNK6 = 0x00100000,
|
||||
ITEMFLAG_COMPACTSAVE = 0x00200000,
|
||||
ITEMFLAG_ETHEREAL = 0x00400000,
|
||||
ITEMFLAG_JUSTSAVED = 0x00800000,
|
||||
ITEMFLAG_PERSONALIZED = 0x01000000,
|
||||
ITEMFLAG_LOWQUALITY = 0x02000000,
|
||||
ITEMFLAG_RUNEWORD = 0x04000000,
|
||||
ITEMFLAG_SHOPITEM = 0x06000000,
|
||||
ITEMFLAG_ITEM = 0x08000000
|
||||
};
|
||||
|
||||
struct unit {
|
||||
unit_type_t type;
|
||||
|
||||
union {
|
||||
player_class_t player_class;
|
||||
int32_t data_record_index;
|
||||
};
|
||||
|
||||
void* memory_pool;
|
||||
uint32_t guid;
|
||||
uint32_t mode;
|
||||
|
||||
union {
|
||||
player_data* player_data;
|
||||
monster_data* monster_data;
|
||||
object_data* object_data;
|
||||
//missile_data* missile_data;
|
||||
item_data* item_data;
|
||||
};
|
||||
|
||||
int8_t act;
|
||||
int8_t act_padding[0x03];
|
||||
drlg_act* drlg_act;
|
||||
|
||||
struct {
|
||||
uint32_t low_seed;
|
||||
uint32_t high_seed;
|
||||
} seed;
|
||||
uint32_t init_seed;
|
||||
|
||||
path* path;
|
||||
|
||||
skill_sequence* skill_sequence;
|
||||
uint32_t skill_sequence_frame_count;
|
||||
uint32_t skill_sequence_frame;
|
||||
|
||||
uint32_t anim_speed;
|
||||
uint32_t skill_sequence_mode;
|
||||
|
||||
uint32_t current_frame;
|
||||
uint32_t frame_count;
|
||||
uint16_t anim_speed_w;
|
||||
|
||||
uint8_t action_frame;
|
||||
uint8_t pad1;
|
||||
|
||||
anim_data* anim_data;
|
||||
|
||||
unit_gfxdata* gfxdata;
|
||||
unit_gfxdata* gfxdata_copy;
|
||||
|
||||
statslistex* statslistex;
|
||||
inventory* inventory;
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint32_t interact_guid;
|
||||
uint32_t interact_type;
|
||||
uint8_t interacting;
|
||||
} interaction;
|
||||
|
||||
struct {
|
||||
void* light_map;
|
||||
uint32_t start_light_radius;
|
||||
uint16_t p12_shift_index;
|
||||
} lightning;
|
||||
};
|
||||
|
||||
uint16_t update_type;
|
||||
unit* update_unit;
|
||||
|
||||
quest_record* quest_record;
|
||||
uint32_t sparky_chest;
|
||||
void* timer_args;
|
||||
|
||||
union {
|
||||
game* game;
|
||||
uint32_t sound_sync;
|
||||
};
|
||||
|
||||
char pad2[0x0C];
|
||||
|
||||
void* event;
|
||||
|
||||
unit_type_t owner_type;
|
||||
uint32_t owner_guid;
|
||||
|
||||
char pad3[8];
|
||||
|
||||
char* hover_text;
|
||||
|
||||
void* skills;
|
||||
|
||||
void* combat;
|
||||
uint32_t hit_class;
|
||||
|
||||
char pad4[4];
|
||||
|
||||
uint32_t drop_code;
|
||||
|
||||
char pad5[8];
|
||||
|
||||
union {
|
||||
struct {
|
||||
uint32_t unit_flags;
|
||||
uint32_t unit_flags_ex;
|
||||
} flags;
|
||||
uint64_t flags64;
|
||||
};
|
||||
|
||||
char pad6[4];
|
||||
|
||||
uint32_t node_index;
|
||||
uint32_t get_tick_count;
|
||||
|
||||
union {
|
||||
uint32_t get_tick_count2;
|
||||
void* particle_stream;
|
||||
};
|
||||
|
||||
void* timer;
|
||||
|
||||
unit* change_next_unit; //?
|
||||
unit* prev_unit;
|
||||
unit* prev_unit_in_room;
|
||||
|
||||
void* msg_first;
|
||||
void* msg_last;
|
||||
|
||||
bool is_hireling() const {
|
||||
if (type != unit_type_t::UNIT_TYPE_MONSTER)
|
||||
return false;
|
||||
|
||||
return (flags.unit_flags & 0x00000200) == 0x00000200;
|
||||
}
|
||||
|
||||
bool is_pet() const {
|
||||
if (type != unit_type_t::UNIT_TYPE_MONSTER)
|
||||
return false;
|
||||
|
||||
return (flags.unit_flags & 0x80000000) == 0x80000000;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#pragma pack(pop)
|
30
include/diablo2/utils/mpq_ifstream.h
Normal file
30
include/diablo2/utils/mpq_ifstream.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <istream>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace structures {
|
||||
struct file_handle;
|
||||
}
|
||||
|
||||
namespace utils {
|
||||
class mpq_ifstream : public std::istream {
|
||||
class mpq_streambuf : public std::streambuf {
|
||||
structures::file_handle* m_handle;
|
||||
char m_data;
|
||||
public:
|
||||
explicit mpq_streambuf(const std::string& path);
|
||||
~mpq_streambuf();
|
||||
|
||||
protected:
|
||||
int_type underflow() override;
|
||||
};
|
||||
|
||||
mpq_streambuf m_streambuf;
|
||||
public:
|
||||
explicit mpq_ifstream(const std::string& path);
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
}
|
13
include/diablo2/utils/screen.h
Normal file
13
include/diablo2/utils/screen.h
Normal file
@@ -0,0 +1,13 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace diablo2 {
|
||||
namespace utils {
|
||||
class screen {
|
||||
public:
|
||||
static void screen_to_world(int32_t sx, int32_t sy, int32_t& wx, int32_t& wy);
|
||||
static void world_to_screen(int32_t wx, int32_t wy, int32_t& sx, int32_t& sy);
|
||||
};
|
||||
}
|
||||
}
|
41
include/fw/pool.h
Normal file
41
include/fw/pool.h
Normal file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstdint>
|
||||
#include <queue>
|
||||
|
||||
template<typename T>
|
||||
class growing_object_pool {
|
||||
std::queue<T*> m_objects;
|
||||
uint32_t m_objects_count;
|
||||
T* (*m_factory)();
|
||||
public:
|
||||
explicit growing_object_pool(T* (*factory)(), uint32_t initialSize = 0) {
|
||||
m_factory = factory;
|
||||
|
||||
m_objects_count = initialSize;
|
||||
for (size_t i = 0; i < initialSize; i++) {
|
||||
m_objects.push(m_factory());
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t get_count() const {
|
||||
return m_objects_count;
|
||||
}
|
||||
|
||||
T* get() {
|
||||
if (m_objects.empty()) {
|
||||
m_objects.push(m_factory());
|
||||
m_objects_count++;
|
||||
}
|
||||
|
||||
auto result = m_objects.front();
|
||||
|
||||
m_objects.pop();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void put(T* obj) {
|
||||
m_objects.push(obj);
|
||||
}
|
||||
};
|
21
include/fw/singleton.h
Normal file
21
include/fw/singleton.h
Normal file
@@ -0,0 +1,21 @@
|
||||
#pragma once
|
||||
|
||||
template<typename T>
|
||||
class singleton {
|
||||
public:
|
||||
static T& instance();
|
||||
|
||||
singleton(const singleton&) = delete;
|
||||
singleton& operator= (singleton) = delete;
|
||||
|
||||
protected:
|
||||
struct token {};
|
||||
singleton() = default;
|
||||
};
|
||||
|
||||
#include <memory>
|
||||
template<typename T>
|
||||
T& singleton<T>::instance() {
|
||||
static const std::unique_ptr<T> instance{ new T{token{}} };
|
||||
return *instance;
|
||||
}
|
Reference in New Issue
Block a user