#include using namespace std; 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; } }