| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | //************************************
 | 
					
						
							|  |  |  |  | // FileName:  D:\VisualStudioSource\dnf_project\src\Dispatch.cpp
 | 
					
						
							|  |  |  |  | // FullName:  D:\VisualStudioSource\dnf_project\src
 | 
					
						
							|  |  |  |  | // Date:      2022/09/01
 | 
					
						
							|  |  |  |  | // By:        Vance
 | 
					
						
							|  |  |  |  | // Copyright (c) 2022.  Vance All rights reserved
 | 
					
						
							|  |  |  |  | //************************************
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | #include "dispatch.h"
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-12 18:11:08 +08:00
										 |  |  |  | CDispatch::CDispatch() : | 
					
						
							|  |  |  |  | 	last_move_map_tickcount(0) | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | CDispatch::~CDispatch() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf) | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | { | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	if (user->get_state() != 3) | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 	{ | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	int v110 = CSecu_ProtectionField::Get()->Check(user, 38); | 
					
						
							|  |  |  |  | 	if (v110) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		user->SendCmdErrorPacket(84, v110); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 	LOG(u8"UseEquipmentMoveItem :%s ", Utils::ToHexString((const unsigned char*)pBuf->get_buf_ptr(0), 40).c_str()); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	short equipment_pos = 0; | 
					
						
							|  |  |  |  | 	int equipment_id = 0; | 
					
						
							|  |  |  |  | 	short item_pos = 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if ((unsigned __int8)pBuf->get_short(&equipment_pos) != 1 | 
					
						
							|  |  |  |  | 		|| (unsigned __int8)pBuf->get_int(&equipment_id) != 1 | 
					
						
							|  |  |  |  | 		|| (unsigned __int8)pBuf->get_short(&item_pos) != 1) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		user->SendCmdErrorPacket(84, -1); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	//1 <20><>Ʒ<EFBFBD><C6B7> 2 ʱװ
 | 
					
						
							|  |  |  |  | 	if (user->CheckItemLock(1, equipment_pos)) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		user->SendCmdErrorPacket(84, 0xD5); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	CInventory* invenR = user->getCurCharacInvenR(); | 
					
						
							|  |  |  |  | 	if (!invenR) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG(u8"user->getCurCharacInvenW : error \n"); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	Inven_Item* equipment_InvenRef = invenR->GetInvenRef(CInventory::INVENTORY_TYPE_ITEM, equipment_pos); | 
					
						
							|  |  |  |  | 	if (!equipment_InvenRef) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG(u8"inven->GetInvenRef : error \n"); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	Inven_Item* item_avartar = invenR->GetInvenRef(CInventory::INVENTORY_TYPE_ITEM, item_pos); | 
					
						
							|  |  |  |  | 	if (!item_avartar) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG(u8"inven->GetInvenRef : error \n"); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (equipment_InvenRef->isEmpty()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG(u8"equipment_InvenRef->isEmpty"); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	if (equipment_InvenRef->getKey() != equipment_id) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG(u8"equipment_InvenRef->getKey() != equipment_id"); | 
					
						
							|  |  |  |  | 		user->SendCmdErrorPacket(4, 0); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (item_avartar->isEmpty()) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG(u8"item_avartar->isEmpty"); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	int item_id = item_avartar->getKey(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	CDataManager* DataManager = CDataManager::G_CDataManager(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (!DataManager) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG(u8"G_CDataManager error"); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 	CEquipItem* equipment_citem = (CEquipItem*)DataManager->find_item(equipment_id); | 
					
						
							|  |  |  |  | 	CStackableItem* item_citem = (CStackableItem*)DataManager->find_item(item_id); | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	LOG(u8"equipment_citem +12: %p" | 
					
						
							|  |  |  |  | 		, *(int*)equipment_citem + 12 | 
					
						
							|  |  |  |  | 	); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (!equipment_citem || !item_citem) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG(u8"!equipment_citem || !item_citem"); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	LOG(u8"UseEquipmentMoveItem [ equipment_pos:%d equipment_id:%d item_pos:%d item_id:%d ]" | 
					
						
							|  |  |  |  | 		, equipment_pos | 
					
						
							|  |  |  |  | 		, equipment_id | 
					
						
							|  |  |  |  | 		, item_pos | 
					
						
							|  |  |  |  | 		, item_id | 
					
						
							|  |  |  |  | 	); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//Data: equipment_citem->GetItemType=147418664 item_citem->is_stackable=1 item_citem->GetItemType=11
 | 
					
						
							|  |  |  |  | 	int equipment_Type = ((CEquipItem*)equipment_citem)->GetItemType(); | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 	int rarity = equipment_citem->get_rarity(); | 
					
						
							| 
									
										
										
										
											2022-09-12 18:11:08 +08:00
										 |  |  |  | 	if (rarity != 4) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		return PAK_OK; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	LOG(u8"Data: equipment_citem->GetItemType=%d item_citem->is_stackable=%d item_citem->GetItemType=%d" | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 		, equipment_Type | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 		, item_citem->is_stackable() | 
					
						
							|  |  |  |  | 		, item_citem->GetItemType() | 
					
						
							|  |  |  |  | 	); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (equipment_Type <= 9 || equipment_Type > 21 || equipment_Type == 11) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG(u8"equipment_Type <= 9 || equipment_Type > 21 || equipment_Type == 11"); | 
					
						
							|  |  |  |  | 		user->SendCmdErrorPacket(84, 0xD5); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (item_citem->is_stackable() != true || item_citem->GetItemType() != ITEM_TYPE_CONSUMABLES) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG(u8"item_citem->is_stackable() != true || item_citem->GetItemType() != ITEM_TYPE_CONSUMABLES"); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		//û<>о<EFBFBD><D0BE><EFBFBD><EFBFBD>ֻ<EFBFBD><D6BB><EFBFBD>֤,<2C><EFBFBD>ʹ<EFBFBD>øù<C3B8><C3B9><EFBFBD>
 | 
					
						
							|  |  |  |  | 		user->SendCmdErrorPacket(205, 209); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	Inven_Item new_equipment_item = {}; | 
					
						
							|  |  |  |  | 	invenR->GetInvenSlot(&new_equipment_item, CInventory::INVENTORY_TYPE_ITEM, equipment_pos); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	int v9 = 0;	//<2F><><EFBFBD>ظ<EFBFBD><D8B8>ͻ<EFBFBD><CDBB>˵Ĵ<CBB5><C4B4><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 	if (item_id == ITEM_ID_KUAJIESHI) | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG(u8"user->CheckInTrade:%d", user->CheckInTrade()); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		if (user->CheckInTrade()) | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 			v9 = 19; | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 		if (!user->IsExistAccountCargo()) | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 			v9 = 19; | 
					
						
							|  |  |  |  | 			LOG(u8"user->IsExistAccountCargo :%d", user->IsExistAccountCargo()); | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 		else | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		{ | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 			CAccountCargo* AccountCargo = user->GetAccountCargo(); | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 			LOG(u8"ins_item.IsTradeLimitAttachTypeItem :%d", new_equipment_item.IsTradeLimitAttachTypeItem()); | 
					
						
							|  |  |  |  | 			LOG(u8"AccountCargo->CheckInsertCondition :%d", AccountCargo->CheckInsertCondition(&new_equipment_item)); | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 			int empty_slot = 0; | 
					
						
							|  |  |  |  | 			if (AccountCargo->CheckSlotEmpty(empty_slot) != 1) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				empty_slot = AccountCargo->GetEmptySlot(); | 
					
						
							|  |  |  |  | 				if (empty_slot < 0) | 
					
						
							|  |  |  |  | 				{ | 
					
						
							|  |  |  |  | 					v9 = 4; | 
					
						
							|  |  |  |  | 					LOG("AccountCargo->CheckSlotEmpty :%d", empty_slot); | 
					
						
							|  |  |  |  | 					return PAK_IGNORE; | 
					
						
							|  |  |  |  | 				} | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 			LOG(u8"empty_slot :%d", empty_slot); | 
					
						
							|  |  |  |  | 			//inven->delete_item(1, emblem_inven_slot, 1, 8, 1);
 | 
					
						
							|  |  |  |  | 			auto invenW = user->getCurCharacInvenW(); | 
					
						
							|  |  |  |  | 			InterfacePacketBuf* packet_guard = (InterfacePacketBuf*)PacketGuard::NewPacketGuard(); | 
					
						
							| 
									
										
										
										
											2022-09-12 18:11:08 +08:00
										 |  |  |  | 			LOG("%p", invenW); | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 			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)) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 				int a9 = AccountCargo->InsertItem(&new_equipment_item, empty_slot); | 
					
						
							|  |  |  |  | 				user->SendUpdateItemList(1, new_equipment_item.GetItemSpace(), equipment_pos); | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 				user->SendUpdateItemList(1, item_avartar->GetItemSpace(), item_pos); | 
					
						
							|  |  |  |  | 				user->send_itemspace(12); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 				packet_guard->put_header(1, 2000); | 
					
						
							|  |  |  |  | 				packet_guard->put_int(1); | 
					
						
							|  |  |  |  | 				packet_guard->finalize(1); | 
					
						
							|  |  |  |  | 				user->Send((PacketGuard*)packet_guard); | 
					
						
							|  |  |  |  | 				PacketGuard::DelPacketGuard((PacketGuard*)packet_guard); | 
					
						
							| 
									
										
										
										
											2022-09-12 18:11:08 +08:00
										 |  |  |  | 				SendNoti(user, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>"); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 				return PAK_OK; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 			else | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				packet_guard->put_header(1, 2000); | 
					
						
							|  |  |  |  | 				packet_guard->put_int(0); | 
					
						
							|  |  |  |  | 				packet_guard->finalize(0); | 
					
						
							|  |  |  |  | 				user->Send((PacketGuard*)packet_guard); | 
					
						
							|  |  |  |  | 				PacketGuard::DelPacketGuard((PacketGuard*)packet_guard); | 
					
						
							| 
									
										
										
										
											2022-09-12 18:11:08 +08:00
										 |  |  |  | 				SendNoti(user, "װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>"); | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 			} | 
					
						
							|  |  |  |  | 			return PAK_IGNORE; | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 		} | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 	/*
 | 
					
						
							|  |  |  |  | 		<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Call (2000) | 
					
						
							|  |  |  |  | 		<EFBFBD><EFBFBD>ԿCall (װ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>,2) | 
					
						
							|  |  |  |  | 		<EFBFBD><EFBFBD>ԿCall (װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>,4) | 
					
						
							|  |  |  |  | 		<EFBFBD><EFBFBD>ԿCall (<EFBFBD><EFBFBD>Ʒλ<EFBFBD><EFBFBD>,2) | 
					
						
							|  |  |  |  | 		<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Call () | 
					
						
							|  |  |  |  | 	*/ | 
					
						
							|  |  |  |  | 	return 	PAK_OK; | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 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; | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 	short equipment_pos = 0; | 
					
						
							|  |  |  |  | 	int equipment_id = 0; | 
					
						
							|  |  |  |  | 	short item_pos = 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if ((unsigned __int8)pBuf->get_short(&equipment_pos) != 1 | 
					
						
							|  |  |  |  | 		|| (unsigned __int8)pBuf->get_int(&equipment_id) != 1 | 
					
						
							|  |  |  |  | 		|| (unsigned __int8)pBuf->get_short(&item_pos) != 1) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		user->SendCmdErrorPacket(84, -1); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	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; | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-04 00:06:13 +08:00
										 |  |  |  | 	CEquipItem* equipment_item = (CEquipItem*)CDataManager::G_CDataManager()->find_item(equipment_id); | 
					
						
							| 
									
										
										
										
											2022-09-13 22:47:38 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	LOG("(*(int(**)(CItem*))(*(_DWORD*)equipment_item + 12)) :%p  %p" | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-13 22:47:38 +08:00
										 |  |  |  | 		, (*(int(**)(CItem*))(*(_DWORD*)equipment_item + 12)) | 
					
						
							|  |  |  |  | 		, ((int(**)(CItem*))(*(_DWORD*)equipment_item + 12)) | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-13 22:47:38 +08:00
										 |  |  |  | 	); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 	if (!equipment_item) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		user->SendCmdErrorPacket(84, 4); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-04 00:06:13 +08:00
										 |  |  |  | 	int equipment_Type = equipment_item->GetItemType(); | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 	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; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-09 12:24:02 +08:00
										 |  |  |  | 	int grade = equipment_item->get_grade();	//<2F><><EFBFBD><EFBFBD><EFBFBD>ȼ<EFBFBD>
 | 
					
						
							|  |  |  |  | 	int rarity = equipment_item->get_rarity();	//ϡ<><CFA1>
 | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 	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); | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-03 17:30:34 +08:00
										 |  |  |  | 	dis_mod->_SendResult(user, 1, item_pos, equipment_pos); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	return PAK_IGNORE; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | ENUM_PACK_RET_TYPE CDispatch::UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* user, PacketBuf* pBuf) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	printf("getCurCharacName :%s \n", user->getCurCharacName().c_str()); | 
					
						
							|  |  |  |  | 	printf("getCurCharacNo :%d \n", user->getCurCharacNo()); | 
					
						
							|  |  |  |  | 	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());
 | 
					
						
							|  |  |  |  | 	int state = user->get_state(); | 
					
						
							|  |  |  |  | 	LOG("state :%d \n", state); | 
					
						
							|  |  |  |  | 	//У<><D0A3><EFBFBD><EFBFBD>ɫ״̬<D7B4>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ
 | 
					
						
							|  |  |  |  | 	if (state != 3) | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	int isEnableAvatarSocketAction = user->isEnableAvatarSocketAction(); | 
					
						
							|  |  |  |  | 	if (isEnableAvatarSocketAction) | 
					
						
							|  |  |  |  | 		user->SendCmdErrorPacket(205, (unsigned char)isEnableAvatarSocketAction); | 
					
						
							|  |  |  |  | 	//<2F><><EFBFBD><EFBFBD>packet_buf
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	short avartar_inven_slot = 0;	//ʱװ<CAB1><D7B0><EFBFBD>ڵı<DAB5><C4B1><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	int avartar_item_id = 0;		//ʱװitem_id
 | 
					
						
							|  |  |  |  | 	char emblem_cnt = 0;			//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if ((unsigned __int8)pBuf->get_short(&avartar_inven_slot) != 1 | 
					
						
							|  |  |  |  | 		|| (unsigned __int8)pBuf->get_int(&avartar_item_id) != 1 | 
					
						
							|  |  |  |  | 		|| (unsigned __int8)pBuf->get_byte(&emblem_cnt) != 1) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		user->SendCmdErrorPacket(205, -1); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (user->CheckItemLock(2, avartar_inven_slot)) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		user->SendCmdErrorPacket(205, 213); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//<2F><>ȡʱװ<CAB1><D7B0><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 	CInventory* CurCharacInvenW = user->getCurCharacInvenW(); | 
					
						
							|  |  |  |  | 	if (!CurCharacInvenW) | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG("pUser->getCurCharacInvenW : error \n"); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 	Inven_Item* avartar_inven_item = CurCharacInvenW->GetInvenRef(CInventory::INVENTORY_TYPE_AVARTAR, avartar_inven_slot); | 
					
						
							|  |  |  |  | 	if (!avartar_inven_item) | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG("inven->GetInvenRef : error \n"); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	//У<><D0A3>ʱװ <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7>Ϸ<EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 	if (avartar_inven_item->isEmpty() || (avartar_inven_item->getKey() != avartar_item_id) || user->CheckItemLock(2, avartar_inven_slot)) | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		LOG("avartar->isEmpty() || avartar->getKey() || pUser->CheckItemLock() : error \n"); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	//<2F><>ȡʱװ<CAB1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 	auto avartar_add_info = avartar_inven_item->get_add_info(); | 
					
						
							|  |  |  |  | 	auto inven_avartar_mgr = (WongWork::CAvatarItemMgr*)CurCharacInvenW->GetAvatarItemMgrW(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	stAvatarEmblemInfo_t* JewelSocketData = (stAvatarEmblemInfo_t*)inven_avartar_mgr->getJewelSocketData(avartar_add_info); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	if (!JewelSocketData) | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		LOG("jewel_socket_data : error \n"); | 
					
						
							|  |  |  |  | 		return PAK_IGNORE; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 	LOG("jewel_socket_data 1:%s \n", Utils::ToHexString((const unsigned char*)JewelSocketData, 30).c_str()); | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +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>
 | 
					
						
							|  |  |  |  | 			short emblem_inven_slot = 0; | 
					
						
							|  |  |  |  | 			pBuf->get_short(&emblem_inven_slot); | 
					
						
							|  |  |  |  | 			//<2F><><EFBFBD><EFBFBD>item_id
 | 
					
						
							|  |  |  |  | 			int emblem_item_id = 0; | 
					
						
							|  |  |  |  | 			pBuf->get_int(&emblem_item_id); | 
					
						
							|  |  |  |  | 			//<2F>û<EFBFBD><C3BB><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD><C7B6>ʱװ<CAB1><D7B0><EFBFBD><EFBFBD>id
 | 
					
						
							|  |  |  |  | 			char avartar_socket_slot = 0; | 
					
						
							|  |  |  |  | 			pBuf->get_byte(&avartar_socket_slot); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 			LOG("emblem_inven_slot :%d emblem_item_id :%d avartar_socket_slot :%d", emblem_inven_slot, emblem_item_id, avartar_socket_slot); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 			//<2F><>ȡ<EFBFBD><C8A1><EFBFBD>µ<EFBFBD><C2B5><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 			Inven_Item* emblem = CurCharacInvenW->GetInvenRef(CInventory::INVENTORY_TYPE_ITEM, emblem_inven_slot); | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 			//У<><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)) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				LOG("emblem->isEmpty() || (emblem->getKey() : error \n"); | 
					
						
							|  |  |  |  | 				user->SendCmdErrorPacket(205, 209); | 
					
						
							|  |  |  |  | 				return PAK_IGNORE; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 			//У<><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) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				LOG("CDataManager::G_CDataManager() : error \n"); | 
					
						
							|  |  |  |  | 				user->SendCmdErrorPacket(205, 209); | 
					
						
							|  |  |  |  | 				return PAK_IGNORE; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 			CStackableItem* citem = (CStackableItem*)DataManager->find_item(emblem_item_id); | 
					
						
							|  |  |  |  | 			if (!citem) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				LOG("DataManager->find_item() : error \n"); | 
					
						
							|  |  |  |  | 				user->SendCmdErrorPacket(205, 209); | 
					
						
							|  |  |  |  | 				return PAK_IGNORE; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 			//У<><D0A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 			if (!citem->is_stackable() || (citem->GetItemType() != 20)) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				LOG("citem->is_stackable() || (citem->GetItemType() : error \n"); | 
					
						
							|  |  |  |  | 				user->SendCmdErrorPacket(205, 209); | 
					
						
							|  |  |  |  | 				return PAK_IGNORE; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 			//<2F><>ȡ<EFBFBD><C8A1><EFBFBD><EFBFBD>֧<EFBFBD>ֵIJ<D6B5><C4B2><EFBFBD>
 | 
					
						
							|  |  |  |  | 			int emblem_socket_type = citem->getJewelTargetSocket(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 			//01 00 C4 25 26 00 01 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 			//<2F><>ȡҪ<C8A1><D2AA>Ƕ<EFBFBD><C7B6>ʱװ<CAB1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 			sizeof(stAvatarEmblemInfo_t); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 			 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 			int avartar_socket_type = JewelSocketData->EmblemSocketData[avartar_socket_slot].slot_type; | 
					
						
							|  |  |  |  | 			LOG("emblem_socket_type :%d avartar_socket_type :%d", emblem_socket_type, avartar_socket_type); | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 			if (!(emblem_socket_type & avartar_socket_type)) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ͳ<EFBFBD>ƥ<EFBFBD><C6A5>
 | 
					
						
							|  |  |  |  | 				LOG("emblem_socket_type & avartar_socket_type\n"); | 
					
						
							|  |  |  |  | 				user->SendCmdErrorPacket(205, 209); | 
					
						
							|  |  |  |  | 				return PAK_IGNORE; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 			LOG("avartar_socket_slot:%d emblem_inven_slot:%d emblem_item_id:%d\n", avartar_socket_slot, emblem_inven_slot, emblem_item_id); | 
					
						
							|  |  |  |  | 			emblems[avartar_socket_slot] = std::make_pair(emblem_inven_slot, emblem_item_id); | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 			if (CurCharacInvenW->delete_item(CInventory::INVENTORY_TYPE_ITEM, emblem_inven_slot, 1, 8, 1)) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				JewelSocketData->EmblemSocketData[avartar_socket_slot].slot_item_id = emblem_item_id; | 
					
						
							|  |  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 		LOG("jewel_socket_data 2:%s \n", Utils::ToHexString((const unsigned char*)JewelSocketData, 30).c_str()); | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 		inven_avartar_mgr->setEmblemSocketData(avartar_add_info, JewelSocketData); | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 		//ʱװ<CAB1><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݴ浵
 | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 		DB_UpdateAvatarJewelSlot::makeRequest(user->getCurCharacNo(), (unsigned int)avartar_add_info, (void*)JewelSocketData); | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 		//֪ͨ<CDA8>ͻ<EFBFBD><CDBB><EFBFBD>ʱװ<CAB1><D7B0><EFBFBD><EFBFBD><EFBFBD>Ѹ<EFBFBD><D1B8><EFBFBD>
 | 
					
						
							|  |  |  |  | 		user->SendUpdateItemList(1, 1, avartar_inven_slot); | 
					
						
							|  |  |  |  | 		//<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); | 
					
						
							|  |  |  |  | 		user->Send((PacketGuard*)packet_guard); | 
					
						
							|  |  |  |  | 		PacketGuard::DelPacketGuard((PacketGuard*)packet_guard); | 
					
						
							| 
									
										
										
										
											2022-09-17 00:49:27 +08:00
										 |  |  |  | 		SendNoti(user, "<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɻ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƕ"); | 
					
						
							| 
									
										
										
										
											2022-09-12 13:35:16 +08:00
										 |  |  |  | 		return PAK_OK; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	return PAK_IGNORE; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-12 18:11:08 +08:00
										 |  |  |  | ENUM_PACK_RET_TYPE CDispatch::MoveMap_dispatch_sig(void* a1, CUser* user, PacketBuf* pBuf) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	USER_DATA data; | 
					
						
							|  |  |  |  | 	if (user_map.Find(user, &data)) | 
					
						
							|  |  |  |  | 	{ | 
					
						
							|  |  |  |  | 		auto CurTickCount = CSystemTime::G_CSystemTime()->getCurTickCount(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		if (CurTickCount >= last_move_map_tickcount) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			if ((CurTickCount - last_move_map_tickcount) <= 1000) | 
					
						
							|  |  |  |  | 			{ | 
					
						
							|  |  |  |  | 				data.abnormal_data_count++; | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 			last_move_map_tickcount = CurTickCount; | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		user_map.Change(user, data); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 		//<2F>ж<EFBFBD><D0B6>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>3
 | 
					
						
							|  |  |  |  | 		if (data.abnormal_data_count >= 3) | 
					
						
							|  |  |  |  | 		{ | 
					
						
							|  |  |  |  | 			return PAK_ERROR; | 
					
						
							|  |  |  |  | 		} | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	return PAK_OK; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | ENUM_PACK_RET_TYPE CDispatch::Inter_LoadEtc_dispatch_sig(void* a1, CUser* user, char* a3) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	user->getCurCharacNo(); | 
					
						
							|  |  |  |  | 	user->getCurCharacName(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	user_map.Push(user, {}); | 
					
						
							|  |  |  |  | 	return PAK_OK; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | ENUM_PACK_RET_TYPE CDispatch::DisPatcher_ReturnToSelectCharacter_dispatch_sig(void* a1, CUser* user, char* a3) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	user_map.Erase(user); | 
					
						
							|  |  |  |  | 	return PAK_OK; | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void CDispatch::SendMsg(CUser* user, int pack_id, int status, const std::string& str) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	char out_str[0xff] = {}; | 
					
						
							|  |  |  |  | 	memset(out_str, 0, sizeof(out_str)); | 
					
						
							|  |  |  |  | 	DNFFLib::ConvertGBKtoUTF8((char*)str.c_str(), out_str); | 
					
						
							|  |  |  |  | 	InterfacePacketBuf* packet_guard = (InterfacePacketBuf*)PacketGuard::NewPacketGuard(); | 
					
						
							|  |  |  |  | 	packet_guard->put_header(1, pack_id); | 
					
						
							|  |  |  |  | 	packet_guard->put_int(status); | 
					
						
							|  |  |  |  | 	packet_guard->put_int(strlen(out_str)); | 
					
						
							|  |  |  |  | 	packet_guard->put_str(out_str, strlen(out_str)); | 
					
						
							|  |  |  |  | 	user->Send((PacketGuard*)packet_guard); | 
					
						
							|  |  |  |  | 	PacketGuard::DelPacketGuard((PacketGuard*)packet_guard); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | void CDispatch::SendNoti(CUser* user, const std::string& str, NOTI_PACKETMESSAGE_TYPE type) | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 	char out_str[0xff] = {}; | 
					
						
							|  |  |  |  | 	memset(out_str, 0, sizeof(out_str)); | 
					
						
							|  |  |  |  | 	DNFFLib::ConvertGBKtoUTF8((char*)str.c_str(), out_str); | 
					
						
							|  |  |  |  | 	user->SendNotiPacketMessage(out_str, type); | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 |