| 
									
										
										
										
											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"
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | CDispatch::CDispatch() | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 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
										 |  |  |  | 		LOG(u8"<EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>!"); | 
					
						
							|  |  |  |  | 		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-02 23:34:06 +08:00
										 |  |  |  | 	LOG(u8"UseEquipmentMoveItem :%s ", Util::ToHexString((const unsigned char*)pBuf->get_buf_ptr(0), 40).c_str()); | 
					
						
							|  |  |  |  | 	int equipment_pos = pBuf->get_short();	//װ<><D7B0>λ<EFBFBD><CEBB>
 | 
					
						
							|  |  |  |  | 	int equipment_id = pBuf->get_int();		//װ<><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
 | 
					
						
							|  |  |  |  | 	int item_pos = pBuf->get_short();		//<2F><>Ʒλ<C6B7><CEBB>
 | 
					
						
							| 
									
										
										
										
											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; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	CItem* equipment_citem = DataManager->find_item(equipment_id); | 
					
						
							|  |  |  |  | 	CItem* item_citem = DataManager->find_item(item_id); | 
					
						
							|  |  |  |  | 	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-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(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 			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); | 
					
						
							|  |  |  |  | 				LOG(u8"user->Send((PacketGuard*)packet_guard)", a9); | 
					
						
							|  |  |  |  | 				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); | 
					
						
							|  |  |  |  | 			} | 
					
						
							|  |  |  |  | 			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
										 |  |  |  | 	/*
 | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-09-02 23:34:06 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	*/ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	//if (!item_citem->is_stackable() || (equipment_citem->GetItemType() != 20))
 | 
					
						
							|  |  |  |  | 	//{
 | 
					
						
							|  |  |  |  | 	//	LOG("citem->is_stackable() || (citem->GetItemType() : error \n");
 | 
					
						
							|  |  |  |  | 	//	pUser->SendCmdErrorPacket(205, 209);
 | 
					
						
							|  |  |  |  | 	//	return 0;
 | 
					
						
							|  |  |  |  | 	//}
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	/*
 | 
					
						
							|  |  |  |  | 	[DNF_PROJECT] Recv()	class:1	id:2000	len:21 packet_data :01 D0 07 15 00 00 00 36 E2 41 37 12 00 09 00 AD 6B 00 00 03 00 | 
					
						
							|  |  |  |  | 	[DNF_PROJECT] UseEquipmentMoveItem :01 D0 07 15 00 00 00 36 E2 41 37 12 00 09 00 AD 6B 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	[DNF_PROJECT] UseEquipmentMoveItem [ equipment_pos:9 equipment_id:27565 item_pos:3 item_id:2660238 ] | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	[DNF_PROJECT] Data: equipment_citem->GetItemType=0 item_citem->is_stackable=1 item_citem->GetItemType=11 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	*/ | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 	/*
 | 
					
						
							|  |  |  |  | 		<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; | 
					
						
							|  |  |  |  | 	} | 
					
						
							|  |  |  |  | 	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; | 
					
						
							|  |  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-09-02 01:27:05 +08:00
										 |  |  |  | 
 |