修复蜜蜡
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user