修复蜜蜡
This commit is contained in:
parent
981b40bd96
commit
9f55b5edb1
51
src/base.h
51
src/base.h
|
|
@ -45,6 +45,7 @@ namespace base
|
|||
const int getCurCharacInvenW = 0x80DA28E;
|
||||
const int _checkItemMovable = 0x0865F1E1;
|
||||
const int getCurCharacInvenR = 0x080DA27E;
|
||||
const int getCurCharacR = 0x08120432;
|
||||
}
|
||||
|
||||
namespace CUser
|
||||
|
|
@ -83,6 +84,39 @@ namespace base
|
|||
const int is_stackable = 0x80F12FA;
|
||||
const int IsRoutingItem = 0x08150F18;
|
||||
const int GetAttachType = 0x080F12E2;
|
||||
const int GetCashPrice = 0x0822C856;
|
||||
const int GetDyeInfo = 0x0822C86E;
|
||||
const int GetExpertJobAdditionalExp = 0x0850D30E;
|
||||
const int GetExpertJobCompoundMaterialVariation = 0x0850D292;
|
||||
const int GetExpertJobCompoundRateVariation = 0x0850D2AA;
|
||||
const int GetExpertJobCompoundResultVariation = 0x0850D2C2;
|
||||
const int GetExpertJobSelfDisjointBigWinRate = 0x0850D2DE;
|
||||
const int GetExpertJobSelfDisjointResultVariation = 0x0850D2F6;
|
||||
const int GetFinishPointPrice = 0x0822C83E;
|
||||
const int GetIncreaseStatusIntData = 0x08694658;
|
||||
const int GetIncreaseStatusType = 0x086946B6;
|
||||
const int GetItemIconName = 0x085143EC;
|
||||
const int GetItemName = 0x0811ED82;
|
||||
const int GetMedalPrice = 0x0822C862;
|
||||
const int GetNeedLevel = 0x08545FDA;
|
||||
const int GetNeedMaterial = 0x0850D6F4;
|
||||
const int GetQuestItemDropBouns = 0x08514404;
|
||||
const int GetRandomOptionGrade = 0x0851441C;
|
||||
const int GetSellPrice = 0x08473612;
|
||||
const int GetUpSkillType = 0x08545FCC;
|
||||
const int GetUsablePvPRank = 0x086946C4;
|
||||
const int getAdvanceAltarNeedGage = 0x081347CA;
|
||||
const int getExpirationDate = 0x080F1306;
|
||||
const int getFootControlRateLimit = 0x0850D286;
|
||||
const int getItemGroupName = 0x080F1312;
|
||||
const int getUsableLevel = 0x080F12EE;
|
||||
const int getUsablePeriod = 0x08110C60;
|
||||
const int get_gen_rate = 0x0832E02A;
|
||||
const int get_grade = 0x08110C54;
|
||||
const int get_index = 0x08110C48;
|
||||
const int get_need_skill = 0x0850D27A;
|
||||
const int get_price = 0x0822C84A;
|
||||
const int get_rarity = 0x080F12D6;
|
||||
}
|
||||
|
||||
namespace CEquipItem
|
||||
|
|
@ -98,6 +132,8 @@ namespace base
|
|||
const int isEquipableItemType = 0x08150812;
|
||||
const int IsTradeLimitAttachTypeItem = 0x081201DC;
|
||||
const int GetItemSpace = 0x083481E2;
|
||||
const int SetReSealCount = 0x0822B466;
|
||||
const int GetReSealCount = 0x0822B456;
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -115,6 +151,8 @@ namespace base
|
|||
const int gain_money = 0x84FF29C;
|
||||
const int GetInvenRef = 0x84FC1DE;
|
||||
const int GetInvenSlot = 0x084FB918;
|
||||
const int update_item = 0x085000AE;
|
||||
|
||||
}
|
||||
|
||||
namespace DB_UpdateAvatarJewelSlot
|
||||
|
|
@ -133,6 +171,7 @@ namespace base
|
|||
const int get_short = 0x858CFC0;
|
||||
const int get_int = 0x858D27E;
|
||||
const int get_binary = 0x858D3B2;
|
||||
const int copy = 0x0858DCD2;
|
||||
}
|
||||
|
||||
namespace InterfacePacketBuf
|
||||
|
|
@ -274,6 +313,18 @@ namespace base
|
|||
const int Get = 0x081935A2;
|
||||
const int SendDurability = 0x08190416;
|
||||
}
|
||||
|
||||
namespace Dispatcher_ModItemAttr
|
||||
{
|
||||
const int dispatch_sig = 0x08200B08;
|
||||
const int dispatch_sig_hook = 0x08201119; //.text:08201119 cmp eax, 28D14Eh
|
||||
const int dispatch_sig_ret = 0x0820111E; //.text:0820111E ja short loc_820113E
|
||||
const int _SendResult = 0x08201938;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
Controller::Controller() :
|
||||
old_IPacketDispatcher_ParamBase_dispatch_template((IPacketDispatcher_ParamBase_dispatch_template_Type*)base::IPacketDispatcher::ParamBase::dispatch_template),
|
||||
old_UseJewel_dispatch_sig((UseJewel_dispatch_sig_Type*)base::Dispatcher_UseJewel::dispatch_sig),
|
||||
old_Dispatcher_ModItemAttr_dispatch_sig((Dispatcher_ModItemAttr_dispatch_sig_Type*)base::Dispatcher_ModItemAttr::dispatch_sig),
|
||||
old_PacketDispatcher_doDispatch((PacketDispatcher_doDispatch_Type*)base::PacketDispatcher::doDispatch)
|
||||
{
|
||||
|
||||
|
|
@ -24,22 +25,26 @@ Controller::~Controller()
|
|||
|
||||
void Controller::init()
|
||||
{
|
||||
CodeHook::WriteUChar((void*)(base::GlobalData::Init_fix_1 - 0x1), 0);
|
||||
Mem::WriteUChar((void*)(base::GlobalData::Init_fix_1 - 0x1), 0);
|
||||
//.text:085BDE9D 83 F8 0A cmp eax, 10
|
||||
CodeHook::WriteUChar((void*)(base::CParty::addDungeonClear_fix_1 + 2), 0x7E); //ÆÕͨ±»»÷
|
||||
Mem::WriteUChar((void*)(base::CParty::addDungeonClear_fix_1 + 2), 0x7E); //ÆÕͨ±»»÷
|
||||
//.text:085BDF30 83 F8 1E cmp eax, 30
|
||||
CodeHook::WriteUChar((void*)(base::CParty::addDungeonClear_fix_2 + 2), 0x7E); //Ô¶¹Å±»»÷
|
||||
Mem::WriteUChar((void*)(base::CParty::addDungeonClear_fix_2 + 2), 0x7E); //Ô¶¹Å±»»÷
|
||||
//.text:085BDFC3 83 F8 32 cmp eax, 50
|
||||
CodeHook::WriteUChar((void*)(base::CParty::addDungeonClear_fix_3 + 2), 0x7E); //Òì½ç±»»÷
|
||||
Mem::WriteUChar((void*)(base::CParty::addDungeonClear_fix_3 + 2), 0x7E); //Òì½ç±»»÷
|
||||
|
||||
|
||||
|
||||
//mhook_IPacketDispatcher_ParamBase_dispatch_template.Hook((void**)&old_IPacketDispatcher_ParamBase_dispatch_template, (void*)hook_IPacketDispatcher_ParamBase_dispatch_template);
|
||||
|
||||
mhook_PacketDispatcher_doDispatch.Hook((void**)&old_PacketDispatcher_doDispatch, (void*)hook_PacketDispatcher_doDispatch);
|
||||
|
||||
mhook_UseJewel_dispatch_sig.Hook((void**)&old_UseJewel_dispatch_sig, (void*)hook_UseJewel_dispatch_sig);
|
||||
|
||||
mhook_UseJewel_dispatch_sig.Hook((void**)&old_Dispatcher_ModItemAttr_dispatch_sig, (void*)hook_Dispatcher_ModItemAttr_dispatch_sig);
|
||||
|
||||
mhook_PacketDispatcher_doDispatch.Hook((void**)&old_PacketDispatcher_doDispatch, (void*)hook_PacketDispatcher_doDispatch);
|
||||
|
||||
|
||||
LOG("Controller::init()");
|
||||
|
||||
}
|
||||
|
|
@ -234,6 +239,34 @@ int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* us
|
|||
return 0;
|
||||
}
|
||||
|
||||
int Controller::hook_Dispatcher_ModItemAttr_dispatch_sig(Dispatcher_ModItemAttr* dis_mod, CUser* user, PacketBuf* pBuf)
|
||||
{
|
||||
PacketBuf new_buf;
|
||||
memcpy(&new_buf, pBuf, sizeof(PacketBuf));
|
||||
int equipment_pos = new_buf.get_short();
|
||||
int equipment_id = new_buf.get_int();
|
||||
int item_pos = new_buf.get_short();
|
||||
|
||||
CInventory* CurCharacInvenW = user->getCurCharacInvenR();
|
||||
|
||||
auto item_inven = CurCharacInvenW->GetInvenRef(CInventory::INVENTORY_TYPE_ITEM, item_pos);
|
||||
|
||||
LOG(u8"UseEquipmentMoveItem [ equipment_pos:%d equipment_id:%d item_pos:%d item_id:%d ]"
|
||||
, equipment_pos
|
||||
, equipment_id
|
||||
, item_pos
|
||||
, item_inven->getKey()
|
||||
);
|
||||
|
||||
if (!item_inven->isEmpty() && item_inven->getKey() == ITEM_ID_YIJIRUHUN)
|
||||
{
|
||||
ENUM_PACK_RET_TYPE ret = CDispatch::Get()->Dispatcher_ModItemAttr_dispatch_sig(dis_mod, user, pBuf);
|
||||
int result = (ret == PAK_ERROR) ? 1 : 0;
|
||||
return result;
|
||||
}
|
||||
return Controller::Get()->old_Dispatcher_ModItemAttr_dispatch_sig(dis_mod, user, pBuf);
|
||||
}
|
||||
|
||||
int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher* a1, CUser* user, int packet_class, int packet_id, char* packet_src, int packet_len, int a7, int a8)
|
||||
{
|
||||
int(***dispatcher)(int, CUser*, char*) = (int(***)(int, CUser*, char*))a1->get_dispatcher(packet_id);
|
||||
|
|
@ -256,7 +289,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher* a1, CUser* us
|
|||
}
|
||||
|
||||
|
||||
if (packet_id == Packet_UseEquipmentMoveItem)
|
||||
if (packet_id == PACKET_ID_ITEM_USE_EQUIPMENT_MOVEITEM)
|
||||
{
|
||||
int result = 0;
|
||||
PacketBuf* v25 = PacketBuf::NewPacketBuf();
|
||||
|
|
|
|||
|
|
@ -32,6 +32,10 @@ private:
|
|||
*/
|
||||
static int hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* pUser, PacketBuf* pBuf);
|
||||
|
||||
//使用蜜蜡
|
||||
static int hook_Dispatcher_ModItemAttr_dispatch_sig(Dispatcher_ModItemAttr* dis_mod, CUser* user, PacketBuf* pBuf);
|
||||
|
||||
|
||||
/**
|
||||
* @brief hook收包处理
|
||||
* @param a1
|
||||
|
|
@ -46,6 +50,8 @@ private:
|
|||
*/
|
||||
static int hook_PacketDispatcher_doDispatch(PacketDispatcher* a1, CUser* a2, int a3, int packet_id, char* packet_src, int pecakt_len, int a7, int a8);
|
||||
|
||||
|
||||
|
||||
private:
|
||||
using IPacketDispatcher_ParamBase_dispatch_template_Type = decltype(hook_IPacketDispatcher_ParamBase_dispatch_template);
|
||||
IPacketDispatcher_ParamBase_dispatch_template_Type* old_IPacketDispatcher_ParamBase_dispatch_template;
|
||||
|
|
@ -53,6 +59,9 @@ private:
|
|||
using UseJewel_dispatch_sig_Type = decltype(hook_UseJewel_dispatch_sig);
|
||||
UseJewel_dispatch_sig_Type* old_UseJewel_dispatch_sig;
|
||||
|
||||
using Dispatcher_ModItemAttr_dispatch_sig_Type = decltype(hook_Dispatcher_ModItemAttr_dispatch_sig);
|
||||
Dispatcher_ModItemAttr_dispatch_sig_Type* old_Dispatcher_ModItemAttr_dispatch_sig;
|
||||
|
||||
using PacketDispatcher_doDispatch_Type = decltype(hook_PacketDispatcher_doDispatch);
|
||||
PacketDispatcher_doDispatch_Type* old_PacketDispatcher_doDispatch;
|
||||
|
||||
|
|
@ -60,6 +69,7 @@ private:
|
|||
private:
|
||||
FuncHook mhook_IPacketDispatcher_ParamBase_dispatch_template;
|
||||
FuncHook mhook_UseJewel_dispatch_sig;
|
||||
FuncHook mhook_Dispatcher_ModItemAttr_dispatch_sig;
|
||||
FuncHook mhook_PacketDispatcher_doDispatch;
|
||||
|
||||
};
|
||||
|
|
@ -318,7 +318,7 @@ void* replaceIAT(const char* pName, void* pAddr)
|
|||
void** jmpAddr = (void**)pRelDyn[i].r_offset;
|
||||
//printf("jmpaddr::::::::::::::::::::%X\n", pRelDyn[i].r_offset);
|
||||
pOrgAddr = (void*)((char*)(*jmpAddr) + (int)jmpAddr + sizeof(void*));
|
||||
CodeHook::WriteBytes(pOrgAddr, &pAddr, sizeof(pAddr));
|
||||
Mem::WriteBytes(pOrgAddr, &pAddr, sizeof(pAddr));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -541,7 +541,7 @@ void loga()
|
|||
{
|
||||
int a = 1;
|
||||
void* buf = malloc(4);
|
||||
CodeHook::WriteBytes(buf, &a, 4);
|
||||
Mem::WriteBytes(buf, &a, 4);
|
||||
getConfigPath(szGamePath, sizeof(szGamePath));
|
||||
unsigned int nMaxGrade = 80;
|
||||
bGMMode = 1;
|
||||
|
|
@ -553,34 +553,34 @@ void loga()
|
|||
|
||||
//CodeHook::WriteUChar(MAIN_OFFSET(0x22069B), 0x01);
|
||||
//ServerParameterScript::isDungeonOpen
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x220894), 0x01);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x220894), 0x01);
|
||||
//Init DataManager
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x258E80), 0xEB);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x258E80), 0xEB);
|
||||
//Init Level Exp
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x314ECB), 0xEB);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x314ECB), 0xEB);
|
||||
//Init Mob Reward
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x314FCB), 0xEB);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x314FCB), 0xEB);
|
||||
//CDataManager::GetSpAtLevelUp
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x318CC8), 0xE6);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x318CC8), 0xE6);
|
||||
//fixbug
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x31C128), 0x7E);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x31C129), 0x06);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x31C128), 0x7E);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x31C129), 0x06);
|
||||
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x547005), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x61AF55), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x61B0F3), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x61DD28), nMaxGrade - 1);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x61E86A), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x61EE9C), nMaxGrade - 1);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x6224A8), nMaxGrade - 1);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x622929), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x641D4B), nMaxGrade - 1);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x647ECE), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x647EDA), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x647F82), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x647F88), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x66521D), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x665223), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x547005), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x61AF55), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x61B0F3), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x61DD28), nMaxGrade - 1);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x61E86A), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x61EE9C), nMaxGrade - 1);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x6224A8), nMaxGrade - 1);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x622929), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x641D4B), nMaxGrade - 1);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x647ECE), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x647EDA), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x647F82), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x647F88), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x66521D), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x665223), nMaxGrade);
|
||||
//SUBHOOK_SETUP(doDispatch);
|
||||
SUBHOOK_SETUP(addServerHackCnt);
|
||||
SUBHOOK_SETUP(put_header);
|
||||
|
|
@ -599,20 +599,20 @@ void loga()
|
|||
if (nMaxGrade > 70)
|
||||
{
|
||||
//以下需要扩充类大小, 修改偏移
|
||||
CodeHook::WriteUInt(MAIN_OFFSET(0x87162 + 3), 0xB678 + nMaxGrade * 4 + nMaxGrade * 12);
|
||||
Mem::WriteUInt(MAIN_OFFSET(0x87162 + 3), 0xB678 + nMaxGrade * 4 + nMaxGrade * 12);
|
||||
//CDataManager::set_reward_sp
|
||||
CodeHook::WriteUInt(MAIN_OFFSET(0x318C26 + 2), 10836 + 840);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x318C3B), nMaxGrade);
|
||||
CodeHook::WriteUInt(MAIN_OFFSET(0x318C68 + 2), 10836 + 840);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x318C79), nMaxGrade);
|
||||
Mem::WriteUInt(MAIN_OFFSET(0x318C26 + 2), 10836 + 840);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x318C3B), nMaxGrade);
|
||||
Mem::WriteUInt(MAIN_OFFSET(0x318C68 + 2), 10836 + 840);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x318C79), nMaxGrade);
|
||||
//CDataManager::GetSpAtLevelUp
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x318CC4), nMaxGrade);
|
||||
CodeHook::WriteUInt(MAIN_OFFSET(0x318CD4 + 2), 10836 + 840);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x318CC4), nMaxGrade);
|
||||
Mem::WriteUInt(MAIN_OFFSET(0x318CD4 + 2), 10836 + 840);
|
||||
}
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x61B8F6), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x622659), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x622941), nMaxGrade);
|
||||
CodeHook::WriteUChar(MAIN_OFFSET(0x622941), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x61B8F6), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x622659), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x622941), nMaxGrade);
|
||||
Mem::WriteUChar(MAIN_OFFSET(0x622941), nMaxGrade);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
124
src/dispatch.cpp
124
src/dispatch.cpp
|
|
@ -115,9 +115,10 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf)
|
|||
|
||||
//Data: equipment_citem->GetItemType=147418664 item_citem->is_stackable=1 item_citem->GetItemType=11
|
||||
int equipment_Type = ((CEquipItem*)equipment_citem)->GetItemType();
|
||||
int rarity = equipment_citem->get_rarity();
|
||||
|
||||
LOG(u8"Data: equipment_citem->GetItemType=%d item_citem->is_stackable=%d item_citem->GetItemType=%d"
|
||||
, (*(int(**)(CItem*))(*(int*)equipment_citem + 12))(equipment_citem)
|
||||
, equipment_Type
|
||||
, item_citem->is_stackable()
|
||||
, item_citem->GetItemType()
|
||||
);
|
||||
|
|
@ -138,10 +139,14 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf)
|
|||
user->SendCmdErrorPacket(205, 209);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
|
||||
Inven_Item new_equipment_item = {};
|
||||
invenR->GetInvenSlot(&new_equipment_item, CInventory::INVENTORY_TYPE_ITEM, equipment_pos);
|
||||
|
||||
|
||||
int v9 = 0; //·µ»Ø¸ø¿Í»§¶ËµÄ´íÎóÂë
|
||||
switch (item_id)
|
||||
{
|
||||
case ITEM_ID_KUAJIESHI:
|
||||
if (item_id == ITEM_ID_KUAJIESHI)
|
||||
{
|
||||
LOG(u8"user->CheckInTrade:%d", user->CheckInTrade());
|
||||
|
||||
|
|
@ -158,15 +163,9 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf)
|
|||
{
|
||||
CAccountCargo* AccountCargo = user->GetAccountCargo();
|
||||
|
||||
invenR = user->getCurCharacInvenR();
|
||||
|
||||
Inven_Item ins_item = {};
|
||||
|
||||
invenR->GetInvenSlot(&ins_item, CInventory::INVENTORY_TYPE_ITEM, equipment_pos);
|
||||
|
||||
|
||||
LOG(u8"ins_item.IsTradeLimitAttachTypeItem :%d", ins_item.IsTradeLimitAttachTypeItem());
|
||||
LOG(u8"AccountCargo->CheckInsertCondition :%d", AccountCargo->CheckInsertCondition(&ins_item));
|
||||
LOG(u8"ins_item.IsTradeLimitAttachTypeItem :%d", new_equipment_item.IsTradeLimitAttachTypeItem());
|
||||
LOG(u8"AccountCargo->CheckInsertCondition :%d", AccountCargo->CheckInsertCondition(&new_equipment_item));
|
||||
|
||||
int empty_slot = 0;
|
||||
if (AccountCargo->CheckSlotEmpty(empty_slot) != 1)
|
||||
|
|
@ -186,8 +185,8 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf)
|
|||
|
||||
if (invenW->delete_item(CInventory::INVENTORY_TYPE_ITEM, equipment_pos, 1, 37, 1) && invenW->delete_item(CInventory::INVENTORY_TYPE_ITEM, item_pos, 1, 37, 1))
|
||||
{
|
||||
int a9 = AccountCargo->InsertItem(&ins_item, empty_slot);
|
||||
user->SendUpdateItemList(1, ins_item.GetItemSpace(), equipment_pos);
|
||||
int a9 = AccountCargo->InsertItem(&new_equipment_item, empty_slot);
|
||||
user->SendUpdateItemList(1, new_equipment_item.GetItemSpace(), equipment_pos);
|
||||
user->SendUpdateItemList(1, item_avartar->GetItemSpace(), item_pos);
|
||||
user->send_itemspace(12);
|
||||
|
||||
|
|
@ -209,17 +208,6 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf)
|
|||
}
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
case ITEM_ID_YIJIRUHUN:
|
||||
{
|
||||
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -263,4 +251,90 @@ ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf)
|
|||
return PAK_OK;
|
||||
}
|
||||
|
||||
ENUM_PACK_RET_TYPE CDispatch::Dispatcher_ModItemAttr_dispatch_sig(Dispatcher_ModItemAttr* dis_mod, CUser* user, PacketBuf* pBuf)
|
||||
{
|
||||
if (user->get_state() != 3 || !user->getCurCharacR())
|
||||
{
|
||||
user->SendCmdErrorPacket(84, 0xD1u);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
int equipment_pos = pBuf->get_short();
|
||||
int equipment_id = pBuf->get_int();
|
||||
int item_pos = pBuf->get_short();
|
||||
|
||||
auto CurCharacInvenW = (CInventory*)user->getCurCharacInvenW();
|
||||
Inven_Item equipment_inven = {};
|
||||
CurCharacInvenW->GetInvenSlot(&equipment_inven, CInventory::INVENTORY_TYPE_ITEM, equipment_pos);
|
||||
|
||||
if (equipment_inven.isEmpty() || equipment_inven.getKey() != equipment_id)
|
||||
{
|
||||
user->SendCmdErrorPacket(84, 4);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
CItem* equipment_item = CDataManager::G_CDataManager()->find_item(equipment_id);
|
||||
if (!equipment_item)
|
||||
{
|
||||
user->SendCmdErrorPacket(84, 4);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
int equipment_Type = ((CEquipItem*)equipment_item)->GetItemType();
|
||||
|
||||
if (equipment_Type <= 9 || equipment_Type > 21 || equipment_Type == 11)
|
||||
{
|
||||
user->SendCmdErrorPacket(84, 19);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
Inven_Item item_inven = {};
|
||||
CurCharacInvenW->GetInvenSlot(&item_inven, CInventory::INVENTORY_TYPE_ITEM, item_pos);
|
||||
|
||||
if (item_inven.isEmpty())
|
||||
{
|
||||
user->SendCmdErrorPacket(84, 17);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
if (user->CheckItemLock(1, equipment_pos))
|
||||
{
|
||||
user->SendCmdErrorPacket(84, 0xD5u);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
if (item_inven.getKey() != ITEM_ID_YIJIRUHUN)
|
||||
{
|
||||
user->SendCmdErrorPacket(84, 17);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
int grade = equipment_item->get_grade();
|
||||
int rarity = equipment_item->get_rarity();
|
||||
int attach_type = equipment_item->GetAttachType();
|
||||
auto add_info = item_inven.get_add_info();
|
||||
|
||||
if (equipment_item->GetAttachType() != 3)
|
||||
{
|
||||
user->SendCmdErrorPacket(84, 19);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
if (equipment_inven.package != 0)
|
||||
{
|
||||
user->SendCmdErrorPacket(84, 18);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
if (CurCharacInvenW->delete_item(CInventory::INVENTORY_TYPE_ITEM, item_pos, 1, 3, 1) != 1)
|
||||
{
|
||||
user->SendCmdErrorPacket(84, -3);
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
equipment_inven.package = 1;
|
||||
CurCharacInvenW->update_item(
|
||||
CInventory::INVENTORY_TYPE_ITEM,
|
||||
equipment_pos,
|
||||
equipment_inven);
|
||||
|
||||
dis_mod->_SendResult(user, 1, item_pos, equipment_pos);
|
||||
|
||||
return PAK_IGNORE;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,8 @@ public:
|
|||
public:
|
||||
ENUM_PACK_RET_TYPE UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf);
|
||||
|
||||
ENUM_PACK_RET_TYPE Dispatcher_ModItemAttr_dispatch_sig(Dispatcher_ModItemAttr* dis_mod, CUser* user, PacketBuf* pBuf);
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,11 @@
|
|||
#pragma once
|
||||
enum ENUM_PACKET_ID
|
||||
{
|
||||
Packet_UseItem = 84,
|
||||
|
||||
Packet_UseEquipmentMoveItem = 2000,
|
||||
PACKET_ID_ITEM_USE = 84,
|
||||
PACKET_ID_ITEM_LOCK = 271,
|
||||
PACKET_ID_ITEM_UNLOCK = 272,
|
||||
PACKET_ID_ITEM_UNLOCK_CANCEL = 273,
|
||||
PACKET_ID_ITEM_USE_EQUIPMENT_MOVEITEM = 2000,
|
||||
};
|
||||
|
||||
enum ENUM_PACK_RET_TYPE
|
||||
|
|
|
|||
|
|
@ -0,0 +1,300 @@
|
|||
/*
|
||||
|
||||
This file contains definitions used by the Hex-Rays decompiler output.
|
||||
It has type definitions and convenience macros to make the
|
||||
output more readable.
|
||||
|
||||
Copyright (c) 2007-2011 Hex-Rays
|
||||
|
||||
*/
|
||||
|
||||
#if defined(__GNUC__)
|
||||
typedef long long ll;
|
||||
typedef unsigned long long ull;
|
||||
#define __int64 long long
|
||||
#define __int32 int
|
||||
#define __int16 short
|
||||
#define __int8 char
|
||||
#define MAKELL(num) num ## LL
|
||||
#define FMT_64 "ll"
|
||||
#elif defined(_MSC_VER)
|
||||
typedef __int64 ll;
|
||||
typedef unsigned __int64 ull;
|
||||
#define MAKELL(num) num ## i64
|
||||
#define FMT_64 "I64"
|
||||
#elif defined (__BORLANDC__)
|
||||
typedef __int64 ll;
|
||||
typedef unsigned __int64 ull;
|
||||
#define MAKELL(num) num ## i64
|
||||
#define FMT_64 "L"
|
||||
#else
|
||||
#error "unknown compiler"
|
||||
#endif
|
||||
typedef unsigned int uint;
|
||||
typedef unsigned char uchar;
|
||||
typedef unsigned short ushort;
|
||||
typedef unsigned long ulong;
|
||||
|
||||
typedef char int8;
|
||||
typedef signed char sint8;
|
||||
typedef unsigned char uint8;
|
||||
typedef short int16;
|
||||
typedef signed short sint16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int int32;
|
||||
typedef signed int sint32;
|
||||
typedef unsigned int uint32;
|
||||
typedef ll int64;
|
||||
typedef ll sint64;
|
||||
typedef ull uint64;
|
||||
|
||||
// Partially defined types:
|
||||
#define _BYTE uint8
|
||||
#define _WORD uint16
|
||||
#define _DWORD uint32
|
||||
#define _QWORD uint64
|
||||
#if !defined(_MSC_VER)
|
||||
#define _LONGLONG __int128
|
||||
#endif
|
||||
|
||||
#ifndef _WINDOWS_
|
||||
typedef int8 BYTE;
|
||||
typedef int16 WORD;
|
||||
typedef int32 DWORD;
|
||||
typedef int32 LONG;
|
||||
#endif
|
||||
typedef int64 QWORD;
|
||||
#ifndef __cplusplus
|
||||
typedef int bool; // we want to use bool in our C programs
|
||||
#endif
|
||||
|
||||
// Some convenience macros to make partial accesses nicer
|
||||
// first unsigned macros:
|
||||
#define LOBYTE(x) (*((_BYTE*)&(x))) // low byte
|
||||
#define LOWORD(x) (*((_WORD*)&(x))) // low word
|
||||
#define LODWORD(x) (*((_DWORD*)&(x))) // low dword
|
||||
#define HIBYTE(x) (*((_BYTE*)&(x)+1))
|
||||
#define HIWORD(x) (*((_WORD*)&(x)+1))
|
||||
#define HIDWORD(x) (*((_DWORD*)&(x)+1))
|
||||
#define BYTEn(x, n) (*((_BYTE*)&(x)+n))
|
||||
#define WORDn(x, n) (*((_WORD*)&(x)+n))
|
||||
#define BYTE1(x) BYTEn(x, 1) // byte 1 (counting from 0)
|
||||
#define BYTE2(x) BYTEn(x, 2)
|
||||
#define BYTE3(x) BYTEn(x, 3)
|
||||
#define BYTE4(x) BYTEn(x, 4)
|
||||
#define BYTE5(x) BYTEn(x, 5)
|
||||
#define BYTE6(x) BYTEn(x, 6)
|
||||
#define BYTE7(x) BYTEn(x, 7)
|
||||
#define BYTE8(x) BYTEn(x, 8)
|
||||
#define BYTE9(x) BYTEn(x, 9)
|
||||
#define BYTE10(x) BYTEn(x, 10)
|
||||
#define BYTE11(x) BYTEn(x, 11)
|
||||
#define BYTE12(x) BYTEn(x, 12)
|
||||
#define BYTE13(x) BYTEn(x, 13)
|
||||
#define BYTE14(x) BYTEn(x, 14)
|
||||
#define BYTE15(x) BYTEn(x, 15)
|
||||
#define WORD1(x) WORDn(x, 1)
|
||||
#define WORD2(x) WORDn(x, 2) // third word of the object, unsigned
|
||||
#define WORD3(x) WORDn(x, 3)
|
||||
#define WORD4(x) WORDn(x, 4)
|
||||
#define WORD5(x) WORDn(x, 5)
|
||||
#define WORD6(x) WORDn(x, 6)
|
||||
#define WORD7(x) WORDn(x, 7)
|
||||
|
||||
// now signed macros (the same but with sign extension)
|
||||
#define SLOBYTE(x) (*((int8*)&(x)))
|
||||
#define SLOWORD(x) (*((int16*)&(x)))
|
||||
#define SLODWORD(x) (*((int32*)&(x)))
|
||||
#define SHIBYTE(x) (*((int8*)&(x)+1))
|
||||
#define SHIWORD(x) (*((int16*)&(x)+1))
|
||||
#define SHIDWORD(x) (*((int32*)&(x)+1))
|
||||
#define SBYTEn(x, n) (*((int8*)&(x)+n))
|
||||
#define SWORDn(x, n) (*((int16*)&(x)+n))
|
||||
#define SBYTE1(x) SBYTEn(x, 1)
|
||||
#define SBYTE2(x) SBYTEn(x, 2)
|
||||
#define SBYTE3(x) SBYTEn(x, 3)
|
||||
#define SBYTE4(x) SBYTEn(x, 4)
|
||||
#define SBYTE5(x) SBYTEn(x, 5)
|
||||
#define SBYTE6(x) SBYTEn(x, 6)
|
||||
#define SBYTE7(x) SBYTEn(x, 7)
|
||||
#define SBYTE8(x) SBYTEn(x, 8)
|
||||
#define SBYTE9(x) SBYTEn(x, 9)
|
||||
#define SBYTE10(x) SBYTEn(x, 10)
|
||||
#define SBYTE11(x) SBYTEn(x, 11)
|
||||
#define SBYTE12(x) SBYTEn(x, 12)
|
||||
#define SBYTE13(x) SBYTEn(x, 13)
|
||||
#define SBYTE14(x) SBYTEn(x, 14)
|
||||
#define SBYTE15(x) SBYTEn(x, 15)
|
||||
#define SWORD1(x) SWORDn(x, 1)
|
||||
#define SWORD2(x) SWORDn(x, 2)
|
||||
#define SWORD3(x) SWORDn(x, 3)
|
||||
#define SWORD4(x) SWORDn(x, 4)
|
||||
#define SWORD5(x) SWORDn(x, 5)
|
||||
#define SWORD6(x) SWORDn(x, 6)
|
||||
#define SWORD7(x) SWORDn(x, 7)
|
||||
|
||||
|
||||
// Helper functions to represent some assembly instructions.
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
// Fill memory block with an integer value
|
||||
inline void memset32(void* ptr, uint32 value, int count)
|
||||
{
|
||||
uint32* p = (uint32*)ptr;
|
||||
for (int i = 0; i < count; i++)
|
||||
*p++ = value;
|
||||
}
|
||||
|
||||
// Generate a reference to pair of operands
|
||||
template<class T> int16 __PAIR__(int8 high, T low) { return (((int16)high) << sizeof(high) * 8) | uint8(low); }
|
||||
template<class T> int32 __PAIR__(int16 high, T low) { return (((int32)high) << sizeof(high) * 8) | uint16(low); }
|
||||
template<class T> int64 __PAIR__(int32 high, T low) { return (((int64)high) << sizeof(high) * 8) | uint32(low); }
|
||||
template<class T> uint16 __PAIR__(uint8 high, T low) { return (((uint16)high) << sizeof(high) * 8) | uint8(low); }
|
||||
template<class T> uint32 __PAIR__(uint16 high, T low) { return (((uint32)high) << sizeof(high) * 8) | uint16(low); }
|
||||
template<class T> uint64 __PAIR__(uint32 high, T low) { return (((uint64)high) << sizeof(high) * 8) | uint32(low); }
|
||||
|
||||
// rotate left
|
||||
template<class T> T __ROL__(T value, uint count)
|
||||
{
|
||||
const uint nbits = sizeof(T) * 8;
|
||||
count %= nbits;
|
||||
|
||||
T high = value >> (nbits - count);
|
||||
value <<= count;
|
||||
value |= high;
|
||||
return value;
|
||||
}
|
||||
|
||||
// rotate right
|
||||
template<class T> T __ROR__(T value, uint count)
|
||||
{
|
||||
const uint nbits = sizeof(T) * 8;
|
||||
count %= nbits;
|
||||
|
||||
T low = value << (nbits - count);
|
||||
value >>= count;
|
||||
value |= low;
|
||||
return value;
|
||||
}
|
||||
|
||||
// carry flag of left shift
|
||||
template<class T> int8 __MKCSHL__(T value, uint count)
|
||||
{
|
||||
const uint nbits = sizeof(T) * 8;
|
||||
count %= nbits;
|
||||
|
||||
return (value >> (nbits - count)) & 1;
|
||||
}
|
||||
|
||||
// carry flag of right shift
|
||||
template<class T> int8 __MKCSHR__(T value, uint count)
|
||||
{
|
||||
return (value >> (count - 1)) & 1;
|
||||
}
|
||||
|
||||
// sign flag
|
||||
template<class T> int8 __SETS__(T x)
|
||||
{
|
||||
if (sizeof(T) == 1)
|
||||
return int8(x) < 0;
|
||||
if (sizeof(T) == 2)
|
||||
return int16(x) < 0;
|
||||
if (sizeof(T) == 4)
|
||||
return int32(x) < 0;
|
||||
return int64(x) < 0;
|
||||
}
|
||||
|
||||
// overflow flag of subtraction (x-y)
|
||||
template<class T, class U> int8 __OFSUB__(T x, U y)
|
||||
{
|
||||
if (sizeof(T) < sizeof(U))
|
||||
{
|
||||
U x2 = x;
|
||||
int8 sx = __SETS__(x2);
|
||||
return (sx ^ __SETS__(y)) & (sx ^ __SETS__(x2 - y));
|
||||
}
|
||||
else
|
||||
{
|
||||
T y2 = y;
|
||||
int8 sx = __SETS__(x);
|
||||
return (sx ^ __SETS__(y2)) & (sx ^ __SETS__(x - y2));
|
||||
}
|
||||
}
|
||||
|
||||
// overflow flag of addition (x+y)
|
||||
template<class T, class U> int8 __OFADD__(T x, U y)
|
||||
{
|
||||
if (sizeof(T) < sizeof(U))
|
||||
{
|
||||
U x2 = x;
|
||||
int8 sx = __SETS__(x2);
|
||||
return ((1 ^ sx) ^ __SETS__(y)) & (sx ^ __SETS__(x2 + y));
|
||||
}
|
||||
else
|
||||
{
|
||||
T y2 = y;
|
||||
int8 sx = __SETS__(x);
|
||||
return ((1 ^ sx) ^ __SETS__(y2)) & (sx ^ __SETS__(x + y2));
|
||||
}
|
||||
}
|
||||
|
||||
// carry flag of subtraction (x-y)
|
||||
template<class T, class U> int8 __CFSUB__(T x, U y)
|
||||
{
|
||||
int size = sizeof(T) > sizeof(U) ? sizeof(T) : sizeof(U);
|
||||
if (size == 1)
|
||||
return uint8(x) < uint8(y);
|
||||
if (size == 2)
|
||||
return uint16(x) < uint16(y);
|
||||
if (size == 4)
|
||||
return uint32(x) < uint32(y);
|
||||
return uint64(x) < uint64(y);
|
||||
}
|
||||
|
||||
// carry flag of addition (x+y)
|
||||
template<class T, class U> int8 __CFADD__(T x, U y)
|
||||
{
|
||||
int size = sizeof(T) > sizeof(U) ? sizeof(T) : sizeof(U);
|
||||
if (size == 1)
|
||||
return uint8(x) > uint8(x + y);
|
||||
if (size == 2)
|
||||
return uint16(x) > uint16(x + y);
|
||||
if (size == 4)
|
||||
return uint32(x) > uint32(x + y);
|
||||
return uint64(x) > uint64(x + y);
|
||||
}
|
||||
|
||||
#else
|
||||
// The following definition is not quite correct because it always returns
|
||||
// uint64. The above C++ functions are good, though.
|
||||
#define __PAIR__(high, low) (((uint64)(high)<<sizeof(high)*8) | low)
|
||||
// For C, we just provide macros, they are not quite correct.
|
||||
#define __ROL__(x, y) __rotl__(x, y) // Rotate left
|
||||
#define __ROR__(x, y) __rotr__(x, y) // Rotate right
|
||||
#define __CFSHL__(x, y) invalid_operation // Generate carry flag for (x<<y)
|
||||
#define __CFSHR__(x, y) invalid_operation // Generate carry flag for (x>>y)
|
||||
#define __CFADD__(x, y) invalid_operation // Generate carry flag for (x+y)
|
||||
#define __CFSUB__(x, y) invalid_operation // Generate carry flag for (x-y)
|
||||
#define __OFADD__(x, y) invalid_operation // Generate overflow flag for (x+y)
|
||||
#define __OFSUB__(x, y) invalid_operation // Generate overflow flag for (x-y)
|
||||
#endif
|
||||
|
||||
// No definition for rcl/rcr because the carry flag is unknown
|
||||
#define __RCL__(x, y) invalid_operation // Rotate left thru carry
|
||||
#define __RCR__(x, y) invalid_operation // Rotate right thru carry
|
||||
#define __MKCRCL__(x, y) invalid_operation // Generate carry flag for a RCL
|
||||
#define __MKCRCR__(x, y) invalid_operation // Generate carry flag for a RCR
|
||||
#define __SETP__(x, y) invalid_operation // Generate parity flag for (x-y)
|
||||
|
||||
// In the decompilation listing there are some objects declarared as _UNKNOWN
|
||||
// because we could not determine their types. Since the C compiler does not
|
||||
// accept void item declarations, we replace them by anything of our choice,
|
||||
// for example a char:
|
||||
|
||||
#define _UNKNOWN char
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define snprintf _snprintf
|
||||
#define vsnprintf _vsnprintf
|
||||
#endif
|
||||
|
|
@ -212,7 +212,7 @@ class CMemPool
|
|||
{
|
||||
private:
|
||||
size_t SysPageSize;
|
||||
void *MemPool;
|
||||
void* MemPool;
|
||||
std::map<void*, size_t> AllocMap;
|
||||
std::map<void*, size_t> FreeMap;
|
||||
public:
|
||||
|
|
@ -254,7 +254,7 @@ public:
|
|||
}
|
||||
void* alloc(size_t _size)
|
||||
{
|
||||
void *pBuf = NULL;
|
||||
void* pBuf = NULL;
|
||||
for (std::map<void*, size_t>::iterator iter = FreeMap.begin(); iter != FreeMap.end(); iter++)
|
||||
{
|
||||
if (iter->second >= _size)
|
||||
|
|
@ -350,32 +350,58 @@ public:
|
|||
}
|
||||
private:
|
||||
bool Actived;
|
||||
void *Src;
|
||||
void **SrcPtr;
|
||||
void *Dst;
|
||||
void* Src;
|
||||
void** SrcPtr;
|
||||
void* Dst;
|
||||
unsigned char* HookCode;
|
||||
size_t SrcCodeSize;
|
||||
size_t HookCodeSize;
|
||||
};
|
||||
|
||||
class CodeHook
|
||||
class Mem
|
||||
{
|
||||
public:
|
||||
static void WriteUChar(void *Addr, unsigned char Value)
|
||||
static void WriteUChar(void* Addr, unsigned char Value)
|
||||
{
|
||||
WriteBytes(Addr, &Value, 1);
|
||||
}
|
||||
static void WriteUShort(void *Addr, unsigned short Value)
|
||||
static void WriteUShort(void* Addr, unsigned short Value)
|
||||
{
|
||||
WriteBytes(Addr, &Value, 2);
|
||||
}
|
||||
static void WriteUInt(void *Addr, unsigned int Value)
|
||||
static void WriteUInt(void* Addr, unsigned int Value)
|
||||
{
|
||||
WriteBytes(Addr, &Value, 4);
|
||||
}
|
||||
static void WriteBytes(void *Addr, void *Data, size_t Len)
|
||||
static void WriteBytes(void* Addr, void* Data, size_t Len)
|
||||
{
|
||||
CMemPool::GetInstance()->SetPageProtect(Addr, PROT_READ | PROT_WRITE | PROT_EXEC);
|
||||
memcpy(Addr, Data, Len);
|
||||
}
|
||||
|
||||
static void HookJmp(int base, int func_)
|
||||
{
|
||||
char Jmp[5] = {};
|
||||
*((char*)Jmp) = 0xE9;
|
||||
*((int*)(Jmp + 1)) = func_ - base - 5;
|
||||
WriteBytes((void*)base, Jmp, 5);
|
||||
}
|
||||
|
||||
static void HookCall(int base, int func_)
|
||||
{
|
||||
char Jmp[5] = {};
|
||||
*((char*)Jmp) = 0xE8;
|
||||
*((int*)(Jmp + 1)) = func_ - base - 5;
|
||||
WriteBytes((void*)base, Jmp, 5);
|
||||
}
|
||||
|
||||
static void HookCall_6(int base, int func_)
|
||||
{
|
||||
char Jmp[6] = {};
|
||||
*((char*)Jmp) = 0xE8;
|
||||
*((int*)(Jmp + 1)) = func_ - base - 5;
|
||||
*((char*)(Jmp + 5)) = 0x90;
|
||||
WriteBytes((void*)base, Jmp, 5);
|
||||
}
|
||||
|
||||
};
|
||||
|
|
|
|||
259
src/sdk_class.h
259
src/sdk_class.h
|
|
@ -2,10 +2,10 @@
|
|||
#define USER_CLASS_H
|
||||
#include "base.h"
|
||||
#include "enum.h"
|
||||
|
||||
#include "ida_sdk.h"
|
||||
#include <string>
|
||||
|
||||
|
||||
#pragma pack(push, 0x01)
|
||||
|
||||
template<typename R, typename A, typename ... ARG> R CallT(A call_addr, const ARG ... arguments)
|
||||
{
|
||||
|
|
@ -36,6 +36,8 @@ class CUser;
|
|||
class PacketBuf;
|
||||
class PacketGuard;
|
||||
class InterfacePacketBuf;
|
||||
class Dispatcher_ModItemAttr;
|
||||
|
||||
|
||||
namespace WongWork
|
||||
{
|
||||
|
|
@ -112,6 +114,11 @@ public:
|
|||
return CallT<CInventory*>(base::CUserCharacInfo::getCurCharacInvenR, this);
|
||||
}
|
||||
|
||||
int getCurCharacR()
|
||||
{
|
||||
return CallT<int>(base::CUserCharacInfo::getCurCharacR, this);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class CUser : public CUserCharacInfo
|
||||
|
|
@ -123,6 +130,12 @@ public:
|
|||
return int(((__func)base::CUser::get_state)(this));
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 检查物品锁定
|
||||
* @param a2 背包位置
|
||||
* @param a3 物品栏位
|
||||
* @return
|
||||
*/
|
||||
bool CheckItemLock(int a2, int a3)
|
||||
{
|
||||
typedef bool (*__func)(CUser* a1, int a2, int a3);
|
||||
|
|
@ -156,10 +169,10 @@ public:
|
|||
return int(((__func)base::CUser::SendUpdateItemList)(this, a2, a3, a4));
|
||||
}
|
||||
|
||||
int SendCmdErrorPacket(int a2, unsigned char a3)
|
||||
int SendCmdErrorPacket(int packet_id, unsigned char a3)
|
||||
{
|
||||
typedef int (*__func)(CUser* a1, int a2, unsigned char a3);
|
||||
return int(((__func)base::CUser::SendCmdErrorPacket)(this, a2, a3));
|
||||
return int(((__func)base::CUser::SendCmdErrorPacket)(this, packet_id, a3));
|
||||
}
|
||||
|
||||
int isEnableAvatarSocketAction()
|
||||
|
|
@ -357,7 +370,11 @@ public:
|
|||
class CItem : public CStackableItem
|
||||
{
|
||||
public:
|
||||
//道具是否为消耗品
|
||||
|
||||
/**
|
||||
* @brief 是否为消耗品
|
||||
* @return
|
||||
*/
|
||||
bool is_stackable()
|
||||
{
|
||||
typedef bool (*__func)(CItem* a1);
|
||||
|
|
@ -370,10 +387,183 @@ public:
|
|||
return ((__func)base::CItem::IsRoutingItem)(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 取附加类型
|
||||
* @return
|
||||
*/
|
||||
int GetAttachType()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetAttachType, this);
|
||||
}
|
||||
|
||||
int GetCashPrice()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetCashPrice, this);
|
||||
}
|
||||
|
||||
int GetDyeInfo()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetDyeInfo, this);
|
||||
}
|
||||
|
||||
int GetExpertJobAdditionalExp(int a2)
|
||||
{
|
||||
return CallT<int>(base::CItem::GetExpertJobAdditionalExp, this, a2);
|
||||
}
|
||||
|
||||
int GetExpertJobCompoundMaterialVariation()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetExpertJobCompoundMaterialVariation, this);
|
||||
}
|
||||
|
||||
int GetExpertJobCompoundRateVariation()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetExpertJobCompoundRateVariation, this);
|
||||
}
|
||||
|
||||
int GetExpertJobCompoundResultVariation(int a2)
|
||||
{
|
||||
return CallT<int>(base::CItem::GetExpertJobCompoundResultVariation, this, a2);
|
||||
}
|
||||
|
||||
int GetExpertJobSelfDisjointBigWinRate()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetExpertJobSelfDisjointBigWinRate, this);
|
||||
}
|
||||
|
||||
int GetExpertJobSelfDisjointResultVariation()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetExpertJobSelfDisjointResultVariation, this);
|
||||
}
|
||||
|
||||
int GetFinishPointPrice()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetFinishPointPrice, this);
|
||||
}
|
||||
|
||||
int GetIncreaseStatusIntData(int a2, int& a3)
|
||||
{
|
||||
return CallT<int>(base::CItem::GetIncreaseStatusIntData, this, a2, a3);
|
||||
}
|
||||
|
||||
int GetIncreaseStatusType()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetIncreaseStatusType, this);
|
||||
}
|
||||
|
||||
int GetItemIconName()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetItemIconName, this);
|
||||
}
|
||||
|
||||
int GetItemName()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetItemName, this);
|
||||
}
|
||||
|
||||
int GetMedalPrice()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetMedalPrice, this);
|
||||
}
|
||||
|
||||
int GetNeedLevel()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetNeedLevel, this);
|
||||
}
|
||||
|
||||
int GetNeedMaterial()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetNeedMaterial, this);
|
||||
}
|
||||
|
||||
int GetQuestItemDropBouns()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetQuestItemDropBouns, this);
|
||||
}
|
||||
|
||||
int GetRandomOptionGrade()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetRandomOptionGrade, this);
|
||||
}
|
||||
|
||||
int GetSellPrice()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetSellPrice, this);
|
||||
}
|
||||
|
||||
int GetUpSkillType()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetUpSkillType, this);
|
||||
}
|
||||
|
||||
int GetUsablePvPRank()
|
||||
{
|
||||
return CallT<int>(base::CItem::GetUsablePvPRank, this);
|
||||
}
|
||||
|
||||
int getAdvanceAltarNeedGage()
|
||||
{
|
||||
return CallT<int>(base::CItem::getAdvanceAltarNeedGage, this);
|
||||
}
|
||||
|
||||
int getExpirationDate()
|
||||
{
|
||||
return CallT<int>(base::CItem::getExpirationDate, this);
|
||||
}
|
||||
|
||||
int getFootControlRateLimit()
|
||||
{
|
||||
return CallT<int>(base::CItem::getFootControlRateLimit, this);
|
||||
}
|
||||
|
||||
int getItemGroupName()
|
||||
{
|
||||
return CallT<int>(base::CItem::getItemGroupName, this);
|
||||
}
|
||||
|
||||
int getUsableLevel()
|
||||
{
|
||||
return CallT<int>(base::CItem::getUsableLevel, this);
|
||||
}
|
||||
|
||||
int getUsablePeriod()
|
||||
{
|
||||
return CallT<int>(base::CItem::getUsablePeriod, this);
|
||||
}
|
||||
|
||||
int get_gen_rate()
|
||||
{
|
||||
return CallT<int>(base::CItem::get_gen_rate, this);
|
||||
}
|
||||
|
||||
int get_grade()
|
||||
{
|
||||
return CallT<int>(base::CItem::get_grade, this);
|
||||
}
|
||||
|
||||
int get_index()
|
||||
{
|
||||
return CallT<int>(base::CItem::get_index, this);
|
||||
}
|
||||
|
||||
int get_need_skill()
|
||||
{
|
||||
return CallT<int>(base::CItem::get_need_skill, this);
|
||||
}
|
||||
|
||||
int get_price()
|
||||
{
|
||||
return CallT<int>(base::CItem::get_price, this);
|
||||
}
|
||||
|
||||
int get_rarity()
|
||||
{
|
||||
return CallT<int>(base::CItem::get_rarity, this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
};
|
||||
|
||||
|
|
@ -390,7 +580,8 @@ public:
|
|||
class Inven_Item
|
||||
{
|
||||
public:
|
||||
unsigned char UnknownData_NUSL[0x3D];
|
||||
unsigned char package;
|
||||
unsigned char UnknownData_NUSL[0x3C];
|
||||
|
||||
public:
|
||||
|
||||
|
|
@ -435,6 +626,17 @@ public:
|
|||
return CallT<int>(base::Inven_Item::GetItemSpace, this);
|
||||
}
|
||||
|
||||
int SetReSealCount(uchar a2)
|
||||
{
|
||||
return CallT<int>(base::Inven_Item::SetReSealCount, this, a2);
|
||||
}
|
||||
|
||||
int GetReSealCount()
|
||||
{
|
||||
return CallT<int>(base::Inven_Item::GetReSealCount, this);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
class CDataManager
|
||||
|
|
@ -458,7 +660,7 @@ class CInventory
|
|||
{
|
||||
public:
|
||||
|
||||
enum INVENTORY_TYPE : int
|
||||
enum INVEN_TYPE : int
|
||||
{
|
||||
INVENTORY_TYPE_BODY = 0, //身上穿的装备
|
||||
INVENTORY_TYPE_ITEM = 1, //物品栏
|
||||
|
|
@ -473,9 +675,9 @@ public:
|
|||
return ((__func)base::CInventory::GetAvatarItemMgrR)(this);
|
||||
}
|
||||
|
||||
int delete_item(INVENTORY_TYPE a2, int pos, int num, int a5, int a6 = 1)
|
||||
int delete_item(INVEN_TYPE a2, int pos, int num, int a5, int a6 = 1)
|
||||
{
|
||||
typedef int (*__func)(CInventory* a1, INVENTORY_TYPE a2, int a3, int a4, int a5, int a6);
|
||||
typedef int (*__func)(CInventory* a1, INVEN_TYPE a2, int a3, int a4, int a5, int a6);
|
||||
return ((__func)base::CInventory::delete_item)(this, a2, pos, num, a5, a6);
|
||||
}
|
||||
|
||||
|
|
@ -494,19 +696,24 @@ public:
|
|||
}
|
||||
|
||||
//获取背包槽中的道具
|
||||
Inven_Item* GetInvenRef(INVENTORY_TYPE a2, int a3)
|
||||
Inven_Item* GetInvenRef(INVEN_TYPE a2, int a3)
|
||||
{
|
||||
typedef Inven_Item* (*__func)(CInventory* a1, INVENTORY_TYPE a2, int a3);
|
||||
typedef Inven_Item* (*__func)(CInventory* a1, INVEN_TYPE a2, int a3);
|
||||
return ((__func)base::CInventory::GetInvenRef)(this, a2, a3);
|
||||
}
|
||||
|
||||
Inven_Item* GetInvenSlot(Inven_Item* a2, INVENTORY_TYPE a3, int a4)
|
||||
Inven_Item* GetInvenSlot(Inven_Item* a2, INVEN_TYPE a3, int a4)
|
||||
{
|
||||
typedef Inven_Item* (__attribute__((__stdcall__))* fnCInventory_GetInvenSlot)(Inven_Item* dest, CInventory* pThis, int space, int location);
|
||||
static fnCInventory_GetInvenSlot CInventory_GetInvenSlot = (fnCInventory_GetInvenSlot)(base::CInventory::GetInvenSlot);
|
||||
return CInventory_GetInvenSlot(a2, this, a3, a4);
|
||||
}
|
||||
|
||||
int update_item(INVEN_TYPE a2, int a3, Inven_Item a4)
|
||||
{
|
||||
return CallT<int>(base::CInventory::update_item, this, a2, a3, a4);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class DB_UpdateAvatarJewelSlot
|
||||
|
|
@ -522,6 +729,19 @@ public:
|
|||
class PacketBuf
|
||||
{
|
||||
public:
|
||||
unsigned char UnknownData_0000[0x20000];
|
||||
|
||||
public:
|
||||
PacketBuf()
|
||||
{
|
||||
memset(UnknownData_0000, 0, sizeof(UnknownData_0000));
|
||||
CallT<PacketBuf*>(base::PacketBuf::PacketBuf_make, this);
|
||||
}
|
||||
|
||||
~PacketBuf()
|
||||
{
|
||||
CallT<int>(base::PacketBuf::PacketBuf_destroy, this);
|
||||
}
|
||||
|
||||
static PacketBuf* NewPacketBuf()
|
||||
{
|
||||
|
|
@ -593,6 +813,11 @@ public:
|
|||
typedef int (*__func)(PacketBuf* a1, char* a2, int a3);
|
||||
return ((__func)base::PacketBuf::get_binary)(this, a2, a3);
|
||||
}
|
||||
|
||||
void* copy(const PacketBuf* a2)
|
||||
{
|
||||
return CallT<void*>(base::PacketBuf::copy, this, a2);
|
||||
}
|
||||
};
|
||||
|
||||
class InterfacePacketBuf
|
||||
|
|
@ -743,5 +968,15 @@ public:
|
|||
}
|
||||
};
|
||||
|
||||
class Dispatcher_ModItemAttr
|
||||
{
|
||||
public:
|
||||
int _SendResult(CUser* a2, ushort a3, ushort a4, ushort a5)
|
||||
{
|
||||
return CallT<int>(base::Dispatcher_ModItemAttr::_SendResult, this, a2, a3, a4, a5);
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
#pragma pack(pop)
|
||||
#endif // __DXFBASE_H__
|
||||
|
|
|
|||
1550
test/main.cc
1550
test/main.cc
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue