| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | //************************************
 | 
					
						
							|  |  |  |  | // FileName:  D:\VisualStudioSource\dnf_project\src\controller.cpp
 | 
					
						
							|  |  |  |  | // FullName:  D:\VisualStudioSource\dnf_project\src
 | 
					
						
							|  |  |  |  | // Date:      2022/09/01
 | 
					
						
							|  |  |  |  | // By:        Vance
 | 
					
						
							|  |  |  |  | // Copyright (c) 2022.  Vance All rights reserved
 | 
					
						
							|  |  |  |  | //************************************
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | #include "controller.h"
 | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | Controller::Controller() : | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 	old_IPacketDispatcher_ParamBase_dispatch_template((IPacketDispatcher_ParamBase_dispatch_template_Type*)base::IPacketDispatcher::ParamBase::dispatch_template), | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	old_UseJewel_dispatch_sig((UseJewel_dispatch_sig_Type*)base::Dispatcher_UseJewel::dispatch_sig), | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 	old_Dispatcher_ModItemAttr_dispatch_sig((Dispatcher_ModItemAttr_dispatch_sig_Type*)base::Dispatcher_ModItemAttr::dispatch_sig), | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	old_PacketDispatcher_doDispatch((PacketDispatcher_doDispatch_Type*)base::PacketDispatcher::doDispatch) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | Controller::~Controller() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void Controller::init() | 
					
						
							|  |  |  |  | { | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 	Mem::WriteUChar((void*)(base::GlobalData::Init_fix_1 - 0x1), 0); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	//.text:085BDE9D 83 F8 0A                                                        cmp     eax, 10
 | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 	Mem::WriteUChar((void*)(base::CParty::addDungeonClear_fix_1 + 2), 0x7E); //<2F><>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	//.text:085BDF30 83 F8 1E                                                        cmp     eax, 30
 | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 	Mem::WriteUChar((void*)(base::CParty::addDungeonClear_fix_2 + 2), 0x7E); //Զ<>ű<EFBFBD><C5B1><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	//.text:085BDFC3 83 F8 32                                                        cmp     eax, 50
 | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 	Mem::WriteUChar((void*)(base::CParty::addDungeonClear_fix_3 + 2), 0x7E); //<2F><><EFBFBD>类<EFBFBD><E7B1BB>
 | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-09 12:24:02 +08:00
										 |  |  |  | 	/*	<09><><EFBFBD><EFBFBD>ʹ<EFBFBD>ô<EFBFBD><C3B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӻ<EFBFBD><D3BB><EFBFBD>
 | 
					
						
							|  |  |  |  | 		<EFBFBD><EFBFBD>ַ	<EFBFBD><EFBFBD><EFBFBD><EFBFBD>	ԭʼ<EFBFBD>ֽ<EFBFBD>	<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD> | 
					
						
							|  |  |  |  | 		08179043	0x1	97 	B8 | 
					
						
							|  |  |  |  | 		0817904E	0x1	8C 	AD | 
					
						
							|  |  |  |  | 	*/ | 
					
						
							|  |  |  |  | 	Mem::WriteUChar((void*)(0x08179043), 0xB8); //<2F><><EFBFBD>类<EFBFBD><E7B1BB>
 | 
					
						
							|  |  |  |  | 	Mem::WriteUChar((void*)(0x0817904E), 0xAD); //<2F><><EFBFBD>类<EFBFBD><E7B1BB>
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 	//mhook_IPacketDispatcher_ParamBase_dispatch_template.Hook((void**)&old_IPacketDispatcher_ParamBase_dispatch_template, (void*)hook_IPacketDispatcher_ParamBase_dispatch_template);
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	mhook_UseJewel_dispatch_sig.Hook((void**)&old_UseJewel_dispatch_sig, (void*)hook_UseJewel_dispatch_sig); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 	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); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	LOG("Controller::init()"); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | int Controller::hook_IPacketDispatcher_ParamBase_dispatch_template(int a1, int a2, int a3) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	//[root@nimzgryilkxubzo game] # [DNF_PROJECT] Recv() class :1 id : 84 len : 21 callback : 0x81258b6	(nil)0x81258b6	0x8125a06	(nil)(nil)
 | 
					
						
							|  |  |  |  | 	//	[DNF_PROJECT] + 12	0x8bd8d54 :	Dispatcher_ModItemAttr::dispatch_sig(CUser *,PacketBuf &)
 | 
					
						
							|  |  |  |  | 	//	[DNF_PROJECT] + 16	0x8bd8d58 :	IPacketDispatcher<MSG_BASE,ParamBase,(ch_state)0>::check_state(CUser *,PacketBuf &)
 | 
					
						
							|  |  |  |  | 	//	[DNF_PROJECT] + 20	0x8bd8d5c :	Dispatcher_ModItemAttr::read(PacketBuf &,MSG_BASE &)
 | 
					
						
							|  |  |  |  | 	//	[DNF_PROJECT] + 24	0x8bd8d60 :	Dispatcher_ModItemAttr::process(CUser *,MSG_BASE &,ParamBase &)
 | 
					
						
							|  |  |  |  | 	//	[DNF_PROJECT] + 28	0x8bd8d64 :	IPacketDispatcher<MSG_BASE,ParamBase,(ch_state)0>::send(CUser *,ParamBase&)
 | 
					
						
							|  |  |  |  | 	// 
 | 
					
						
							|  |  |  |  | 	// 
 | 
					
						
							|  |  |  |  | 	//	[DNF_PROJECT] + 12	0x8bd7dd4 :	Dispatcher_Antibot::dispatch_sig
 | 
					
						
							|  |  |  |  | 	//	[DNF_PROJECT] + 16	0x8bd7dd8 :	IPacketDispatcher<MSG_BASE,ParamBase,(ch_state)0>::check_state(CUser *,PacketBuf &)
 | 
					
						
							|  |  |  |  | 	//	[DNF_PROJECT] + 20	0x8bd7ddc :	Dispatcher_Antibot::read(PacketBuf &,MSG_BASE &)
 | 
					
						
							|  |  |  |  | 	//	[DNF_PROJECT] + 24	0x8bd7de0 :	Dispatcher_Antibot::process(CUser *,MSG_BASE &,ParamBase &)
 | 
					
						
							|  |  |  |  | 	//	[DNF_PROJECT] + 28	0x8bd7de4 :	IPacketDispatcher<MSG_BASE,ParamBase,(ch_state)0>::send(CUser *,ParamBase&)
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//LOG("ParamBase_dispatch_template[ +12	:%p	+16	:%p	+20	:%p	+24	:%p	+28	:%p ]"
 | 
					
						
							|  |  |  |  | 	//	, *(int*)a1 + 12
 | 
					
						
							|  |  |  |  | 	//	, *(int*)a1 + 16
 | 
					
						
							|  |  |  |  | 	//	, *(int*)a1 + 20
 | 
					
						
							|  |  |  |  | 	//	, *(int*)a1 + 24
 | 
					
						
							|  |  |  |  | 	//	, *(int*)a1 + 28
 | 
					
						
							|  |  |  |  | 	//);
 | 
					
						
							|  |  |  |  | 	Controller::Get()->old_IPacketDispatcher_ParamBase_dispatch_template(a1, a2, a3); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* user, PacketBuf* pBuf) | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	printf("getCurCharacName :%s \n", user->getCurCharacName().c_str()); | 
					
						
							|  |  |  |  | 	printf("getCurCharacNo :%d \n", user->getCurCharacNo()); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	printf("get_buf_ptr :%p %p \n", pBuf->get_buf_ptr(0)); | 
					
						
							|  |  |  |  | 	printf("get_len :%d \n", pBuf->get_len()); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// printf("pBuf :%s \n",  Util::ToHexString((const unsigned char*)pBuf->get_buf_ptr(0),40).c_str());
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	int state = user->get_state(); | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 	LOG("state :%d \n", state); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	//У<><D0A3><EFBFBD><EFBFBD>ɫ״̬<D7B4>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ
 | 
					
						
							|  |  |  |  | 	if (state != 3) | 
					
						
							|  |  |  |  | 		return 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	int isEnableAvatarSocketAction = user->isEnableAvatarSocketAction(); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	if (isEnableAvatarSocketAction) | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 		user->SendCmdErrorPacket(205, (unsigned char)isEnableAvatarSocketAction); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	//<2F><><EFBFBD><EFBFBD>packet_buf
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//ʱװ<CAB1><D7B0><EFBFBD>ڵı<DAB5><C4B1><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	int avartar_inven_slot = pBuf->get_short(); | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 	LOG("avartar_inven_slot :%d \n", avartar_inven_slot); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	//ʱװitem_id
 | 
					
						
							|  |  |  |  | 	int avartar_item_id = pBuf->get_int(); | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 	LOG("avartar_item_id :%d \n", avartar_item_id); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	int emblem_cnt = pBuf->get_byte(); | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 	LOG("emblem_cnt :%d \n", emblem_cnt); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	if (user->CheckItemLock(2, avartar_inven_slot)) | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 		user->SendCmdErrorPacket(205, 213); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 		return 0; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//<2F><>ȡʱװ<CAB1><D7B0><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	CInventory* inven = user->getCurCharacInvenW(); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	if (!inven) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		LOG("pUser->getCurCharacInvenW : error \n"); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 		return 0; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	Inven_Item* avartar = inven->GetInvenRef(CInventory::INVENTORY_TYPE_AVARTAR, avartar_inven_slot); | 
					
						
							|  |  |  |  | 	if (!avartar) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		LOG("inven->GetInvenRef : error \n"); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 		return 0; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	//У<><D0A3>ʱװ <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ϸ<EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	if (avartar->isEmpty() || (avartar->getKey() != avartar_item_id) || user->CheckItemLock(2, avartar_inven_slot)) | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		LOG("avartar->isEmpty() || avartar->getKey() || pUser->CheckItemLock() : error \n"); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 		return 0; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	//<2F><>ȡʱװ<CAB1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	WongWork::CAvatarItemMgr* avartar_add_info = avartar->get_add_info(); | 
					
						
							|  |  |  |  | 	WongWork::CAvatarItemMgr* inven_avartar_mgr = inven->GetAvatarItemMgrR(); | 
					
						
							|  |  |  |  | 	int jewel_socket_data = inven_avartar_mgr->getJewelSocketData(avartar_add_info); | 
					
						
							|  |  |  |  | 	if (!jewel_socket_data) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		LOG("jewel_socket_data : error \n"); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 		return 0; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 	LOG("jewel_socket_data :%s \n", Util::ToHexString((const unsigned char*)jewel_socket_data, 40).c_str()); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	if (emblem_cnt <= 3) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		std::map<int, std::pair<int, int>> emblems; | 
					
						
							|  |  |  |  | 		for (int i = 0; i < emblem_cnt; i++) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵı<DAB5><C4B1><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 			int emblem_inven_slot = pBuf->get_short(); | 
					
						
							|  |  |  |  | 			//<2F><><EFBFBD><EFBFBD>item_id
 | 
					
						
							|  |  |  |  | 			int emblem_item_id = pBuf->get_int(); | 
					
						
							|  |  |  |  | 			//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6>ʱװ<CAB1><D7B0><EFBFBD><EFBFBD>id
 | 
					
						
							|  |  |  |  | 			int avartar_socket_slot = pBuf->get_byte(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 			//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>
 | 
					
						
							|  |  |  |  | 			Inven_Item* emblem = inven->GetInvenRef(CInventory::INVENTORY_TYPE_ITEM, emblem_inven_slot); | 
					
						
							|  |  |  |  | 			//У<><D0A3><EFBFBD><EFBFBD><EFBFBD>¼<EFBFBD><C2BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ϸ<EFBFBD>
 | 
					
						
							|  |  |  |  | 			if (emblem->isEmpty() || (emblem->getKey() != emblem_item_id) || (avartar_socket_slot >= 3)) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 				LOG("emblem->isEmpty() || (emblem->getKey() : error \n"); | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 				user->SendCmdErrorPacket(205, 209); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 				return 0; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 			//У<><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>ʱװ<CAB1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɫҪ<C9AB><D2AA>
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 			//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>pvf<76><66><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 			CDataManager* DataManager = CDataManager::G_CDataManager(); | 
					
						
							|  |  |  |  | 			if (!DataManager) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 				LOG("CDataManager::G_CDataManager() : error \n"); | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 				user->SendCmdErrorPacket(205, 209); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 				return 0; | 
					
						
							|  |  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-09-09 12:24:02 +08:00
										 |  |  |  | 			CStackableItem* citem = (CStackableItem*)DataManager->find_item(emblem_item_id); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 			if (!citem) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 				LOG("DataManager->find_item() : error \n"); | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 				user->SendCmdErrorPacket(205, 209); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 				return 0; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 			//У<><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 			if (!citem->is_stackable() || (citem->GetItemType() != 20)) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 				LOG("citem->is_stackable() || (citem->GetItemType() : error \n"); | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 				user->SendCmdErrorPacket(205, 209); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 				return 0; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 			//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>֧<EFBFBD>ֵIJ<D6B5><C4B2><EFBFBD>
 | 
					
						
							|  |  |  |  | 			int emblem_socket_type = citem->getJewelTargetSocket(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 			//<2F><>ȡҪ<C8A1><D2AA>Ƕ<EFBFBD><C7B6>ʱװ<CAB1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 			int avartar_socket_type = *(short*)(jewel_socket_data + avartar_socket_slot * 6); | 
					
						
							|  |  |  |  | 			if (!(emblem_socket_type & avartar_socket_type)) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD>ƥ<EFBFBD><C6A5>
 | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 				LOG("emblem_socket_type & avartar_socket_type\n"); | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 				user->SendCmdErrorPacket(205, 209); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 				return 0; | 
					
						
							|  |  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 			LOG("avartar_socket_slot:%d emblem_inven_slot:%d emblem_item_id:%d\n", avartar_socket_slot, emblem_inven_slot, emblem_item_id); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 			emblems[avartar_socket_slot] = std::make_pair(emblem_inven_slot, emblem_item_id); | 
					
						
							|  |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		LOG("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѷ<EFBFBD>ȡ!!!\n"); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 		for (auto& avartar_socket_slot : emblems) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			//ɾ<><C9BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 			int emblem_inven_slot = avartar_socket_slot.second.first; | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 			inven->delete_item(CInventory::INVENTORY_TYPE_ITEM, emblem_inven_slot, 1, 8, 1); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 			//<2F><><EFBFBD><EFBFBD>ʱװ<CAB1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 			int emblem_item_id = avartar_socket_slot.second.second; | 
					
						
							|  |  |  |  | 			*(int*)(jewel_socket_data + avartar_socket_slot.first * 6 + 2) = emblem_item_id; | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 			LOG("<EFBFBD><EFBFBD><EFBFBD><EFBFBD>item_id=%d <20>ѳɹ<D1B3><C9B9><EFBFBD>Ƕ<EFBFBD><C7B6>avartar_socket_slot=%d <20>IJ<EFBFBD><C4B2><EFBFBD>!\n", emblem_item_id, avartar_socket_slot); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		//ʱװ<CAB1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ浵
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 		DB_UpdateAvatarJewelSlot::makeRequest(user->getCurCharacNo(), avartar->get_ui_id(), (void*)jewel_socket_data); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 		//֪ͨ<CDA8>ͻ<EFBFBD><CDBB><EFBFBD>ʱװ<CAB1><D7B0><EFBFBD><EFBFBD><EFBFBD>Ѹ<EFBFBD><D1B8><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 		user->SendUpdateItemList(1, 1, avartar_inven_slot); | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		LOG("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>!!!"); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 		//<2F>ذ<EFBFBD><D8B0><EFBFBD><EFBFBD>ͻ<EFBFBD><CDBB><EFBFBD>
 | 
					
						
							|  |  |  |  | 		InterfacePacketBuf* packet_guard = (InterfacePacketBuf*)PacketGuard::NewPacketGuard(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		packet_guard->put_header(1, 204); | 
					
						
							|  |  |  |  | 		packet_guard->put_int(1); | 
					
						
							|  |  |  |  | 		packet_guard->finalize(1); | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 		user->Send((PacketGuard*)packet_guard); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 		PacketGuard::DelPacketGuard((PacketGuard*)packet_guard); | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	// 08217C06  <20>ֽ<EFBFBD>
 | 
					
						
							|  |  |  |  | 	return 0; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 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); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 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) | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | { | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 	int(***dispatcher)(int, CUser*, char*) = (int(***)(int, CUser*, char*))a1->get_dispatcher(packet_id); | 
					
						
							|  |  |  |  | 	if (dispatcher) | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		//v32 = (**dispatcher)(dispatcher, user, v25);
 | 
					
						
							|  |  |  |  | 		LOG("Recv()	class:%d	id:%d	len:%d	%p	[ +00 :%p +12 :%p +16 :%p +20 :%p +24 :%p +28 :%p ]" | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 			, packet_class | 
					
						
							|  |  |  |  | 			, packet_id | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 			, packet_len | 
					
						
							|  |  |  |  | 			, (**dispatcher) | 
					
						
							|  |  |  |  | 			, *(int*)dispatcher | 
					
						
							|  |  |  |  | 			, *(int*)dispatcher + 12 | 
					
						
							|  |  |  |  | 			, *(int*)dispatcher + 16 | 
					
						
							|  |  |  |  | 			, *(int*)dispatcher + 20 | 
					
						
							|  |  |  |  | 			, *(int*)dispatcher + 24 | 
					
						
							|  |  |  |  | 			, *(int*)dispatcher + 28 | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 		); | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 	if (packet_id == PACKET_ID_ITEM_USE_EQUIPMENT_MOVEITEM) | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 		int result = 0; | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		PacketBuf* v25 = PacketBuf::NewPacketBuf(); | 
					
						
							|  |  |  |  | 		user->setLastPacketID(packet_id); | 
					
						
							|  |  |  |  | 		v25->bind_packet(packet_src, packet_len); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		LOG("Recv()	class:%d	id:%d	len:%d packet_data :%s " | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 			, packet_class | 
					
						
							|  |  |  |  | 			, packet_id | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 			, packet_len | 
					
						
							|  |  |  |  | 			, Util::ToHexString((const unsigned char*)packet_src, packet_len).c_str() | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 		); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 		if (v25) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			ENUM_PACK_RET_TYPE ret = CDispatch::Get()->UseEquipmentMoveItem(user, v25); | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 			result = (ret == PAK_ERROR) ? 1 : 0; | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 			PacketBuf::DelPacketBuf(v25); | 
					
						
							|  |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		return result; | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 	return Controller::Get()->old_PacketDispatcher_doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8); | 
					
						
							| 
									
										
										
										
											2022-09-01 16:56:37 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 |