diff --git a/src/base.h b/src/base.h index 148c577..265faa5 100644 --- a/src/base.h +++ b/src/base.h @@ -5,7 +5,6 @@ namespace base namespace CGameManager { const int G_CGameManager = 0x080CC18E; - } namespace Dispatcher_UseJewel @@ -19,6 +18,12 @@ namespace base { const int Init = 0x08299FA0; const int Init_fix_1 = 0x0829C075; + + + //base + const int s_pSecuProtectionField = 0x0941F7CC; + + } namespace CParty @@ -38,6 +43,8 @@ namespace base const int getCurCharacLastPlayTick = 0x82A66AA; const int get_level_up_exp = 0x0864E3BA; const int getCurCharacInvenW = 0x80DA28E; + const int _checkItemMovable = 0x0865F1E1; + const int getCurCharacInvenR = 0x080DA27E; } namespace CUser @@ -57,6 +64,11 @@ namespace base const int isGMUser = 0x0814589C; const int exchange_interspace = 0x0865F7B0; const int setLastPacketID = 0x0867CBC4; + const int GetAccountCargo = 0x0822FC22; + const int CheckInTrade = 0x080DA2FE; + const int IsExistAccountCargo = 0x0822FC30; + const int send_itemspace = 0x0865DB6C; + } namespace CStackableItem @@ -70,6 +82,12 @@ namespace base { const int is_stackable = 0x80F12FA; const int IsRoutingItem = 0x08150F18; + const int GetAttachType = 0x080F12E2; + } + + namespace CEquipItem + { + const int GetItemType = 0x08514D26; } namespace Inven_Item @@ -78,6 +96,9 @@ namespace base const int isEmpty = 0x811ED66; const int getKey = 0x850D14E; const int isEquipableItemType = 0x08150812; + const int IsTradeLimitAttachTypeItem = 0x081201DC; + const int GetItemSpace = 0x083481E2; + } namespace CDataManager @@ -93,6 +114,7 @@ namespace base const int use_money = 0x84FF54C; const int gain_money = 0x84FF29C; const int GetInvenRef = 0x84FC1DE; + const int GetInvenSlot = 0x084FB918; } namespace DB_UpdateAvatarJewelSlot @@ -193,7 +215,65 @@ namespace base } } + namespace CSecu_ProtectionField + { + const int Check = 0x08288A02; + } + namespace CAccountCargo + { + const int GetCapacity = 0x0822F012; + const int GetMoney = 0x0822F020; + const int CAccountCargo = 0x08289794; + const int SetDBData = 0x08289816; + const int Clear = 0x0828986C; + const int ResetSlot = 0x082898C0; + const int GetSlot = 0x082898F8; + const int GetSlotRef = 0x08289A0C; + const int CheckInsertCondition = 0x08289A4A; + const int InsertItem = 0x08289C82; + const int DeleteItem = 0x08289E3C; + const int MoveItem = 0x08289F26; + const int DepositMoney = 0x0828A12A; + const int WithdrawMoney = 0x0828A2F6; + const int CheckMoneyLimit = 0x0828A4CA; + const int CheckValidSlot = 0x0828A554; + const int GetEmptySlot = 0x0828A580; + const int CheckSlotEmpty = 0x0828A5D4; + const int GetSpecificItemSlot = 0x0828A61A; + const int CheckStackLimit = 0x0828A670; + const int AddMoney = 0x0828A742; + const int SubMoney = 0x0828A764; + const int GetItemCount = 0x0828A794; + const int SendNotifyMoney = 0x0828A7DC; + const int SendItemList = 0x0828A88A; + const int MakeItemPacket = 0x0828AB1C; + const int CreateAccountCargo = 0x0828AD72; + const int UpgradeAccountCargo = 0x0828B0B2; + const int SendNotifyRecipe = 0x0828B3D0; + const int DeleteAccountCargo = 0x0828B4EC; + const int SetStable = 0x0844DC16; + const int SetCapacity = 0x084EBE46; + const int IsAlter = 0x08695A0C; + } + + namespace stMoveItemParam + { + const int stMoveItemParam_make = 0x08230CD4; + const int stMoveItemParam_destroy = 0x08248062; + const int stMoveItemParam_del = 0x08248092; + } + + namespace cUserHistoryLog + { + const int AccountCargoAddItem = 0x086868B4; + } + + namespace AvatarRechargeServer + { + const int Get = 0x081935A2; + const int SendDurability = 0x08190416; + } } diff --git a/src/controller.cpp b/src/controller.cpp index ca1af88..df16c68 100644 --- a/src/controller.cpp +++ b/src/controller.cpp @@ -71,23 +71,23 @@ int Controller::hook_IPacketDispatcher_ParamBase_dispatch_template(int a1, int a Controller::Get()->old_IPacketDispatcher_ParamBase_dispatch_template(a1, a2, a3); } -int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* pUser, PacketBuf* pBuf) +int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* user, PacketBuf* pBuf) { - printf("getCurCharacName :%s \n", pUser->getCurCharacName().c_str()); - printf("getCurCharacNo :%d \n", pUser->getCurCharacNo()); + 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 = pUser->get_state(); + int state = user->get_state(); LOG("state :%d \n", state); //校验角色状态是否允许镶嵌 if (state != 3) return 0; - int isEnableAvatarSocketAction = pUser->isEnableAvatarSocketAction(); + int isEnableAvatarSocketAction = user->isEnableAvatarSocketAction(); if (isEnableAvatarSocketAction) - pUser->SendCmdErrorPacket(205, (unsigned char)isEnableAvatarSocketAction); + user->SendCmdErrorPacket(205, (unsigned char)isEnableAvatarSocketAction); //解析packet_buf //时装所在的背包槽 @@ -100,14 +100,14 @@ int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* pU int emblem_cnt = pBuf->get_byte(); LOG("emblem_cnt :%d \n", emblem_cnt); - if (pUser->CheckItemLock(2, avartar_inven_slot)) + if (user->CheckItemLock(2, avartar_inven_slot)) { - pUser->SendCmdErrorPacket(205, 213); + user->SendCmdErrorPacket(205, 213); return 0; } //获取时装道具 - CInventory* inven = pUser->getCurCharacInvenW(); + CInventory* inven = user->getCurCharacInvenW(); if (!inven) { LOG("pUser->getCurCharacInvenW : error \n"); @@ -120,7 +120,7 @@ int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* pU return 0; } //校验时装 数据是否合法 - if (avartar->isEmpty() || (avartar->getKey() != avartar_item_id) || pUser->CheckItemLock(2, avartar_inven_slot)) + if (avartar->isEmpty() || (avartar->getKey() != avartar_item_id) || user->CheckItemLock(2, avartar_inven_slot)) { LOG("avartar->isEmpty() || avartar->getKey() || pUser->CheckItemLock() : error \n"); @@ -155,7 +155,7 @@ int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* pU if (emblem->isEmpty() || (emblem->getKey() != emblem_item_id) || (avartar_socket_slot >= 3)) { LOG("emblem->isEmpty() || (emblem->getKey() : error \n"); - pUser->SendCmdErrorPacket(205, 209); + user->SendCmdErrorPacket(205, 209); return 0; } @@ -166,14 +166,14 @@ int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* pU if (!DataManager) { LOG("CDataManager::G_CDataManager() : error \n"); - pUser->SendCmdErrorPacket(205, 209); + user->SendCmdErrorPacket(205, 209); return 0; } CItem* citem = DataManager->find_item(emblem_item_id); if (!citem) { LOG("DataManager->find_item() : error \n"); - pUser->SendCmdErrorPacket(205, 209); + user->SendCmdErrorPacket(205, 209); return 0; } @@ -181,7 +181,7 @@ int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* pU if (!citem->is_stackable() || (citem->GetItemType() != 20)) { LOG("citem->is_stackable() || (citem->GetItemType() : error \n"); - pUser->SendCmdErrorPacket(205, 209); + user->SendCmdErrorPacket(205, 209); return 0; } @@ -194,7 +194,7 @@ int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* pU { //插槽类型不匹配 LOG("emblem_socket_type & avartar_socket_type\n"); - pUser->SendCmdErrorPacket(205, 209); + user->SendCmdErrorPacket(205, 209); return 0; } LOG("avartar_socket_slot:%d emblem_inven_slot:%d emblem_item_id:%d\n", avartar_socket_slot, emblem_inven_slot, emblem_item_id); @@ -206,7 +206,7 @@ int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* pU { //删除徽章 int emblem_inven_slot = avartar_socket_slot.second.first; - inven->delete_item(1, emblem_inven_slot, 1, 8, 1); + inven->delete_item(CInventory::INVENTORY_TYPE_ITEM, emblem_inven_slot, 1, 8, 1); //设置时装插槽数据 int emblem_item_id = avartar_socket_slot.second.second; @@ -215,10 +215,10 @@ int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* pU } //时装插槽数据存档 - DB_UpdateAvatarJewelSlot::makeRequest(pUser->getCurCharacNo(), avartar->get_ui_id(), (void*)jewel_socket_data); + DB_UpdateAvatarJewelSlot::makeRequest(user->getCurCharacNo(), avartar->get_ui_id(), (void*)jewel_socket_data); //通知客户端时装数据已更新 - pUser->SendUpdateItemList(1, 1, avartar_inven_slot); + user->SendUpdateItemList(1, 1, avartar_inven_slot); LOG("徽章镶嵌完毕!!!"); //回包给客户端 InterfacePacketBuf* packet_guard = (InterfacePacketBuf*)PacketGuard::NewPacketGuard(); @@ -226,7 +226,7 @@ int Controller::hook_UseJewel_dispatch_sig(void* pDispatcher_UseJewel, CUser* pU packet_guard->put_header(1, 204); packet_guard->put_int(1); packet_guard->finalize(1); - pUser->Send((PacketGuard*)packet_guard); + user->Send((PacketGuard*)packet_guard); PacketGuard::DelPacketGuard((PacketGuard*)packet_guard); } @@ -258,6 +258,7 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher* a1, CUser* us if (packet_id == Packet_UseEquipmentMoveItem) { + int result = 0; PacketBuf* v25 = PacketBuf::NewPacketBuf(); user->setLastPacketID(packet_id); v25->bind_packet(packet_src, packet_len); @@ -271,11 +272,14 @@ int Controller::hook_PacketDispatcher_doDispatch(PacketDispatcher* a1, CUser* us , Util::ToHexString((const unsigned char*)packet_src, packet_len).c_str() ); - int result = CDispatch::Get()->UseEquipmentMoveItem(user, v25); + if (v25) + { + ENUM_PACK_RET_TYPE ret = CDispatch::Get()->UseEquipmentMoveItem(user, v25); + result = (ret == PAK_ERROR) ? 1 : 0; - - PacketBuf::DelPacketBuf(v25); + PacketBuf::DelPacketBuf(v25); + } return result; } return Controller::Get()->old_PacketDispatcher_doDispatch(a1, user, packet_class, packet_id, packet_src, packet_len, a7, a8); diff --git a/src/dispatch.cpp b/src/dispatch.cpp index c0baf7c..69a75b6 100644 --- a/src/dispatch.cpp +++ b/src/dispatch.cpp @@ -18,115 +18,249 @@ CDispatch::~CDispatch() } -int CDispatch::UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf) +ENUM_PACK_RET_TYPE CDispatch::UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf) { - int result = 0; - if (pBuf) + if (user->get_state() != 3) { - int equipment_pos = pBuf->get_short(); //装备位置 - int equipment_id = pBuf->get_int(); //装备代码 - int item_pos = pBuf->get_short(); //物品位置 + LOG(u8"玩家状态不正常!"); + return PAK_IGNORE; + } + + int v110 = CSecu_ProtectionField::Get()->Check(user, 38); + if (v110) + { + user->SendCmdErrorPacket(84, v110); + return PAK_IGNORE; + } + + LOG(u8"UseEquipmentMoveItem :%s ", Util::ToHexString((const unsigned char*)pBuf->get_buf_ptr(0), 40).c_str()); + int equipment_pos = pBuf->get_short(); //装备位置 + int equipment_id = pBuf->get_int(); //装备代码 + int item_pos = pBuf->get_short(); //物品位置 + + //1 物品栏 2 时装 + if (user->CheckItemLock(1, equipment_pos)) + { + user->SendCmdErrorPacket(84, 0xD5); + return PAK_IGNORE; + } + + 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(); + + LOG(u8"Data: equipment_citem->GetItemType=%d item_citem->is_stackable=%d item_citem->GetItemType=%d" + , (*(int(**)(CItem*))(*(int*)equipment_citem + 12))(equipment_citem) + , item_citem->is_stackable() + , item_citem->GetItemType() + ); - //1 物品栏 2 时装 - if (user->CheckItemLock(1, equipment_pos)) + 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"); + + //没有镜像手机认证,无法使用该功能 + user->SendCmdErrorPacket(205, 209); + return PAK_IGNORE; + } + int v9 = 0; //返回给客户端的错误码 + switch (item_id) + { + case ITEM_ID_KUAJIESHI: + { + LOG(u8"user->CheckInTrade:%d", user->CheckInTrade()); + + if (user->CheckInTrade()) { - user->SendCmdErrorPacket(83, 213); - return result; + v9 = 19; } - - CInventory* inven = user->getCurCharacInvenW(); - if (!inven) + if (!user->IsExistAccountCargo()) { - LOG("user->getCurCharacInvenW : error \n"); - return result; + v9 = 19; + LOG(u8"user->IsExistAccountCargo :%d", user->IsExistAccountCargo()); } - - Inven_Item* equipment_avartar = inven->GetInvenRef(CInventory::INVENTORY_TYPE_ITEM, equipment_pos); - if (!equipment_avartar) + else { - LOG("inven->GetInvenRef : error \n"); - return result; + CAccountCargo* AccountCargo = user->GetAccountCargo(); + + invenR = user->getCurCharacInvenR(); + + Inven_Item ins_item = {}; + + invenR->GetInvenSlot(&ins_item, CInventory::INVENTORY_TYPE_ITEM, equipment_pos); + + + LOG(u8"ins_item.IsTradeLimitAttachTypeItem :%d", ins_item.IsTradeLimitAttachTypeItem()); + LOG(u8"AccountCargo->CheckInsertCondition :%d", AccountCargo->CheckInsertCondition(&ins_item)); + + 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)) + { + int a9 = AccountCargo->InsertItem(&ins_item, empty_slot); + user->SendUpdateItemList(1, ins_item.GetItemSpace(), equipment_pos); + 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; } - Inven_Item* item_avartar = inven->GetInvenRef(CInventory::INVENTORY_TYPE_ITEM, item_pos); - if (!item_avartar) - { - LOG("inven->GetInvenRef : error \n"); - return result; - } - - if (equipment_avartar->isEmpty() ) - { - LOG("服务器背包为空"); - return result; - } - if (equipment_avartar->getKey() != equipment_id) - { - LOG("需要操作的装备ID和数据库的装备ID不一致"); - return result; - } - - if (item_avartar->isEmpty()) - { - LOG("需要操作的物品为空"); - return result; - } - - int item_id = item_avartar->getKey(); - - CDataManager* DataManager = CDataManager::G_CDataManager(); - - if (!DataManager) - { - LOG("G_CDataManager 错误"); - return result; - } - - CItem* equipment_citem = DataManager->find_item(equipment_id); - CItem* item_citem = DataManager->find_item(item_id); - - if (!equipment_citem || !item_citem) - { - LOG("获取pvf中数据失败!"); - return result; - } - - LOG("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 - LOG("Data: equipment_citem->GetItemType=%d item_citem->is_stackable=%d item_citem->GetItemType=%d" - , equipment_citem->GetItemType() - , item_citem->is_stackable() - , item_citem->GetItemType() - - ); - - //if (!item_citem->is_stackable() || (equipment_citem->GetItemType() != 20)) - //{ - // LOG("citem->is_stackable() || (citem->GetItemType() : error \n"); - // pUser->SendCmdErrorPacket(205, 209); - // return 0; - //} - - /* - 缓冲Call (2000) - 密钥Call (装备位置,2) - 密钥Call (装备代码,4) - 密钥Call (物品位置,2) - 发包Call () - */ - - } - return result; + break; + case ITEM_ID_YIJIRUHUN: + { + + } + break; + default: + break; + } + + + + /* + + + + + + */ + + //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 + + */ + + /* + 缓冲Call (2000) + 密钥Call (装备位置,2) + 密钥Call (装备代码,4) + 密钥Call (物品位置,2) + 发包Call () + */ + + + + + return PAK_OK; } diff --git a/src/dispatch.h b/src/dispatch.h index 96e7690..ac16c57 100644 --- a/src/dispatch.h +++ b/src/dispatch.h @@ -14,7 +14,7 @@ public: CDispatch(); ~CDispatch(); public: - int UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf); + ENUM_PACK_RET_TYPE UseEquipmentMoveItem(CUser* user, PacketBuf* pBuf); protected: diff --git a/src/enum.h b/src/enum.h index f51e049..78e2fec 100644 --- a/src/enum.h +++ b/src/enum.h @@ -6,3 +6,24 @@ enum ENUM_PACKET_ID Packet_UseEquipmentMoveItem = 2000, }; +enum ENUM_PACK_RET_TYPE +{ + PAK_OK = 0, + PAK_IGNORE = 1, + PAK_ERROR = 2, +}; + +enum ENUM_ITEM_TYPE +{ + ITEM_TYPE_EQUIPMENT = 0, + ITEM_TYPE_CONSUMABLES = 11, + ITEM_TYPE_JEWEL = 20, + +}; + +enum ENUM_ITEM_ID +{ + ITEM_ID_YIJIRUHUN = 2660238, //一击入魂蜜蜡 + ITEM_ID_KUAJIESHI = 20220831, //测试跨界石 + +}; \ No newline at end of file diff --git a/src/sdk_class.h b/src/sdk_class.h index 932c706..73aa787 100644 --- a/src/sdk_class.h +++ b/src/sdk_class.h @@ -25,6 +25,7 @@ template R CallT(A call_addr, const AR return R(); } +class CAccountCargo; class DB_UpdateAvatarJewelSlot; class CInventory; class CStackableItem; @@ -100,6 +101,17 @@ public: typedef CInventory* (*__func)(CUserCharacInfo* a1); return ((__func)base::CUserCharacInfo::getCurCharacInvenW)(this); } + + bool _checkItemMovable(int a2, int a3, int a4, int a5, int a6, int a7) + { + CallT(base::CUserCharacInfo::_checkItemMovable, this, a2, a3, a4, a5, a6, a7); + } + + CInventory* getCurCharacInvenR() + { + return CallT(base::CUserCharacInfo::getCurCharacInvenR, this); + } + }; class CUser : public CUserCharacInfo @@ -167,6 +179,161 @@ public: return CallT(base::CUser::setLastPacketID, this, a2); } + CAccountCargo* GetAccountCargo() + { + return CallT(base::CUser::GetAccountCargo, this); + } + + int CheckInTrade() + { + return CallT(base::CUser::CheckInTrade, this); + } + + bool IsExistAccountCargo() + { + return CallT(base::CUser::IsExistAccountCargo, this); + } + + int send_itemspace(int a2) + { + return CallT(base::CUser::send_itemspace, this, a2); + } + +}; + +class CAccountCargo +{ +public: + + int GetCapacity() + { + return CallT(base::CAccountCargo::GetCapacity, this); + } + int GetMoney() + { + return CallT(base::CAccountCargo::GetMoney, this); + } + int SetDBData(CUser* a2, Inven_Item* a3, uint a4, uint a5) + { + return CallT(base::CAccountCargo::SetDBData, this, a2, a3, a4, a5); + } + int Clear() + { + return CallT(base::CAccountCargo::Clear, this); + } + int ResetSlot(int a2) + { + return CallT(base::CAccountCargo::ResetSlot, this, a2); + } + int* GetSlot(int a2) + { + return CallT(base::CAccountCargo::GetSlot, this, a2); + } + int GetSlotRef(int a2) + { + return CallT(base::CAccountCargo::GetSlotRef, this, a2); + } + int CheckInsertCondition(Inven_Item* a2) + { + return CallT(base::CAccountCargo::CheckInsertCondition, this, a2); + } + int InsertItem(Inven_Item* a2, int a3) + { + return CallT(base::CAccountCargo::InsertItem, this, a2, a3); + } + int DeleteItem(int a2, int a3) + { + return CallT(base::CAccountCargo::DeleteItem, this, a2, a3); + } + int MoveItem(int a2, int a3) + { + return CallT(base::CAccountCargo::MoveItem, this, a2, a3); + } + int DepositMoney(uint a2) + { + return CallT(base::CAccountCargo::DepositMoney, this, a2); + } + int WithdrawMoney(uint a2) + { + return CallT(base::CAccountCargo::WithdrawMoney, this, a2); + } + int CheckMoneyLimit(uint a2) + { + return CallT(base::CAccountCargo::CheckMoneyLimit, this, a2); + } + int CheckValidSlot(int a2) + { + return CallT(base::CAccountCargo::CheckValidSlot, this); + } + int GetEmptySlot() + { + return CallT(base::CAccountCargo::GetEmptySlot, this); + } + int CheckSlotEmpty(int a2) + { + return CallT(base::CAccountCargo::CheckSlotEmpty, this, a2); + } + int GetSpecificItemSlot(int a2) + { + return CallT(base::CAccountCargo::GetSpecificItemSlot, this, a2); + } + int CheckStackLimit(int a2, int a3, int a4) + { + return CallT(base::CAccountCargo::CheckStackLimit, this); + } + int AddMoney(uint a2) + { + return CallT(base::CAccountCargo::AddMoney, this, a2); + } + int SubMoney(uint a2) + { + return CallT(base::CAccountCargo::SubMoney, this, a2); + } + int GetItemCount() + { + return CallT(base::CAccountCargo::GetItemCount, this); + } + int SendNotifyMoney(int a2) + { + return CallT(base::CAccountCargo::SendNotifyMoney, this, a2); + } + int SendItemList() + { + return CallT(base::CAccountCargo::SendItemList, this); + } + int MakeItemPacket(PacketGuard* a2, int a3) + { + return CallT(base::CAccountCargo::MakeItemPacket, this, a2, a3); + } + int CreateAccountCargo(CUser* a2) + { + return CallT(base::CAccountCargo::CreateAccountCargo, this, a2); + } + int UpgradeAccountCargo(CUser* a2) + { + return CallT(base::CAccountCargo::UpgradeAccountCargo, this, a2); + } + int SendNotifyRecipe(CUser* a2, int a3, bool a4) + { + return CallT(base::CAccountCargo::SendNotifyRecipe, this, a2, a3, a4); + } + int DeleteAccountCargo(CUser* a2) + { + return CallT(base::CAccountCargo::DeleteAccountCargo, this, a2); + } + int SetStable() + { + return CallT(base::CAccountCargo::SetStable, this); + } + int SetCapacity(uint a2) + { + return CallT(base::CAccountCargo::SetCapacity, this, a2); + } + int IsAlter(void) + { + return CallT(base::CAccountCargo::IsAlter, this); + } + }; class CStackableItem @@ -191,9 +358,9 @@ class CItem : public CStackableItem { public: //閬撳叿鏄惁涓烘秷鑰楀搧 - int is_stackable() + bool is_stackable() { - typedef int (*__func)(CItem* a1); + typedef bool (*__func)(CItem* a1); return ((__func)base::CItem::is_stackable)(this); } @@ -203,12 +370,30 @@ public: return ((__func)base::CItem::IsRoutingItem)(this); } + int GetAttachType() + { + return CallT(base::CItem::GetAttachType, this); + } private: }; +class CEquipItem +{ +public: + int GetItemType() + { + return CallT(base::CEquipItem::GetItemType, this); + } + +}; + class Inven_Item { public: + unsigned char UnknownData_NUSL[0x3D]; + +public: + //鑾峰彇閬撳叿闄勫姞淇℃伅 WongWork::CAvatarItemMgr* get_add_info() { @@ -239,6 +424,17 @@ public: { return *(int*)(this + 0x7); } + + bool IsTradeLimitAttachTypeItem() + { + return CallT(base::Inven_Item::IsTradeLimitAttachTypeItem, this); + } + + int GetItemSpace() + { + return CallT(base::Inven_Item::GetItemSpace, this); + } + }; class CDataManager @@ -261,6 +457,7 @@ public: class CInventory { public: + enum INVENTORY_TYPE : int { INVENTORY_TYPE_BODY = 0, //韬笂绌跨殑瑁呭 @@ -276,10 +473,10 @@ public: return ((__func)base::CInventory::GetAvatarItemMgrR)(this); } - int delete_item(int a2, int a3, int a4, int a5, int a6) + int delete_item(INVENTORY_TYPE a2, int pos, int num, int a5, int a6 = 1) { - typedef int (*__func)(CInventory* a1, int a2, int a3, int a4, int a5, int a6); - return ((__func)base::CInventory::delete_item)(this, a2, a3, a4, a5, a6); + typedef int (*__func)(CInventory* a1, INVENTORY_TYPE a2, int a3, int a4, int a5, int a6); + return ((__func)base::CInventory::delete_item)(this, a2, pos, num, a5, a6); } //浣跨敤閲戝竵 @@ -302,6 +499,14 @@ public: typedef Inven_Item* (*__func)(CInventory* a1, INVENTORY_TYPE a2, int a3); return ((__func)base::CInventory::GetInvenRef)(this, a2, a3); } + + Inven_Item* GetInvenSlot(Inven_Item* a2, INVENTORY_TYPE a3, int a4) + { + typedef Inven_Item* (__attribute__((__stdcall__))* fnCInventory_GetInvenSlot)(Inven_Item* dest, CInventory* pThis, int space, int location); + static fnCInventory_GetInvenSlot CInventory_GetInvenSlot = (fnCInventory_GetInvenSlot)(base::CInventory::GetInvenSlot); + return CInventory_GetInvenSlot(a2, this, a3, a4); + } + }; class DB_UpdateAvatarJewelSlot @@ -321,6 +526,7 @@ public: static PacketBuf* NewPacketBuf() { void* v62 = malloc(0x20000); + if (!v62) return NULL; return CallT(base::PacketBuf::PacketBuf_make, v62); } @@ -447,6 +653,7 @@ public: { void* v62 = malloc(0x20000); typedef int (*__func)(void* a1); + if (!v62) return NULL; ((__func)base::PacketGuard::PacketGuard_make)(v62); return (PacketGuard*)v62; } @@ -474,7 +681,67 @@ public: } }; +class CSecu_ProtectionField +{ +public: + static CSecu_ProtectionField* Get() + { + return (CSecu_ProtectionField*)(*(int*)base::GlobalData::s_pSecuProtectionField); + } + + int Check(CUser* a2, int a3) + { + return CallT(base::CSecu_ProtectionField::Check, this, a2, a3); + } + +}; + +class stMoveItemParam +{ +public: + static stMoveItemParam* NewstMoveItemParam() + { + void* v62 = malloc(0x20000); + if (!v62) return NULL; + CallT(base::stMoveItemParam::stMoveItemParam_make, v62); + return (stMoveItemParam*)v62; + } + + static void DelstMoveItemParam(stMoveItemParam* a1) + { + CallT(base::stMoveItemParam::stMoveItemParam_destroy, a1); + free(a1); + } + + static void DelstMoveItemParam2(stMoveItemParam* a1) + { + CallT(base::stMoveItemParam::stMoveItemParam_del, a1); + } + + +}; + +class cUserHistoryLog +{ +public: + +}; + +class AvatarRechargeServer +{ +public: + + static AvatarRechargeServer* Get() + { + return CallT(base::AvatarRechargeServer::Get); + } + + char SendDurability(CUser* a2, char a3, short a4, char a5, int a6) + { + return CallT(base::AvatarRechargeServer::SendDurability, this, a2, a3, a4, a5, a6); + } +}; #endif // __DXFBASE_H__ diff --git a/test/main.cc b/test/main.cc index 8fb603f..60a7dde 100644 --- a/test/main.cc +++ b/test/main.cc @@ -7,3 +7,1507 @@ int main(int argc, char** argv) return 0; } +int __cdecl CUser::exchange_interspace( + CUser* this, + int type, + int equipment_pos, + unsigned int a4, + int a5, + int a6, + CInventory* empty_slot, + unsigned int a8, + int* a9) +{ + int v9; // ebx + CInventory* CurCharacInvenW; // eax + int CurCharacInvenR; // eax + int v12; // ebx + CDataManager* v13; // eax + CCargo* CurCharacCargoR; // eax + CCargo* v15; // eax + int v16; // ebx + CCargo* v17; // eax + CCargo* v18; // eax + CCargo* v19; // eax + CCargo* v20; // eax + CInventory* v21; // eax + CCargo* CurCharacCargoW; // eax + int v23; // eax + int add_info; // eax + char CurCharacNo; // bl + int v26; // ebx + CGameManager* v27; // eax + unsigned int acc_id; // eax + void* v29; // eax + int v30; // eax + CInventory* v31; // eax + int v32; // eax + int v33; // eax + CCargo* v34; // eax + int v35; // eax + unsigned int v36; // eax + char v37; // bl + char v38; // bl + CCargo* v39; // eax + int v40; // eax + CCargo* v41; // eax + int v42; // eax + int v43; // eax + int v45; // ebx + CGameManager* v46; // eax + GameWorld* v47; // eax + CInventory* v48; // eax + char* String; // eax + CInventory* v50; // eax + int v51; // ebx + CGameManager* v52; // eax + int v53; // eax + int v54; // eax + int v55; // eax + int v56; // eax + int v57; // eax + CInventory* v59; // eax + int v60; // ebx + CGameManager* v61; // eax + CGameManager* v62; // eax + GameWorld* v63; // eax + CInventory* v64; // eax + CInventory* v65; // eax + CInventory* v66; // eax + int v67; // ebx + CGameManager* v68; // eax + CGameManager* v69; // eax + void* v70; // eax + int v71; // eax + int v72; // eax + unsigned int v73; // eax + char v74; // bl + CCargo* v75; // eax + CCargo* v76; // eax + int v77; // ebx + CCargo* v78; // eax + CCargo* v79; // eax + CCargo* v80; // eax + CCargo* v81; // eax + CCargo* v82; // eax + unsigned int v83; // eax + char v84; // bl + int v86; // [esp+4h] [ebp-464h] + int v87; // [esp+4h] [ebp-464h] + int v88; // [esp+4h] [ebp-464h] + const Inven_Item* v89; // [esp+4h] [ebp-464h] + int v90; // [esp+4h] [ebp-464h] + const Inven_Item* v91; // [esp+4h] [ebp-464h] + int v92; // [esp+40h] [ebp-428h] + int v93; // [esp+40h] [ebp-428h] + long double v94; // [esp+50h] [ebp-418h] BYREF + int v95; // [esp+5Ch] [ebp-40Ch] + int v96; // [esp+60h] [ebp-408h] + int v97; // [esp+64h] [ebp-404h] + int v98; // [esp+68h] [ebp-400h] + int v99; // [esp+6Ch] [ebp-3FCh] + int v100; // [esp+70h] [ebp-3F8h] + int v101; // [esp+74h] [ebp-3F4h] + int v102; // [esp+78h] [ebp-3F0h] + int v103; // [esp+7Ch] [ebp-3ECh] + int v104; // [esp+80h] [ebp-3E8h] + int v105; // [esp+84h] [ebp-3E4h] + int v106; // [esp+88h] [ebp-3E0h] + char v107; // [esp+8Ch] [ebp-3DCh] + char v108[7]; // [esp+98h] [ebp-3D0h] BYREF + int v109; // [esp+9Fh] [ebp-3C9h] + char v110[7]; // [esp+D5h] [ebp-393h] BYREF + int v111; // [esp+DCh] [ebp-38Ch] + long double v112; // [esp+112h] [ebp-356h] BYREF + int v113; // [esp+11Eh] [ebp-34Ah] + int v114; // [esp+122h] [ebp-346h] + int v115; // [esp+126h] [ebp-342h] + int v116; // [esp+12Ah] [ebp-33Eh] + int v117; // [esp+12Eh] [ebp-33Ah] + int v118; // [esp+132h] [ebp-336h] + int v119; // [esp+136h] [ebp-332h] + int v120; // [esp+13Ah] [ebp-32Eh] + int v121; // [esp+13Eh] [ebp-32Ah] + int v122; // [esp+142h] [ebp-326h] + int v123; // [esp+146h] [ebp-322h] + int v124; // [esp+14Ah] [ebp-31Eh] + char v125; // [esp+14Eh] [ebp-31Ah] + int v126; // [esp+14Fh] [ebp-319h] BYREF + __int64 v127; // [esp+153h] [ebp-315h] + int v128; // [esp+15Bh] [ebp-30Dh] + int v129; // [esp+15Fh] [ebp-309h] + int v130; // [esp+163h] [ebp-305h] + int v131; // [esp+167h] [ebp-301h] + int v132; // [esp+16Bh] [ebp-2FDh] + int v133; // [esp+16Fh] [ebp-2F9h] + int v134; // [esp+173h] [ebp-2F5h] + int v135; // [esp+177h] [ebp-2F1h] + int v136; // [esp+17Bh] [ebp-2EDh] + int v137; // [esp+17Fh] [ebp-2E9h] + int v138; // [esp+183h] [ebp-2E5h] + int v139; // [esp+187h] [ebp-2E1h] + char v140; // [esp+18Bh] [ebp-2DDh] + int v141; // [esp+18Ch] [ebp-2DCh] BYREF + __int64 v142; // [esp+190h] [ebp-2D8h] + int v143; // [esp+198h] [ebp-2D0h] + int v144; // [esp+19Ch] [ebp-2CCh] + int v145; // [esp+1A0h] [ebp-2C8h] + int v146; // [esp+1A4h] [ebp-2C4h] + int v147; // [esp+1A8h] [ebp-2C0h] + int v148; // [esp+1ACh] [ebp-2BCh] + int v149; // [esp+1B0h] [ebp-2B8h] + int v150; // [esp+1B4h] [ebp-2B4h] + int v151; // [esp+1B8h] [ebp-2B0h] + int v152; // [esp+1BCh] [ebp-2ACh] + int v153; // [esp+1C0h] [ebp-2A8h] + int v154; // [esp+1C4h] [ebp-2A4h] + char v155; // [esp+1C8h] [ebp-2A0h] + char v156[7]; // [esp+1C9h] [ebp-29Fh] BYREF + WongWork::CAvatarItemMgr* v157; // [esp+1D0h] [ebp-298h] + char v158[7]; // [esp+206h] [ebp-262h] BYREF + WongWork::CAvatarItemMgr* v159; // [esp+20Dh] [ebp-25Bh] + char v160[2]; // [esp+243h] [ebp-225h] BYREF + int v161; // [esp+245h] [ebp-223h] + int v162; // [esp+24Ah] [ebp-21Eh] + long double v163; // [esp+280h] [ebp-1E8h] BYREF + int v164; // [esp+28Ch] [ebp-1DCh] + int v165; // [esp+290h] [ebp-1D8h] + int v166; // [esp+294h] [ebp-1D4h] + int v167; // [esp+298h] [ebp-1D0h] + int v168; // [esp+29Ch] [ebp-1CCh] + int v169; // [esp+2A0h] [ebp-1C8h] + int v170; // [esp+2A4h] [ebp-1C4h] + int v171; // [esp+2A8h] [ebp-1C0h] + int v172; // [esp+2ACh] [ebp-1BCh] + int v173; // [esp+2B0h] [ebp-1B8h] + int v174; // [esp+2B4h] [ebp-1B4h] + int v175; // [esp+2B8h] [ebp-1B0h] + char v176; // [esp+2BCh] [ebp-1ACh] + char v177[2]; // [esp+2BDh] [ebp-1ABh] BYREF + int v178; // [esp+2BFh] [ebp-1A9h] + int v179; // [esp+2C4h] [ebp-1A4h] + char v180[61]; // [esp+2FAh] [ebp-16Eh] BYREF + long double v181; // [esp+337h] [ebp-131h] BYREF + int v182; // [esp+343h] [ebp-125h] + int v183; // [esp+347h] [ebp-121h] + int v184; // [esp+34Bh] [ebp-11Dh] + int v185; // [esp+34Fh] [ebp-119h] + int v186; // [esp+353h] [ebp-115h] + int v187; // [esp+357h] [ebp-111h] + int v188; // [esp+35Bh] [ebp-10Dh] + int v189; // [esp+35Fh] [ebp-109h] + int v190; // [esp+363h] [ebp-105h] + int v191; // [esp+367h] [ebp-101h] + int v192; // [esp+36Bh] [ebp-FDh] + int v193; // [esp+36Fh] [ebp-F9h] + char v194; // [esp+373h] [ebp-F5h] + char v195[12]; // [esp+374h] [ebp-F4h] BYREF + int v196[4]; // [esp+380h] [ebp-E8h] BYREF + int v197[4]; // [esp+390h] [ebp-D8h] BYREF + int v198[4]; // [esp+3A0h] [ebp-C8h] BYREF + int v199[4]; // [esp+3B0h] [ebp-B8h] BYREF + int v200[4]; // [esp+3C0h] [ebp-A8h] BYREF + int v201[4]; // [esp+3D0h] [ebp-98h] BYREF + char v202[4]; // [esp+3E0h] [ebp-88h] + CTradeSpace* TradeSpace; // [esp+3E4h] [ebp-84h] + int v204; // [esp+3E8h] [ebp-80h] + int item; // [esp+3ECh] [ebp-7Ch] + CInventory* v207; // [esp+3F4h] [ebp-74h] + CParty* Party; // [esp+3F8h] [ebp-70h] + int v209; // [esp+3FCh] [ebp-6Ch] + CAccountCargo* AccountCargo; // [esp+400h] [ebp-68h] + int SpecificItemSlot; // [esp+408h] [ebp-60h] + int v214; // [esp+410h] [ebp-58h] + CAccountCargo* v215; // [esp+414h] [ebp-54h] + int v217; // [esp+41Ch] [ebp-4Ch] + int v218; // [esp+420h] [ebp-48h] + online_preliminary::COnlinePreliminary* InvenRef; // [esp+424h] [ebp-44h] + int v220; // [esp+428h] [ebp-40h] + int v221; // [esp+42Ch] [ebp-3Ch] + online_preliminary::COnlinePreliminary* v222; // [esp+430h] [ebp-38h] + int v223; // [esp+434h] [ebp-34h] + int v224; // [esp+438h] [ebp-30h] + CAccountCargo* v225; // [esp+43Ch] [ebp-2Ch] + CAccountCargo* v226; // [esp+440h] [ebp-28h] + CAccountCargo* v228; // [esp+448h] [ebp-20h] + CInventory* inserted; // [esp+488h] [ebp+20h] + CInventory* v231; // [esp+488h] [ebp+20h] + + PacketGuard::PacketGuard((PacketGuard*)v195); + Inven_Item::Inven_Item((Inven_Item*)&v181); + *(_DWORD*)v202 = 0; + if ((unsigned __int8)_checkItemMovable(this, type, equipment_pos, a4, a6, (int)empty_slot, a8) != 1) + { + *a9 = -1; + v9 = 21; + goto LABEL_303; + } + switch (type) + { + case 0: + switch (a6) + { + case 0: + v204 = 0; + CurCharacInvenW = (CInventory*)CUserCharacInfo::getCurCharacInvenW(this); + v204 = CInventory::move_item(CurCharacInvenW, 1, equipment_pos, 1, empty_slot); + if (v204) + { + v9 = v204; + } + else + { + *a9 = (int)empty_slot; + v9 = 0; + } + goto LABEL_303; + case 2: + if ((unsigned __int8)CUser::CheckInTrade(this)) + { + v9 = 19; + goto LABEL_303; + } + CurCharacInvenR = CUserCharacInfo::getCurCharacInvenR(this); + CInventory::GetInvenSlot((CInventory*)&v94, CurCharacInvenR, 1, equipment_pos); + v181 = v94; + v182 = v95; + v183 = v96; + v184 = v97; + v185 = v98; + v186 = v99; + v187 = v100; + v188 = v101; + v189 = v102; + v190 = v103; + v191 = v104; + v192 = v105; + v193 = v106; + v194 = v107; + v12 = *(_DWORD*)((char*)&v181 + 2); + v13 = (CDataManager*)G_CDataManager(); + item = CDataManager::find_item(v13, v12); + if (!item) + { + v9 = 23; + goto LABEL_303; + } + if ((*(unsigned __int8(__cdecl**)(int))(*(_DWORD*)item + 64))(item)) + { + v9 = 23; + goto LABEL_303; + } + if (*(_DWORD*)((char*)&v181 + 2) > 0x1963u && *(_DWORD*)((char*)&v181 + 2) <= 0x1B57u) + { + v9 = 23; + goto LABEL_303; + } + if (BYTE1(v181) == 1) + { + CurCharacCargoR = (CCargo*)CUserCharacInfo::getCurCharacCargoR(this); + if ((unsigned __int8)CCargo::check_slot_empty(CurCharacCargoR, (int)empty_slot) != 1) + { + v15 = (CCargo*)CUserCharacInfo::getCurCharacCargoR(this); + empty_slot = (CInventory*)CCargo::get_empty_slot(v15); + if ((int)empty_slot < 0) + { + v9 = 4; + goto LABEL_303; + } + } + } + else + { + if (BYTE1(v181) == 4) + { + v9 = 23; + goto LABEL_303; + } + if (Inven_Item::get_add_info((Inven_Item*)&v181) < a5) + { + v9 = 17; + goto LABEL_303; + } + Inven_Item::set_add_info((Inven_Item*)&v181, a5); + v207 = 0; + v16 = *(_DWORD*)((char*)&v181 + 2); + v17 = (CCargo*)CUserCharacInfo::getCurCharacCargoR(this); + v207 = (CInventory*)CCargo::check_item_exist(v17, v16); + if ((int)v207 >= 0) + { + empty_slot = v207; + } + else + { + v18 = (CCargo*)CUserCharacInfo::getCurCharacCargoR(this); + if ((unsigned __int8)CCargo::check_slot_empty(v18, (int)empty_slot) != 1) + { + v19 = (CCargo*)CUserCharacInfo::getCurCharacCargoR(this); + empty_slot = (CInventory*)CCargo::get_empty_slot(v19); + if ((int)empty_slot < 0) + { + v9 = 4; + goto LABEL_303; + } + } + } + } + v20 = (CCargo*)CUserCharacInfo::getCurCharacCargoR(this); + inserted = (CInventory*)CCargo::tryInsertItemSpecialSlot(v20, (const Inven_Item*)&v181, (int)empty_slot); + if ((int)inserted >= 0) + { + v21 = (CInventory*)CUserCharacInfo::getCurCharacInvenW(this); + if ((unsigned __int8)CInventory::delete_item(v21, 1, equipment_pos, a5, 7, 1)) + { + CurCharacCargoW = (CCargo*)CUserCharacInfo::getCurCharacCargoW(this); + *a9 = CCargo::insert_item_special_slot(CurCharacCargoW, (Inven_Item*)&v181, (int)inserted); + v23 = CUserCharacInfo::getCurCharacCargoR(this); + CCargo::get_cargo_slot((CCargo*)v180, v23); + if (v180[1] == 1) + { + cUserHistoryLog::ItemAddCargo((CUser*)((char*)this + 497408), *(int*)((char*)&v181 + 2), a5, 1); + } + else + { + add_info = Inven_Item::get_add_info((Inven_Item*)v180); + cUserHistoryLog::ItemAddCargo( + (CUser*)((char*)this + 497408), + *(int*)((char*)&v181 + 2), + a5, + add_info); + } + } + else + { + CurCharacNo = CUserCharacInfo::getCurCharacNo(this); + cMyTrace::cMyTrace( + (cMyTrace*)v196, + "int CUser::exchange_interspace(int, int, itemIndexOnlyServer_t, int, int, int, itemIndexOnlyServer_t, int*)", + 15137, + 5); + cMyTrace::operator()((int)v196, "delete_item failed %d %d %d", CurCharacNo); + } + goto LABEL_302; + } + v9 = 4; + goto LABEL_303; + case 3: + if ((unsigned __int8)CUser::CheckInTrade(this)) + { + v9 = 19; + } + else + { + *(_DWORD*)v202 = CUser::change_equip(this, type, equipment_pos, (int)empty_slot); + if (*(_DWORD*)v202) + { + v9 = *(_DWORD*)v202; + } + else + { + *a9 = (int)empty_slot; + Party = (CParty*)CUser::GetParty(this); + if (Party) + CParty::Reset_party_overlapped_drop_ratio(Party); + v9 = 0; + } + } + goto LABEL_303; + case 4: + v26 = *((__int16*)this + 288769); + v27 = (CGameManager*)G_CGameManager(); + TradeSpace = (CTradeSpace*)CGameManager::GetTradeSpace(v27, v26); + if (TradeSpace) + { + if ((unsigned __int8)CTradeSpace::is_empty(TradeSpace)) + { + *((_WORD*)this + 288769) = -1; + v9 = 21; + } + else + { + if ((unsigned __int8)CTradeSpace::check_trade_possibility(TradeSpace) != 1) + goto LABEL_234; + if ((unsigned __int8)CTradeSpace::IsLocked(TradeSpace)) + { + v9 = 17; + } + else + { + *(_DWORD*)v202 = CTradeSpace::regist_item(TradeSpace, this, 0, equipment_pos, a5); + if (*(int*)v202 >= 0) + { + *a9 = *(_DWORD*)v202; + goto LABEL_302; + } + CUserCharacInfo::getCurCharacNo(this); + acc_id = CUser::get_acc_id(this); + NumberToString(acc_id, 0); + cMyTrace::cMyTrace( + (cMyTrace*)v197, + "int CUser::exchange_interspace(int, int, itemIndexOnlyServer_t, int, int, int, itemIndexOnlyServer_t, int*)", + 15191, + 5); + cMyTrace::operator()( + (int)v197, + "(regist_item(): %d)(m_id: %s) (CharacNo: %d) (from_slot: %d) (item_count: %d)", + v202[0]); + if (*(_DWORD*)v202 == -4) + v9 = 94; + else + v9 = 17; + } + } + } + else + { + v9 = 1; + } + goto LABEL_303; + case 12: + if ((unsigned __int8)CUser::CheckInTrade(this)) + { + v9 = 19; + } + else + { + v29 = ARAD::Singleton::Get(); + if ((unsigned __int8)ServiceRestrictManager::isRestricted((int)v29, this, 1, 27)) + { + v9 = 209; + } + else + { + v209 = CSecu_ProtectionField::Check(GlobalData::s_pSecuProtectionField, this, 1); + if (v209) + { + v9 = v209; + } + else if ((unsigned __int8)CUser::IsExistAccountCargo(this) != 1) + { + v9 = 19; + } + else + { + AccountCargo = (CAccountCargo*)CUser::GetAccountCargo(this); + v30 = CUserCharacInfo::getCurCharacInvenR(this); + CInventory::GetInvenSlot((CInventory*)&v94, v30, 1, equipment_pos); + v181 = v94; + v182 = v95; + v183 = v96; + v184 = v97; + v185 = v98; + v186 = v99; + v187 = v100; + v188 = v101; + v189 = v102; + v190 = v103; + v191 = v104; + v192 = v105; + v193 = v106; + v194 = v107; + if ((unsigned __int8)IsTradeLimitAttachTypeItem((const Inven_Item*)&v181)) + { + v9 = 23; + } + else + { + if ((unsigned __int8)CAccountCargo::CheckInsertCondition(AccountCargo, (Inven_Item*)&v181) == 1) + { + if (BYTE1(v181) == 1) + { + if ((unsigned __int8)CAccountCargo::CheckSlotEmpty(AccountCargo, (int)empty_slot) != 1) + { + empty_slot = (CInventory*)CAccountCargo::GetEmptySlot(AccountCargo); + if ((int)empty_slot < 0) + { + v9 = 4; + goto LABEL_303; + } + } + } + else + { + if (Inven_Item::get_add_info((Inven_Item*)&v181) < a5) + { + v9 = 17; + goto LABEL_303; + } + Inven_Item::set_add_info((Inven_Item*)&v181, a5); + SpecificItemSlot = CAccountCargo::GetSpecificItemSlot(AccountCargo, *(int*)((char*)&v181 + 2)); + if (SpecificItemSlot < 0) + { + if ((unsigned __int8)CAccountCargo::CheckSlotEmpty(AccountCargo, (int)empty_slot) != 1) + { + empty_slot = (CInventory*)CAccountCargo::GetEmptySlot(AccountCargo); + if ((int)empty_slot < 0) + { + v9 = 4; + goto LABEL_303; + } + } + } + else + { + if ((unsigned __int8)CAccountCargo::CheckStackLimit( + AccountCargo, + SpecificItemSlot, + *(int*)((char*)&v181 + 2), + a5) != 1) + { + v9 = 4; + goto LABEL_303; + } + empty_slot = (CInventory*)SpecificItemSlot; + } + } + v31 = (CInventory*)CUserCharacInfo::getCurCharacInvenW(this); + if ((unsigned __int8)CInventory::delete_item(v31, 1, equipment_pos, a5, 37, 1)) + { + *a9 = CAccountCargo::InsertItem(AccountCargo, (Inven_Item*)&v181, (int)empty_slot); + CAccountCargo::GetSlot((CAccountCargo*)v177, (int)AccountCargo, *a9);// 获取金库位置 + if (v177[1] == 1) + cUserHistoryLog::AccountCargoAddItem((char*)this + 497408, v178, 1, 1, 45); + else + cUserHistoryLog::AccountCargoAddItem((char*)this + 497408, v178, v179, a5, 45); + } + goto LABEL_302; + } + v9 = 17; + } + } + } + } + break; + default: + v9 = 1; + goto LABEL_303; + } + goto LABEL_303; + case 1: + Inven_Item::Inven_Item((Inven_Item*)&v141); + Inven_Item::Inven_Item((Inven_Item*)&v126); + switch (a6) + { + case 3: + v53 = CUserCharacInfo::getCurCharacInvenR(this); + CInventory::GetInvenSlot((CInventory*)&v94, v53, 2, equipment_pos); + v126 = LODWORD(v94); + v127 = *(_QWORD*)((char*)&v94 + 4); + v128 = v95; + v129 = v96; + v130 = v97; + v131 = v98; + v132 = v99; + v133 = v100; + v134 = v101; + v135 = v102; + v136 = v103; + v137 = v104; + v138 = v105; + v139 = v106; + v140 = v107; + v54 = CUserCharacInfo::getCurCharacInvenR(this); + CInventory::GetInvenSlot((CInventory*)&v94, v54, 0, (int)empty_slot); + v141 = LODWORD(v94); + v142 = *(_QWORD*)((char*)&v94 + 4); + v143 = v95; + v144 = v96; + v145 = v97; + v146 = v98; + v147 = v99; + v148 = v100; + v149 = v101; + v150 = v102; + v151 = v103; + v152 = v104; + v153 = v105; + v154 = v106; + v155 = v107; + break; + case 4: + v57 = CUserCharacInfo::getCurCharacInvenR(this); + CInventory::GetInvenSlot((CInventory*)&v94, v57, 2, equipment_pos); + v126 = LODWORD(v94); + v127 = *(_QWORD*)((char*)&v94 + 4); + v128 = v95; + v129 = v96; + v130 = v97; + v131 = v98; + v132 = v99; + v133 = v100; + v134 = v101; + v135 = v102; + v136 = v103; + v137 = v104; + v138 = v105; + v139 = v106; + v140 = v107; + break; + case 1: + v55 = CUserCharacInfo::getCurCharacInvenR(this); + CInventory::GetInvenSlot((CInventory*)&v94, v55, 2, equipment_pos); + v126 = LODWORD(v94); + v127 = *(_QWORD*)((char*)&v94 + 4); + v128 = v95; + v129 = v96; + v130 = v97; + v131 = v98; + v132 = v99; + v133 = v100; + v134 = v101; + v135 = v102; + v136 = v103; + v137 = v104; + v138 = v105; + v139 = v106; + v140 = v107; + v56 = CUserCharacInfo::getCurCharacInvenR(this); + CInventory::GetInvenSlot((CInventory*)&v94, v56, 2, (int)empty_slot); + v141 = LODWORD(v94); + v142 = *(_QWORD*)((char*)&v94 + 4); + v143 = v95; + v144 = v96; + v145 = v97; + v146 = v98; + v147 = v99; + v148 = v100; + v149 = v101; + v150 = v102; + v151 = v103; + v152 = v104; + v153 = v105; + v154 = v106; + v155 = v107; + break; + } + if ((unsigned __int8)WongWork::CAvatarItemMgr::IsTempKey(*(WongWork::CAvatarItemMgr**)((char*)&v127 + 3), v86) + || (unsigned __int8)WongWork::CAvatarItemMgr::IsTempKey(*(WongWork::CAvatarItemMgr**)((char*)&v142 + 3), v90)) + { + v9 = 19; + goto LABEL_303; + } + switch (a6) + { + case 3: + *(_DWORD*)v202 = CUser::change_equip(this, type, equipment_pos, (int)empty_slot); + if (*(int*)v202 > 0) + { + v9 = *(_DWORD*)v202; + goto LABEL_303; + } + *a9 = (int)empty_slot; + break; + case 4: + v60 = *((__int16*)this + 288769); + v61 = (CGameManager*)G_CGameManager(); + TradeSpace = (CTradeSpace*)CGameManager::GetTradeSpace(v61, v60); + if (!TradeSpace) + { + v9 = 1; + goto LABEL_303; + } + if ((unsigned __int8)CTradeSpace::is_empty(TradeSpace)) + { + *((_WORD*)this + 288769) = -1; + v9 = 21; + goto LABEL_303; + } + if ((unsigned __int8)CTradeSpace::check_trade_possibility(TradeSpace) != 1) + { + CTradeSpace::cancel_trade(TradeSpace); + v62 = (CGameManager*)G_CGameManager(); + CGameManager::PutTradeSpace(v62, TradeSpace); + goto LABEL_302; + } + if ((unsigned __int8)CTradeSpace::IsLocked(TradeSpace)) + { + v9 = 17; + goto LABEL_303; + } + *(_DWORD*)v202 = CTradeSpace::regist_item(TradeSpace, this, 1, equipment_pos, a5); + if (*(int*)v202 < 0) + { + v9 = 17; + goto LABEL_303; + } + *a9 = *(_DWORD*)v202; + break; + case 1: + v220 = 0; + v59 = (CInventory*)CUserCharacInfo::getCurCharacInvenW(this); + v220 = CInventory::move_item(v59, 2, equipment_pos, 2, empty_slot); + if (v220) + { + v9 = v220; + goto LABEL_303; + } + *a9 = (int)empty_slot; + break; + default: + v9 = 1; + goto LABEL_303; + } + goto LABEL_302; + case 2: + switch (a6) + { + case 0: + if ((unsigned __int8)CUser::CheckInTrade(this)) + { + v9 = 19; + } + else + { + v32 = CUserCharacInfo::getCurCharacCargoR(this); + CCargo::get_cargo_slot((CCargo*)&v94, v32); + v181 = v94; + v182 = v95; + v183 = v96; + v184 = v97; + v185 = v98; + v186 = v99; + v187 = v100; + v188 = v101; + v189 = v102; + v190 = v103; + v191 = v104; + v192 = v105; + v193 = v106; + v194 = v107; + v163 = v94; + v164 = v95; + v165 = v96; + v166 = v97; + v167 = v98; + v168 = v99; + v169 = v100; + v170 = v101; + v171 = v102; + v172 = v103; + v173 = v104; + v174 = v105; + v175 = v106; + v176 = v107; + if (BYTE1(v94) != 1) + Inven_Item::set_add_info((Inven_Item*)&v163, a5); + v33 = CUserCharacInfo::getCurCharacInvenW(this); + if (CInventory::tryInsertItemIntoInventory( + v33, + LODWORD(v163), + DWORD1(v163), + HIDWORD(v163), + v164, + v165, + v166, + v167, + v168, + v169, + v170, + v171, + v172, + v173, + v174, + v175, + v176) != -1) + { + v34 = (CCargo*)CUserCharacInfo::getCurCharacCargoW(this); + if ((unsigned __int8)CCargo::delete_item(v34, equipment_pos, a5, 7)) + { + v35 = CUserCharacInfo::getCurCharacInvenW(this); + LOBYTE(v92) = v176; + *a9 = CInventory::insertItemIntoInventory( + v35, + LODWORD(v163), + DWORD1(v163), + HIDWORD(v163), + v164, + v165, + v166, + v167, + v168, + v169, + v170, + v171, + v172, + v173, + v174, + v175, + v92, + 7, + 1, + 0); + if (*a9 == -1) + { + CUserCharacInfo::getCurCharacNo(this); + v36 = CUser::get_acc_id(this); + v37 = NumberToString(v36, 0); + cMyTrace::cMyTrace( + (cMyTrace*)v198, + "int CUser::exchange_interspace(int, int, itemIndexOnlyServer_t, int, int, int, itemIndexOnlyServer_t, int*)", + 15333, + 5); + cMyTrace::operator()((int)v198, "insertItemIntoInventory failed %s %d %d %d", v37); + } + } + else + { + v38 = CUserCharacInfo::getCurCharacNo(this); + cMyTrace::cMyTrace( + (cMyTrace*)v199, + "int CUser::exchange_interspace(int, int, itemIndexOnlyServer_t, int, int, int, itemIndexOnlyServer_t, int*)", + 15338, + 5); + cMyTrace::operator()((int)v199, "delete_item failed %d %d %d", v38); + } + goto LABEL_302; + } + v9 = 17; + } + goto LABEL_303; + case 2: + v39 = (CCargo*)CUserCharacInfo::getCurCharacCargoW(this); + if ((unsigned __int8)CCargo::move_item(v39, equipment_pos, (int)empty_slot) != 1) + { + v9 = 17; + } + else + { + *a9 = (int)empty_slot; + v9 = 0; + } + goto LABEL_303; + case 3: + if ((unsigned __int8)CUser::CheckInTrade(this)) + v9 = 19; + else + v9 = 1; + goto LABEL_303; + case 7: + v9 = 1; + goto LABEL_303; + case 12: + if ((unsigned __int8)CUser::CheckInTrade(this)) + { + v9 = 19; + } + else + { + v214 = CSecu_ProtectionField::Check(GlobalData::s_pSecuProtectionField, this, 1); + if (v214) + { + v9 = v214; + } + else if ((unsigned __int8)CUser::IsExistAccountCargo(this) != 1) + { + v9 = 19; + } + else + { + v215 = (CAccountCargo*)CUser::GetAccountCargo(this); + v40 = CUserCharacInfo::getCurCharacCargoR(this); + CCargo::get_cargo_slot((CCargo*)&v94, v40); + v181 = v94; + v182 = v95; + v183 = v96; + v184 = v97; + v185 = v98; + v186 = v99; + v187 = v100; + v188 = v101; + v189 = v102; + v190 = v103; + v191 = v104; + v192 = v105; + v193 = v106; + v194 = v107; + if ((unsigned __int8)CAccountCargo::CheckInsertCondition(v215, (Inven_Item*)&v181) == 1) + { + if (BYTE1(v181) == 1) + { + if ((unsigned __int8)CAccountCargo::CheckSlotEmpty(v215, (int)empty_slot) != 1) + { + empty_slot = (CInventory*)CAccountCargo::GetEmptySlot(v215); + if ((int)empty_slot < 0) + { + v9 = 4; + goto LABEL_303; + } + } + } + else + { + if (Inven_Item::get_add_info((Inven_Item*)&v181) < a5) + { + v9 = 17; + goto LABEL_303; + } + Inven_Item::set_add_info((Inven_Item*)&v181, a5); + v217 = CAccountCargo::GetSpecificItemSlot(v215, *(int*)((char*)&v181 + 2)); + if (v217 < 0) + { + if ((unsigned __int8)CAccountCargo::CheckSlotEmpty(v215, (int)empty_slot) != 1) + { + empty_slot = (CInventory*)CAccountCargo::GetEmptySlot(v215); + if ((int)empty_slot < 0) + { + v9 = 4; + goto LABEL_303; + } + } + } + else + { + if ((unsigned __int8)CAccountCargo::CheckStackLimit(v215, v217, *(int*)((char*)&v181 + 2), a5) != 1) + { + v9 = 4; + goto LABEL_303; + } + empty_slot = (CInventory*)v217; + } + } + v41 = (CCargo*)CUserCharacInfo::getCurCharacCargoW(this); + if ((unsigned __int8)CCargo::delete_item(v41, equipment_pos, a5, 37)) + { + *a9 = CAccountCargo::InsertItem(v215, (Inven_Item*)&v181, (int)empty_slot); + CAccountCargo::GetSlot((CAccountCargo*)v160, (int)v215, *a9); + if (v160[1] == 1) + cUserHistoryLog::AccountCargoAddItem((char*)this + 497408, v161, 1, 1, 46); + else + cUserHistoryLog::AccountCargoAddItem((char*)this + 497408, v161, v162, a5, 46); + } + goto LABEL_302; + } + v9 = 17; + } + } + break; + default: + v9 = 1; + goto LABEL_303; + } + goto LABEL_303; + case 3: + switch (a6) + { + case 0: + if ((unsigned __int8)CUser::CheckInTrade(this)) + { + v9 = 19; + } + else + { + *(_DWORD*)v202 = CUser::change_equip(this, a6, (__int16)empty_slot, equipment_pos); + if (*(_DWORD*)v202) + { + v9 = *(_DWORD*)v202; + } + else + { + *a9 = equipment_pos; + v9 = 0; + } + } + break; + case 1: + v42 = CUserCharacInfo::getCurCharacInvenR(this); + CInventory::GetInvenSlot((CInventory*)v158, v42, 0, equipment_pos); + v43 = CUserCharacInfo::getCurCharacInvenR(this); + CInventory::GetInvenSlot((CInventory*)v156, v43, 2, (int)empty_slot); + if ((unsigned __int8)WongWork::CAvatarItemMgr::IsTempKey(v159, v87) + || (unsigned __int8)WongWork::CAvatarItemMgr::IsTempKey(v157, v88)) + { + v9 = 19; + } + else + { + *(_DWORD*)v202 = CUser::change_equip(this, type, equipment_pos, (int)empty_slot); + if (*(int*)v202 <= 0) + { + *a9 = (int)empty_slot; + v9 = 0; + } + else + { + v9 = *(_DWORD*)v202; + } + } + break; + case 2: + if ((unsigned __int8)CUser::CheckInTrade(this)) + v9 = 19; + else + v9 = 1; + break; + case 4: + v45 = *((__int16*)this + 288769); + v46 = (CGameManager*)G_CGameManager(); + TradeSpace = (CTradeSpace*)CGameManager::GetTradeSpace(v46, v45); + if (TradeSpace) + { + if ((unsigned __int8)CTradeSpace::is_empty(TradeSpace)) + { + *((_WORD*)this + 288769) = -1; + v9 = 21; + } + else + { + if ((unsigned __int8)CTradeSpace::check_trade_possibility(TradeSpace) != 1) + goto LABEL_234; + if ((unsigned __int8)CTradeSpace::IsLocked(TradeSpace)) + { + v9 = 17; + } + else + { + *(_DWORD*)v202 = CTradeSpace::regist_item(TradeSpace, this, 3, equipment_pos, a5); + if (*(int*)v202 >= 0) + { + *a9 = *(_DWORD*)v202; + CUser::send_equip(this, equipment_pos); + goto LABEL_302; + } + v9 = 17; + } + } + } + else + { + v9 = 1; + } + break; + case 7: + v47 = (GameWorld*)G_GameWorld(); + if ((unsigned __int8)GameWorld::IsCheckUnusableEquipmentChannel(v47)) + { + v48 = (CInventory*)CUserCharacInfo::getCurCharacInvenR(this); + InvenRef = (online_preliminary::COnlinePreliminary*)CInventory::GetInvenRef(v48, 3, (int)empty_slot); + if ((unsigned __int8)online_preliminary::COnlinePreliminary::CheckUnusableEquipment(InvenRef, v89) != 1) + goto LABEL_164; + } + v218 = 0; + v50 = (CInventory*)CUserCharacInfo::getCurCharacInvenW(this); + v218 = CInventory::move_item(v50, 0, equipment_pos, 3, empty_slot); + if (!v218) + goto LABEL_167; + v9 = v218; + break; + default: + v9 = 1; + break; + } + goto LABEL_303; + case 4: + if ((unsigned int)a6 > 7 || ((1 << a6) & 0x8B) == 0) + { + v9 = 1; + goto LABEL_303; + } + v51 = *((__int16*)this + 288769); + v52 = (CGameManager*)G_CGameManager(); + TradeSpace = (CTradeSpace*)CGameManager::GetTradeSpace(v52, v51); + if (!TradeSpace) + { + v9 = 1; + goto LABEL_303; + } + if ((unsigned __int8)CTradeSpace::is_empty(TradeSpace)) + { + *((_WORD*)this + 288769) = -1; + v9 = 21; + goto LABEL_303; + } + if ((unsigned __int8)CTradeSpace::check_trade_possibility(TradeSpace) != 1) + goto LABEL_234; + if ((unsigned __int8)CTradeSpace::IsLocked(TradeSpace)) + { + v9 = 17; + goto LABEL_303; + } + *(_DWORD*)v202 = CTradeSpace::remove_item(TradeSpace, this, equipment_pos, a6, (int)empty_slot, a5); + if (*(int*)v202 < 0) + { + v9 = 17; + goto LABEL_303; + } + *a9 = *(_DWORD*)v202; + if (a6 == 3) + CUser::send_equip(this, (int)empty_slot); + goto LABEL_302; + case 7: + switch (a6) + { + case 4: + v67 = *((__int16*)this + 288769); + v68 = (CGameManager*)G_CGameManager(); + TradeSpace = (CTradeSpace*)CGameManager::GetTradeSpace(v68, v67); + if (!TradeSpace) + { + v9 = 1; + break; + } + if ((unsigned __int8)CTradeSpace::is_empty(TradeSpace)) + { + *((_WORD*)this + 288769) = -1; + v9 = 21; + break; + } + if ((unsigned __int8)CTradeSpace::check_trade_possibility(TradeSpace) != 1) + { + LABEL_234: + CTradeSpace::cancel_trade(TradeSpace); + v69 = (CGameManager*)G_CGameManager(); + CGameManager::PutTradeSpace(v69, TradeSpace); + } + else + { + if ((unsigned __int8)CTradeSpace::IsLocked(TradeSpace)) + { + v9 = 17; + break; + } + *(_DWORD*)v202 = CTradeSpace::regist_item(TradeSpace, this, 7, equipment_pos, a5); + if (*(int*)v202 < 0) + { + v9 = 17; + break; + } + *a9 = *(_DWORD*)v202; + } + goto LABEL_302; + case 7: + v223 = 0; + v66 = (CInventory*)CUserCharacInfo::getCurCharacInvenW(this); + v223 = CInventory::move_item(v66, 3, equipment_pos, 3, empty_slot); + if (v223) + { + v9 = v223; + break; + } + *a9 = (int)empty_slot; + LABEL_302: + v9 = 0; + break; + case 3: + v63 = (GameWorld*)G_GameWorld(); + if ((unsigned __int8)GameWorld::IsCheckUnusableEquipmentChannel(v63) + && (v64 = (CInventory*)CUserCharacInfo::getCurCharacInvenR(this), + v222 = (online_preliminary::COnlinePreliminary*)CInventory::GetInvenRef(v64, 3, equipment_pos), + (unsigned __int8)online_preliminary::COnlinePreliminary::CheckUnusableEquipment(v222, v91) ^ 1)) + { + LABEL_164: + String = (char*)RDARScriptStringManager::findString( + (RDARScriptStringManager*)&g_scriptStringManager_, + 4, + "game_server_msg_146", + 0); + CUser::SendNotiPacketMessage(this, String, 0); + v9 = 1; + } + else + { + v221 = 0; + v65 = (CInventory*)CUserCharacInfo::getCurCharacInvenW(this); + v221 = CInventory::move_item(v65, 3, equipment_pos, 0, empty_slot); + if (v221) + { + v9 = v221; + } + else + { + LABEL_167: + *a9 = (int)empty_slot; + CUser::send_equip(this, (int)empty_slot); + v9 = 0; + } + } + break; + default: + v9 = 1; + break; + } + LABEL_303: + PacketGuard::~PacketGuard((PacketGuard*)v195); + return v9; + case 12: + v70 = ARAD::Singleton::Get(); + if ((unsigned __int8)ServiceRestrictManager::isRestricted((int)v70, this, 1, 27)) + { + v9 = 209; + goto LABEL_303; + } + v224 = CSecu_ProtectionField::Check(GlobalData::s_pSecuProtectionField, this, 1); + if (v224) + { + v9 = v224; + goto LABEL_303; + } + switch (a6) + { + case 0: + if ((unsigned __int8)CUser::CheckInTrade(this)) + { + v9 = 19; + } + else if ((unsigned __int8)CUser::IsExistAccountCargo(this) != 1) + { + v9 = 19; + } + else + { + v226 = (CAccountCargo*)CUser::GetAccountCargo(this); + CAccountCargo::GetSlot((CAccountCargo*)&v94, (int)v226, equipment_pos); + v181 = v94; + v182 = v95; + v183 = v96; + v184 = v97; + v185 = v98; + v186 = v99; + v187 = v100; + v188 = v101; + v189 = v102; + v190 = v103; + v191 = v104; + v192 = v105; + v193 = v106; + v194 = v107; + v112 = v94; + v113 = v95; + v114 = v96; + v115 = v97; + v116 = v98; + v117 = v99; + v118 = v100; + v119 = v101; + v120 = v102; + v121 = v103; + v122 = v104; + v123 = v105; + v124 = v106; + v125 = v107; + if (BYTE1(v94) != 1) + Inven_Item::set_add_info((Inven_Item*)&v112, a5); + v71 = CUserCharacInfo::getCurCharacInvenW(this); + if (CInventory::tryInsertItemIntoInventory( + v71, + LODWORD(v112), + DWORD1(v112), + HIDWORD(v112), + v113, + v114, + v115, + v116, + v117, + v118, + v119, + v120, + v121, + v122, + v123, + v124, + v125) != -1) + { + if ((unsigned __int8)CAccountCargo::DeleteItem(v226, equipment_pos, a5)) + { + v72 = CUserCharacInfo::getCurCharacInvenW(this); + LOBYTE(v93) = v125; + *a9 = CInventory::insertItemIntoInventory( + v72, + LODWORD(v112), + DWORD1(v112), + HIDWORD(v112), + v113, + v114, + v115, + v116, + v117, + v118, + v119, + v120, + v121, + v122, + v123, + v124, + v93, + 7, + 1, + 0); + if (*a9 == -1) + { + CUserCharacInfo::getCurCharacNo(this); + v73 = CUser::get_acc_id(this); + v74 = NumberToString(v73, 0); + cMyTrace::cMyTrace( + (cMyTrace*)v200, + "int CUser::exchange_interspace(int, int, itemIndexOnlyServer_t, int, int, int, itemIndexOnlyServer_t, int*)", + 16083, + 5); + cMyTrace::operator()((int)v200, "insertItemIntoInventory failed %s %d %d %d", v74); + } + CAccountCargo::GetSlot((CAccountCargo*)v110, (int)v226, equipment_pos); + if (v110[1] == 1) + cUserHistoryLog::AccountCargoDelItem((char*)this + 497408, *(_DWORD*)((char*)&v112 + 2), 0, 1, 38); + else + cUserHistoryLog::AccountCargoDelItem( + (char*)this + 497408, + *(_DWORD*)((char*)&v112 + 2), + v111, + a5, + 38); + } + goto LABEL_302; + } + v9 = 17; + } + goto LABEL_303; + case 2: + if ((unsigned __int8)CUser::CheckInTrade(this)) + { + v9 = 19; + goto LABEL_303; + } + if ((unsigned __int8)CUser::IsExistAccountCargo(this) != 1) + { + v9 = 19; + goto LABEL_303; + } + v228 = (CAccountCargo*)CUser::GetAccountCargo(this); + CAccountCargo::GetSlot((CAccountCargo*)&v94, (int)v228, equipment_pos); + v181 = v94; + v182 = v95; + v183 = v96; + v184 = v97; + v185 = v98; + v186 = v99; + v187 = v100; + v188 = v101; + v189 = v102; + v190 = v103; + v191 = v104; + v192 = v105; + v193 = v106; + v194 = v107; + if (*(_DWORD*)((char*)&v181 + 2) > 0x1963u && *(_DWORD*)((char*)&v181 + 2) <= 0x1B57u) + { + v9 = 23; + goto LABEL_303; + } + if (BYTE1(v181) == 4) + { + v9 = 23; + goto LABEL_303; + } + if (BYTE1(v181) == 1) + { + v75 = (CCargo*)CUserCharacInfo::getCurCharacCargoR(this); + if ((unsigned __int8)CCargo::check_slot_empty(v75, (int)empty_slot) != 1) + { + v76 = (CCargo*)CUserCharacInfo::getCurCharacCargoR(this); + empty_slot = (CInventory*)CCargo::get_empty_slot(v76); + if ((int)empty_slot < 0) + { + v9 = 4; + goto LABEL_303; + } + } + } + else + { + if (Inven_Item::get_add_info((Inven_Item*)&v181) < a5) + { + v9 = 17; + goto LABEL_303; + } + Inven_Item::set_add_info((Inven_Item*)&v181, a5); + v77 = *(_DWORD*)((char*)&v181 + 2); + v78 = (CCargo*)CUserCharacInfo::getCurCharacCargoR(this); + if ((int)CCargo::check_item_exist(v78, v77) < 0) + { + v79 = (CCargo*)CUserCharacInfo::getCurCharacCargoR(this); + if ((unsigned __int8)CCargo::check_slot_empty(v79, (int)empty_slot) != 1) + { + v80 = (CCargo*)CUserCharacInfo::getCurCharacCargoR(this); + empty_slot = (CInventory*)CCargo::get_empty_slot(v80); + if ((int)empty_slot < 0) + { + v9 = 4; + goto LABEL_303; + } + } + } + } + v81 = (CCargo*)CUserCharacInfo::getCurCharacCargoR(this); + v231 = (CInventory*)CCargo::tryInsertItemSpecialSlot(v81, (const Inven_Item*)&v181, (int)empty_slot); + if ((int)v231 >= 0) + { + if ((unsigned __int8)CAccountCargo::DeleteItem(v228, equipment_pos, a5)) + { + v82 = (CCargo*)CUserCharacInfo::getCurCharacCargoW(this); + *a9 = CCargo::insert_item_special_slot(v82, (Inven_Item*)&v181, (int)v231); + if (*a9 == -1) + { + CUserCharacInfo::getCurCharacNo(this); + v83 = CUser::get_acc_id(this); + v84 = NumberToString(v83, 0); + cMyTrace::cMyTrace( + (cMyTrace*)v201, + "int CUser::exchange_interspace(int, int, itemIndexOnlyServer_t, int, int, int, itemIndexOnlyServer_t, int*)", + 16151, + 5); + cMyTrace::operator()((int)v201, "insertItemIntoInventory failed %s %d %d %d", v84); + } + CAccountCargo::GetSlot((CAccountCargo*)v108, (int)v228, equipment_pos); + if (v108[1] == 1) + cUserHistoryLog::AccountCargoDelItem((char*)this + 497408, *(_DWORD*)((char*)&v181 + 2), 0, 1, 39); + else + cUserHistoryLog::AccountCargoDelItem( + (char*)this + 497408, + *(_DWORD*)((char*)&v181 + 2), + v109, + a5, + 39); + } + goto LABEL_302; + } + v9 = 4; + break; + case 3: + if ((unsigned __int8)CUser::CheckInTrade(this)) + v9 = 19; + else + v9 = 1; + goto LABEL_303; + case 7: + v9 = 1; + goto LABEL_303; + case 12: + if ((unsigned __int8)CUser::CheckInTrade(this)) + { + v9 = 19; + } + else if ((unsigned __int8)CUser::IsExistAccountCargo(this) != 1) + { + v9 = 19; + } + else + { + v225 = (CAccountCargo*)CUser::GetAccountCargo(this); + if ((unsigned __int8)CAccountCargo::MoveItem(v225, equipment_pos, (int)empty_slot) == 1) + { + *a9 = (int)empty_slot; + goto LABEL_302; + } + v9 = 17; + } + goto LABEL_303; + default: + v9 = 1; + goto LABEL_303; + } + goto LABEL_303; + default: + v9 = 1; + goto LABEL_303; + } +} + +